Skip to content

Commit 735e6f5

Browse files
committed
Merge remote-tracking branch 'origin/develop' into feature/(#199)-notification_api
2 parents ac55dc5 + 248e430 commit 735e6f5

25 files changed

+267
-134
lines changed

Projects/Core/Sources/Steps/ApplyStep.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ public enum ApplyStep: Step {
44
case applyIsRequired(recruitmentId: Int, name: String, imageURL: String)
55
case reApplyIsRequired(applicationId: Int, name: String, imageURL: String)
66
case popToRecruitmentDetail
7+
case errorToast(message: String)
78
}

Projects/Core/Sources/Steps/CompanyDetailStep.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ import RxFlow
22

33
public enum CompanyDetailStep: Step {
44
case companyDetailIsRequired
5-
case recruitmentDetailIsRequired
5+
case popIsRequired
6+
case recruitmentDetailIsRequired(id: Int)
67
}

Projects/Data/Sources/DataSource/API/ApplicationsAPI.swift

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ enum ApplicationsAPI {
1212
}
1313

1414
extension ApplicationsAPI: JobisAPI {
15-
typealias ErrorType = JobisError
15+
typealias ErrorType = ApplicationsError
1616

1717
var domain: JobisDomain {
1818
.applications
@@ -81,10 +81,18 @@ extension ApplicationsAPI: JobisAPI {
8181
public var errorMap: [Int: ErrorType]? {
8282
switch self {
8383
case .applyCompany:
84-
return [:]
84+
return [
85+
404: .badRequest,
86+
409: .conflict,
87+
500: .internalServerError
88+
]
8589

8690
case .reApplyCompany:
87-
return [:]
91+
return [
92+
404: .badRequest,
93+
409: .conflict,
94+
500: .internalServerError
95+
]
8896

8997
case .cancelApply:
9098
return [:]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import Foundation
2+
3+
public enum ApplicationsError: Error {
4+
case conflict
5+
case badRequest
6+
case internalServerError
7+
}

Projects/Flow/Sources/Apply/ApplyFlow.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@ public final class ApplyFlow: Flow {
2222
switch step {
2323
case let .applyIsRequired(id, name, imageURL):
2424
return navigateToApply(id: id, name: name, imageURL: imageURL)
25+
2526
case .popToRecruitmentDetail:
2627
return popToRecruitmentDetail()
28+
2729
case let .reApplyIsRequired(id, name, imageURL):
2830
return navigateToReApply(id: id, name: name, imageURL: imageURL)
31+
32+
case let .errorToast(message):
33+
return errorToast(message: message)
2934
}
3035
}
3136
}
@@ -57,4 +62,9 @@ private extension ApplyFlow {
5762
self.rootViewController.navigationController?.popViewController(animated: true)
5863
return .none
5964
}
65+
66+
func errorToast(message: String) -> FlowContributors {
67+
self.rootViewController.showJobisToast(text: message, inset: 92)
68+
return .none
69+
}
6070
}

Projects/Flow/Sources/BookmarkFlow.swift

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,19 @@ private extension BookmarkFlow {
4343
}
4444

4545
func navigateToRecruitmentDetail(_ recruitmentID: Int) -> FlowContributors {
46-
let recruitmentDetailViewController = container.resolve(RecruitmentDetailViewController.self)!.then {
47-
$0.viewModel.recruitmentID = recruitmentID
46+
let recruitmentDetailFlow = RecruitmentDetailFlow(container: container)
47+
48+
Flows.use(recruitmentDetailFlow, when: .created) { (root) in
49+
let view = root as? RecruitmentDetailViewController
50+
view?.viewModel.recruitmentID = recruitmentID
51+
self.rootViewController.pushViewController(
52+
view!, animated: true
53+
)
4854
}
4955

50-
self.rootViewController.pushViewController(
51-
recruitmentDetailViewController,
52-
animated: true
53-
)
54-
5556
return .one(flowContributor: .contribute(
56-
withNextPresentable: recruitmentDetailViewController,
57-
withNextStepper: recruitmentDetailViewController.viewModel
57+
withNextPresentable: recruitmentDetailFlow,
58+
withNextStepper: OneStepper(withSingleStep: RecruitmentDetailStep.recruitmentDetailIsRequired)
5859
))
5960
}
6061
}

Projects/Flow/Sources/Company/CompanyDetailFlow.swift

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ public final class CompanyDetailFlow: Flow {
2323
case .companyDetailIsRequired:
2424
return navigateToCompanyDetail()
2525

26-
case .recruitmentDetailIsRequired:
27-
return dismissCompanyDetail()
26+
case .popIsRequired:
27+
return popCompanyDetail()
28+
29+
case let.recruitmentDetailIsRequired(id):
30+
return navigateToRecruimtentDetail(recruitmentID: id)
2831
}
2932
}
3033
}
@@ -37,8 +40,26 @@ private extension CompanyDetailFlow {
3740
))
3841
}
3942

