Skip to content

Commit

Permalink
프젝 세팅 & Auth 퍼블리싱
Browse files Browse the repository at this point in the history
  • Loading branch information
juyeong525 committed Feb 22, 2024
1 parent 1b35b26 commit fb1b77b
Show file tree
Hide file tree
Showing 112 changed files with 2,404 additions and 797 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ public extension TargetDependency.SPM {
static let KeychainSwift = TargetDependency.external(name: "KeychainSwift")
static let ReactorKit = TargetDependency.external(name: "ReactorKit")
static let RxGesture = TargetDependency.external(name: "RxGesture")
static let TextFieldEffets = TargetDependency.external(name: "TextFieldEffects")
}
3 changes: 2 additions & 1 deletion Projects/App/Sources/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
) -> Bool {

assembler = Assembler([
KeychainAssembly()
KeychainAssembly(),
PresentationAssembly()
], container: AppDelegate.container)
return true
}
Expand Down
2 changes: 2 additions & 0 deletions Projects/Core/Sources/Steps/AppStep.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ import RxFlow

public enum AppStep: Step {
case onboardingIsRequired
case oauthLoginIsRequired
case tabIsRequired
}
8 changes: 8 additions & 0 deletions Projects/Core/Sources/Steps/OauthLoginStep.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import RxFlow

public enum OauthLoginStep: Step {
case oauthLoginIsRequired
case emailLoginisRequired
case emailSignupIsRequired
case tabIsRequired
}
7 changes: 7 additions & 0 deletions Projects/Core/Sources/Steps/OnboardingStep.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import RxFlow

public enum OnboardingStep: Step {
case oauthLoginIsRequired
case tabIsRequired
case onboardingIsRequired
}
7 changes: 7 additions & 0 deletions Projects/Core/Sources/Steps/Singup/AgeSignupStep.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import RxFlow

public enum AgeSignupStep: Step {
case ageSignupIsRequired
case oauthLoginIsRequired
case proFilSignupIsRequired
}
7 changes: 7 additions & 0 deletions Projects/Core/Sources/Steps/Singup/EmailSignupStep.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import RxFlow

public enum EmailSignupStep: Step {
case emailSignupIsRequired
case oauthLoginIsRequired
case passwordSignupIsrequired
}
7 changes: 7 additions & 0 deletions Projects/Core/Sources/Steps/Singup/NickNameSignupStep.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import RxFlow

public enum NickNameSignupStep: Step {
case ageSignupIsRequired
case oauthLoginIsRequired
case nickNameSignupIsRequired
}
7 changes: 7 additions & 0 deletions Projects/Core/Sources/Steps/Singup/PasswordSignupStep.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import RxFlow

public enum PasswordSignupStep: Step {
case oauthLoginIsRequired
case passwordSignupIsrequired
case nickNameSignupIsRequired
}
6 changes: 6 additions & 0 deletions Projects/Core/Sources/Steps/Singup/ProFilSignupStep.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import RxFlow

public enum ProFilSignupStep: Step {
case oauthLoginIsRequired
case proFilSignupIsRequired
}
58 changes: 58 additions & 0 deletions Projects/Flow/Sources/AgeSignupFlow.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import UIKit
import RxFlow
import RxSwift
import Core
import Swinject
import Presentation

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

private let rootViewController: AgeSignupViewController

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

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

switch step {
case .ageSignupIsRequired:
return navigationToAgeSignup()
case .proFilSignupIsRequired:
return navigationToProFilSignup()
case .oauthLoginIsRequired:
return .end(forwardToParentFlowWithStep: NickNameSignupStep.oauthLoginIsRequired)
}
}
}

private extension AgeSignupFlow {
func navigationToAgeSignup() -> FlowContributors {
return .one(flowContributor: .contribute(
withNextPresentable: rootViewController,
withNextStepper: rootViewController.reactor
))
}

func navigationToProFilSignup() -> FlowContributors {
let profilSignupFlow = ProFilSignupFlow(container: container)

Flows.use(profilSignupFlow, when: .created) { (root) in
self.rootViewController.navigationController?.pushViewController(
root,
animated: true
)
}

return .one(flowContributor: .contribute(
withNextPresentable: rootViewController,
withNextStepper: rootViewController.reactor
))
}
}
59 changes: 49 additions & 10 deletions Projects/Flow/Sources/AppFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@ public final class AppFlow: Flow {
return self.window
}

private let rootViewController: MainViewController

public init(window: UIWindow, container: Container) {
self.window = window
self.container = container
self.rootViewController = MainViewController(MainReactor())
}

