Skip to content

Commit 11d063d

Browse files
authored
πŸ”— :: (#251) μ§€μ›ν˜„ν™© ν•©κ²©λœ νšŒμ‚¬ 클릭 μ‹œ 이벀트 처리
πŸ”— :: (#251) μ§€μ›ν˜„ν™© ν•©κ²©λœ νšŒμ‚¬ 클릭 μ‹œ 이벀트 처리
2 parents cfce963 + 75c41a9 commit 11d063d

File tree

4 files changed

+53
-1
lines changed

4 files changed

+53
-1
lines changed

β€ŽProjects/Core/Sources/Steps/HomeStep.swiftβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ public enum HomeStep: Step {
1717
companyName: String,
1818
companyImageURL: String
1919
)
20+
case recruitmentDetailIsRequired(id: Int)
21+
case none
2022
}

β€ŽProjects/Flow/Sources/Home/HomeFlow.swiftβ€Ž

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ public final class HomeFlow: Flow {
3636

3737
case let .reApplyIsRequired(recruitmentID, applicationID, companyName, companyImageURL):
3838
return navigateToReApply(recruitmentID, applicationID, companyName, companyImageURL)
39+
40+
case let .recruitmentDetailIsRequired(id):
41+
return navigateToRecruitmentDetail(id)
42+
43+
case .none:
44+
return .none
3945
}
4046
}
4147
}
@@ -156,4 +162,32 @@ private extension HomeFlow {
156162
)
157163
))
158164
}
165+
166+
func navigateToRecruitmentDetail(_ recruitmentID: Int) -> FlowContributors {
167+
let recruitmentDetailFlow = RecruitmentDetailFlow(container: container)
168+
169+
Flows.use(recruitmentDetailFlow, when: .created) { (root) in
170+
let view = root as? RecruitmentDetailViewController
171+
view?.viewModel.recruitmentID = recruitmentID
172+
view?.isPopViewController = { id, bookmark in
173+
let popView = self.rootViewController.topViewController as? RecruitmentViewController
174+
var oldData = popView?.viewModel.recruitmentData.value
175+
oldData?.enumerated().forEach {
176+
if $0.element.recruitID == id {
177+
oldData![$0.offset].bookmarked = bookmark
178+
}
179+
}
180+
popView?.viewModel.recruitmentData.accept(oldData!)
181+
popView?.isTabNavigation = false
182+
}
183+
self.rootViewController.pushViewController(
184+
view!, animated: true
185+
)
186+
}
187+
188+
return .one(flowContributor: .contribute(
189+
withNextPresentable: recruitmentDetailFlow,
190+
withNextStepper: OneStepper(withSingleStep: RecruitmentDetailStep.recruitmentDetailIsRequired)
191+
))
192+
}
159193
}

β€ŽProjects/Presentation/Sources/Home/HomeViewController.swiftβ€Ž

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ public final class HomeViewController: BaseViewController<HomeViewModel> {
113113
navigateToEasterEggDidTap: navigateToEasterEggDidTap,
114114
navigateToCompanyButtonDidTap: findCompanysCard.rx.tap.asSignal(),
115115
rejectButtonDidTap: rejectButtonDidTap,
116-
reApplyButtonDidTap: reApplyButtonDidTap
116+
reApplyButtonDidTap: reApplyButtonDidTap,
117+
applicationStatusTableViewDidTap: applicationStatusTableView.rx
118+
.modelSelected(ApplicationEntity.self)
119+
.asObservable()
120+
.map { ($0.recruitmentID, $0.applicationStatus) }
117121
)
118122

119123
titleImageView.rx.tapGesture().when(.recognized).asObservable()

β€ŽProjects/Presentation/Sources/Home/HomeViewModel.swiftβ€Ž

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public final class HomeViewModel: BaseViewModel, Stepper {
3232
let navigateToCompanyButtonDidTap: Signal<Void>
3333
let rejectButtonDidTap: PublishRelay<ApplicationEntity>
3434
let reApplyButtonDidTap: PublishRelay<ApplicationEntity>
35+
let applicationStatusTableViewDidTap: Observable<(Int, ApplicationStatusType)>
3536
}
3637

3738
public struct Output {
@@ -125,6 +126,17 @@ public final class HomeViewModel: BaseViewModel, Stepper {
125126
.bind(to: steps)
126127
.disposed(by: disposeBag)
127128

129+
input.applicationStatusTableViewDidTap.asObservable()
130+
.map { id, status in
131+
if status == .pass || status == .fieldTrain {
132+
return HomeStep.recruitmentDetailIsRequired(id: id)
133+
} else {
134+
return HomeStep.none
135+
}
136+
}
137+
.bind(to: steps)
138+
.disposed(by: disposeBag)
139+
128140
return Output(
129141
studentInfo: studentInfo,
130142
applicationList: applicationList,

0 commit comments

Comments
Β (0)