-
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.
Merge pull request #153 from boostcampwm-2022/develop
Develop
- Loading branch information
Showing
175 changed files
with
11,499 additions
and
143 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
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,21 @@ | ||
// | ||
// AppAppearance.swift | ||
// DailyQuest | ||
// | ||
// Created by jinwoong Kim on 2022/11/16. | ||
// | ||
|
||
import UIKit | ||
|
||
final class AppAppearance { | ||
static func setupAppearance() { | ||
UITabBar.appearance().backgroundColor = .white | ||
UITabBar.appearance().tintColor = .maxGreen | ||
|
||
UITableViewCell.appearance().selectionStyle = .none | ||
UITableView.appearance().separatorStyle = .none | ||
|
||
UISwitch.appearance().tintColor = .maxLightGrey | ||
UISwitch.appearance().onTintColor = .maxYellow | ||
} | ||
} |
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,75 @@ | ||
// | ||
// AppCoordinator.swift | ||
// DailyQuest | ||
// | ||
// Created by jinwoong Kim on 2022/11/16. | ||
// | ||
|
||
import UIKit | ||
|
||
final class AppCoordinator: NSObject, TabCoordinator, UITabBarControllerDelegate { | ||
weak var finishDelegate: CoordinatorFinishDelegate? | ||
var tabBarController: UITabBarController | ||
var childCoordinators: [Coordinator] = [] | ||
let appDIContainer: AppDIContainer | ||
|
||
init(tabBarController: UITabBarController, | ||
appDIContainer: AppDIContainer) { | ||
self.tabBarController = tabBarController | ||
self.appDIContainer = appDIContainer | ||
} | ||
|
||
func start() { | ||
let pages: [TabBarPage] = [.home, .browse, .settings] | ||
let controllers: [UINavigationController] = pages.map(getTabController(_:)) | ||
|
||
prepareTabBarController(withTabControllers: controllers) | ||
} | ||
|
||
private func prepareTabBarController(withTabControllers tabControllers: [UIViewController]) { | ||
tabBarController.delegate = self | ||
tabBarController.setViewControllers(tabControllers, animated: true) | ||
tabBarController.selectedIndex = TabBarPage.home.pageOrderNumber | ||
tabBarController.tabBar.isTranslucent = false | ||
|
||
} | ||
|
||
private func getTabController(_ page: TabBarPage) -> UINavigationController { | ||
let navController = UINavigationController() | ||
navController.setNavigationBarHidden(false, animated: false) | ||
|
||
navController.tabBarItem = UITabBarItem.init(title: page.pageTitleValue, | ||
image: page.pageIcon, | ||
tag: page.pageOrderNumber) | ||
|
||
switch page { | ||
case .home: | ||
let homeSceneDIContainer = appDIContainer.makeHomeSceneDIContainer() | ||
let homeCoordinator = homeSceneDIContainer.makeHomeCoordinator(navigationController: navController, | ||
homeSceneDIContainer: homeSceneDIContainer) | ||
homeCoordinator.start() | ||
childCoordinators.append(homeCoordinator) | ||
break | ||
case .browse: | ||
let browseSceneDIContainer = appDIContainer.makeBrowseSceneDIContainer() | ||
let browseCoordinator = browseSceneDIContainer.makeBrowseCoordinator(navigationController: navController, | ||
browseSceneDIContainer: browseSceneDIContainer) | ||
browseCoordinator.start() | ||
childCoordinators.append(browseCoordinator) | ||
case .settings: | ||
let settingsSceneDIContainer = appDIContainer.makeSettingsSceneDIContainer() | ||
let settingsCoordinator = settingsSceneDIContainer.makeSettingsCoordinator(navigationController: navController, | ||
settingsSceneDIContainer: settingsSceneDIContainer) | ||
settingsCoordinator.start() | ||
childCoordinators.append(settingsCoordinator) | ||
} | ||
|
||
return navController | ||
} | ||
} | ||
|
||
extension AppCoordinator: CoordinatorFinishDelegate { | ||
func coordinatorDidFinish(childCoordinator: Coordinator) { | ||
|
||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
DailyQuest/DailyQuest/Application/Container/Repository/RepositoryKey.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,29 @@ | ||
// | ||
// RepositoryKey.swift | ||
// DailyQuest | ||
// | ||
// Created by jinwoong Kim on 2022/12/12. | ||
// | ||
|
||
import Foundation | ||
import DailyContainer | ||
|
||
struct QuestRepositoryKey: InjectionKey { | ||
typealias Value = QuestsRepository | ||
} | ||
|
||
struct AuthRepositoryKey: InjectionKey { | ||
typealias Value = AuthRepository | ||
} | ||
|
||
struct BrowseRepositoryKey: InjectionKey { | ||
typealias Value = BrowseRepository | ||
} | ||
|
||
struct UserRepositoryKey: InjectionKey { | ||
typealias Value = UserRepository | ||
} | ||
|
||
struct ProtectedUserRepositoryKey: InjectionKey { | ||
typealias Value = ProtectedUserRepository | ||
} |
13 changes: 13 additions & 0 deletions
13
DailyQuest/DailyQuest/Application/Container/Service/ServiceKey.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 @@ | ||
// | ||
// ServiceKey.swift | ||
// DailyQuest | ||
// | ||
// Created by jinwoong Kim on 2022/12/12. | ||
// | ||
|
||
import Foundation | ||
import DailyContainer | ||
|
||
struct ServiceKey: InjectionKey { | ||
typealias Value = NetworkService | ||
} |
21 changes: 21 additions & 0 deletions
21
DailyQuest/DailyQuest/Application/Container/Storage/StroageKey.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,21 @@ | ||
// | ||
// StroageKey.swift | ||
// DailyQuest | ||
// | ||
// Created by jinwoong Kim on 2022/12/12. | ||
// | ||
|
||
import Foundation | ||
import DailyContainer | ||
|
||
struct QuestStorageKey: InjectionKey { | ||
typealias Value = QuestsStorage | ||
} | ||
|
||
struct BrowseQuestStorageKey: InjectionKey { | ||
typealias Value = BrowseQuestsStorage | ||
} | ||
|
||
struct UserInfoStorageKey: InjectionKey { | ||
typealias Value = UserInfoStorage | ||
} |
30 changes: 30 additions & 0 deletions
30
DailyQuest/DailyQuest/Application/Container/UseCase/UseCaseKey.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,30 @@ | ||
// | ||
// UseCaseKey.swift | ||
// DailyQuest | ||
// | ||
// Created by jinwoong Kim on 2022/12/12. | ||
// | ||
|
||
import Foundation | ||
import DailyContainer | ||
|
||
// MARK: - Home Scene | ||
struct QuestUseCaseKey: InjectionKey { | ||
typealias Value = QuestUseCase | ||
} | ||
|
||
struct EnrollUseCaseKey: InjectionKey { | ||
typealias Value = EnrollUseCase | ||
} | ||
|
||
struct UserUseCaseKey: InjectionKey { | ||
typealias Value = UserUseCase | ||
} | ||
|
||
struct CalendarUseCaseKey: InjectionKey { | ||
typealias Value = CalendarUseCase | ||
} | ||
|
||
// MARK: - Browse Scene | ||
|
||
// MARK: - Settings Scene |
94 changes: 94 additions & 0 deletions
94
DailyQuest/DailyQuest/Application/DIContainer/AppDIContainer.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,94 @@ | ||
// | ||
// AppDIContainer.swift | ||
// DailyQuest | ||
// | ||
// Created by jinwoong Kim on 2022/11/16. | ||
// | ||
|
||
import Foundation | ||
import DailyContainer | ||
|
||
final class AppDIContainer { | ||
|
||
init() { | ||
registerService() | ||
registerStorage() | ||
registerRepository() | ||
} | ||
|
||
func makeHomeSceneDIContainer() -> HomeSceneDIContainer { | ||
return HomeSceneDIContainer() | ||
} | ||
|
||
func makeBrowseSceneDIContainer() -> BrowseSceneDIContainer { | ||
return BrowseSceneDIContainer() | ||
} | ||
|
||
func makeSettingsSceneDIContainer() -> SettingsSceneDIContainer { | ||
return SettingsSceneDIContainer() | ||
} | ||
} | ||
|
||
private extension AppDIContainer { | ||
func registerService() { | ||
Container.shared.register { | ||
Module(ServiceKey.self) { FirebaseService.shared } | ||
} | ||
} | ||
|
||
func registerStorage() { | ||
Container.shared.register { | ||
Module(QuestStorageKey.self) { RealmQuestsStorage() } | ||
Module(BrowseQuestStorageKey.self) { RealmBrowseQuestsStorage() } | ||
Module(UserInfoStorageKey.self) { RealmUserInfoStorage() } | ||
} | ||
} | ||
|
||
func registerRepository() { | ||
Container.shared.register { | ||
Module(QuestRepositoryKey.self) { | ||
@Injected(QuestStorageKey.self) | ||
var questStorage: QuestsStorage | ||
return DefaultQuestsRepository(persistentStorage: questStorage) | ||
} | ||
|
||
Module(AuthRepositoryKey.self) { | ||
@Injected(QuestStorageKey.self) | ||
var questStorage: QuestsStorage | ||
|
||
@Injected(UserInfoStorageKey.self) | ||
var userInfoStorage: UserInfoStorage | ||
|
||
return DefaultAuthRepository(persistentQuestsStorage: questStorage, | ||
persistentUserStorage: userInfoStorage) | ||
} | ||
|
||
Module(BrowseRepositoryKey.self) { | ||
@Injected(BrowseQuestStorageKey.self) | ||
var browseQuestStroage: BrowseQuestsStorage | ||
|
||
@Injected(ServiceKey.self) | ||
var networkService: NetworkService | ||
|
||
return DefaultBrowseRepository(persistentStorage: browseQuestStroage, | ||
networkService: networkService) | ||
} | ||
|
||
/** | ||
Networ service instance needed. | ||
*/ | ||
Module(UserRepositoryKey.self) { | ||
@Injected(UserInfoStorageKey.self) | ||
var userInfoStorage: UserInfoStorage | ||
|
||
return DefaultUserRepository(persistentStorage: userInfoStorage) | ||
} | ||
|
||
/** | ||
Protected User Repository Injection | ||
goes here. | ||
*/ | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.