public func navigate(to step: Step) -> FlowContributors {
Expand All @@ -26,18 +23,60 @@ public final class AppFlow: Flow {
switch step {
case .onboardingIsRequired:
return navigationToOnboarding()
case .oauthLoginIsRequired:
return navigationToOauthLogin()
case .tabIsRequired:
return navigationToTab()
}
}
}

private extension AppFlow {
func navigationToOnboarding() -> FlowContributors {
self.window.rootViewController = rootViewController
return .one(
flowContributor: .contribute(
withNextPresentable: rootViewController,
withNextStepper: rootViewController.reactor
)
)
let onboardingFlow = OnboardingFlow(container: container)

Flows.use(onboardingFlow, when: .created) { (root) in
self.window.rootViewController = root
}

return .one(flowContributor: .contribute(
withNextPresentable: onboardingFlow,
withNextStepper: OneStepper(withSingleStep: OnboardingStep.onboardingIsRequired)
))
}

func navigationToOauthLogin() -> FlowContributors {
let oauthLoginFlow = OauthLoginFlow(container: container)

Flows.use(oauthLoginFlow, when: .created) { (root) in
UIView.transition(
with: self.window,
duration: 0.5,
options: .transitionCrossDissolve
) {
self.window.rootViewController = root
}
}

return .one(flowContributor: .contribute(
withNextPresentable: oauthLoginFlow,
withNextStepper: OneStepper(withSingleStep: OauthLoginStep.oauthLoginIsRequired)
))
}

func navigationToTab() -> FlowContributors {
let mainViewController = container.resolve(MainViewController.self)!
UIView.transition(
with: self.window,
duration: 0.5,
options: .transitionCrossDissolve
) {
self.window.rootViewController = mainViewController
}

return .one(flowContributor: .contribute(
withNextPresentable: mainViewController,
withNextStepper: mainViewController.reactor
))
}
}
58 changes: 58 additions & 0 deletions Projects/Flow/Sources/EmailSignupFlow.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import UIKit
import RxFlow
import RxSwift
import Core
import Swinject
import Presentation

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

private let rootViewController: EmailSignupViewController

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

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

switch step {
case .emailSignupIsRequired:
return navigationToEmailSignup()
case .passwordSignupIsrequired:
return navigationToPasswordSignup()
case .oauthLoginIsRequired:
return .end(forwardToParentFlowWithStep: OauthLoginStep.oauthLoginIsRequired)
}
}
}

private extension EmailSignupFlow {
func navigationToEmailSignup() -> FlowContributors {
return .one(flowContributor: .contribute(
withNextPresentable: rootViewController,
withNextStepper: rootViewController.reactor
))
}

func navigationToPasswordSignup() -> FlowContributors {
let passwordSignupFlow = PasswordSignupFlow(container: container)

Flows.use(passwordSignupFlow, when: .created) { (root) in
self.rootViewController.navigationController?.pushViewController(
root,
animated: true
)
}

return .one(flowContributor: .contribute(
withNextPresentable: passwordSignupFlow,
withNextStepper: OneStepper(withSingleStep: PasswordSignupStep.passwordSignupIsrequired)
))
}
}
58 changes: 58 additions & 0 deletions Projects/Flow/Sources/NickNameSignupFlow.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import UIKit
import RxFlow
import RxSwift
import Core
import Swinject
import Presentation

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

private let rootViewController: NickNameSignupViewController

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

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

switch step {
case .ageSignupIsRequired:
return navigationToAgeSignup()
case .oauthLoginIsRequired:
return .end(forwardToParentFlowWithStep: PasswordSignupStep.oauthLoginIsRequired)
case .nickNameSignupIsRequired:
return navigationToNickNameSignup()
}
}
}

private extension NickNameSignupFlow {
func navigationToNickNameSignup() -> FlowContributors {
return .one(flowContributor: .contribute(
withNextPresentable: rootViewController,
withNextStepper: rootViewController.reactor
))
}

func navigationToAgeSignup() -> FlowContributors {
let ageSignupFlow = AgeSignupFlow(container: container)

Flows.use(ageSignupFlow, when: .created) { (root) in
self.rootViewController.navigationController?.pushViewController(
root,
animated: true
)
}

return .one(flowContributor: .contribute(
withNextPresentable: ageSignupFlow,
withNextStepper: OneStepper(withSingleStep: AgeSignupStep.ageSignupIsRequired)
))
}
}
Loading

0 comments on commit fb1b77b

Please sign in to comment.