-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Refactor] #241 - 성취뷰 MVVM + Combine
[Refactor] #241 - 성취뷰 MVVM + Combine
- Loading branch information
Showing
75 changed files
with
1,285 additions
and
694 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
38 changes: 38 additions & 0 deletions
38
iOS-NOTTODO/iOS-NOTTODO/Coordinator/Factory/AchieveViewControllerFactory.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,38 @@ | ||
// | ||
// AchieveViewControllerFactory.swift | ||
// iOS-NOTTODO | ||
// | ||
// Created by JEONGEUN KIM on 3/23/24. | ||
// | ||
|
||
import Foundation | ||
|
||
extension ViewControllerFactoryImpl { | ||
|
||
func makeAchieveViewModel(coordinator: AchieveCoordinator) -> any AchievementViewModel { | ||
let missionAPI = DefaultMissionService() | ||
let manager = AchieveManagerImpl(missionAPI: missionAPI) | ||
let viewModel = AchievementViewModelImpl(coordinator: coordinator, manager: manager) | ||
return viewModel | ||
} | ||
|
||
func makeAchieveViewController(coordinator: AchieveCoordinator) -> AchievementViewController { | ||
let viewModel = self.makeAchieveViewModel(coordinator: coordinator) | ||
let viewController = AchievementViewController(viewModel: viewModel) | ||
return viewController | ||
} | ||
|
||
func makeAchieveDetailViewModel(coordinator: AchieveCoordinator) -> any DetailAchievementViewModel & DetailAchievementViewModelPresentable { | ||
let missionAPI = DefaultMissionService() | ||
let manager = AchieveManagerImpl(missionAPI: missionAPI) | ||
let viewModel = DetailAchievementViewModelImpl(coordinator: coordinator, manager: manager) | ||
return viewModel | ||
} | ||
|
||
func makeAchieveDetailViewController(coordinator: AchieveCoordinator, date: String) -> DetailAchievementViewController { | ||
let viewModel = self.makeAchieveDetailViewModel(coordinator: coordinator) | ||
viewModel.selectedDate(date) | ||
let viewController = DetailAchievementViewController(viewModel: viewModel) | ||
return viewController | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
iOS-NOTTODO/iOS-NOTTODO/Coordinator/Factory/AuthViewControllerFactory.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,51 @@ | ||
// | ||
// AuthViewControllerFactory.swift | ||
// iOS-NOTTODO | ||
// | ||
// Created by JEONGEUN KIM on 3/23/24. | ||
// | ||
|
||
import Foundation | ||
|
||
extension ViewControllerFactoryImpl { | ||
func makeAuthViewController(coordinator: AuthCoordinator) -> AuthViewController { | ||
let viewController = AuthViewController(coordinator: coordinator) | ||
return viewController | ||
} | ||
|
||
func makeNotificationDialogViewController(coordinator: AuthCoordinator, completion: @escaping () -> Void) -> NotificationDialogViewController { | ||
let viewController = NotificationDialogViewController() | ||
viewController.buttonHandler = { | ||
completion() | ||
} | ||
return viewController | ||
} | ||
} | ||
|
||
// Onboarding | ||
extension ViewControllerFactoryImpl { | ||
func makeValueOnboardingViewController(coordinator: AuthCoordinator) -> ValueOnboardingViewController { | ||
let viewController = ValueOnboardingViewController(coordinator: coordinator) | ||
return viewController | ||
} | ||
func makeLogoOnboardingViewController(coordinator: AuthCoordinator) -> LogoOnboardingViewController { | ||
let viewController = LogoOnboardingViewController(coordinator: coordinator) | ||
return viewController | ||
} | ||
func makeSecondOnboardingViewController(coordinator: AuthCoordinator) -> SecondOnboardingViewController { | ||
let viewController = SecondOnboardingViewController(coordinator: coordinator) | ||
return viewController | ||
} | ||
func makeThirdOnboardingViewController(coordinator: AuthCoordinator) -> ThirdOnboardingViewController { | ||
let viewController = ThirdOnboardingViewController(coordinator: coordinator) | ||
return viewController | ||
} | ||
func makeFourthOnboardingViewController(coordinator: AuthCoordinator) -> FourthOnboardingViewController { | ||
let viewController = FourthOnboardingViewController(coordinator: coordinator) | ||
return viewController | ||
} | ||
func makeFifthOnboardingViewController(coordinator: AuthCoordinator) -> FifthOnboardingViewController { | ||
let viewController = FifthOnboardingViewController(coordinator: coordinator) | ||
return viewController | ||
} | ||
} |
91 changes: 91 additions & 0 deletions
91
iOS-NOTTODO/iOS-NOTTODO/Coordinator/Factory/HomeViewControllerFactory.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,91 @@ | ||
// | ||
// HomeViewControllerFactory.swift | ||
// iOS-NOTTODO | ||
// | ||
// Created by JEONGEUN KIM on 3/23/24. | ||
// | ||
|
||
import Foundation | ||
|
||
// Home | ||
extension ViewControllerFactoryImpl { | ||
func makePopupViewController(coordinator: HomeCoordinator, completion: @escaping () -> Void) -> CommonNotificationViewController { | ||
let viewController = CommonNotificationViewController(coordinator: coordinator) | ||
viewController.tapCloseButton = { | ||
completion() | ||
} | ||
return viewController | ||
} | ||
|
||
func makeHomeViewController(coordinator: HomeCoordinator) -> HomeViewController { | ||
let viewController = HomeViewController(coordinator: coordinator) | ||
return viewController | ||
} | ||
} | ||
|
||
// HomeDetail | ||
extension ViewControllerFactoryImpl { | ||
func makeDeleteViewController(coordinator: HomeCoordinator, completion: @escaping () -> Void) -> HomeDeleteViewController { | ||
let viewController = HomeDeleteViewController(coordinator: coordinator) | ||
viewController.deleteClosure = { | ||
completion() | ||
} | ||
return viewController | ||
} | ||
|
||
func makeMissionDetailViewController(coordinator: HomeCoordinator, id: Int, deleteClosure: @escaping () -> Void, moveDateClosure: @escaping (String) -> Void) -> MissionDetailViewController { | ||
let viewController = MissionDetailViewController(coordinator: coordinator) | ||
viewController.userId = id | ||
viewController.deleteClosure = { | ||
deleteClosure() | ||
} | ||
viewController.moveDateClosure = { date in | ||
moveDateClosure(date) | ||
} | ||
return viewController | ||
} | ||
|
||
func makeModifyViewController(coordinator: HomeCoordinator, id: Int = 0, type: MissionType) -> AddMissionViewController { | ||
let viewController = AddMissionViewController(coordinator: coordinator) | ||
viewController.setViewType(type) | ||
viewController.setMissionId(id) | ||
return viewController | ||
} | ||
|
||
func makeSelectDateViewController(coordinator: HomeCoordinator, data: MissionDetailResponseDTO, id: Int, moveDateClosure: @escaping (String) -> Void) -> DetailCalendarViewController { | ||
let viewController = DetailCalendarViewController(coordinator: coordinator) | ||
viewController.detailModel = data | ||
viewController.userId = id | ||
viewController.movedateClosure = { date in | ||
moveDateClosure(date) | ||
} | ||
return viewController | ||
} | ||
} | ||
|
||
// Add Mission | ||
extension ViewControllerFactoryImpl { | ||
|
||
func makeRecommendViewController(coordinator: HomeCoordinator, date: String) -> RecommendViewController { | ||
let viewController = RecommendViewController(coordinator: coordinator) | ||
viewController.setSelectDate(date) | ||
return viewController | ||
} | ||
|
||
func makeRecommendDetailViewController(coordinator: HomeCoordinator, data: RecommendActionData) -> RecommendActionViewController { | ||
let viewController = RecommendActionViewController(coordinator: coordinator) | ||
viewController.actionHeaderData = data | ||
return viewController | ||
} | ||
|
||
func makeAddViewController(coordinator: HomeCoordinator, data: AddMissionData, type: MissionType) -> AddMissionViewController { | ||
let viewController = AddMissionViewController(coordinator: coordinator) | ||
viewController.setViewType(type) | ||
viewController.setNottodoLabel(data.nottodo ?? "") | ||
viewController.setSituationLabel(data.situation ?? "") | ||
viewController.setActionLabel(data.action ?? "") | ||
viewController.setDate(data.date) | ||
|
||
return viewController | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
iOS-NOTTODO/iOS-NOTTODO/Coordinator/Factory/MyPageViewControllerFactory.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,25 @@ | ||
// | ||
// MyPageViewControllerFactory.swift | ||
// iOS-NOTTODO | ||
// | ||
// Created by JEONGEUN KIM on 3/23/24. | ||
// | ||
|
||
import Foundation | ||
|
||
extension ViewControllerFactoryImpl { | ||
func makeMyInfoViewController(coordinator: MypageCoordinator) -> MyInfoViewController { | ||
let viewController = MyInfoViewController(coordinator: coordinator) | ||
return viewController | ||
} | ||
|
||
func makeMyInfoAccountViewController(coordinator: MypageCoordinator) -> MyInfoAccountViewController { | ||
let viewController = MyInfoAccountViewController(coordinator: coordinator) | ||
return viewController | ||
} | ||
|
||
func makeWithdrawViewController(coordinator: MypageCoordinator) -> NottodoModalViewController { | ||
let viewController = NottodoModalViewController(coordinator: coordinator) | ||
return viewController | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
iOS-NOTTODO/iOS-NOTTODO/Coordinator/Factory/Protocol/AchieveFlowControllerFactory.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,13 @@ | ||
// | ||
// AchieveFlowControllerFactory.swift | ||
// iOS-NOTTODO | ||
// | ||
// Created by JEONGEUN KIM on 3/23/24. | ||
// | ||
|
||
import Foundation | ||
|
||
protocol AchieveFlowControllerFactory { | ||
func makeAchieveViewController(coordinator: AchieveCoordinator) -> AchievementViewController | ||
func makeAchieveDetailViewController(coordinator: AchieveCoordinator, date: String) -> DetailAchievementViewController | ||
} |
18 changes: 18 additions & 0 deletions
18
iOS-NOTTODO/iOS-NOTTODO/Coordinator/Factory/Protocol/AuthFlowControllerFactory.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,18 @@ | ||
// | ||
// AuthFlowControllerFactory.swift | ||
// iOS-NOTTODO | ||
// | ||
// Created by JEONGEUN KIM on 3/23/24. | ||
// | ||
|
||
import Foundation | ||
protocol AuthFlowControllerFactory { | ||
func makeValueOnboardingViewController(coordinator: AuthCoordinator) -> ValueOnboardingViewController | ||
func makeLogoOnboardingViewController(coordinator: AuthCoordinator) -> LogoOnboardingViewController | ||
func makeSecondOnboardingViewController(coordinator: AuthCoordinator) -> SecondOnboardingViewController | ||
func makeThirdOnboardingViewController(coordinator: AuthCoordinator) -> ThirdOnboardingViewController | ||
func makeFourthOnboardingViewController(coordinator: AuthCoordinator) -> FourthOnboardingViewController | ||
func makeFifthOnboardingViewController(coordinator: AuthCoordinator) -> FifthOnboardingViewController | ||
func makeAuthViewController(coordinator: AuthCoordinator) -> AuthViewController | ||
func makeNotificationDialogViewController(coordinator: AuthCoordinator, completion: @escaping () -> Void) -> NotificationDialogViewController | ||
} |
20 changes: 20 additions & 0 deletions
20
iOS-NOTTODO/iOS-NOTTODO/Coordinator/Factory/Protocol/HomeFlowControllerFactory.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,20 @@ | ||
// | ||
// HomeFlowControllerFactory.swift | ||
// iOS-NOTTODO | ||
// | ||
// Created by JEONGEUN KIM on 3/23/24. | ||
// | ||
|
||
import Foundation | ||
|
||
protocol HomeFlowControllerFactory { | ||
func makePopupViewController(coordinator: HomeCoordinator, completion: @escaping () -> Void) -> CommonNotificationViewController | ||
func makeHomeViewController(coordinator: HomeCoordinator) -> HomeViewController | ||
func makeRecommendViewController(coordinator: HomeCoordinator, date: String) -> RecommendViewController | ||
func makeRecommendDetailViewController(coordinator: HomeCoordinator, data: RecommendActionData) -> RecommendActionViewController | ||
func makeAddViewController(coordinator: HomeCoordinator, data: AddMissionData, type: MissionType) -> AddMissionViewController | ||
func makeDeleteViewController(coordinator: HomeCoordinator, completion: @escaping () -> Void) -> HomeDeleteViewController | ||
func makeMissionDetailViewController(coordinator: HomeCoordinator, id: Int, deleteClosure: @escaping () -> Void, moveDateClosure: @escaping (String) -> Void) -> MissionDetailViewController | ||
func makeModifyViewController(coordinator: HomeCoordinator, id: Int, type: MissionType) -> AddMissionViewController | ||
func makeSelectDateViewController(coordinator: HomeCoordinator, data: MissionDetailResponseDTO, id: Int, moveDateClosure: @escaping (String) -> Void) -> DetailCalendarViewController | ||
} |
14 changes: 14 additions & 0 deletions
14
iOS-NOTTODO/iOS-NOTTODO/Coordinator/Factory/Protocol/MyPageFlowControllerFactory.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,14 @@ | ||
// | ||
// MyPageFlowControllerFactory.swift | ||
// iOS-NOTTODO | ||
// | ||
// Created by JEONGEUN KIM on 3/23/24. | ||
// | ||
|
||
import Foundation | ||
|
||
protocol MyPageFlowControllerFactory { | ||
func makeMyInfoViewController(coordinator: MypageCoordinator) -> MyInfoViewController | ||
func makeMyInfoAccountViewController(coordinator: MypageCoordinator) -> MyInfoAccountViewController | ||
func makeWithdrawViewController(coordinator: MypageCoordinator) -> NottodoModalViewController | ||
} |
12 changes: 12 additions & 0 deletions
12
iOS-NOTTODO/iOS-NOTTODO/Coordinator/Factory/Protocol/TabBarFlowControllerFactory.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,12 @@ | ||
// | ||
// TabBarFlowControllerFactory.swift | ||
// iOS-NOTTODO | ||
// | ||
// Created by JEONGEUN KIM on 3/23/24. | ||
// | ||
|
||
import UIKit | ||
|
||
protocol TabBarControllerFactory { | ||
func makeTabBarController(_ navigationController: UINavigationController) -> (UITabBarController, [UINavigationController]) | ||
} |
12 changes: 12 additions & 0 deletions
12
iOS-NOTTODO/iOS-NOTTODO/Coordinator/Factory/Protocol/UpdateFlowcontrollerFactory.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,12 @@ | ||
// | ||
// UpdateFlowcontrollerFactory.swift | ||
// iOS-NOTTODO | ||
// | ||
// Created by JEONGEUN KIM on 3/23/24. | ||
// | ||
|
||
import Foundation | ||
|
||
protocol UpdateFlowcontrollerFactory { | ||
func makeUpdateCheckViewController(coordinator: UpdateCoordinator) -> UpdateCheckViewController | ||
} |
24 changes: 24 additions & 0 deletions
24
iOS-NOTTODO/iOS-NOTTODO/Coordinator/Factory/TabBarViewControllerFactory.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,24 @@ | ||
// | ||
// TabBarViewControllerFactory.swift | ||
// iOS-NOTTODO | ||
// | ||
// Created by JEONGEUN KIM on 3/23/24. | ||
// | ||
|
||
import UIKit | ||
|
||
extension ViewControllerFactoryImpl { | ||
func makeTabBarController(_: UINavigationController) -> (UITabBarController, [UINavigationController]) { | ||
let tabBarController = TabBarController() | ||
let navigationControllers = tabBarController.setTabBarItems().map(makeNavigationController) | ||
|
||
return (tabBarController, navigationControllers) | ||
} | ||
|
||
func makeNavigationController(_ tabBarItem: UITabBarItem) -> UINavigationController { | ||
let navigationController = UINavigationController() | ||
navigationController.tabBarItem = tabBarItem | ||
navigationController.setNavigationBarHidden(true, animated: false) | ||
return navigationController | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
iOS-NOTTODO/iOS-NOTTODO/Coordinator/Factory/UpdateViewControllerFactory.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,15 @@ | ||
// | ||
// UpdateViewControllerFactory.swift | ||
// iOS-NOTTODO | ||
// | ||
// Created by JEONGEUN KIM on 3/23/24. | ||
// | ||
|
||
import Foundation | ||
|
||
extension ViewControllerFactoryImpl { | ||
func makeUpdateCheckViewController(coordinator: UpdateCoordinator) -> UpdateCheckViewController { | ||
let viewController = UpdateCheckViewController(coordinator: coordinator) | ||
return viewController | ||
} | ||
} |
Oops, something went wrong.