Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

๐Ÿ”— :: (#251) ์ง€์›ํ˜„ํ™ฉ ํ•ฉ๊ฒฉ๋œ ํšŒ์‚ฌ ํด๋ฆญ ์‹œ ์ด๋ฒคํŠธ ์ฒ˜๋ฆฌ #253

Merged
merged 3 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
))
}
}
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
Loading