Skip to content

Commit

Permalink
πŸ”— :: (#251) μ§€μ›ν˜„ν™© ν•©κ²©λœ νšŒμ‚¬ 클릭 μ‹œ 이벀트 처리
Browse files Browse the repository at this point in the history
πŸ”— :: (#251) μ§€μ›ν˜„ν™© ν•©κ²©λœ νšŒμ‚¬ 클릭 μ‹œ 이벀트 처리
  • Loading branch information
ray3238 authored Jul 24, 2024
2 parents cfce963 + 75c41a9 commit 11d063d
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Projects/Core/Sources/Steps/HomeStep.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ public enum HomeStep: Step {
companyName: String,
companyImageURL: String
)
case recruitmentDetailIsRequired(id: Int)
case none
}
34 changes: 34 additions & 0 deletions Projects/Flow/Sources/Home/HomeFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ public final class HomeFlow: Flow {

case let .reApplyIsRequired(recruitmentID, applicationID, companyName, companyImageURL):
return navigateToReApply(recruitmentID, applicationID, companyName, companyImageURL)

case let .recruitmentDetailIsRequired(id):
return navigateToRecruitmentDetail(id)

case .none:
return .none
}
}
}
Expand Down Expand Up @@ -156,4 +162,32 @@ private extension HomeFlow {
)
))
}

func navigateToRecruitmentDetail(_ recruitmentID: Int) -> FlowContributors {
let recruitmentDetailFlow = RecruitmentDetailFlow(container: container)

Flows.use(recruitmentDetailFlow, when: .created) { (root) in
let view = root as? RecruitmentDetailViewController
view?.viewModel.recruitmentID = recruitmentID
view?.isPopViewController = { id, bookmark in
let popView = self.rootViewController.topViewController as? RecruitmentViewController
var oldData = popView?.viewModel.recruitmentData.value
oldData?.enumerated().forEach {
if $0.element.recruitID == id {
oldData![$0.offset].bookmarked = bookmark
}
}
popView?.viewModel.recruitmentData.accept(oldData!)
popView?.isTabNavigation = false
}
self.rootViewController.pushViewController(
view!, animated: true
)
}

return .one(flowContributor: .contribute(
withNextPresentable: recruitmentDetailFlow,
withNextStepper: OneStepper(withSingleStep: RecruitmentDetailStep.recruitmentDetailIsRequired)
))
}
}
6 changes: 5 additions & 1 deletion Projects/Presentation/Sources/Home/HomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ public final class HomeViewController: BaseViewController<HomeViewModel> {
navigateToEasterEggDidTap: navigateToEasterEggDidTap,
navigateToCompanyButtonDidTap: findCompanysCard.rx.tap.asSignal(),
rejectButtonDidTap: rejectButtonDidTap,
reApplyButtonDidTap: reApplyButtonDidTap
reApplyButtonDidTap: reApplyButtonDidTap,
applicationStatusTableViewDidTap: applicationStatusTableView.rx
.modelSelected(ApplicationEntity.self)
.asObservable()
.map { ($0.recruitmentID, $0.applicationStatus) }
)

titleImageView.rx.tapGesture().when(.recognized).asObservable()
Expand Down
12 changes: 12 additions & 0 deletions Projects/Presentation/Sources/Home/HomeViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public final class HomeViewModel: BaseViewModel, Stepper {
let navigateToCompanyButtonDidTap: Signal<Void>
let rejectButtonDidTap: PublishRelay<ApplicationEntity>
let reApplyButtonDidTap: PublishRelay<ApplicationEntity>
let applicationStatusTableViewDidTap: Observable<(Int, ApplicationStatusType)>
}

public struct Output {
Expand Down Expand Up @@ -125,6 +126,17 @@ public final class HomeViewModel: BaseViewModel, Stepper {
.bind(to: steps)
.disposed(by: disposeBag)

input.applicationStatusTableViewDidTap.asObservable()
.map { id, status in
if status == .pass || status == .fieldTrain {
return HomeStep.recruitmentDetailIsRequired(id: id)
} else {
return HomeStep.none
}
}
.bind(to: steps)
.disposed(by: disposeBag)

return Output(
studentInfo: studentInfo,
applicationList: applicationList,
Expand Down

0 comments on commit 11d063d

Please sign in to comment.