40-
func dismissCompanyDetail() -> FlowContributors {
43+
func popCompanyDetail() -> FlowContributors {
4144
rootViewController.navigationController?.popViewController(animated: true)
4245
return .none
4346
}
47+
48+
func navigateToRecruimtentDetail(recruitmentID: Int) -> FlowContributors {
49+
let recruitmentDetailFlow = RecruitmentDetailFlow(container: container)
50+
51+
Flows.use(recruitmentDetailFlow, when: .created) { (root) in
52+
let view = root as? RecruitmentDetailViewController
53+
view?.viewModel.recruitmentID = recruitmentID
54+
view?.viewModel.type = .companyDeatil
55+
self.rootViewController.navigationController?.pushViewController(
56+
view!, animated: true
57+
)
58+
}
59+
60+
return .one(flowContributor: .contribute(
61+
withNextPresentable: recruitmentDetailFlow,
62+
withNextStepper: OneStepper(withSingleStep: RecruitmentDetailStep.recruitmentDetailIsRequired)
63+
))
64+
}
4465
}

Projects/Flow/Sources/Company/CompanySearchFlow.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ private extension CompanySearchFlow {
4242
Flows.use(companyDetailFlow, when: .created) { (root) in
4343
let view = root as? CompanyDetailViewController
4444
view?.viewModel.companyID = id
45+
view?.viewModel.type = .searchCompany
4546
self.rootViewController.navigationController?.pushViewController(
4647
view!, animated: true
4748
)

Projects/Modules/DesignSystem/Sources/Extensions/UIViewController/UIViewController+showJobisToast.swift

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,40 @@ import UIKit
22
import SnapKit
33

44
public extension UIViewController {
5-
func showJobisToast(text: String) {
5+
func showJobisToast(text: String, inset: CGFloat) {
66
let jobisToast = JobisToast(text: text)
77
let animationOption = UIView.AnimationOptions.transitionCrossDissolve
8-
self.view.addSubview(jobisToast)
9-
resetToast(toast: jobisToast)
8+
let scenes = UIApplication.shared.connectedScenes
9+
let windowScene = scenes.first as? UIWindowScene
10+
let window = windowScene?.windows.first
11+
12+
window?.addSubview(jobisToast)
13+
resetToast(toast: jobisToast, inset: inset)
1014

1115
UIView.animate(
1216
withDuration: 0.3,
1317
delay: 0,
1418
options: animationOption
15-
) { [self] in
19+
) {
1620
jobisToast.alpha = 1
17-
jobisToast.snp.remakeConstraints {
18-
$0.centerX.equalToSuperview()
19-
$0.bottom.equalTo(self.view.safeAreaLayoutGuide).inset(12).priority(1000)
20-
}
21-
self.view.layoutIfNeeded()
2221
}
2322

2423
UIView.animate(
2524
withDuration: 0.3,
26-
delay: 3,
25+
delay: 1.25,
2726
options: animationOption,
28-
animations: { [self] in
27+
animations: {
2928
jobisToast.alpha = 0
30-
resetToast(toast: jobisToast)
3129
}, completion: { _ in
3230
jobisToast.removeFromSuperview()
3331
}
3432
)
3533
}
3634

37-
private func resetToast(toast: JobisToast) {
38-
self.view.layoutIfNeeded()
35+
private func resetToast(toast: JobisToast, inset: CGFloat) {
3936
toast.snp.makeConstraints {
4037
$0.centerX.equalToSuperview()
41-
$0.top.equalTo(self.view.snp.bottom)
38+
$0.bottomMargin.equalToSuperview().inset(inset)
4239
}
4340
}
4441
}

Projects/Modules/DesignSystem/Sources/Toast/JobisToast.swift

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import UIKit
22
import Then
33
import SnapKit
44

5-
final class JobisToast: UIView {
5+
final class JobisToast: UIStackView {
66
private let imageView = UIImageView().then {
77
$0.image = DesignSystemAsset.Icons.toastIcon.image
88
}
@@ -13,7 +13,8 @@ final class JobisToast: UIView {
1313
textLabel.setJobisText(text, font: .subHeadLine, color: .GrayScale.gray90)
1414
configureView()
1515
}
16-
required init?(coder: NSCoder) {
16+
17+
required init(coder: NSCoder) {
1718
fatalError("init(coder:) has not been implemented")
1819
}
1920

@@ -22,20 +23,18 @@ final class JobisToast: UIView {
2223
self.layer.borderColor = UIColor.GrayScale.gray40.cgColor
2324
self.layer.borderWidth = 1
2425
self.backgroundColor = .GrayScale.gray30
26+
self.axis = .horizontal
27+
self.spacing = 4
28+
self.layoutMargins = .init(top: 12, left: 16, bottom: 12, right: 16)
29+
self.isLayoutMarginsRelativeArrangement = true
2530

2631
[
2732
imageView,
2833
textLabel
29-
].forEach { self.addSubview($0) }
34+
].forEach { self.addArrangedSubview($0) }
3035

3136
imageView.snp.makeConstraints {
32-
$0.leading.top.bottom.equalToSuperview().inset(12)
3337
$0.width.height.equalTo(24)
3438
}
35-
textLabel.snp.makeConstraints {
36-
$0.trailing.equalToSuperview().inset(16)
37-
$0.top.bottom.equalToSuperview().inset(12)
38-
$0.leading.equalTo(imageView.snp.trailing).offset(4)
39-
}
4039
}
4140
}

0 commit comments

Comments
 (0)