-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
🔗 :: (#258) 겨울인턴 개발
- Loading branch information
Showing
13 changed files
with
408 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
Projects/Flow/Sources/WinterIntern/WinterInternFlow.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import UIKit | ||
import Presentation | ||
import Swinject | ||
import RxFlow | ||
import Core | ||
|
||
public final class WinterInternFlow: Flow { | ||
public let container: Container | ||
private let rootViewController: WinterInternViewController | ||
public var root: Presentable { | ||
return rootViewController | ||
} | ||
|
||
public init(container: Container) { | ||
self.container = container | ||
self.rootViewController = container.resolve(WinterInternViewController.self)! | ||
} | ||
|
||
public func navigate(to step: Step) -> FlowContributors { | ||
guard let step = step as? RecruitmentStep else { return .none } | ||
|
||
switch step { | ||
case .recruitmentIsRequired: | ||
return navigateToRecruitment() | ||
|
||
case let .recruitmentDetailIsRequired(id): | ||
return navigateToRecruitmentDetail(recruitmentID: id) | ||
|
||
case .recruitmentFilterIsRequired: | ||
return navigateToRecruitmentFilter() | ||
|
||
case .searchRecruitmentIsRequired: | ||
return navigateToSearchRecruitment() | ||
} | ||
} | ||
} | ||
|
||
private extension WinterInternFlow { | ||
func navigateToRecruitment() -> FlowContributors { | ||
return .one(flowContributor: .contribute( | ||
withNextPresentable: rootViewController, | ||
withNextStepper: rootViewController.viewModel | ||
)) | ||
} | ||
|
||
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 | ||
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.navigationController?.pushViewController( | ||
view!, animated: true | ||
) | ||
} | ||
|
||
return .one(flowContributor: .contribute( | ||
withNextPresentable: recruitmentDetailFlow, | ||
withNextStepper: OneStepper(withSingleStep: RecruitmentDetailStep.recruitmentDetailIsRequired) | ||
)) | ||
} | ||
|
||
func navigateToSearchRecruitment() -> FlowContributors { | ||
let searchRecruitmentFlow = SearchRecruitmentFlow(container: container) | ||
|
||
Flows.use(searchRecruitmentFlow, when: .created) { (root) in | ||
let view = root as? SearchRecruitmentViewController | ||
self.rootViewController.navigationController?.pushViewController( | ||
view!, animated: true | ||
) | ||
} | ||
|
||
return .one(flowContributor: .contribute( | ||
withNextPresentable: searchRecruitmentFlow, | ||
withNextStepper: OneStepper(withSingleStep: SearchRecruitmentStep.searchRecruitmentIsRequired) | ||
)) | ||
} | ||
|
||
func navigateToRecruitmentFilter() -> FlowContributors { | ||
let recruitmentFilterFlow = RecruitmentFilterFlow(container: container) | ||
|
||
Flows.use(recruitmentFilterFlow, when: .created) { (root) in | ||
self.rootViewController.navigationController?.pushViewController( | ||
root, animated: true | ||
) | ||
} | ||
|
||
return .one(flowContributor: .contribute( | ||
withNextPresentable: recruitmentFilterFlow, | ||
withNextStepper: OneStepper(withSingleStep: RecruitmentFilterStep.recruitmentFilterIsRequired) | ||
)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.