Skip to content

Commit

Permalink
[Fix] #244 - MyPage Factory 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jeongdung-eo committed Mar 23, 2024
1 parent 2d7e863 commit 86ac90f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class MypageCoordinatorImpl: MypageCoordinator {
}

func showMyInfoViewController() {
let viewController = viewControllerFactory.makeMyInfoViewController(coordinator: self)
let viewController = viewControllerFactory.makeMyPageViewController(coordinator: self)
navigationController.setViewControllers([viewController], animated: true)
}

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

extension ViewControllerFactoryImpl {
func makeMyInfoViewController(coordinator: MypageCoordinator) -> MyInfoViewController {
let viewController = MyInfoViewController(coordinator: coordinator)

func makeMyPageManager() -> MyPageManger {
let authAPI = DefaultAuthService()
let manager = MyPageManagerImpl(authAPI: authAPI)
return manager
}

func makeMyPageViewModel(coordinator: MypageCoordinator) -> any MyPageViewModel {
let viewModel = MyPageViewModelImpl(coordinator: coordinator)
return viewModel
}

func makeMyPageViewController(coordinator: MypageCoordinator) -> MyPageViewController {
let viewModel = self.makeMyPageViewModel(coordinator: coordinator)
let viewController = MyPageViewController(viewModel: viewModel)
return viewController
}

func makeMyInfoAccountViewController(coordinator: MypageCoordinator) -> MyInfoAccountViewController {
let viewController = MyInfoAccountViewController(coordinator: coordinator)
func makeMyPageAccountViewModel(coordinator: MypageCoordinator) -> any MyPageAccountViewModel {
let manager = self.makeMyPageManager()
let viewModel = MyPageAccountViewModelImpl(coordinator: coordinator, manager: manager)
return viewModel
}

func makeMyPageAccountViewController(coordinator: MypageCoordinator) -> MyPageAccountViewController {
let viewModel = self.makeMyPageAccountViewModel(coordinator: coordinator)
let viewController = MyPageAccountViewController(viewModel: viewModel)
return viewController
}

func makeWithdrawViewModel(coordinator: MypageCoordinator) -> any ModalViewModel {
let manager = self.makeMyPageManager()
let viewModel = ModalViewModelImpl(coordinator: coordinator, manager: manager)
return viewModel
}

func makeWithdrawViewController(coordinator: MypageCoordinator) -> NottodoModalViewController {
let viewController = NottodoModalViewController(coordinator: coordinator)
let viewModel = self.makeWithdrawViewModel(coordinator: coordinator)
let viewController = NottodoModalViewController(viewModel: viewModel)
return viewController
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation

protocol MyPageFlowControllerFactory {
func makeMyInfoViewController(coordinator: MypageCoordinator) -> MyInfoViewController
func makeMyInfoAccountViewController(coordinator: MypageCoordinator) -> MyInfoAccountViewController
func makeMyPageViewController(coordinator: MypageCoordinator) -> MyPageViewController
func makeMyPageAccountViewController(coordinator: MypageCoordinator) -> MyPageAccountViewController
func makeWithdrawViewController(coordinator: MypageCoordinator) -> NottodoModalViewController
}

0 comments on commit 86ac90f

Please sign in to comment.