Skip to content

Commit

Permalink
⚡️ :: 전체적인 회원가입 flow 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
juyeong525 committed Mar 20, 2024
1 parent f6332f2 commit 8abd36b
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 13 deletions.
6 changes: 6 additions & 0 deletions Projects/Core/Sources/Steps/EmailLoginStep.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import RxFlow

public enum EmailLoginStep: Step {
case emailLoginisRequired
case tabIsRequired
}
4 changes: 2 additions & 2 deletions Projects/Flow/Sources/AgeSignupFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ private extension AgeSignupFlow {
}

return .one(flowContributor: .contribute(
withNextPresentable: rootViewController,
withNextStepper: rootViewController.reactor
withNextPresentable: profilSignupFlow,
withNextStepper: OneStepper(withSingleStep: ProfilSignupStep.profilSignupIsRequired)
))
}
}
2 changes: 1 addition & 1 deletion Projects/Flow/Sources/AppStepper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public final class AppStepper: Stepper {
public init() {}

public var initialStep: Step {
return AppStep.testIsRequired
return AppStep.onboardingIsRequired
}
}
40 changes: 40 additions & 0 deletions Projects/Flow/Sources/EmailLoginFlow.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import UIKit
import RxFlow
import RxSwift
import Core
import Swinject
import Presentation

public final class EmailLoginFlow: Flow {
public let container: Container
public var root: Presentable {
return self.rootViewController
}

public let rootViewController: EmailLoginViewController

public init(container: Container) {
self.container = container
self.rootViewController = container.resolve(EmailLoginViewController.self)!
}

public func navigate(to step: Step) -> FlowContributors {
guard let step = step as? EmailLoginStep else { return .none }

switch step {
case .emailLoginisRequired:
return navigationToEmailLogin()
case .tabIsRequired:
return .end(forwardToParentFlowWithStep: OauthLoginStep.tabIsRequired)
}
}
}

private extension EmailLoginFlow {
func navigationToEmailLogin() -> FlowContributors {
return .one(flowContributor: .contribute(
withNextPresentable: rootViewController,
withNextStepper: rootViewController.reactor
))
}
}
15 changes: 7 additions & 8 deletions Projects/Flow/Sources/OauthLoginFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public final class OauthLoginFlow: Flow {
case .emailSignupIsRequired:
return navigationToEmailSignup()
case .tabIsRequired:
return .end(forwardToParentFlowWithStep: OnboardingStep.tabIsRequired)
return .end(forwardToParentFlowWithStep: AppStep.tabIsRequired)
}
}
}
Expand All @@ -50,16 +50,15 @@ private extension OauthLoginFlow {
}

func navigationToEmailLogin() -> FlowContributors {
let emailLoginViewController = container.resolve(EmailLoginViewController.self)!
let emailLoginFlow = EmailLoginFlow(container: container)

self.rootViewController.pushViewController(
emailLoginViewController,
animated: true
)
Flows.use(emailLoginFlow, when: .created) { (root) in
self.rootViewController.pushViewController(root, animated: true)
}

return .one(flowContributor: .contribute(
withNextPresentable: emailLoginViewController,
withNextStepper: emailLoginViewController.reactor
withNextPresentable: emailLoginFlow,
withNextStepper: OneStepper(withSingleStep: EmailLoginStep.emailLoginisRequired)
))
}

Expand Down
7 changes: 6 additions & 1 deletion Projects/Flow/Sources/ProFilSignupFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public final class ProFilSignupFlow: Flow {
return navigationToProfilSignup()

case .oauthLoginIsRequired:
return .end(forwardToParentFlowWithStep: AgeSignupStep.oauthLoginIsRequired)
return navigationToOauthLogin()
}
}
}
Expand All @@ -38,4 +38,9 @@ private extension ProFilSignupFlow {
withNextStepper: rootViewController.reactor
))
}

func navigationToOauthLogin() -> FlowContributors {
self.rootViewController.navigationController?.popToRootViewController(animated: true)
return .end(forwardToParentFlowWithStep: AgeSignupStep.oauthLoginIsRequired)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class BaseReactorViewController<Reactor: BaseReactor>: UIViewController,
bindAction()
bindState()
configureViewController()
// configureNavigation()
configureNavigation()

self.viewDidLoadPublisher.accept(())
}
Expand Down

0 comments on commit 8abd36b

Please sign in to comment.