diff --git a/MLS/Data/Data/Network/DTO/CollectionDTO/CollectionListResponseDTO.swift b/MLS/Data/Data/Network/DTO/CollectionDTO/CollectionListResponseDTO.swift index 131b9b6c..24b01d40 100644 --- a/MLS/Data/Data/Network/DTO/CollectionDTO/CollectionListResponseDTO.swift +++ b/MLS/Data/Data/Network/DTO/CollectionDTO/CollectionListResponseDTO.swift @@ -6,7 +6,7 @@ public struct CollectionListResponseDTO: Decodable { public let createdAt: [Int] public let recentBookmarks: [BookmarkDTO] - public func toDomain() -> CollectionListResponse { - return CollectionListResponse(collectionId: collectionId, name: name, createdAt: createdAt, recentBookmarks: recentBookmarks.toDomain()) + public func toDomain() -> CollectionResponse { + return CollectionResponse(collectionId: collectionId, name: name, createdAt: createdAt, recentBookmarks: recentBookmarks.toDomain()) } } diff --git a/MLS/Data/Data/Network/Endpoints/CollectionEndPoint.swift b/MLS/Data/Data/Network/Endpoints/CollectionEndPoint.swift index b1bd304c..1f4e98c2 100644 --- a/MLS/Data/Data/Network/Endpoints/CollectionEndPoint.swift +++ b/MLS/Data/Data/Network/Endpoints/CollectionEndPoint.swift @@ -10,4 +10,12 @@ public enum CollectionEndPoint { public static func createCollectionList(body: Encodable) -> EndPoint { .init(baseURL: base, path: "/api/v1/collections", method: .POST, body: body) } + + public static func fetchCollection(id: Int) -> ResponsableEndPoint<[BookmarkDTO]> { + .init( + baseURL: base, + path: "/api/v1/collections/\(id)/bookmarks", + method: .GET + ) + } } diff --git a/MLS/Data/Data/Repository/CollectionAPIRepositoryImpl.swift b/MLS/Data/Data/Repository/CollectionAPIRepositoryImpl.swift index 7ba368e7..4332421c 100644 --- a/MLS/Data/Data/Repository/CollectionAPIRepositoryImpl.swift +++ b/MLS/Data/Data/Repository/CollectionAPIRepositoryImpl.swift @@ -13,17 +13,22 @@ public class CollectionAPIRepositoryImpl: CollectionAPIRepository { self.tokenInterceptor = tokenInterceptor } - public func fetchCollectionList() -> Observable<[CollectionListResponse]> { + public func fetchCollectionList() -> Observable<[CollectionResponse]> { let endPoint = CollectionEndPoint.fetchCollectionList() - return provider.requestData(endPoint: endPoint, interceptor: tokenInterceptor).map { - $0.map {$0.toDomain()} - } + return provider.requestData(endPoint: endPoint, interceptor: tokenInterceptor) + .map { $0.map { $0.toDomain() } + } } public func createCollectionList(name: String) -> Completable { let endPoint = CollectionEndPoint.createCollectionList(body: CreateCollectionRequestDTO(name: name)) return provider.requestData(endPoint: endPoint, interceptor: tokenInterceptor) + } + public func fetchCollectionUseCase(id: Int) -> Observable<[BookmarkResponse]> { + let endPoint = CollectionEndPoint.fetchCollection(id: id) + return provider.requestData(endPoint: endPoint, interceptor: tokenInterceptor) + .map { $0.toDomain() } } } @@ -31,5 +36,4 @@ private extension CollectionAPIRepositoryImpl { struct CreateCollectionRequestDTO: Encodable { let name: String } - } diff --git a/MLS/Domain/Domain/UseCaseImpl/Collection/FetchCollectionListUseCaseImpl.swift b/MLS/Domain/Domain/UseCaseImpl/Collection/FetchCollectionListUseCaseImpl.swift index 10d586c6..8e7793d1 100644 --- a/MLS/Domain/Domain/UseCaseImpl/Collection/FetchCollectionListUseCaseImpl.swift +++ b/MLS/Domain/Domain/UseCaseImpl/Collection/FetchCollectionListUseCaseImpl.swift @@ -9,7 +9,7 @@ public final class FetchCollectionListUseCaseImpl: FetchCollectionListUseCase { self.repository = repository } - public func execute() -> Observable<[CollectionListResponse]> { + public func execute() -> Observable<[CollectionResponse]> { return repository.fetchCollectionList() } } diff --git a/MLS/Domain/Domain/UseCaseImpl/Collection/FetchCollectionUseCaseImpl.swift b/MLS/Domain/Domain/UseCaseImpl/Collection/FetchCollectionUseCaseImpl.swift new file mode 100644 index 00000000..94067888 --- /dev/null +++ b/MLS/Domain/Domain/UseCaseImpl/Collection/FetchCollectionUseCaseImpl.swift @@ -0,0 +1,15 @@ +import DomainInterface + +import RxSwift + +public final class FetchCollectionUseCaseImpl: FetchCollectionUseCase { + private let repository: CollectionAPIRepository + + public init(repository: CollectionAPIRepository) { + self.repository = repository + } + + public func execute(id: Int) -> Observable<[BookmarkResponse]> { + return repository.fetchCollectionUseCase(id: id) + } +} diff --git a/MLS/Domain/DomainInterface/Entity/Collection/CollectionListResponse.swift b/MLS/Domain/DomainInterface/Entity/Collection/CollectionResponse.swift similarity index 72% rename from MLS/Domain/DomainInterface/Entity/Collection/CollectionListResponse.swift rename to MLS/Domain/DomainInterface/Entity/Collection/CollectionResponse.swift index f972b262..a69ddd5c 100644 --- a/MLS/Domain/DomainInterface/Entity/Collection/CollectionListResponse.swift +++ b/MLS/Domain/DomainInterface/Entity/Collection/CollectionResponse.swift @@ -1,8 +1,8 @@ -public struct CollectionListResponse { +public struct CollectionResponse: Equatable { public let collectionId: Int - public let name: String + public var name: String public let createdAt: [Int] - public let recentBookmarks: [BookmarkResponse] + public var recentBookmarks: [BookmarkResponse] public init(collectionId: Int, name: String, createdAt: [Int], recentBookmarks: [BookmarkResponse]) { self.collectionId = collectionId diff --git a/MLS/Domain/DomainInterface/Repository/CollectionAPIRepository.swift b/MLS/Domain/DomainInterface/Repository/CollectionAPIRepository.swift index b074294b..8c80c87c 100644 --- a/MLS/Domain/DomainInterface/Repository/CollectionAPIRepository.swift +++ b/MLS/Domain/DomainInterface/Repository/CollectionAPIRepository.swift @@ -4,7 +4,9 @@ import RxSwift public protocol CollectionAPIRepository { // 컬렉션 목록 조회 - func fetchCollectionList() -> Observable<[CollectionListResponse]> + func fetchCollectionList() -> Observable<[CollectionResponse]> // 컬렉션 목록 추가 func createCollectionList(name: String) -> Completable + // 컬렉션 상세 조회 + func fetchCollectionUseCase(id: Int) -> Observable<[BookmarkResponse]> } diff --git a/MLS/Domain/DomainInterface/UseCase/Collection/FetchCollectionListUseCase.swift b/MLS/Domain/DomainInterface/UseCase/Collection/FetchCollectionListUseCase.swift index 008f07d1..6b71f667 100644 --- a/MLS/Domain/DomainInterface/UseCase/Collection/FetchCollectionListUseCase.swift +++ b/MLS/Domain/DomainInterface/UseCase/Collection/FetchCollectionListUseCase.swift @@ -1,5 +1,5 @@ import RxSwift public protocol FetchCollectionListUseCase { - func execute() -> Observable<[CollectionListResponse]> + func execute() -> Observable<[CollectionResponse]> } diff --git a/MLS/Domain/DomainInterface/UseCase/Collection/FetchCollectionUseCase.swift b/MLS/Domain/DomainInterface/UseCase/Collection/FetchCollectionUseCase.swift new file mode 100644 index 00000000..29d8226d --- /dev/null +++ b/MLS/Domain/DomainInterface/UseCase/Collection/FetchCollectionUseCase.swift @@ -0,0 +1,5 @@ +import RxSwift + +public protocol FetchCollectionUseCase { + func execute(id: Int) -> Observable<[BookmarkResponse]> +} diff --git a/MLS/MLS.xcworkspace/xcshareddata/swiftpm/Package.resolved b/MLS/MLS.xcworkspace/xcshareddata/swiftpm/Package.resolved index e1857c8b..f4ae71b6 100644 --- a/MLS/MLS.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/MLS/MLS.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "fb6d3e788453c324ee469b761f38d588d165a7bd629581f71955713d53ad5f81", + "originHash" : "f7b0491e2198bb3edde5fd2999d888cbedc1acb8555c5e1c2b384a269b2fb29d", "pins" : [ { "identity" : "abseil-cpp-binary", diff --git a/MLS/MLS/Application/AppDelegate.swift b/MLS/MLS/Application/AppDelegate.swift index cd4b57ca..065d02a5 100644 --- a/MLS/MLS/Application/AppDelegate.swift +++ b/MLS/MLS/Application/AppDelegate.swift @@ -1,10 +1,6 @@ // swiftlint:disable function_body_length // swiftlint:disable line_length -import os -import UIKit -import UserNotifications - import AuthFeature import AuthFeatureInterface import BaseFeature @@ -18,44 +14,60 @@ import DictionaryFeature import DictionaryFeatureInterface import Domain import DomainInterface -import MyPageFeature -import MyPageFeatureInterface - import Firebase import KakaoSDKCommon +import MyPageFeature +import MyPageFeatureInterface +import UIKit +import UserNotifications +import os @main class AppDelegate: UIResponder, UIApplicationDelegate { - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication + .LaunchOptionsKey: Any]? + ) -> Bool { // MARK: - UserNotification Set - FirebaseApp.configure() // Firebase Set - Messaging.messaging().delegate = self // 파이어베이스 Meesaging 설정 + FirebaseApp.configure() // Firebase Set + Messaging.messaging().delegate = self // 파이어베이스 Meesaging 설정 - UNUserNotificationCenter.current().delegate = self // NotificationCenter Delegate - let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound] // 필요한 알림 권한을 설정 + UNUserNotificationCenter.current().delegate = self // NotificationCenter Delegate + let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound] // 필요한 알림 권한을 설정 UNUserNotificationCenter.current().requestAuthorization( options: authOptions, completionHandler: { _, _ in } ) - application.registerForRemoteNotifications() // UNUserNotificationCenterDelegate를 구현한 메서드를 실행시킴 + application.registerForRemoteNotifications() // UNUserNotificationCenterDelegate를 구현한 메서드를 실행시킴 // MARK: - Modules Set - ImageLoader.shared.configure.diskCacheCountLimit = 10 // ImageLoader - FontManager.registerFonts() // FontManager + ImageLoader.shared.configure.diskCacheCountLimit = 10 // ImageLoader + FontManager.registerFonts() // FontManager // MARK: - KakaoSDK Set - let kakaoNativeAppKey: String = Bundle.main.infoDictionary?["KAKAO_NATIVE_APP_KEY"] as? String ?? "" + let kakaoNativeAppKey: String = + Bundle.main.infoDictionary?["KAKAO_NATIVE_APP_KEY"] as? String ?? "" KakaoSDK.initSDK(appKey: kakaoNativeAppKey) registerDependencies() return true } - func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { - return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) + func application( + _ application: UIApplication, + configurationForConnecting connectingSceneSession: UISceneSession, + options: UIScene.ConnectionOptions + ) -> UISceneConfiguration { + return UISceneConfiguration( + name: "Default Configuration", + sessionRole: connectingSceneSession.role) } - func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) {} + func application( + _ application: UIApplication, + didDiscardSceneSessions sceneSessions: Set + ) {} } // MARK: - Notification Delegate, MessagingDelegate @@ -63,21 +75,27 @@ extension AppDelegate: UNUserNotificationCenterDelegate, MessagingDelegate { func userNotificationCenter( _ center: UNUserNotificationCenter, willPresent notification: UNNotification, - withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void + withCompletionHandler completionHandler: @escaping ( + UNNotificationPresentationOptions + ) -> Void ) { completionHandler([.list, .banner]) } // 파이어베이스 MessagingDelegate 설정 - func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) { + func messaging( + _ messaging: Messaging, didReceiveRegistrationToken fcmToken: String? + ) { let dataDict: [String: String] = ["token": fcmToken ?? ""] NotificationCenter.default.post( name: Notification.Name("FCMToken"), object: nil, userInfo: dataDict ) - let tokenUseCase = DIContainer.resolve(type: SaveTokenToLocalUseCase.self) - let result = tokenUseCase.execute(type: .fcmToken, value: fcmToken ?? "") + let tokenUseCase = DIContainer.resolve( + type: SaveTokenToLocalUseCase.self) + let result = tokenUseCase.execute( + type: .fcmToken, value: fcmToken ?? "") switch result { case .success: @@ -89,30 +107,36 @@ extension AppDelegate: UNUserNotificationCenterDelegate, MessagingDelegate { } // MARK: - registerDependencies -private extension AppDelegate { - func registerDependencies() { +extension AppDelegate { + fileprivate func registerDependencies() { registerProvider() registerRepository() registerUseCase() registerFactory() } - func registerProvider() { + fileprivate func registerProvider() { DIContainer.register(type: NetworkProvider.self) { NetworkProviderImpl() } - DIContainer.register(type: SocialAuthenticatableProvider.self, name: "kakao") { + DIContainer.register( + type: SocialAuthenticatableProvider.self, name: "kakao" + ) { KakaoLoginProviderImpl() } - DIContainer.register(type: SocialAuthenticatableProvider.self, name: "apple") { + DIContainer.register( + type: SocialAuthenticatableProvider.self, name: "apple" + ) { AppleLoginProviderImpl() } DIContainer.register(type: Interceptor.self) { - TokenInterceptor(fetchTokenUseCase: DIContainer.resolve(type: FetchTokenFromLocalUseCase.self)) + TokenInterceptor( + fetchTokenUseCase: DIContainer.resolve( + type: FetchTokenFromLocalUseCase.self)) } } - func registerRepository() { + fileprivate func registerRepository() { DIContainer.register(type: AuthAPIRepository.self) { AuthAPIRepositoryImpl( provider: DIContainer.resolve(type: NetworkProvider.self), @@ -123,33 +147,48 @@ private extension AppDelegate { KeyChainRepositoryImpl() } DIContainer.register(type: DictionaryDetailAPIRepository.self) { - DictionaryDetailAPIRepositoryImpl(provider: DIContainer.resolve(type: NetworkProvider.self), tokenInterceptor: DIContainer.resolve(type: Interceptor.self)) + DictionaryDetailAPIRepositoryImpl( + provider: DIContainer.resolve(type: NetworkProvider.self), + tokenInterceptor: DIContainer.resolve(type: Interceptor.self)) } DIContainer.register(type: DictionaryListAPIRepository.self) { - DictionaryListAPIRepositoryImpl(provider: DIContainer.resolve(type: NetworkProvider.self), tokenInterceptor: DIContainer.resolve(type: Interceptor.self)) + DictionaryListAPIRepositoryImpl( + provider: DIContainer.resolve(type: NetworkProvider.self), + tokenInterceptor: DIContainer.resolve(type: Interceptor.self)) } DIContainer.register(type: BookmarkRepository.self) { - BookmarkRepositoryImpl(provider: DIContainer.resolve(type: NetworkProvider.self), interceptor: DIContainer.resolve(type: Interceptor.self)) + BookmarkRepositoryImpl( + provider: DIContainer.resolve(type: NetworkProvider.self), + interceptor: DIContainer.resolve(type: Interceptor.self)) } DIContainer.register(type: UserDefaultsRepository.self) { UserDefaultsRepositoryImpl() } DIContainer.register(type: AlarmAPIRepository.self) { - AlarmAPIRepositoryImpl(provider: DIContainer.resolve(type: NetworkProvider.self), interceptor: DIContainer.resolve(type: Interceptor.self)) + AlarmAPIRepositoryImpl( + provider: DIContainer.resolve(type: NetworkProvider.self), + interceptor: DIContainer.resolve(type: Interceptor.self)) } DIContainer.register(type: CollectionAPIRepository.self) { - CollectionAPIRepositoryImpl(provider: DIContainer.resolve(type: NetworkProvider.self), - tokenInterceptor: DIContainer.resolve(type: Interceptor.self)) + CollectionAPIRepositoryImpl( + provider: DIContainer.resolve(type: NetworkProvider.self), + tokenInterceptor: DIContainer.resolve(type: Interceptor.self)) } } - func registerUseCase() { - DIContainer.register(type: FetchSocialCredentialUseCase.self, name: "kakao") { - let provider = DIContainer.resolve(type: SocialAuthenticatableProvider.self, name: "kakao") + fileprivate func registerUseCase() { + DIContainer.register( + type: FetchSocialCredentialUseCase.self, name: "kakao" + ) { + let provider = DIContainer.resolve( + type: SocialAuthenticatableProvider.self, name: "kakao") return SocialLoginUseCaseImpl(provider: provider) } - DIContainer.register(type: FetchSocialCredentialUseCase.self, name: "apple") { - let provider = DIContainer.resolve(type: SocialAuthenticatableProvider.self, name: "apple") + DIContainer.register( + type: FetchSocialCredentialUseCase.self, name: "apple" + ) { + let provider = DIContainer.resolve( + type: SocialAuthenticatableProvider.self, name: "apple") return SocialLoginUseCaseImpl(provider: provider) } DIContainer.register(type: CheckEmptyLevelAndRoleUseCase.self) { @@ -159,40 +198,65 @@ private extension AppDelegate { CheckValidLevelUseCaseImpl() } DIContainer.register(type: FetchJobListUseCase.self) { - FetchJobListUseCaseImpl(repository: DIContainer.resolve(type: AuthAPIRepository.self)) + FetchJobListUseCaseImpl( + repository: DIContainer.resolve(type: AuthAPIRepository.self)) } DIContainer.register(type: LoginWithAppleUseCase.self) { - LoginWithAppleUseCaseImpl(authRepository: DIContainer.resolve(type: AuthAPIRepository.self), tokenRepository: DIContainer.resolve(type: TokenRepository.self), userDefaultsRepository: DIContainer.resolve(type: UserDefaultsRepository.self)) + LoginWithAppleUseCaseImpl( + authRepository: DIContainer.resolve( + type: AuthAPIRepository.self), + tokenRepository: DIContainer.resolve( + type: TokenRepository.self), + userDefaultsRepository: DIContainer.resolve( + type: UserDefaultsRepository.self)) } DIContainer.register(type: LoginWithKakaoUseCase.self) { - LoginWithKakaoUseCaseImpl(authRepository: DIContainer.resolve(type: AuthAPIRepository.self), tokenRepository: DIContainer.resolve(type: TokenRepository.self), userDefaultsRepository: DIContainer.resolve(type: UserDefaultsRepository.self)) + LoginWithKakaoUseCaseImpl( + authRepository: DIContainer.resolve( + type: AuthAPIRepository.self), + tokenRepository: DIContainer.resolve( + type: TokenRepository.self), + userDefaultsRepository: DIContainer.resolve( + type: UserDefaultsRepository.self)) } DIContainer.register(type: SignUpWithAppleUseCase.self) { - SignUpWithAppleUseCaseImpl(repository: DIContainer.resolve(type: AuthAPIRepository.self)) + SignUpWithAppleUseCaseImpl( + repository: DIContainer.resolve(type: AuthAPIRepository.self)) } DIContainer.register(type: SignUpWithKakaoUseCase.self) { - SignUpWithKakaoUseCaseImpl(repository: DIContainer.resolve(type: AuthAPIRepository.self)) + SignUpWithKakaoUseCaseImpl( + repository: DIContainer.resolve(type: AuthAPIRepository.self)) } DIContainer.register(type: UpdateUserInfoUseCase.self) { - UpdateUserInfoUseCaseImpl(repository: DIContainer.resolve(type: AuthAPIRepository.self)) + UpdateUserInfoUseCaseImpl( + repository: DIContainer.resolve(type: AuthAPIRepository.self)) } DIContainer.register(type: ReissueUseCase.self) { - ReissueUseCaseImpl(repository: DIContainer.resolve(type: AuthAPIRepository.self)) + ReissueUseCaseImpl( + repository: DIContainer.resolve(type: AuthAPIRepository.self)) } DIContainer.register(type: PutFCMTokenUseCase.self) { - PutFCMTokenUseCaseImpl(repository: DIContainer.resolve(type: AuthAPIRepository.self)) + PutFCMTokenUseCaseImpl( + repository: DIContainer.resolve(type: AuthAPIRepository.self)) } DIContainer.register(type: FetchTokenFromLocalUseCase.self) { - FetchTokenFromLocalUseCaseImpl(repository: DIContainer.resolve(type: TokenRepository.self)) + FetchTokenFromLocalUseCaseImpl( + repository: DIContainer.resolve(type: TokenRepository.self)) } DIContainer.register(type: SaveTokenToLocalUseCase.self) { - SaveTokenToLocalUseCaseImpl(repository: DIContainer.resolve(type: TokenRepository.self)) + SaveTokenToLocalUseCaseImpl( + repository: DIContainer.resolve(type: TokenRepository.self)) } DIContainer.register(type: DeleteTokenFromLocalUseCase.self) { - DeleteTokenFromLocalUseCaseImpl(repository: DIContainer.resolve(type: TokenRepository.self)) + DeleteTokenFromLocalUseCaseImpl( + repository: DIContainer.resolve(type: TokenRepository.self)) } DIContainer.register(type: UpdateMarketingAgreementUseCase.self) { - UpdateMarketingAgreementUseCaseImpl(authRepository: DIContainer.resolve(type: AuthAPIRepository.self), tokenRepository: DIContainer.resolve(type: TokenRepository.self)) + UpdateMarketingAgreementUseCaseImpl( + authRepository: DIContainer.resolve( + type: AuthAPIRepository.self), + tokenRepository: DIContainer.resolve(type: TokenRepository.self) + ) } DIContainer.register(type: CheckNotificationPermissionUseCase.self) { CheckNotificationPermissionUseCaseImpl() @@ -201,158 +265,254 @@ private extension AppDelegate { OpenNotificationSettingUseCaseImpl() } DIContainer.register(type: UpdateNotificationAgreementUseCase.self) { - UpdateNotificationAgreementUseCaseImpl(authRepository: DIContainer.resolve(type: AuthAPIRepository.self)) + UpdateNotificationAgreementUseCaseImpl( + authRepository: DIContainer.resolve( + type: AuthAPIRepository.self)) } DIContainer.register(type: CheckLoginUseCase.self) { - CheckLoginUseCaseImpl(authRepository: DIContainer.resolve(type: AuthAPIRepository.self), tokenRepository: DIContainer.resolve(type: TokenRepository.self)) + CheckLoginUseCaseImpl( + authRepository: DIContainer.resolve( + type: AuthAPIRepository.self), + tokenRepository: DIContainer.resolve(type: TokenRepository.self) + ) } DIContainer.register(type: FetchDictionaryAllListUseCase.self) { - FetchDictionaryAllListUseCaseImpl(repository: DIContainer.resolve(type: DictionaryListAPIRepository.self)) + FetchDictionaryAllListUseCaseImpl( + repository: DIContainer.resolve( + type: DictionaryListAPIRepository.self)) } DIContainer.register(type: SetBookmarkUseCase.self) { - SetBookmarkUseCaseImpl(repository: DIContainer.resolve(type: BookmarkRepository.self)) + SetBookmarkUseCaseImpl( + repository: DIContainer.resolve(type: BookmarkRepository.self)) } DIContainer.register(type: FetchPlatformUseCase.self) { - FetchPlatformUseCaseImpl(repository: DIContainer.resolve(type: UserDefaultsRepository.self)) + FetchPlatformUseCaseImpl( + repository: DIContainer.resolve( + type: UserDefaultsRepository.self)) } DIContainer.register(type: FetchDictionaryMapListUseCase.self) { - FetchDictionaryMapListUseCaseImpl(repository: DIContainer.resolve(type: DictionaryListAPIRepository.self)) + FetchDictionaryMapListUseCaseImpl( + repository: DIContainer.resolve( + type: DictionaryListAPIRepository.self)) } DIContainer.register(type: FetchDictionaryItemListUseCase.self) { - FetchDictionaryItemListUseCaseImpl(repository: DIContainer.resolve(type: DictionaryListAPIRepository.self)) + FetchDictionaryItemListUseCaseImpl( + repository: DIContainer.resolve( + type: DictionaryListAPIRepository.self)) } DIContainer.register(type: FetchDictionaryQuestListUseCase.self) { - FetchDictionaryQuestListUseCaseImpl(repository: DIContainer.resolve(type: DictionaryListAPIRepository.self)) + FetchDictionaryQuestListUseCaseImpl( + repository: DIContainer.resolve( + type: DictionaryListAPIRepository.self)) } DIContainer.register(type: FetchDictionaryNpcListUseCase.self) { - FetchDictionaryNpcListUseCaseImpl(repository: DIContainer.resolve(type: DictionaryListAPIRepository.self)) + FetchDictionaryNpcListUseCaseImpl( + repository: DIContainer.resolve( + type: DictionaryListAPIRepository.self)) } DIContainer.register(type: FetchDictionaryMonsterListUseCase.self) { - FetchDictionaryMonsterListUseCaseImpl(repository: DIContainer.resolve(type: DictionaryListAPIRepository.self)) + FetchDictionaryMonsterListUseCaseImpl( + repository: DIContainer.resolve( + type: DictionaryListAPIRepository.self)) } DIContainer.register(type: FetchDictionaryDetailMonsterUseCase.self) { - FetchDictionaryDetailMonsterUseCaseImpl(repository: DIContainer.resolve(type: DictionaryDetailAPIRepository.self)) - } - DIContainer.register(type: FetchDictionaryDetailMonsterItemsUseCase.self) { - FetchDictionaryDetailMonsterDropItemUseCaseImpl(repository: DIContainer.resolve(type: DictionaryDetailAPIRepository.self)) - } - DIContainer.register(type: FetchDictionaryDetailMonsterMapUseCase.self) { - FetchDictionaryDetailMonsterMapUseCaseImpl(repository: DIContainer.resolve(type: DictionaryDetailAPIRepository.self)) + FetchDictionaryDetailMonsterUseCaseImpl( + repository: DIContainer.resolve( + type: DictionaryDetailAPIRepository.self)) + } + DIContainer.register( + type: FetchDictionaryDetailMonsterItemsUseCase.self + ) { + FetchDictionaryDetailMonsterDropItemUseCaseImpl( + repository: DIContainer.resolve( + type: DictionaryDetailAPIRepository.self)) + } + DIContainer.register(type: FetchDictionaryDetailMonsterMapUseCase.self) + { + FetchDictionaryDetailMonsterMapUseCaseImpl( + repository: DIContainer.resolve( + type: DictionaryDetailAPIRepository.self)) } DIContainer.register(type: FetchDictionaryDetailNpcUseCase.self) { - FetchDictionaryDetailNpcUseCaseImpl(repository: DIContainer.resolve(type: DictionaryDetailAPIRepository.self)) + FetchDictionaryDetailNpcUseCaseImpl( + repository: DIContainer.resolve( + type: DictionaryDetailAPIRepository.self)) } DIContainer.register(type: FetchDictionaryDetailNpcQuestUseCase.self) { - FetchDictionaryDetailNpcQuestUseCaseImpl(repository: DIContainer.resolve(type: DictionaryDetailAPIRepository.self)) + FetchDictionaryDetailNpcQuestUseCaseImpl( + repository: DIContainer.resolve( + type: DictionaryDetailAPIRepository.self)) } DIContainer.register(type: FetchDictionaryDetailNpcMapUseCase.self) { - FetchDictionaryDetailNpcMapUseCaseImpl(repository: DIContainer.resolve(type: DictionaryDetailAPIRepository.self)) + FetchDictionaryDetailNpcMapUseCaseImpl( + repository: DIContainer.resolve( + type: DictionaryDetailAPIRepository.self)) } DIContainer.register(type: FetchDictionaryDetailItemUseCase.self) { - FetchDictionaryDetailItemUseCaseImpl(repository: DIContainer.resolve(type: DictionaryDetailAPIRepository.self)) + FetchDictionaryDetailItemUseCaseImpl( + repository: DIContainer.resolve( + type: DictionaryDetailAPIRepository.self)) } - DIContainer.register(type: FetchDictionaryDetailItemDropMonsterUseCase.self) { - FetchDictionaryDetailItemDropMonsterUseCaseImpl(repository: DIContainer.resolve(type: DictionaryDetailAPIRepository.self)) + DIContainer.register( + type: FetchDictionaryDetailItemDropMonsterUseCase.self + ) { + FetchDictionaryDetailItemDropMonsterUseCaseImpl( + repository: DIContainer.resolve( + type: DictionaryDetailAPIRepository.self)) } DIContainer.register(type: FetchDictionaryDetailQuestUseCase.self) { - FetchDictionaryDetailQuestUseCaseImpl(repository: DIContainer.resolve(type: DictionaryDetailAPIRepository.self)) + FetchDictionaryDetailQuestUseCaseImpl( + repository: DIContainer.resolve( + type: DictionaryDetailAPIRepository.self)) } - DIContainer.register(type: FetchDictionaryDetailQuestLinkedQuestsUseCase.self) { - FetchDictionaryDetailQuestLinkedQuestsUseCaseImpl(repository: DIContainer.resolve(type: DictionaryDetailAPIRepository.self)) + DIContainer.register( + type: FetchDictionaryDetailQuestLinkedQuestsUseCase.self + ) { + FetchDictionaryDetailQuestLinkedQuestsUseCaseImpl( + repository: DIContainer.resolve( + type: DictionaryDetailAPIRepository.self)) } DIContainer.register(type: FetchDictionaryDetailMapUseCase.self) { - FetchDictionaryDetailMapUseCaseImpl(repository: DIContainer.resolve(type: DictionaryDetailAPIRepository.self)) + FetchDictionaryDetailMapUseCaseImpl( + repository: DIContainer.resolve( + type: DictionaryDetailAPIRepository.self)) } - DIContainer.register(type: FetchDictionaryDetailMapSpawnMonsterUseCase.self) { - FetchDictionaryDetailMapSpawnMonsterUseCaseImpl(repository: DIContainer.resolve(type: DictionaryDetailAPIRepository.self)) + DIContainer.register( + type: FetchDictionaryDetailMapSpawnMonsterUseCase.self + ) { + FetchDictionaryDetailMapSpawnMonsterUseCaseImpl( + repository: DIContainer.resolve( + type: DictionaryDetailAPIRepository.self)) } DIContainer.register(type: FetchDictionaryDetailMapNpcUseCase.self) { - FetchDictionaryDetailMapNpcUseCaseImpl(repository: DIContainer.resolve(type: DictionaryDetailAPIRepository.self)) + FetchDictionaryDetailMapNpcUseCaseImpl( + repository: DIContainer.resolve( + type: DictionaryDetailAPIRepository.self)) } DIContainer.register(type: RecentSearchRemoveUseCase.self) { - RecentSearchRemoveUseCaseImpl(repository: DIContainer.resolve(type: UserDefaultsRepository.self)) + RecentSearchRemoveUseCaseImpl( + repository: DIContainer.resolve( + type: UserDefaultsRepository.self)) } DIContainer.register(type: RecentSearchAddUseCase.self) { - RecentSearchAddUseCaseImpl(repository: DIContainer.resolve(type: UserDefaultsRepository.self)) + RecentSearchAddUseCaseImpl( + repository: DIContainer.resolve( + type: UserDefaultsRepository.self)) } DIContainer.register(type: FetchDictionaryListCountUseCase.self) { - FetchDictionaryListCountUseCaseImpl(repository: DIContainer.resolve(type: DictionaryListAPIRepository.self)) + FetchDictionaryListCountUseCaseImpl( + repository: DIContainer.resolve( + type: DictionaryListAPIRepository.self)) } DIContainer.register(type: FetchDictionarySearchListUseCase.self) { - FetchDictionarySearchListUseCaseImpl(repository: DIContainer.resolve(type: DictionaryListAPIRepository.self)) + FetchDictionarySearchListUseCaseImpl( + repository: DIContainer.resolve( + type: DictionaryListAPIRepository.self)) } DIContainer.register(type: RecentSearchFetchUseCase.self) { - RecentSearchFetchUseCaseImpl(repository: DIContainer.resolve(type: UserDefaultsRepository.self)) + RecentSearchFetchUseCaseImpl( + repository: DIContainer.resolve( + type: UserDefaultsRepository.self)) } DIContainer.register(type: FetchBookmarkUseCase.self) { - FetchBookmarkUseCaseImpl(repository: DIContainer.resolve(type: BookmarkRepository.self)) + FetchBookmarkUseCaseImpl( + repository: DIContainer.resolve(type: BookmarkRepository.self)) } DIContainer.register(type: FetchMonsterBookmarkUseCase.self) { - FetchMonsterBookmarkUseCaseImpl(repository: DIContainer.resolve(type: BookmarkRepository.self)) + FetchMonsterBookmarkUseCaseImpl( + repository: DIContainer.resolve(type: BookmarkRepository.self)) } DIContainer.register(type: FetchItemBookmarkUseCase.self) { - FetchItemBookmarkUseCaseImpl(repository: DIContainer.resolve(type: BookmarkRepository.self)) + FetchItemBookmarkUseCaseImpl( + repository: DIContainer.resolve(type: BookmarkRepository.self)) } DIContainer.register(type: FetchNPCBookmarkUseCase.self) { - FetchNPCBookmarkUseCaseImpl(repository: DIContainer.resolve(type: BookmarkRepository.self)) + FetchNPCBookmarkUseCaseImpl( + repository: DIContainer.resolve(type: BookmarkRepository.self)) } DIContainer.register(type: FetchQuestBookmarkUseCase.self) { - FetchQuestBookmarkUseCaseImpl(repository: DIContainer.resolve(type: BookmarkRepository.self)) + FetchQuestBookmarkUseCaseImpl( + repository: DIContainer.resolve(type: BookmarkRepository.self)) } DIContainer.register(type: FetchMapBookmarkUseCase.self) { - FetchMapBookmarkUseCaseImpl(repository: DIContainer.resolve(type: BookmarkRepository.self)) + FetchMapBookmarkUseCaseImpl( + repository: DIContainer.resolve(type: BookmarkRepository.self)) } DIContainer.register(type: UpdateProfileImageUseCase.self) { - UpdateProfileImageUseCaseImpl(repository: DIContainer.resolve(type: AuthAPIRepository.self)) + UpdateProfileImageUseCaseImpl( + repository: DIContainer.resolve(type: AuthAPIRepository.self)) } DIContainer.register(type: FetchJobUseCase.self) { - FetchJobUseCaseImpl(repository: DIContainer.resolve(type: AuthAPIRepository.self)) + FetchJobUseCaseImpl( + repository: DIContainer.resolve(type: AuthAPIRepository.self)) } DIContainer.register(type: FetchProfileUseCase.self) { - FetchProfileUseCaseImpl(repository: DIContainer.resolve(type: AuthAPIRepository.self), fetchJobUseCase: DIContainer.resolve(type: FetchJobUseCase.self)) + FetchProfileUseCaseImpl( + repository: DIContainer.resolve(type: AuthAPIRepository.self), + fetchJobUseCase: DIContainer.resolve(type: FetchJobUseCase.self) + ) } DIContainer.register(type: CheckNickNameUseCase.self) { CheckNickNameUseCaseImpl() } DIContainer.register(type: UpdateNickNameUseCase.self) { - UpdateNickNameUseCaseImpl(repository: DIContainer.resolve(type: AuthAPIRepository.self)) + UpdateNickNameUseCaseImpl( + repository: DIContainer.resolve(type: AuthAPIRepository.self)) } DIContainer.register(type: LogoutUseCase.self) { - LogoutUseCaseImpl(repository: DIContainer.resolve(type: TokenRepository.self)) + LogoutUseCaseImpl( + repository: DIContainer.resolve(type: TokenRepository.self)) } DIContainer.register(type: WithdrawUseCase.self) { - WithdrawUseCaseImpl(authRepository: DIContainer.resolve(type: AuthAPIRepository.self), tokenRepository: DIContainer.resolve(type: TokenRepository.self)) + WithdrawUseCaseImpl( + authRepository: DIContainer.resolve( + type: AuthAPIRepository.self), + tokenRepository: DIContainer.resolve(type: TokenRepository.self) + ) } DIContainer.register(type: FetchNoticesUseCase.self) { - FetchNoticesUseCaseImpl(repository: DIContainer.resolve(type: AlarmAPIRepository.self)) + FetchNoticesUseCaseImpl( + repository: DIContainer.resolve(type: AlarmAPIRepository.self)) } DIContainer.register(type: FetchOngoingEventsUseCase.self) { - FetchOngoingEventsUseCaseImpl(repository: DIContainer.resolve(type: AlarmAPIRepository.self)) + FetchOngoingEventsUseCaseImpl( + repository: DIContainer.resolve(type: AlarmAPIRepository.self)) } DIContainer.register(type: FetchOutdatedEventsUseCase.self) { - FetchOutdatedEventsUseCaseImpl(repository: DIContainer.resolve(type: AlarmAPIRepository.self)) + FetchOutdatedEventsUseCaseImpl( + repository: DIContainer.resolve(type: AlarmAPIRepository.self)) } DIContainer.register(type: FetchPatchNotesUseCase.self) { - FetchPatchNotesUseCaseImpl(repository: DIContainer.resolve(type: AlarmAPIRepository.self)) + FetchPatchNotesUseCaseImpl( + repository: DIContainer.resolve(type: AlarmAPIRepository.self)) } DIContainer.register(type: SetReadUseCase.self) { - SetReadUseCaseImpl(repository: DIContainer.resolve(type: AlarmAPIRepository.self)) + SetReadUseCaseImpl( + repository: DIContainer.resolve(type: AlarmAPIRepository.self)) } DIContainer.register(type: FetchAllAlarmUseCase.self) { - FetchAllAlarmUseCaseImpl(repository: DIContainer.resolve(type: AlarmAPIRepository.self)) + FetchAllAlarmUseCaseImpl( + repository: DIContainer.resolve(type: AlarmAPIRepository.self)) } DIContainer.register(type: ParseItemFilterResultUseCase.self) { ParseItemFilterResultUseCaseImpl() } DIContainer.register(type: FetchCollectionListUseCase.self) { - FetchCollectionListUseCaseImpl(repository: DIContainer.resolve(type: CollectionAPIRepository.self)) + FetchCollectionListUseCaseImpl( + repository: DIContainer.resolve( + type: CollectionAPIRepository.self)) } DIContainer.register(type: CreateCollectionListUseCase.self) { - CreateCollectionListUseCaseImpl(repository: DIContainer.resolve(type: CollectionAPIRepository.self)) + CreateCollectionListUseCaseImpl( + repository: DIContainer.resolve( + type: CollectionAPIRepository.self)) + } + DIContainer.register(type: FetchCollectionUseCase.self) { + FetchCollectionUseCaseImpl(repository: DIContainer.resolve(type: CollectionAPIRepository.self)) } } - func registerFactory() { + fileprivate func registerFactory() { DIContainer.register(type: ItemFilterBottomSheetFactory.self) { ItemFilterBottomSheetFactoryImpl() } @@ -366,115 +526,227 @@ private extension AppDelegate { AddCollectionFactoryImpl() } DIContainer.register(type: BookmarkModalFactory.self) { - BookmarkModalFactoryImpl(addCollectionFactory: DIContainer.resolve(type: AddCollectionFactory.self)) + BookmarkModalFactoryImpl( + addCollectionFactory: DIContainer.resolve( + type: AddCollectionFactory.self)) } DIContainer.register(type: LoginFactory.self) { LoginFactoryImpl( - termsAgreementsFactory: DIContainer.resolve(type: TermsAgreementFactory.self), - appleLoginUseCase: DIContainer.resolve(type: FetchSocialCredentialUseCase.self, name: "apple"), - kakaoLoginUseCase: DIContainer.resolve(type: FetchSocialCredentialUseCase.self, name: "kakao"), - loginWithAppleUseCase: DIContainer.resolve(type: LoginWithAppleUseCase.self), - loginWithKakaoUseCase: DIContainer.resolve(type: LoginWithKakaoUseCase.self), - fetchTokenUseCase: DIContainer.resolve(type: FetchTokenFromLocalUseCase.self), - putFCMTokenUseCase: DIContainer.resolve(type: PutFCMTokenUseCase.self), fetchPlatformUseCase: DIContainer.resolve(type: FetchPlatformUseCase.self) + termsAgreementsFactory: DIContainer.resolve( + type: TermsAgreementFactory.self), + appleLoginUseCase: DIContainer.resolve( + type: FetchSocialCredentialUseCase.self, name: "apple"), + kakaoLoginUseCase: DIContainer.resolve( + type: FetchSocialCredentialUseCase.self, name: "kakao"), + loginWithAppleUseCase: DIContainer.resolve( + type: LoginWithAppleUseCase.self), + loginWithKakaoUseCase: DIContainer.resolve( + type: LoginWithKakaoUseCase.self), + fetchTokenUseCase: DIContainer.resolve( + type: FetchTokenFromLocalUseCase.self), + putFCMTokenUseCase: DIContainer.resolve( + type: PutFCMTokenUseCase.self), + fetchPlatformUseCase: DIContainer.resolve( + type: FetchPlatformUseCase.self) ) } DIContainer.register(type: DictionaryDetailFactory.self) { - DictionaryDetailFactoryImpl(loginFactory: { DIContainer.resolve(type: LoginFactory.self) }, bookmarkModalFactory: DIContainer.resolve(type: BookmarkModalFactory.self), dictionaryDetailMapUseCase: DIContainer.resolve(type: FetchDictionaryDetailMapUseCase.self), dictionaryDetailMapSpawnMonsterUseCase: DIContainer.resolve(type: FetchDictionaryDetailMapSpawnMonsterUseCase.self), dictionaryDetailMapNpcUseCase: DIContainer.resolve(type: FetchDictionaryDetailMapNpcUseCase.self), dictionaryDetailQuestLinkedQuestsUseCase: DIContainer.resolve(type: FetchDictionaryDetailQuestLinkedQuestsUseCase.self), dictionaryDetailQuestUseCase: DIContainer.resolve(type: FetchDictionaryDetailQuestUseCase.self), dictionaryDetailItemDropMonsterUseCase: DIContainer.resolve(type: FetchDictionaryDetailItemDropMonsterUseCase.self), dictionaryDetailItemUseCase: DIContainer.resolve(type: FetchDictionaryDetailItemUseCase.self), dictionaryDetailNpcUseCase: DIContainer.resolve(type: FetchDictionaryDetailNpcUseCase.self), dictionaryDetailNpcQuestUseCase: DIContainer.resolve(type: FetchDictionaryDetailNpcQuestUseCase.self), dictionaryDetailNpcMapUseCase: DIContainer.resolve(type: FetchDictionaryDetailNpcMapUseCase.self), dictionaryDetailMonsterUseCase: DIContainer.resolve(type: FetchDictionaryDetailMonsterUseCase.self), dictionaryDetailMonsterDropItemUseCase: DIContainer.resolve(type: FetchDictionaryDetailMonsterItemsUseCase.self), dictionaryDetailMonsterMapUseCase: DIContainer.resolve(type: FetchDictionaryDetailMonsterMapUseCase.self), checkLoginUseCase: DIContainer.resolve(type: CheckLoginUseCase.self), setBookmarkUseCase: DIContainer.resolve(type: SetBookmarkUseCase.self)) + DictionaryDetailFactoryImpl( + loginFactory: { DIContainer.resolve(type: LoginFactory.self) }, + bookmarkModalFactory: DIContainer.resolve( + type: BookmarkModalFactory.self), + dictionaryDetailMapUseCase: DIContainer.resolve( + type: FetchDictionaryDetailMapUseCase.self), + dictionaryDetailMapSpawnMonsterUseCase: DIContainer.resolve( + type: FetchDictionaryDetailMapSpawnMonsterUseCase.self), + dictionaryDetailMapNpcUseCase: DIContainer.resolve( + type: FetchDictionaryDetailMapNpcUseCase.self), + dictionaryDetailQuestLinkedQuestsUseCase: DIContainer.resolve( + type: FetchDictionaryDetailQuestLinkedQuestsUseCase.self), + dictionaryDetailQuestUseCase: DIContainer.resolve( + type: FetchDictionaryDetailQuestUseCase.self), + dictionaryDetailItemDropMonsterUseCase: DIContainer.resolve( + type: FetchDictionaryDetailItemDropMonsterUseCase.self), + dictionaryDetailItemUseCase: DIContainer.resolve( + type: FetchDictionaryDetailItemUseCase.self), + dictionaryDetailNpcUseCase: DIContainer.resolve( + type: FetchDictionaryDetailNpcUseCase.self), + dictionaryDetailNpcQuestUseCase: DIContainer.resolve( + type: FetchDictionaryDetailNpcQuestUseCase.self), + dictionaryDetailNpcMapUseCase: DIContainer.resolve( + type: FetchDictionaryDetailNpcMapUseCase.self), + dictionaryDetailMonsterUseCase: DIContainer.resolve( + type: FetchDictionaryDetailMonsterUseCase.self), + dictionaryDetailMonsterDropItemUseCase: DIContainer.resolve( + type: FetchDictionaryDetailMonsterItemsUseCase.self), + dictionaryDetailMonsterMapUseCase: DIContainer.resolve( + type: FetchDictionaryDetailMonsterMapUseCase.self), + checkLoginUseCase: DIContainer.resolve( + type: CheckLoginUseCase.self), + setBookmarkUseCase: DIContainer.resolve( + type: SetBookmarkUseCase.self)) } DIContainer.register(type: DictionaryMainListFactory.self) { DictionaryListFactoryImpl( - checkLoginUseCase: DIContainer.resolve(type: CheckLoginUseCase.self), - dictionaryAllListItemUseCase: DIContainer.resolve(type: FetchDictionaryAllListUseCase.self), - dictionaryMapListItemUseCase: DIContainer.resolve(type: FetchDictionaryMapListUseCase.self), - dictionaryItemListItemUseCase: DIContainer.resolve(type: FetchDictionaryItemListUseCase.self), - dictionaryQuestListItemUseCase: DIContainer.resolve(type: FetchDictionaryQuestListUseCase.self), - dictionaryNpcListItemUseCase: DIContainer + checkLoginUseCase: DIContainer.resolve( + type: CheckLoginUseCase.self), + dictionaryAllListItemUseCase: DIContainer.resolve( + type: FetchDictionaryAllListUseCase.self), + dictionaryMapListItemUseCase: DIContainer.resolve( + type: FetchDictionaryMapListUseCase.self), + dictionaryItemListItemUseCase: DIContainer.resolve( + type: FetchDictionaryItemListUseCase.self), + dictionaryQuestListItemUseCase: DIContainer.resolve( + type: FetchDictionaryQuestListUseCase.self), + dictionaryNpcListItemUseCase: + DIContainer .resolve(type: FetchDictionaryNpcListUseCase.self), - dictionaryListItemUseCase: DIContainer.resolve(type: FetchDictionaryMonsterListUseCase.self), - setBookmarkUseCase: DIContainer.resolve(type: SetBookmarkUseCase.self), parseItemFilterResultUseCase: DIContainer.resolve(type: ParseItemFilterResultUseCase.self), - itemFilterFactory: DIContainer.resolve(type: ItemFilterBottomSheetFactory.self), - monsterFilterFactory: DIContainer.resolve(type: MonsterFilterBottomSheetFactory.self), - sortedFactory: DIContainer.resolve(type: SortedBottomSheetFactory.self), - bookmarkModalFactory: DIContainer.resolve(type: BookmarkModalFactory.self), - detailFactory: DIContainer.resolve(type: DictionaryDetailFactory.self), loginFactory: { DIContainer.resolve(type: LoginFactory.self) } + dictionaryListItemUseCase: DIContainer.resolve( + type: FetchDictionaryMonsterListUseCase.self), + setBookmarkUseCase: DIContainer.resolve( + type: SetBookmarkUseCase.self), + parseItemFilterResultUseCase: DIContainer.resolve( + type: ParseItemFilterResultUseCase.self), + itemFilterFactory: DIContainer.resolve( + type: ItemFilterBottomSheetFactory.self), + monsterFilterFactory: DIContainer.resolve( + type: MonsterFilterBottomSheetFactory.self), + sortedFactory: DIContainer.resolve( + type: SortedBottomSheetFactory.self), + bookmarkModalFactory: DIContainer.resolve( + type: BookmarkModalFactory.self), + detailFactory: DIContainer.resolve( + type: DictionaryDetailFactory.self), + loginFactory: { DIContainer.resolve(type: LoginFactory.self) } ) } DIContainer.register(type: DictionarySearchResultFactory.self) { DictionarySearchResultFactoryImpl( - dictionaryListCountUseCase: DIContainer.resolve(type: FetchDictionaryListCountUseCase.self), - dictionaryMainListFactory: DIContainer + dictionaryListCountUseCase: DIContainer.resolve( + type: FetchDictionaryListCountUseCase.self), + dictionaryMainListFactory: + DIContainer .resolve(type: DictionaryMainListFactory.self), - dictionarySearchListUseCase: DIContainer.resolve(type: FetchDictionarySearchListUseCase.self) + dictionarySearchListUseCase: DIContainer.resolve( + type: FetchDictionarySearchListUseCase.self) ) } DIContainer.register(type: DictionarySearchFactory.self) { - DictionarySearchFactoryImpl(recentSearchRemoveUseCase: DIContainer.resolve(type: RecentSearchRemoveUseCase.self), - recentSearchAddUseCase: DIContainer.resolve(type: RecentSearchAddUseCase.self), - searchResultFactory: DIContainer - .resolve(type: DictionarySearchResultFactory.self), recentSearchFetchUseCase: DIContainer.resolve(type: RecentSearchFetchUseCase.self)) + DictionarySearchFactoryImpl( + recentSearchRemoveUseCase: DIContainer.resolve( + type: RecentSearchRemoveUseCase.self), + recentSearchAddUseCase: DIContainer.resolve( + type: RecentSearchAddUseCase.self), + searchResultFactory: + DIContainer + .resolve(type: DictionarySearchResultFactory.self), + recentSearchFetchUseCase: DIContainer.resolve( + type: RecentSearchFetchUseCase.self)) } DIContainer.register(type: NotificationSettingFactory.self) { - NotificationSettingFactoryImpl(checkNotificationPermissionUseCase: DIContainer.resolve(type: CheckNotificationPermissionUseCase.self), updateNotificationAgreementUseCase: DIContainer.resolve(type: UpdateNotificationAgreementUseCase.self)) + NotificationSettingFactoryImpl( + checkNotificationPermissionUseCase: DIContainer.resolve( + type: CheckNotificationPermissionUseCase.self), + updateNotificationAgreementUseCase: DIContainer.resolve( + type: UpdateNotificationAgreementUseCase.self)) } DIContainer.register(type: DictionaryNotificationFactory.self) { - DictionaryNotificationFactoryImpl(notificationSettingFactory: DIContainer.resolve(type: NotificationSettingFactory.self), fetchAllAlarmUseCase: DIContainer.resolve(type: FetchAllAlarmUseCase.self), fetchProfileUseCase: DIContainer.resolve(type: FetchProfileUseCase.self)) + DictionaryNotificationFactoryImpl( + notificationSettingFactory: DIContainer.resolve( + type: NotificationSettingFactory.self), + fetchAllAlarmUseCase: DIContainer.resolve( + type: FetchAllAlarmUseCase.self), + fetchProfileUseCase: DIContainer.resolve( + type: FetchProfileUseCase.self)) } DIContainer.register(type: DictionaryMainViewFactory.self) { DictionaryMainViewFactoryImpl( - dictionaryMainListFactory: DIContainer + dictionaryMainListFactory: + DIContainer .resolve(type: DictionaryMainListFactory.self), - searchFactory: DIContainer.resolve(type: DictionarySearchFactory.self), - notificationFactory: DIContainer - .resolve(type: DictionaryNotificationFactory.self), checkLoginUseCase: DIContainer.resolve(type: CheckLoginUseCase.self) + searchFactory: DIContainer.resolve( + type: DictionarySearchFactory.self), + notificationFactory: + DIContainer + .resolve(type: DictionaryNotificationFactory.self), + checkLoginUseCase: DIContainer.resolve( + type: CheckLoginUseCase.self) ) } DIContainer.register(type: OnBoardingNotificationSheetFactory.self) { OnBoardingNotificationSheetFactoryImpl( - checkNotificationPermissionUseCase: DIContainer + checkNotificationPermissionUseCase: + DIContainer .resolve(type: CheckNotificationPermissionUseCase.self), - openNotificationSettingUseCase: DIContainer + openNotificationSettingUseCase: + DIContainer .resolve(type: OpenNotificationSettingUseCase.self), - updateNotificationAgreementUseCase: DIContainer - .resolve(type: UpdateNotificationAgreementUseCase.self), updateUserInfoUseCase: DIContainer.resolve(type: UpdateUserInfoUseCase.self), dictionaryMainViewFactory: DIContainer.resolve(type: DictionaryMainViewFactory.self) + updateNotificationAgreementUseCase: + DIContainer + .resolve(type: UpdateNotificationAgreementUseCase.self), + updateUserInfoUseCase: DIContainer.resolve( + type: UpdateUserInfoUseCase.self), + dictionaryMainViewFactory: DIContainer.resolve( + type: DictionaryMainViewFactory.self) ) } DIContainer.register(type: OnBoardingInputFactory.self) { OnBoardingInputFactoryImpl( - checkEmptyUseCase: DIContainer.resolve(type: CheckEmptyLevelAndRoleUseCase.self), - checkValidLevelUseCase: DIContainer.resolve(type: CheckValidLevelUseCase.self), - fetchJobListUseCase: DIContainer.resolve(type: FetchJobListUseCase.self), - updateUserInfoUseCase: DIContainer.resolve(type: UpdateUserInfoUseCase.self), onBoardingNotificationFactory: DIContainer.resolve(type: OnBoardingNotificationFactory.self) + checkEmptyUseCase: DIContainer.resolve( + type: CheckEmptyLevelAndRoleUseCase.self), + checkValidLevelUseCase: DIContainer.resolve( + type: CheckValidLevelUseCase.self), + fetchJobListUseCase: DIContainer.resolve( + type: FetchJobListUseCase.self), + updateUserInfoUseCase: DIContainer.resolve( + type: UpdateUserInfoUseCase.self), + onBoardingNotificationFactory: DIContainer.resolve( + type: OnBoardingNotificationFactory.self) ) } DIContainer.register(type: OnBoardingQuestionFactory.self) { OnBoardingQuestionFactoryImpl( - onBoardingInputFactory: DIContainer.resolve(type: OnBoardingInputFactory.self) + onBoardingInputFactory: DIContainer.resolve( + type: OnBoardingInputFactory.self) ) } DIContainer.register(type: TermsAgreementFactory.self) { TermsAgreementFactoryImpl( - onBoardingQuestionFactory: DIContainer.resolve(type: OnBoardingQuestionFactory.self), - signUpWithKakaoUseCase: DIContainer.resolve(type: SignUpWithKakaoUseCase.self), - signUpWithAppleUseCase: DIContainer.resolve(type: SignUpWithAppleUseCase.self), - saveTokenUseCase: DIContainer.resolve(type: SaveTokenToLocalUseCase.self), - fetchTokenUseCase: DIContainer.resolve(type: FetchTokenFromLocalUseCase.self), updateMarketingAgreementUseCase: DIContainer.resolve(type: UpdateMarketingAgreementUseCase.self) + onBoardingQuestionFactory: DIContainer.resolve( + type: OnBoardingQuestionFactory.self), + signUpWithKakaoUseCase: DIContainer.resolve( + type: SignUpWithKakaoUseCase.self), + signUpWithAppleUseCase: DIContainer.resolve( + type: SignUpWithAppleUseCase.self), + saveTokenUseCase: DIContainer.resolve( + type: SaveTokenToLocalUseCase.self), + fetchTokenUseCase: DIContainer.resolve( + type: FetchTokenFromLocalUseCase.self), + updateMarketingAgreementUseCase: DIContainer.resolve( + type: UpdateMarketingAgreementUseCase.self) ) } DIContainer.register(type: OnBoardingNotificationFactory.self) { - OnBoardingNotificationFactoryImpl(onBoardingNotificationSheetFactory: DIContainer.resolve(type: OnBoardingNotificationSheetFactory.self)) + OnBoardingNotificationFactoryImpl( + onBoardingNotificationSheetFactory: DIContainer.resolve( + type: OnBoardingNotificationSheetFactory.self)) } DIContainer.register(type: BookmarkMainFactory.self) { BookmarkMainFactoryImpl( - setBookmarkUseCase: DIContainer + setBookmarkUseCase: + DIContainer .resolve(type: SetBookmarkUseCase.self), - onBoardingFactory: DIContainer + onBoardingFactory: + DIContainer .resolve(type: BookmarkOnBoardingFactory.self), - bookmarkListFactory: DIContainer + bookmarkListFactory: + DIContainer .resolve(type: BookmarkListFactory.self), - collectionListFactory: DIContainer + collectionListFactory: + DIContainer .resolve(type: CollectionListFactory.self), - searchFactory: DIContainer + searchFactory: + DIContainer .resolve(type: DictionarySearchFactory.self), notificationFactory: DIContainer.resolve( type: DictionaryNotificationFactory.self @@ -485,65 +757,147 @@ private extension AppDelegate { BookmarkOnBoardingFactoryImpl() } DIContainer.register(type: BookmarkListFactory.self) { - BookmarkListFactoryImpl(itemFilterFactory: DIContainer.resolve(type: ItemFilterBottomSheetFactory.self), monsterFilterFactory: DIContainer.resolve(type: MonsterFilterBottomSheetFactory.self), sortedFactory: DIContainer.resolve(type: SortedBottomSheetFactory.self), bookmarkModalFactory: DIContainer.resolve(type: BookmarkModalFactory.self), loginFactory: DIContainer.resolve(type: LoginFactory.self), dictionaryDetailFactory: DIContainer.resolve(type: DictionaryDetailFactory.self), setBookmarkUseCase: DIContainer.resolve(type: SetBookmarkUseCase.self), checkLoginUseCase: DIContainer.resolve(type: CheckLoginUseCase.self), fetchBookmarkUseCase: DIContainer.resolve(type: FetchBookmarkUseCase.self), fetchMonsterBookmarkUseCase: DIContainer.resolve(type: FetchMonsterBookmarkUseCase.self), fetchItemBookmarkUseCase: DIContainer.resolve(type: FetchItemBookmarkUseCase.self), fetchNPCBookmarkUseCase: DIContainer.resolve(type: FetchNPCBookmarkUseCase.self), fetchQuestBookmarkUseCase: DIContainer.resolve(type: FetchQuestBookmarkUseCase.self), fetchMapBookmarkUseCase: DIContainer.resolve(type: FetchMapBookmarkUseCase.self), collectionEditFactory: DIContainer.resolve(type: CollectionEditFactory.self)) + BookmarkListFactoryImpl( + itemFilterFactory: DIContainer.resolve( + type: ItemFilterBottomSheetFactory.self), + monsterFilterFactory: DIContainer.resolve( + type: MonsterFilterBottomSheetFactory.self), + sortedFactory: DIContainer.resolve( + type: SortedBottomSheetFactory.self), + bookmarkModalFactory: DIContainer.resolve( + type: BookmarkModalFactory.self), + loginFactory: DIContainer.resolve(type: LoginFactory.self), + dictionaryDetailFactory: DIContainer.resolve( + type: DictionaryDetailFactory.self), + setBookmarkUseCase: DIContainer.resolve( + type: SetBookmarkUseCase.self), + checkLoginUseCase: DIContainer.resolve( + type: CheckLoginUseCase.self), + fetchBookmarkUseCase: DIContainer.resolve( + type: FetchBookmarkUseCase.self), + fetchMonsterBookmarkUseCase: DIContainer.resolve( + type: FetchMonsterBookmarkUseCase.self), + fetchItemBookmarkUseCase: DIContainer.resolve( + type: FetchItemBookmarkUseCase.self), + fetchNPCBookmarkUseCase: DIContainer.resolve( + type: FetchNPCBookmarkUseCase.self), + fetchQuestBookmarkUseCase: DIContainer.resolve( + type: FetchQuestBookmarkUseCase.self), + fetchMapBookmarkUseCase: DIContainer.resolve( + type: FetchMapBookmarkUseCase.self), + collectionEditFactory: DIContainer.resolve( + type: CollectionEditFactory.self)) } DIContainer.register(type: CollectionListFactory.self) { - CollectionListFactoryImpl(collectionListUseCase: DIContainer.resolve(type: FetchCollectionListUseCase.self), createCollectionListUseCase: DIContainer.resolve(type: CreateCollectionListUseCase.self), addCollectionFactory: DIContainer.resolve(type: AddCollectionFactory.self), bookmarkDetailFactory: DIContainer.resolve(type: CollectionDetailFactory.self)) + CollectionListFactoryImpl( + collectionListUseCase: DIContainer.resolve( + type: FetchCollectionListUseCase.self), + createCollectionListUseCase: DIContainer.resolve( + type: CreateCollectionListUseCase.self), + addCollectionFactory: DIContainer.resolve( + type: AddCollectionFactory.self), + bookmarkDetailFactory: DIContainer.resolve( + type: CollectionDetailFactory.self)) } DIContainer.register(type: CollectionDetailFactory.self) { CollectionDetailFactoryImpl( - setBookmarkUseCase: DIContainer - .resolve(type: SetBookmarkUseCase.self), - bookmarkModalFactory: DIContainer + bookmarkModalFactory: + DIContainer .resolve(type: BookmarkModalFactory.self), - collectionSettingFactory: DIContainer + collectionSettingFactory: + DIContainer .resolve(type: CollectionSettingFactory.self), - addCollectionFactory: DIContainer + addCollectionFactory: + DIContainer .resolve(type: AddCollectionFactory.self), - collectionEditFactory: DIContainer + collectionEditFactory: + DIContainer .resolve(type: CollectionEditFactory.self), - dictionaryDetailFactory: DIContainer - .resolve(type: DictionaryDetailFactory.self) + dictionaryDetailFactory: + DIContainer + .resolve(type: DictionaryDetailFactory.self), + setBookmarkUseCase: + DIContainer + .resolve(type: SetBookmarkUseCase.self), + fetchCollectionUseCase: DIContainer.resolve( + type: FetchCollectionUseCase.self) ) } DIContainer.register(type: CollectionSettingFactory.self) { CollectionSettingFactoryImpl() } DIContainer.register(type: CollectionEditFactory.self) { - CollectionEditFactoryImpl(setBookmarkUseCase: DIContainer.resolve(type: SetBookmarkUseCase.self), bookmarkModalFactory: DIContainer.resolve(type: BookmarkModalFactory.self)) + CollectionEditFactoryImpl( + setBookmarkUseCase: DIContainer.resolve( + type: SetBookmarkUseCase.self), + bookmarkModalFactory: DIContainer.resolve( + type: BookmarkModalFactory.self)) } DIContainer.register(type: MyPageMainFactory.self) { MyPageMainFactoryImpl( - loginFactory: DIContainer.resolve(type: LoginFactory.self), setProfileFactory: DIContainer + loginFactory: DIContainer.resolve(type: LoginFactory.self), + setProfileFactory: + DIContainer .resolve(type: SetProfileFactory.self), - customerSupportFactory: DIContainer + customerSupportFactory: + DIContainer .resolve(type: CustomerSupportFactory.self), - notificationSettingFactory: DIContainer + notificationSettingFactory: + DIContainer .resolve(type: NotificationSettingFactory.self), - setCharacterFactory: DIContainer - .resolve(type: SetCharacterFactory.self), fetchProfileUseCase: DIContainer.resolve(type: FetchProfileUseCase.self) + setCharacterFactory: + DIContainer + .resolve(type: SetCharacterFactory.self), + fetchProfileUseCase: DIContainer.resolve( + type: FetchProfileUseCase.self) ) } DIContainer.register(type: CustomerSupportFactory.self) { - CustomerSupportBaseViewFactoryImpl(fetchNoticesUseCase: DIContainer.resolve(type: FetchNoticesUseCase.self), fetchOngoingEventsUseCase: DIContainer.resolve(type: FetchOngoingEventsUseCase.self), fetchOutdatedEventsUseCase: DIContainer.resolve(type: FetchOutdatedEventsUseCase.self), fetchPatchNotesUseCase: DIContainer.resolve(type: FetchPatchNotesUseCase.self), setReadUseCase: DIContainer.resolve(type: SetReadUseCase.self)) + CustomerSupportBaseViewFactoryImpl( + fetchNoticesUseCase: DIContainer.resolve( + type: FetchNoticesUseCase.self), + fetchOngoingEventsUseCase: DIContainer.resolve( + type: FetchOngoingEventsUseCase.self), + fetchOutdatedEventsUseCase: DIContainer.resolve( + type: FetchOutdatedEventsUseCase.self), + fetchPatchNotesUseCase: DIContainer.resolve( + type: FetchPatchNotesUseCase.self), + setReadUseCase: DIContainer.resolve(type: SetReadUseCase.self)) } DIContainer.register(type: SetProfileFactory.self) { - SetProfileFactoryImpl(selectImageFactory: DIContainer.resolve(type: SelectImageFactory.self), checkNickNameUseCase: DIContainer.resolve(type: CheckNickNameUseCase.self), updateNickNameUseCase: DIContainer.resolve(type: UpdateNickNameUseCase.self), logoutUseCase: DIContainer.resolve(type: LogoutUseCase.self), withdrawUseCase: DIContainer.resolve(type: WithdrawUseCase.self), fetchProfileUseCase: DIContainer.resolve(type: FetchProfileUseCase.self)) + SetProfileFactoryImpl( + selectImageFactory: DIContainer.resolve( + type: SelectImageFactory.self), + checkNickNameUseCase: DIContainer.resolve( + type: CheckNickNameUseCase.self), + updateNickNameUseCase: DIContainer.resolve( + type: UpdateNickNameUseCase.self), + logoutUseCase: DIContainer.resolve(type: LogoutUseCase.self), + withdrawUseCase: DIContainer.resolve( + type: WithdrawUseCase.self), + fetchProfileUseCase: DIContainer.resolve( + type: FetchProfileUseCase.self)) } DIContainer.register(type: SetCharacterFactory.self) { SetCharacterFactoryImpl( - checkEmptyUseCase: DIContainer + checkEmptyUseCase: + DIContainer .resolve(type: CheckEmptyLevelAndRoleUseCase.self), - checkValidLevelUseCase: DIContainer + checkValidLevelUseCase: + DIContainer .resolve(type: CheckValidLevelUseCase.self), - fetchJobListUseCase: DIContainer + fetchJobListUseCase: + DIContainer .resolve(type: FetchJobListUseCase.self), - updateUserInfoUseCase: DIContainer + updateUserInfoUseCase: + DIContainer .resolve(type: UpdateUserInfoUseCase.self) ) } DIContainer.register(type: SelectImageFactory.self) { - SelectImageFactoryImpl(updateProfileImageUseCase: DIContainer.resolve(type: UpdateProfileImageUseCase.self)) + SelectImageFactoryImpl( + updateProfileImageUseCase: DIContainer.resolve( + type: UpdateProfileImageUseCase.self)) } } } diff --git a/MLS/Presentation/BookmarkFeature/BookmarkFeature.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/MLS/Presentation/BookmarkFeature/BookmarkFeature.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..94b2795e --- /dev/null +++ b/MLS/Presentation/BookmarkFeature/BookmarkFeature.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,4 @@ + + + diff --git a/MLS/Presentation/BookmarkFeature/BookmarkFeature/AddCollection/AddCollectionFactoryImpl.swift b/MLS/Presentation/BookmarkFeature/BookmarkFeature/AddCollection/AddCollectionFactoryImpl.swift index 56a4f906..1480acd1 100644 --- a/MLS/Presentation/BookmarkFeature/BookmarkFeature/AddCollection/AddCollectionFactoryImpl.swift +++ b/MLS/Presentation/BookmarkFeature/BookmarkFeature/AddCollection/AddCollectionFactoryImpl.swift @@ -1,13 +1,14 @@ import BaseFeature import BookmarkFeatureInterface +import DomainInterface public final class AddCollectionFactoryImpl: AddCollectionFactory { public init() {} - public func make(collection: BookmarkCollection?, onDismissWithMessage: @escaping (BookmarkCollection?) -> Void) -> BaseViewController { + public func make(collection: CollectionResponse?, onDismissWithMessage: @escaping (CollectionResponse?) -> Void) -> BaseViewController { let viewController = AddCollectionViewController() viewController.reactor = AddCollectionModalReactor(collection: collection) - viewController.onDismissWithMessage = onDismissWithMessage +// viewController.onDismissWithMessage = onDismissWithMessage return viewController } } diff --git a/MLS/Presentation/BookmarkFeature/BookmarkFeature/AddCollection/AddCollectionReactor.swift b/MLS/Presentation/BookmarkFeature/BookmarkFeature/AddCollection/AddCollectionReactor.swift index a21feece..d4c74a4e 100644 --- a/MLS/Presentation/BookmarkFeature/BookmarkFeature/AddCollection/AddCollectionReactor.swift +++ b/MLS/Presentation/BookmarkFeature/BookmarkFeature/AddCollection/AddCollectionReactor.swift @@ -1,4 +1,5 @@ import BookmarkFeatureInterface +import DomainInterface import ReactorKit @@ -6,7 +7,7 @@ public final class AddCollectionModalReactor: Reactor { // MARK: - Route public enum Route { case dismiss - case dismissWithSuccess(BookmarkCollection?) + case dismissWithSuccess(CollectionResponse?) } // MARK: - Action @@ -28,7 +29,7 @@ public final class AddCollectionModalReactor: Reactor { // MARK: - State public struct State { @Pulse var route: Route? - var collection: BookmarkCollection? + var collection: CollectionResponse? var inputText: String? var isError: Bool = false var isButtonEnabled: Bool = false @@ -38,9 +39,9 @@ public final class AddCollectionModalReactor: Reactor { public var initialState = State(collection: nil) // MARK: - Init - public init(collection: BookmarkCollection?) { + public init(collection: CollectionResponse?) { self.initialState.collection = collection - self.initialState.inputText = collection?.title + self.initialState.inputText = collection?.name } // MARK: - Mutate @@ -80,13 +81,13 @@ public final class AddCollectionModalReactor: Reactor { newState.isButtonEnabled = isEnabled case .toNavigate(let route): newState.route = route - case .addCollection(let title): + case .addCollection(let name): var collection = newState.collection // 기존 collection이 없으면 새로 생성 if collection == nil { - collection = BookmarkCollection(id: -1, title: title, items: []) + collection = CollectionResponse(collectionId: -1, name: "", createdAt: [], recentBookmarks: []) } else { - collection?.title = title + collection?.name = name } newState.route = .dismissWithSuccess(collection) } diff --git a/MLS/Presentation/BookmarkFeature/BookmarkFeature/AddCollection/AddCollectionView.swift b/MLS/Presentation/BookmarkFeature/BookmarkFeature/AddCollection/AddCollectionView.swift index fae0539c..385f3acc 100644 --- a/MLS/Presentation/BookmarkFeature/BookmarkFeature/AddCollection/AddCollectionView.swift +++ b/MLS/Presentation/BookmarkFeature/BookmarkFeature/AddCollection/AddCollectionView.swift @@ -2,6 +2,7 @@ import UIKit import BookmarkFeatureInterface import DesignSystem +import DomainInterface import SnapKit @@ -167,7 +168,7 @@ extension AddCollectionView { completeButton.isEnabled = isEnabled } - func checkIsEmptyCollection(collection: BookmarkCollection?) { + func checkIsEmptyCollection(collection: CollectionResponse?) { if collection != nil { nameLabel.attributedText = .makeStyledString(font: .sub_m_sb, text: "컬렉션 이름 수정", alignment: .left) } diff --git a/MLS/Presentation/BookmarkFeature/BookmarkFeature/AddCollection/AddCollectionViewController.swift b/MLS/Presentation/BookmarkFeature/BookmarkFeature/AddCollection/AddCollectionViewController.swift index 72aff19c..14ae3f7e 100644 --- a/MLS/Presentation/BookmarkFeature/BookmarkFeature/AddCollection/AddCollectionViewController.swift +++ b/MLS/Presentation/BookmarkFeature/BookmarkFeature/AddCollection/AddCollectionViewController.swift @@ -15,7 +15,7 @@ public final class AddCollectionViewController: BaseViewController, View { // MARK: - Properties public var disposeBag = DisposeBag() - public var onDismissWithMessage: ((BookmarkCollection?) -> Void)? +// public var onDismissWithMessage: ((BookmarkCollection?) -> Void)? // MARK: - Components private let mainView = AddCollectionView() @@ -65,8 +65,8 @@ private extension AddCollectionViewController { view.addSubview(addCollectionContainer) addCollectionContainer.addSubview(mainView) - addCollectionContainer.clipsToBounds = true addCollectionContainer.layer.cornerRadius = 16 + addCollectionContainer.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner] addCollectionContainer.backgroundColor = .whiteMLS addCollectionContainer.isHidden = true @@ -173,7 +173,7 @@ extension AddCollectionViewController { case .dismissWithSuccess(let collectionName): owner.dismissWithAnimation { owner.dismiss(animated: false) { - owner.onDismissWithMessage?(collectionName) +// owner.onDismissWithMessage?(collectionName) } } default: diff --git a/MLS/Presentation/BookmarkFeature/BookmarkFeature/BookmarkModal/BookmarkModalFactoryImpl.swift b/MLS/Presentation/BookmarkFeature/BookmarkFeature/BookmarkModal/BookmarkModalFactoryImpl.swift index 22c3358b..c03c2981 100644 --- a/MLS/Presentation/BookmarkFeature/BookmarkFeature/BookmarkModal/BookmarkModalFactoryImpl.swift +++ b/MLS/Presentation/BookmarkFeature/BookmarkFeature/BookmarkModal/BookmarkModalFactoryImpl.swift @@ -1,5 +1,6 @@ import BaseFeature import BookmarkFeatureInterface +import DomainInterface public final class BookmarkModalFactoryImpl: BookmarkModalFactory { private let addCollectionFactory: AddCollectionFactory @@ -8,7 +9,7 @@ public final class BookmarkModalFactoryImpl: BookmarkModalFactory { self.addCollectionFactory = addCollectionFactory } - public func make(onDismissWithColletions: (([BookmarkCollection?]) -> Void)?, onDismissWithMessage: ((BookmarkCollection?) -> Void)?) -> BaseViewController { + public func make(onDismissWithColletions: (([CollectionResponse?]) -> Void)?, onDismissWithMessage: ((CollectionResponse?) -> Void)?) -> BaseViewController { let reactor = BookmarkModalReactor() let viewController = BookmarkModalViewController(addCollectionFactory: addCollectionFactory) viewController.reactor = reactor diff --git a/MLS/Presentation/BookmarkFeature/BookmarkFeature/BookmarkModal/BookmarkModalReactor.swift b/MLS/Presentation/BookmarkFeature/BookmarkFeature/BookmarkModal/BookmarkModalReactor.swift index d0537fc1..9a39d87c 100644 --- a/MLS/Presentation/BookmarkFeature/BookmarkFeature/BookmarkModal/BookmarkModalReactor.swift +++ b/MLS/Presentation/BookmarkFeature/BookmarkFeature/BookmarkModal/BookmarkModalReactor.swift @@ -18,22 +18,13 @@ public final class BookmarkModalReactor: Reactor { public enum Mutation { case toNavigate(Route) - case checkCollection([BookmarkCollection]) + case checkCollection([CollectionResponse]) } public struct State { @Pulse var route: Route - var collections = [ - BookmarkCollection(id: 1, title: "1번", items: [ - DictionaryItem(id: 1, type: .item, mainText: "메인", subText: "서브", image: .checkmark, isBookmarked: true), - DictionaryItem(id: 2, type: .monster, mainText: "메인", subText: "서브", image: .checkmark, isBookmarked: false) - ]), - BookmarkCollection(id: 2, title: "3번", items: [ - DictionaryItem(id: 3, type: .item, mainText: "메인", subText: "서브", image: .checkmark, isBookmarked: true), - DictionaryItem(id: 4, type: .monster, mainText: "메인", subText: "서브", image: .checkmark, isBookmarked: false) - ]) - ] - var selectedItems = [BookmarkCollection]() + var collections = [CollectionResponse]() + var selectedItems = [CollectionResponse]() } public var initialState: State @@ -52,9 +43,9 @@ public final class BookmarkModalReactor: Reactor { return .just(.toNavigate(.addCollection)) case .selectItem(let id): var newItems = currentState.selectedItems - if let index = newItems.firstIndex(where: { $0.id == id }) { + if let index = newItems.firstIndex(where: { $0.collectionId == id }) { newItems.remove(at: index) - } else if let collection = currentState.collections.first(where: { $0.id == id }) { + } else if let collection = currentState.collections.first(where: { $0.collectionId == id }) { newItems.append(collection) } return .just(.checkCollection(newItems)) diff --git a/MLS/Presentation/BookmarkFeature/BookmarkFeature/BookmarkModal/BookmarkModalViewController.swift b/MLS/Presentation/BookmarkFeature/BookmarkFeature/BookmarkModal/BookmarkModalViewController.swift index 1faa22d3..8f13e823 100644 --- a/MLS/Presentation/BookmarkFeature/BookmarkFeature/BookmarkModal/BookmarkModalViewController.swift +++ b/MLS/Presentation/BookmarkFeature/BookmarkFeature/BookmarkModal/BookmarkModalViewController.swift @@ -2,6 +2,7 @@ import UIKit import BaseFeature import BookmarkFeatureInterface +import DomainInterface import ReactorKit import RxCocoa @@ -14,8 +15,8 @@ public final class BookmarkModalViewController: BaseViewController, View { // MARK: - Properties public var disposeBag = DisposeBag() - public var onDismissWithMessage: ((BookmarkCollection?) -> Void)? - public var onDismissWithCollections: (([BookmarkCollection?]) -> Void)? + public var onDismissWithMessage: ((CollectionResponse?) -> Void)? + public var onDismissWithCollections: (([CollectionResponse?]) -> Void)? private let addCollectionFactory: AddCollectionFactory @@ -132,9 +133,9 @@ extension BookmarkModalViewController: UICollectionViewDelegate, UICollectionVie return UICollectionViewCell() } let collection = reactor.currentState.collections[indexPath.row - 1] - let isSelected = reactor.currentState.selectedItems.contains(where: { $0.id == collection.id }) + let isSelected = reactor.currentState.selectedItems.contains(where: { $0.collectionId == collection.collectionId }) cell.isChecked = isSelected - cell.inject(title: collection.title) + cell.inject(title: collection.name) return cell } } @@ -144,7 +145,7 @@ extension BookmarkModalViewController: UICollectionViewDelegate, UICollectionVie reactor?.action.onNext(.addCollectionTapped) } else { guard let collection = reactor?.currentState.collections[indexPath.row - 1] else { return } - reactor?.action.onNext(.selectItem(collection.id)) + reactor?.action.onNext(.selectItem(collection.collectionId)) } } } diff --git a/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionDetail/CollectionDetailFactoryImpl.swift b/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionDetail/CollectionDetailFactoryImpl.swift index efe6dce9..4d9c1ef2 100644 --- a/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionDetail/CollectionDetailFactoryImpl.swift +++ b/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionDetail/CollectionDetailFactoryImpl.swift @@ -4,32 +4,37 @@ import DictionaryFeatureInterface import DomainInterface public final class CollectionDetailFactoryImpl: CollectionDetailFactory { - private let setBookmarkUseCase: SetBookmarkUseCase private let bookmarkModalFactory: BookmarkModalFactory private let collectionSettingFactory: CollectionSettingFactory private let addCollectionFactory: AddCollectionFactory private let collectionEditFactory: CollectionEditFactory private let dictionaryDetailFactory: DictionaryDetailFactory + + private let setBookmarkUseCase: SetBookmarkUseCase + private let fetchCollectionUseCase: FetchCollectionUseCase public init( - setBookmarkUseCase: SetBookmarkUseCase, bookmarkModalFactory: BookmarkModalFactory, collectionSettingFactory: CollectionSettingFactory, addCollectionFactory: AddCollectionFactory, collectionEditFactory: CollectionEditFactory, - dictionaryDetailFactory: DictionaryDetailFactory + dictionaryDetailFactory: DictionaryDetailFactory, + setBookmarkUseCase: SetBookmarkUseCase, + fetchCollectionUseCase: FetchCollectionUseCase ) { - self.setBookmarkUseCase = setBookmarkUseCase self.bookmarkModalFactory = bookmarkModalFactory self.collectionSettingFactory = collectionSettingFactory self.addCollectionFactory = addCollectionFactory self.collectionEditFactory = collectionEditFactory self.dictionaryDetailFactory = dictionaryDetailFactory + self.setBookmarkUseCase = setBookmarkUseCase + self.fetchCollectionUseCase = fetchCollectionUseCase } - public func make(collection: BookmarkCollection) -> BaseViewController { + public func make(collection: CollectionResponse) -> BaseViewController { let reactor = CollectionDetailReactor( setBookmarkUseCase: setBookmarkUseCase, + fetchCollectionUseCase: fetchCollectionUseCase, collection: collection ) let viewController = CollectionDetailViewController( diff --git a/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionDetail/CollectionDetailReactor.swift b/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionDetail/CollectionDetailReactor.swift index c848a242..01c15359 100644 --- a/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionDetail/CollectionDetailReactor.swift +++ b/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionDetail/CollectionDetailReactor.swift @@ -27,7 +27,7 @@ public final class CollectionDetailReactor: Reactor { public enum Mutation { case navigateTo(Route) - case setItems([DictionaryItem]) + case setItems([BookmarkResponse]) case setMenu(CollectionSettingMenu) case setName(String) case setLastDeletedBookmark(BookmarkResponse?) @@ -40,34 +40,49 @@ public final class CollectionDetailReactor: Reactor { return type.pageTabList.map { $0.title } } let type = DictionaryMainViewType.bookmark - var collection: BookmarkCollection + var collection: CollectionResponse + var bookmarks = [BookmarkResponse]() var lastDeletedBookmark: BookmarkResponse? } // MARK: - Properties private let setBookmarkUseCase: SetBookmarkUseCase + private let fetchCollectionUseCase: FetchCollectionUseCase public var initialState: State private let disposeBag = DisposeBag() - public init(setBookmarkUseCase: SetBookmarkUseCase, collection: BookmarkCollection) { + public init(setBookmarkUseCase: SetBookmarkUseCase, fetchCollectionUseCase: FetchCollectionUseCase, collection: CollectionResponse) { self.initialState = State(route: .none, collection: collection) self.setBookmarkUseCase = setBookmarkUseCase + self.fetchCollectionUseCase = fetchCollectionUseCase } public func mutate(action: Action) -> Observable { switch action { case .toggleBookmark(let id, let isSelected): - // 북마크 설정 및 마지막 삭제 데이터 저장 후 컬렉션 데이터 가져오는 동작 필요 - return .empty() + guard let bookmarkItem = currentState.bookmarks.first(where: { $0.originalId == id }) else { return .empty() } + + let saveDeletedMutation: Observable = + isSelected ? .just(.setLastDeletedBookmark(bookmarkItem)) + : .just(.setLastDeletedBookmark(nil)) + + return saveDeletedMutation + .concat( + setBookmarkUseCase.execute( + bookmarkId: isSelected ? bookmarkItem.bookmarkId : id, + isBookmark: isSelected ? .delete : .set(bookmarkItem.type) + ) + .andThen(fetchCollectionUseCase.execute(id: currentState.collection.collectionId).map { .setItems($0) }) + ) case .backButtonTapped: return .just(.navigateTo(.dismiss)) case .editButtonTapped: return .just(.navigateTo(.edit)) case .viewWillAppear: - // 데이터 불러오기? - return .empty() + return fetchCollectionUseCase.execute(id: currentState.collection.collectionId) + .map { .setItems($0) } case .addButtonTapped: // 컬렉션 추가 return .empty() @@ -90,9 +105,9 @@ public final class CollectionDetailReactor: Reactor { ]) ) case .dataTapped(let index): - let item = currentState.collection.items[index] + let item = currentState.bookmarks[index] guard let type = item.type.toDictionaryType else { return .empty() } - return .just(.navigateTo(.detail(type, item.id))) + return .just(.navigateTo(.detail(type, item.originalId))) } } @@ -100,13 +115,13 @@ public final class CollectionDetailReactor: Reactor { var newState = state switch mutation { case .setItems(let items): - newState.collection.items = items + newState.bookmarks = items case .navigateTo(let route): newState.route = route case .setMenu(let menu): newState.collectionMenu = menu case .setName(let name): - newState.collection.title = name + newState.collection.name = name case .setLastDeletedBookmark(let bookmark): newState.lastDeletedBookmark = bookmark } diff --git a/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionDetail/CollectionDetailViewController.swift b/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionDetail/CollectionDetailViewController.swift index dfbcae9a..1b740217 100644 --- a/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionDetail/CollectionDetailViewController.swift +++ b/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionDetail/CollectionDetailViewController.swift @@ -28,7 +28,7 @@ public final class CollectionDetailViewController: BaseViewController, View { private var mainView: CollectionDetailView public init(reactor: CollectionDetailReactor, bookmarkModalFactory: BookmarkModalFactory, collectionSettingFactory: CollectionSettingFactory, addCollectionFactory: AddCollectionFactory, collectionEditFactory: CollectionEditFactory, dictionaryDetailFactory: DictionaryDetailFactory) { - self.mainView = CollectionDetailView(navTitle: reactor.currentState.collection.title) + self.mainView = CollectionDetailView(navTitle: reactor.currentState.collection.name) self.bookmarkModalFactory = bookmarkModalFactory self.collectionSettingFactory = collectionSettingFactory self.addCollectionFactory = addCollectionFactory @@ -119,7 +119,7 @@ extension CollectionDetailViewController { func bindViewState(reactor: Reactor) { reactor.state - .map(\.collection.items) + .map(\.collection.recentBookmarks) .distinctUntilChanged() .observe(on: MainScheduler.instance) .bind(onNext: { [weak self] items in @@ -139,7 +139,7 @@ extension CollectionDetailViewController { case .editName: let viewController = owner.addCollectionFactory.make(collection: reactor.currentState.collection, onDismissWithMessage: { collection in guard let collection = collection else { return } - reactor.action.onNext(.changeName(collection.title)) + reactor.action.onNext(.changeName(collection.name)) }) owner.present(viewController, animated: true) case .delete: @@ -187,7 +187,7 @@ extension CollectionDetailViewController { // MARK: - Delegate extension CollectionDetailViewController: UICollectionViewDelegate, UICollectionViewDataSource { public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - reactor?.currentState.collection.items.count ?? 0 + reactor?.currentState.collection.recentBookmarks.count ?? 0 } public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { @@ -196,7 +196,7 @@ extension CollectionDetailViewController: UICollectionViewDelegate, UICollection withReuseIdentifier: DictionaryListCell.identifier, for: indexPath ) as? DictionaryListCell, - let item = reactor?.currentState.collection.items[indexPath.row] + let item = reactor?.currentState.collection.recentBookmarks[indexPath.row] else { return UICollectionViewCell() } diff --git a/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionEdit/CollectionEditReactor.swift b/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionEdit/CollectionEditReactor.swift index 28747a63..383850ca 100644 --- a/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionEdit/CollectionEditReactor.swift +++ b/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionEdit/CollectionEditReactor.swift @@ -16,21 +16,21 @@ public final class CollectionEditReactor: Reactor { case backButtonTapped case addCollectionButtonTapped case completeButtonTapped - case dismissAddCollection([BookmarkCollection]) + case dismissAddCollection([CollectionResponse]) case itemTapped(Int) } public enum Mutation { case navigateTo(Route) - case checkBookMarks([DictionaryItem]) - case checkCollections([BookmarkCollection]) + case checkBookMarks([BookmarkResponse]) + case checkCollections([CollectionResponse]) } public struct State { @Pulse var route: Route - var collection: BookmarkCollection - var selectedItems = [DictionaryItem]() - var selectedCollections = [BookmarkCollection]() + var collection: CollectionResponse + var selectedItems = [BookmarkResponse]() + var selectedCollections = [CollectionResponse]() } // MARK: - Properties @@ -39,11 +39,7 @@ public final class CollectionEditReactor: Reactor { private let disposeBag = DisposeBag() public init() { - self.initialState = State(route: .none, collection: - BookmarkCollection(id: 3, title: "2번", items: [ - DictionaryItem(id: 3, type: .item, mainText: "3번 아이템", subText: "3번 설명", image: .add, isBookmarked: false), - DictionaryItem(id: 4, type: .item, mainText: "4번 아이템", subText: "4번 설명", image: .add, isBookmarked: false) - ])) + self.initialState = State(route: .none, collection: CollectionResponse(collectionId: -1, name: "", createdAt: [], recentBookmarks: [])) } public func mutate(action: Action) -> Observable { @@ -60,9 +56,9 @@ public final class CollectionEditReactor: Reactor { // addCollection에서 선택된 컬렉션 목록 저장 return .empty() case .itemTapped(let index): - let item = currentState.collection.items[index] + let item = currentState.collection.recentBookmarks[index] var newItems = currentState.selectedItems - if let index = newItems.firstIndex(where: { $0.id == item.id }) { + if let index = newItems.firstIndex(where: { $0.originalId == item.originalId }) { newItems.remove(at: index) } else { newItems.append(item) diff --git a/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionEdit/CollectionEditViewController.swift b/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionEdit/CollectionEditViewController.swift index c97eee38..f11a1710 100644 --- a/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionEdit/CollectionEditViewController.swift +++ b/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionEdit/CollectionEditViewController.swift @@ -98,7 +98,7 @@ extension CollectionEditViewController { .disposed(by: disposeBag) reactor.state - .map(\.collection.items) + .map(\.collection.recentBookmarks) .distinctUntilChanged() .withUnretained(self) .subscribe { owner, _ in @@ -141,7 +141,7 @@ extension CollectionEditViewController { // MARK: - Delegate extension CollectionEditViewController: UICollectionViewDelegate, UICollectionViewDataSource { public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - reactor?.currentState.collection.items.count ?? 0 + reactor?.currentState.collection.recentBookmarks.count ?? 0 } public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { @@ -150,11 +150,11 @@ extension CollectionEditViewController: UICollectionViewDelegate, UICollectionVi withReuseIdentifier: DictionaryListCell.identifier, for: indexPath ) as? DictionaryListCell, - let item = reactor?.currentState.collection.items[indexPath.row] + let item = reactor?.currentState.collection.recentBookmarks[indexPath.row] else { return UICollectionViewCell() } - let isSelected = reactor?.currentState.selectedItems.contains(where: { $0.id == item.id }) ?? false + let isSelected = reactor?.currentState.selectedItems.contains(where: { $0.originalId == item.originalId }) ?? false // cell.inject( // type: .checkbox, diff --git a/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionList/CollectionListReactor.swift b/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionList/CollectionListReactor.swift index 0970ed54..f0443c02 100644 --- a/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionList/CollectionListReactor.swift +++ b/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionList/CollectionListReactor.swift @@ -8,7 +8,7 @@ import ReactorKit public final class CollectionListReactor: Reactor { public enum Route { case none - case detail(BookmarkCollection) + case detail(CollectionResponse) } public enum Action { @@ -19,13 +19,12 @@ public final class CollectionListReactor: Reactor { public enum Mutation { case navigateTo(Route) - case setListData([CollectionListResponse]) + case setListData([CollectionResponse]) } public struct State { @Pulse var route: Route - var collections: [BookmarkCollection] - var collectionListData: [CollectionListResponse] + var collectionList: [CollectionResponse] } // MARK: - Properties @@ -42,16 +41,7 @@ public final class CollectionListReactor: Reactor { ) { self.collectionListUseCase = collectionListUseCase self.createCollectionListUseCase = createCollectionListUseCase - self.initialState = State(route: .none, collections: [ - BookmarkCollection(id: 1, title: "1000번", items: [ - DictionaryItem(id: 1, type: .item, mainText: "1번 아이템", subText: "1번 설명", image: .add, isBookmarked: false), - DictionaryItem(id: 2, type: .item, mainText: "2번 아이템", subText: "2번 설명", image: .add, isBookmarked: false) - ]), - BookmarkCollection(id: 2, title: "2000번", items: [ - DictionaryItem(id: 3, type: .item, mainText: "3번 아이템", subText: "3번 설명", image: .add, isBookmarked: false), - DictionaryItem(id: 4, type: .item, mainText: "4번 아이템", subText: "4번 설명", image: .add, isBookmarked: false) - ]) - ], collectionListData: []) + self.initialState = State(route: .none, collectionList: []) } public func mutate(action: Action) -> Observable { @@ -59,7 +49,7 @@ public final class CollectionListReactor: Reactor { case .viewWillAppear: return collectionListUseCase.execute().map { .setListData($0) } case .itemTapped(let index): - return .just(.navigateTo(.detail(currentState.collections[index]))) + return .just(.navigateTo(.detail(currentState.collectionList[index]))) case .addCollection(let collection): return createCollectionListUseCase.execute(name: collection).andThen(collectionListUseCase.execute()) .map {.setListData($0)} @@ -70,7 +60,7 @@ public final class CollectionListReactor: Reactor { var newState = state switch mutation { case .setListData(let data): - newState.collectionListData = data + newState.collectionList = data case .navigateTo(let route): newState.route = route } diff --git a/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionList/CollectionListViewController.swift b/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionList/CollectionListViewController.swift index e72bc4b7..7269b4f2 100644 --- a/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionList/CollectionListViewController.swift +++ b/MLS/Presentation/BookmarkFeature/BookmarkFeature/CollectionList/CollectionListViewController.swift @@ -2,6 +2,7 @@ import UIKit import BaseFeature import BookmarkFeatureInterface +import DomainInterface import ReactorKit import RxSwift @@ -12,7 +13,7 @@ public final class CollectionListViewController: BaseViewController, View { // MARK: - Properties public var disposeBag = DisposeBag() - public var onDismissWithMessage: ((BookmarkCollection?) -> Void)? + public var onDismissWithMessage: ((CollectionResponse?) -> Void)? private let addCollectionFactory: AddCollectionFactory private let detailFactory: CollectionDetailFactory @@ -60,13 +61,14 @@ private extension CollectionListViewController { addFloatingButton { [weak self] in guard let self = self else { return } - let viewController = self.addCollectionFactory.make(collection: nil, onDismissWithMessage: { [weak self] collection in - if let collection = collection { - // Reactor에게 새로운 콜렉션 추가를 알림 - self?.reactor?.action.onNext(.addCollection(collection.title)) - } - self?.onDismissWithMessage?(collection) - }) +// let viewController = self.addCollectionFactory.make(collection: nil, onDismissWithMessage: { [weak self] collection in +// if let collection = collection { +// // Reactor에게 새로운 콜렉션 추가를 알림 +// self?.reactor?.action.onNext(.addCollection(collection.title)) +// } +// self?.onDismissWithMessage?(collection) +// }) + let viewController = self.addCollectionFactory.make(collection: nil, onDismissWithMessage: { _ in }) self.present(viewController, animated: true) } } @@ -111,11 +113,11 @@ extension CollectionListViewController { .disposed(by: disposeBag) reactor.state - .map(\.collectionListData) + .map(\.collectionList) .withUnretained(self) .observe(on: MainScheduler.instance) - .subscribe { owner, collectionListData in - owner.mainView.updateView(isEmptyData: collectionListData.isEmpty) + .subscribe { owner, collectionList in + owner.mainView.updateView(isEmptyData: collectionList.isEmpty) owner.mainView.listCollectionView.reloadData() } .disposed(by: disposeBag) @@ -125,7 +127,7 @@ extension CollectionListViewController { // MARK: - Delegate extension CollectionListViewController: UICollectionViewDelegate, UICollectionViewDataSource { public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - reactor?.currentState.collectionListData.count ?? 0 + reactor?.currentState.collectionList.count ?? 0 } public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { @@ -134,7 +136,7 @@ extension CollectionListViewController: UICollectionViewDelegate, UICollectionVi withReuseIdentifier: CollectionListCell.identifier, for: indexPath ) as? CollectionListCell, - let item = reactor?.currentState.collectionListData[indexPath.row] + let item = reactor?.currentState.collectionList[indexPath.row] else { return UICollectionViewCell() } diff --git a/MLS/Presentation/BookmarkFeature/BookmarkFeatureInterface/AddCollectionFactory.swift b/MLS/Presentation/BookmarkFeature/BookmarkFeatureInterface/AddCollectionFactory.swift index 97b4064e..21449643 100644 --- a/MLS/Presentation/BookmarkFeature/BookmarkFeatureInterface/AddCollectionFactory.swift +++ b/MLS/Presentation/BookmarkFeature/BookmarkFeatureInterface/AddCollectionFactory.swift @@ -1,5 +1,6 @@ import BaseFeature +import DomainInterface public protocol AddCollectionFactory { - func make(collection: BookmarkCollection?, onDismissWithMessage: @escaping (BookmarkCollection?) -> Void) -> BaseViewController + func make(collection: CollectionResponse?, onDismissWithMessage: @escaping (CollectionResponse?) -> Void) -> BaseViewController } diff --git a/MLS/Presentation/BookmarkFeature/BookmarkFeatureInterface/BookmarkCollection.swift b/MLS/Presentation/BookmarkFeature/BookmarkFeatureInterface/BookmarkCollection.swift deleted file mode 100644 index 4fb95d20..00000000 --- a/MLS/Presentation/BookmarkFeature/BookmarkFeatureInterface/BookmarkCollection.swift +++ /dev/null @@ -1,22 +0,0 @@ -import UIKit - -import DomainInterface - -public struct BookmarkCollection: Equatable { - public var id: Int - public var title: String - public var count: Int { - return items.count - } - - public var items: [DictionaryItem] - public var thumbnails: [UIImage] { - Array(items.prefix(4).map { $0.image }) - } - - public init(id: Int, title: String, items: [DictionaryItem]) { - self.id = id - self.title = title - self.items = items - } -} diff --git a/MLS/Presentation/BookmarkFeature/BookmarkFeatureInterface/BookmarkModalFactory.swift b/MLS/Presentation/BookmarkFeature/BookmarkFeatureInterface/BookmarkModalFactory.swift index 9b22daf3..acea1e83 100644 --- a/MLS/Presentation/BookmarkFeature/BookmarkFeatureInterface/BookmarkModalFactory.swift +++ b/MLS/Presentation/BookmarkFeature/BookmarkFeatureInterface/BookmarkModalFactory.swift @@ -1,5 +1,6 @@ import BaseFeature +import DomainInterface public protocol BookmarkModalFactory { - func make(onDismissWithColletions: (([BookmarkCollection?]) -> Void)?, onDismissWithMessage: ((BookmarkCollection?) -> Void)?) -> BaseViewController + func make(onDismissWithColletions: (([CollectionResponse?]) -> Void)?, onDismissWithMessage: ((CollectionResponse?) -> Void)?) -> BaseViewController } diff --git a/MLS/Presentation/BookmarkFeature/BookmarkFeatureInterface/CollectionDetailFactory.swift b/MLS/Presentation/BookmarkFeature/BookmarkFeatureInterface/CollectionDetailFactory.swift index 4a9d9348..ca409fc1 100644 --- a/MLS/Presentation/BookmarkFeature/BookmarkFeatureInterface/CollectionDetailFactory.swift +++ b/MLS/Presentation/BookmarkFeature/BookmarkFeatureInterface/CollectionDetailFactory.swift @@ -1,5 +1,6 @@ import BaseFeature +import DomainInterface public protocol CollectionDetailFactory { - func make(collection: BookmarkCollection) -> BaseViewController + func make(collection: CollectionResponse) -> BaseViewController }