Skip to content

Commit

Permalink
[REFACTOR] AuthCoordinator에서 Adator생성분리(#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
kimscastle committed Oct 19, 2023
1 parent 76b5758 commit 060952d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 17 deletions.
4 changes: 2 additions & 2 deletions LionHeart-iOS/LionHeart-iOS/Scenes/Adaptor/AuthAdaptor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

import Foundation

typealias AuthNaviation = LoginNavigation & OnboardingNavigation & CompleteOnbardingNavigation
typealias EntireAuthNaviation = LoginNavigation & OnboardingNavigation & CompleteOnbardingNavigation

final class AuthAdaptor: AuthNaviation {
final class AuthAdaptor: EntireAuthNaviation {

let coordinator: AuthCoordinator
init(coordinator: AuthCoordinator) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ final class AuthCoordinatorImpl: AuthCoordinator {
}

func showLoginViewController() {
let authAdaptor = AuthAdaptor(coordinator: self)
let loginViewController = factory.makeLoginViewController(navigator: authAdaptor)
let loginViewController = factory.makeLoginViewController(coordinator: self)
self.navigationController.pushViewController(loginViewController, animated: true)
}

Expand All @@ -36,8 +35,7 @@ final class AuthCoordinatorImpl: AuthCoordinator {
}

func showOnboardingCompleteViewController(data: UserOnboardingModel) {
let completeAdaptor = AuthAdaptor(coordinator: self)
let completeViewController = factory.makeCompleteOnbardingViewController(navigator: completeAdaptor)
let completeViewController = factory.makeCompleteOnbardingViewController(coordinator: self)
completeViewController.userData = data
self.navigationController.pushViewController(completeViewController, animated: true)
}
Expand All @@ -48,8 +46,7 @@ final class AuthCoordinatorImpl: AuthCoordinator {
case .verified:
splashCoorinator?.showTabbarViewContoller()
case .nonVerified:
let onboardingAdaptor = AuthAdaptor(coordinator: self)
let onboardingViewController = factory.makeOnboardingViewController(navigator: onboardingAdaptor)
let onboardingViewController = factory.makeOnboardingViewController(coordinator: self)
onboardingViewController.setKakaoAccessToken(kakaoToken)
self.navigationController.pushViewController(onboardingViewController, animated: true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ final class MypageCoordinator: Coordinator {
myPageViewController.coordinator = self
self.navigationController.pushViewController(myPageViewController, animated: true)
}
func dismiss() {

}

func pop() {

}
}

extension MypageCoordinator: MyPageNavigation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,22 @@
import UIKit

struct AuthFactoryImpl: AuthFactory {
func makeAuthAdaptor(coordinator: AuthCoordinator) -> EntireAuthNaviation {
return AuthAdaptor(coordinator: coordinator)
}

func makeLoginViewController(navigator: LoginNavigation) -> LoginViewControllerable {
let loginViewController = LoginViewController(manager: LoginMangerImpl(authService: AuthServiceImpl(apiService: APIService())), navigator: navigator)
func makeLoginViewController(coordinator: AuthCoordinator) -> LoginViewControllerable {
let loginViewController = LoginViewController(manager: LoginMangerImpl(authService: AuthServiceImpl(apiService: APIService())), navigator: self.makeAuthAdaptor(coordinator: coordinator))
return loginViewController
}

func makeCompleteOnbardingViewController(navigator: CompleteOnbardingNavigation) -> CompleteOnbardingViewControllerable {
let completeViewController = CompleteOnbardingViewController(navigator: navigator)
func makeCompleteOnbardingViewController(coordinator: AuthCoordinator) -> CompleteOnbardingViewControllerable {
let completeViewController = CompleteOnbardingViewController(navigator: self.makeAuthAdaptor(coordinator: coordinator))
return completeViewController
}

func makeOnboardingViewController(navigator: OnboardingNavigation) -> OnboardingViewControllerable {
let onboardingViewController = OnboardingViewController(manager: OnboardingManagerImpl(authService: AuthServiceImpl(apiService: APIService())), navigator: navigator)
func makeOnboardingViewController(coordinator: AuthCoordinator) -> OnboardingViewControllerable {
let onboardingViewController = OnboardingViewController(manager: OnboardingManagerImpl(authService: AuthServiceImpl(apiService: APIService())), navigator: self.makeAuthAdaptor(coordinator: coordinator))
return onboardingViewController
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
import Foundation

protocol AuthFactory {
func makeLoginViewController(navigator: LoginNavigation) -> LoginViewControllerable
func makeCompleteOnbardingViewController(navigator: CompleteOnbardingNavigation) -> CompleteOnbardingViewControllerable
func makeOnboardingViewController(navigator: OnboardingNavigation) -> OnboardingViewControllerable
func makeAuthAdaptor(coordinator: AuthCoordinator) -> EntireAuthNaviation
func makeLoginViewController(coordinator: AuthCoordinator) -> LoginViewControllerable
func makeCompleteOnbardingViewController(coordinator: AuthCoordinator) -> CompleteOnbardingViewControllerable
func makeOnboardingViewController(coordinator: AuthCoordinator) -> OnboardingViewControllerable
}


0 comments on commit 060952d

Please sign in to comment.