From f8bf8af7dbcbf802306037d6ed3bdc32bbc256f1 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Sat, 31 Jan 2026 00:16:02 +0900 Subject: [PATCH 01/45] =?UTF-8?q?[refactor]=20ViewControllerFactory=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=EB=B6=80=20DIContainer=EB=A1=9C=EB=B6=80?= =?UTF-8?q?=ED=84=B0=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FLINT/FLINT/Dependency/DIContainer.swift | 87 +------------------ ...dContentSelectViewControllerFactory+.swift | 17 ++++ ...llectionDetailViewControllerFactory+.swift | 16 ++++ ...tionFolderListViewControllerFactory+.swift | 17 ++++ ...eateCollectionViewControllerFactory+.swift | 17 ++++ .../ExploreViewControllerFactory+.swift | 16 ++++ .../FilmSelectViewControllerFactory+.swift | 16 ++++ .../HomeViewControllerFactory+.swift | 16 ++++ .../LoginViewControllerFactory+.swift | 16 ++++ .../NicknameViewControllerFactory+.swift | 16 ++++ ...OnboardingDoneViewControllerFactory+.swift | 16 ++++ .../OttSelectViewControllerFactory+.swift | 16 ++++ .../ProfileViewControllerFactory+.swift | 25 ++++++ .../SplashViewControllerFactory+.swift | 16 ++++ .../TabBarViewControllerFactory+.swift | 16 ++++ .../OnboardingViewModelFactory.swift | 7 +- .../Dependency/ViewControllerFactory.swift | 41 ++++----- .../CollectionDetailViewController.swift | 4 + .../AddContentSelectViewController.swift | 4 + .../CreateCollectionViewController.swift | 4 + .../Scene/Explore/ExploreViewController.swift | 4 + .../CollectionFolderListViewController.swift | 4 + .../Scene/Home/HomeViewController.swift | 6 +- .../Scene/Login/LoginViewController.swift | 4 + .../Scene/MyViewController.swift | 32 ------- .../Done/OnboardingDoneViewController.swift | 4 + .../FilmSelect/FilmSelectViewController.swift | 6 +- .../Nickname/NicknameViewController.swift | 4 + .../OttSelect/OttSelectViewController.swift | 4 + .../Scene/Profile/ProfileViewController.swift | 5 ++ .../Scene/Splash/SplashViewController.swift | 4 + .../TabBar/TabBarViewController.swift | 4 + 32 files changed, 325 insertions(+), 139 deletions(-) create mode 100644 FLINT/FLINT/Dependency/Factory/ViewController/AddContentSelectViewControllerFactory+.swift create mode 100644 FLINT/FLINT/Dependency/Factory/ViewController/CollectionDetailViewControllerFactory+.swift create mode 100644 FLINT/FLINT/Dependency/Factory/ViewController/CollectionFolderListViewControllerFactory+.swift create mode 100644 FLINT/FLINT/Dependency/Factory/ViewController/CreateCollectionViewControllerFactory+.swift create mode 100644 FLINT/FLINT/Dependency/Factory/ViewController/ExploreViewControllerFactory+.swift create mode 100644 FLINT/FLINT/Dependency/Factory/ViewController/FilmSelectViewControllerFactory+.swift create mode 100644 FLINT/FLINT/Dependency/Factory/ViewController/HomeViewControllerFactory+.swift create mode 100644 FLINT/FLINT/Dependency/Factory/ViewController/LoginViewControllerFactory+.swift create mode 100644 FLINT/FLINT/Dependency/Factory/ViewController/NicknameViewControllerFactory+.swift create mode 100644 FLINT/FLINT/Dependency/Factory/ViewController/OnboardingDoneViewControllerFactory+.swift create mode 100644 FLINT/FLINT/Dependency/Factory/ViewController/OttSelectViewControllerFactory+.swift create mode 100644 FLINT/FLINT/Dependency/Factory/ViewController/ProfileViewControllerFactory+.swift create mode 100644 FLINT/FLINT/Dependency/Factory/ViewController/SplashViewControllerFactory+.swift create mode 100644 FLINT/FLINT/Dependency/Factory/ViewController/TabBarViewControllerFactory+.swift delete mode 100644 FLINT/Presentation/Sources/ViewController/Scene/MyViewController.swift rename FLINT/Presentation/Sources/ViewController/Scene/{ => Onboarding}/Nickname/NicknameViewController.swift (98%) diff --git a/FLINT/FLINT/Dependency/DIContainer.swift b/FLINT/FLINT/Dependency/DIContainer.swift index 45446cd8..9c9c9c6d 100644 --- a/FLINT/FLINT/Dependency/DIContainer.swift +++ b/FLINT/FLINT/Dependency/DIContainer.swift @@ -15,9 +15,9 @@ import Data import Domain import Presentation -typealias AppFactory = ViewControllerFactory & OnboardingViewModelFactory & ExploreViewModelFactory & CreateCollectionFactory & AddContentSelectViewModelFactory & ProfileFactory & HomeFactory & CollectionDetailFactory & LoginViewModelFactory +typealias DependencyFactory = ViewControllerFactory & OnboardingViewModelFactory & ExploreViewModelFactory & CreateCollectionFactory & AddContentSelectViewModelFactory & ProfileFactory & HomeFactory & CollectionDetailFactory & LoginViewModelFactory -final class DIContainer: AppFactory { +final class DIContainer: DependencyFactory { // MARK: - Root Dependency @@ -69,90 +69,9 @@ final class DIContainer: AppFactory { // MARK: - Init init() { - tokenStorage.clearAll() +// tokenStorage.clearAll() } - // MARK: - ViewControllerFactory - - func makeSplashViewController() -> SplashViewController { - return SplashViewController(viewControllerFactory: self) - } - - func makeLoginViewController() -> LoginViewController { - return LoginViewController(loginViewModel: makeLoginViewModel(), viewControllerFactory: self) - } - - func makeTabBarViewController() -> TabBarViewController { - return TabBarViewController(viewControllerFactory: self) - } - - func makeNicknameViewController() -> NicknameViewController { - return NicknameViewController(onboardingViewModel: makeOnboardingViewModel(), viewControllerFactory: self) - } - - func makeAddContentSelectViewController() -> AddContentSelectViewController { - let vm = makeAddContentSelectViewModel() - return AddContentSelectViewController(viewModel: vm, viewControllerFactory: self) - } - - func makeCreateCollectionViewController() -> CreateCollectionViewController { - let vm = makeCreateCollectionViewModel() - return CreateCollectionViewController(viewModel: vm, viewControllerFactory: self) - } - - func makeHomeViewController() -> HomeViewController { - let vm = makeHomeViewModel() - return HomeViewController(viewModel: vm, viewControllerFactory: self) - } - - func makeFilmSelectViewController(onboardingViewModel: OnboardingViewModel) -> FilmSelectViewController { - return FilmSelectViewController(onboardingViewModel: onboardingViewModel, viewControllerFactory: self) - } - - func makeOttSelectViewController(onboardingViewModel: OnboardingViewModel) -> OttSelectViewController { - return OttSelectViewController(onboardingViewModel: onboardingViewModel, viewControllerFactory: self) - } - - func makeOnboardingDoneViewController(onboardingViewModel: OnboardingViewModel) -> OnboardingDoneViewController { - return OnboardingDoneViewController(onboardingViewModel: onboardingViewModel, viewControllerFactory: self) - } - - func makeExploreViewController() -> ViewController.ExploreViewController { - return ExploreViewController(exploreViewModel: makeExploreViewModel(), viewControllerFactory: self) - } - - - func makeProfileViewController() -> ProfileViewController { - makeProfileViewController(target: .me) - } - - func makeProfileViewController( - target: ProfileViewModel.Target = .me - ) -> ProfileViewController { - return ProfileViewController( - profileViewModel: makeProfileViewModel(target: target), - viewControllerFactory: self - ) - } - - -// func makeCollectionDetailViewController(collectionId: Int64) -> CollectionDetailViewController { -// let vm = makeCollectionDetailViewModel(collectionId: collectionId) -// return CollectionDetailViewController(viewModel: vm) -// } - func makeCollectionDetailViewController(collectionId: Int64) -> CollectionDetailViewController { - let vm = makeCollectionDetailViewModel(collectionId: collectionId) - return CollectionDetailViewController(viewModel: vm, viewControllerFactory: self) - } - - - func makeCollectionFolderListViewController() -> CollectionFolderListViewController { - let vm = CollectionFolderListViewModel(fetchWatchingCollectionsUseCase: makeFetchWatchingCollectionsUseCase()) - return CollectionFolderListViewController(viewModel: vm, viewControllerFactory: self) - } - - - // MARK: - Root Dependency Injection func makeTokenStorage() -> TokenStorage { diff --git a/FLINT/FLINT/Dependency/Factory/ViewController/AddContentSelectViewControllerFactory+.swift b/FLINT/FLINT/Dependency/Factory/ViewController/AddContentSelectViewControllerFactory+.swift new file mode 100644 index 00000000..4052eb7c --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/ViewController/AddContentSelectViewControllerFactory+.swift @@ -0,0 +1,17 @@ +// +// AddContentSelectViewControllerFactory+.swift +// FLINT +// +// Created by 김호성 on 2026.01.31. +// + +import Foundation + +import Presentation + +extension AddContentSelectViewControllerFactory where Self: AddContentSelectViewModelFactory & ViewControllerFactory { + func makeAddContentSelectViewController() -> AddContentSelectViewController { + let vm = makeAddContentSelectViewModel() + return AddContentSelectViewController(viewModel: vm, viewControllerFactory: self) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/ViewController/CollectionDetailViewControllerFactory+.swift b/FLINT/FLINT/Dependency/Factory/ViewController/CollectionDetailViewControllerFactory+.swift new file mode 100644 index 00000000..f849aa39 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/ViewController/CollectionDetailViewControllerFactory+.swift @@ -0,0 +1,16 @@ +// +// CollectionDetailViewControllerFactory+.swift +// FLINT +// +// Created by 김호성 on 2026.01.31. +// + +import Foundation + +import Presentation + +extension CollectionDetailViewControllerFactory where Self: CollectionDetailFactory & ViewControllerFactory { + func makeCollectionDetailViewController(collectionId: Int64) -> CollectionDetailViewController { + return CollectionDetailViewController(viewModel: makeCollectionDetailViewModel(collectionId: collectionId), viewControllerFactory: self) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/ViewController/CollectionFolderListViewControllerFactory+.swift b/FLINT/FLINT/Dependency/Factory/ViewController/CollectionFolderListViewControllerFactory+.swift new file mode 100644 index 00000000..1f5ed29a --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/ViewController/CollectionFolderListViewControllerFactory+.swift @@ -0,0 +1,17 @@ +// +// CollectionFolderListViewControllerFactory+.swift +// FLINT +// +// Created by 김호성 on 2026.01.31. +// + +import Foundation + +import Presentation + +extension CollectionFolderListViewControllerFactory where Self: HomeFactory & ViewControllerFactory { + func makeCollectionFolderListViewController() -> CollectionFolderListViewController { + let vm = CollectionFolderListViewModel(fetchWatchingCollectionsUseCase: makeFetchWatchingCollectionsUseCase()) + return CollectionFolderListViewController(viewModel: vm, viewControllerFactory: self) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/ViewController/CreateCollectionViewControllerFactory+.swift b/FLINT/FLINT/Dependency/Factory/ViewController/CreateCollectionViewControllerFactory+.swift new file mode 100644 index 00000000..4c717023 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/ViewController/CreateCollectionViewControllerFactory+.swift @@ -0,0 +1,17 @@ +// +// CreateCollectionViewControllerFactory+.swift +// FLINT +// +// Created by 김호성 on 2026.01.31. +// + +import Foundation + +import Presentation + +extension CreateCollectionViewControllerFactory where Self: CreateCollectionFactory & ViewControllerFactory { + func makeCreateCollectionViewController() -> CreateCollectionViewController { + let vm = makeCreateCollectionViewModel() + return CreateCollectionViewController(viewModel: vm, viewControllerFactory: self) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/ViewController/ExploreViewControllerFactory+.swift b/FLINT/FLINT/Dependency/Factory/ViewController/ExploreViewControllerFactory+.swift new file mode 100644 index 00000000..86e55d61 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/ViewController/ExploreViewControllerFactory+.swift @@ -0,0 +1,16 @@ +// +// ExploreViewControllerFactory+.swift +// FLINT +// +// Created by 김호성 on 2026.01.31. +// + +import Foundation + +import Presentation + +extension ExploreViewControllerFactory where Self: ExploreViewModelFactory & ViewControllerFactory { + func makeExploreViewController() -> ExploreViewController { + return ExploreViewController(exploreViewModel: makeExploreViewModel(), viewControllerFactory: self) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/ViewController/FilmSelectViewControllerFactory+.swift b/FLINT/FLINT/Dependency/Factory/ViewController/FilmSelectViewControllerFactory+.swift new file mode 100644 index 00000000..2fa43ae6 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/ViewController/FilmSelectViewControllerFactory+.swift @@ -0,0 +1,16 @@ +// +// FilmSelectViewControllerFactory+.swift +// FLINT +// +// Created by 김호성 on 2026.01.30. +// + +import Foundation + +import Presentation + +extension FilmSelectViewControllerFactory where Self: ViewControllerFactory { + func makeFilmSelectViewController(onboardingViewModel: OnboardingViewModel) -> FilmSelectViewController { + return FilmSelectViewController(onboardingViewModel: onboardingViewModel, viewControllerFactory: self) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/ViewController/HomeViewControllerFactory+.swift b/FLINT/FLINT/Dependency/Factory/ViewController/HomeViewControllerFactory+.swift new file mode 100644 index 00000000..b11866f0 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/ViewController/HomeViewControllerFactory+.swift @@ -0,0 +1,16 @@ +// +// HomeViewControllerFactory+.swift +// FLINT +// +// Created by 김호성 on 2026.01.31. +// + +import Foundation + +import Presentation + +extension HomeViewControllerFactory where Self: HomeFactory & ViewControllerFactory { + func makeHomeViewController() -> HomeViewController { + return HomeViewController(viewModel: makeHomeViewModel(), viewControllerFactory: self) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/ViewController/LoginViewControllerFactory+.swift b/FLINT/FLINT/Dependency/Factory/ViewController/LoginViewControllerFactory+.swift new file mode 100644 index 00000000..1fc0dae4 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/ViewController/LoginViewControllerFactory+.swift @@ -0,0 +1,16 @@ +// +// SplashViewControllerFactory.swift +// FLINT +// +// Created by 김호성 on 2026.01.30. +// + +import Foundation + +import Presentation + +extension LoginViewControllerFactory where Self: LoginViewModelFactory & ViewControllerFactory { + func makeLoginViewController() -> LoginViewController { + return LoginViewController(loginViewModel: makeLoginViewModel(), viewControllerFactory: self) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/ViewController/NicknameViewControllerFactory+.swift b/FLINT/FLINT/Dependency/Factory/ViewController/NicknameViewControllerFactory+.swift new file mode 100644 index 00000000..89c8fcda --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/ViewController/NicknameViewControllerFactory+.swift @@ -0,0 +1,16 @@ +// +// NicknameViewControllerFactory+.swift +// FLINT +// +// Created by 김호성 on 2026.01.30. +// + +import Foundation + +import Presentation + +extension NicknameViewControllerFactory where Self: OnboardingViewModelFactory & ViewControllerFactory { + func makeNicknameViewController() -> NicknameViewController { + return NicknameViewController(onboardingViewModel: makeOnboardingViewModel(), viewControllerFactory: self) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/ViewController/OnboardingDoneViewControllerFactory+.swift b/FLINT/FLINT/Dependency/Factory/ViewController/OnboardingDoneViewControllerFactory+.swift new file mode 100644 index 00000000..cde5b901 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/ViewController/OnboardingDoneViewControllerFactory+.swift @@ -0,0 +1,16 @@ +// +// OnboardingDoneViewControllerFactory+.swift +// FLINT +// +// Created by 김호성 on 2026.01.30. +// + +import Foundation + +import Presentation + +extension OnboardingDoneViewControllerFactory where Self: ViewControllerFactory { + func makeOnboardingDoneViewController(onboardingViewModel: OnboardingViewModel) -> OnboardingDoneViewController { + return OnboardingDoneViewController(onboardingViewModel: onboardingViewModel, viewControllerFactory: self) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/ViewController/OttSelectViewControllerFactory+.swift b/FLINT/FLINT/Dependency/Factory/ViewController/OttSelectViewControllerFactory+.swift new file mode 100644 index 00000000..44f393a6 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/ViewController/OttSelectViewControllerFactory+.swift @@ -0,0 +1,16 @@ +// +// OttSelectViewControllerFactory+.swift +// FLINT +// +// Created by 김호성 on 2026.01.30. +// + +import Foundation + +import Presentation + +extension OttSelectViewControllerFactory where Self: ViewControllerFactory { + func makeOttSelectViewController(onboardingViewModel: OnboardingViewModel) -> OttSelectViewController { + return OttSelectViewController(onboardingViewModel: onboardingViewModel, viewControllerFactory: self) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/ViewController/ProfileViewControllerFactory+.swift b/FLINT/FLINT/Dependency/Factory/ViewController/ProfileViewControllerFactory+.swift new file mode 100644 index 00000000..3fbee8a2 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/ViewController/ProfileViewControllerFactory+.swift @@ -0,0 +1,25 @@ +// +// ProfileViewControllerFactory+.swift +// FLINT +// +// Created by 김호성 on 2026.01.31. +// + +import Foundation + +import Presentation + +extension ProfileViewControllerFactory where Self: ProfileFactory & ViewControllerFactory { + func makeProfileViewController() -> ProfileViewController { + makeProfileViewController(target: .me) + } + + func makeProfileViewController( + target: ProfileViewModel.Target = .me + ) -> ProfileViewController { + return ProfileViewController( + profileViewModel: makeProfileViewModel(target: target), + viewControllerFactory: self + ) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/ViewController/SplashViewControllerFactory+.swift b/FLINT/FLINT/Dependency/Factory/ViewController/SplashViewControllerFactory+.swift new file mode 100644 index 00000000..b72c0724 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/ViewController/SplashViewControllerFactory+.swift @@ -0,0 +1,16 @@ +// +// SplashViewControllerFactory.swift +// FLINT +// +// Created by 김호성 on 2026.01.30. +// + +import Foundation + +import Presentation + +extension SplashViewControllerFactory where Self: ViewControllerFactory { + func makeSplashViewController() -> SplashViewController { + return SplashViewController(viewControllerFactory: self) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/ViewController/TabBarViewControllerFactory+.swift b/FLINT/FLINT/Dependency/Factory/ViewController/TabBarViewControllerFactory+.swift new file mode 100644 index 00000000..8e6642f2 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/ViewController/TabBarViewControllerFactory+.swift @@ -0,0 +1,16 @@ +// +// TabBarViewControllerFactory+.swift +// FLINT +// +// Created by 김호성 on 2026.01.31. +// + +import Foundation + +import Presentation + +extension TabBarViewControllerFactory where Self: ViewControllerFactory { + func makeTabBarViewController() -> TabBarViewController { + return TabBarViewController(viewControllerFactory: self) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/OnboardingViewModelFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/OnboardingViewModelFactory.swift index 5d1a9a7c..84181aff 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewModel/OnboardingViewModelFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/OnboardingViewModelFactory.swift @@ -17,7 +17,12 @@ protocol OnboardingViewModelFactory: NicknameUseCaseFactory, SearchContentsUseCa extension OnboardingViewModelFactory { func makeOnboardingViewModel() -> OnboardingViewModel { - return makeOnboardingViewModel(nicknameUseCase: makeNicknameUseCase(), contentsUseCase: makeContentsUseCase(), searchContentsUseCase: makeSearchContentsUseCase(), signupUseCase: makeSignupUseCase()) + return makeOnboardingViewModel( + nicknameUseCase: makeNicknameUseCase(), + contentsUseCase: makeContentsUseCase(), + searchContentsUseCase: makeSearchContentsUseCase(), + signupUseCase: makeSignupUseCase() + ) } func makeOnboardingViewModel(nicknameUseCase: NicknameUseCase, contentsUseCase: ContentsUseCase, searchContentsUseCase: SearchContentsUseCase, signupUseCase: SignupUseCase) -> OnboardingViewModel { return DefaultOnboardingViewModel(nicknameUseCase: nicknameUseCase, contentsUseCase: contentsUseCase, searchContentsUseCase: searchContentsUseCase, signupUseCase: signupUseCase) diff --git a/FLINT/Presentation/Sources/ViewController/Dependency/ViewControllerFactory.swift b/FLINT/Presentation/Sources/ViewController/Dependency/ViewControllerFactory.swift index aab113db..7d2d346a 100644 --- a/FLINT/Presentation/Sources/ViewController/Dependency/ViewControllerFactory.swift +++ b/FLINT/Presentation/Sources/ViewController/Dependency/ViewControllerFactory.swift @@ -9,29 +9,30 @@ import UIKit import ViewModel -public protocol ViewControllerFactory { - func makeSplashViewController() -> SplashViewController - func makeLoginViewController() -> LoginViewController - - func makeNicknameViewController() -> NicknameViewController +public typealias ViewControllerFactory = - func makeFilmSelectViewController(onboardingViewModel: OnboardingViewModel) -> FilmSelectViewController - func makeOttSelectViewController(onboardingViewModel: OnboardingViewModel) -> OttSelectViewController - func makeOnboardingDoneViewController(onboardingViewModel: OnboardingViewModel) -> OnboardingDoneViewController + // MARK: - Splash / Login - func makeTabBarViewController() -> TabBarViewController + SplashViewControllerFactory & + LoginViewControllerFactory & - func makeHomeViewController() -> HomeViewController - func makeExploreViewController() -> ExploreViewController + // MARK: - Onboarding - func makeAddContentSelectViewController() -> AddContentSelectViewController - func makeCreateCollectionViewController() -> CreateCollectionViewController + NicknameViewControllerFactory & + FilmSelectViewControllerFactory & + OttSelectViewControllerFactory & + OnboardingDoneViewControllerFactory & - func makeProfileViewController() -> ProfileViewController - func makeProfileViewController(target: ProfileViewModel.Target) -> ProfileViewController - - func makeCollectionDetailViewController(collectionId: Int64) -> CollectionDetailViewController + // MARK: - Main - func makeCollectionFolderListViewController() -> CollectionFolderListViewController - -} + TabBarViewControllerFactory & + HomeViewControllerFactory & + ExploreViewControllerFactory & + ProfileViewControllerFactory & + + // MARK: - Collection + + CollectionFolderListViewControllerFactory & + CollectionDetailViewControllerFactory & + AddContentSelectViewControllerFactory & + CreateCollectionViewControllerFactory diff --git a/FLINT/Presentation/Sources/ViewController/Scene/CollectionDetail/CollectionDetailViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/CollectionDetail/CollectionDetailViewController.swift index bd225082..96dc4b99 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/CollectionDetail/CollectionDetailViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/CollectionDetail/CollectionDetailViewController.swift @@ -14,6 +14,10 @@ import Entity import View import ViewModel +public protocol CollectionDetailViewControllerFactory { + func makeCollectionDetailViewController(collectionId: Int64) -> CollectionDetailViewController +} + public final class CollectionDetailViewController: BaseViewController { // MARK: - Enum diff --git a/FLINT/Presentation/Sources/ViewController/Scene/CreateCollection/CollectionSearchVIew/AddContentSelectViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/CreateCollection/CollectionSearchVIew/AddContentSelectViewController.swift index 74f7e9bd..3250e0ff 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/CreateCollection/CollectionSearchVIew/AddContentSelectViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/CreateCollection/CollectionSearchVIew/AddContentSelectViewController.swift @@ -16,6 +16,10 @@ import Domain import View import ViewModel +public protocol AddContentSelectViewControllerFactory { + func makeAddContentSelectViewController() -> AddContentSelectViewController +} + public final class AddContentSelectViewController: BaseViewController { // MARK: - Output diff --git a/FLINT/Presentation/Sources/ViewController/Scene/CreateCollection/CreateCollectionView/CreateCollectionViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/CreateCollection/CreateCollectionView/CreateCollectionViewController.swift index 9c84fc79..1c32bd15 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/CreateCollection/CreateCollectionView/CreateCollectionViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/CreateCollection/CreateCollectionView/CreateCollectionViewController.swift @@ -12,6 +12,10 @@ import Domain import View import ViewModel +public protocol CreateCollectionViewControllerFactory { + func makeCreateCollectionViewController() -> CreateCollectionViewController +} + public final class CreateCollectionViewController: BaseViewController { // MARK: - Enum diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Explore/ExploreViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Explore/ExploreViewController.swift index 55730f54..c35978ba 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Explore/ExploreViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Explore/ExploreViewController.swift @@ -16,6 +16,10 @@ import Domain import View import ViewModel +public protocol ExploreViewControllerFactory { + func makeExploreViewController() -> ExploreViewController +} + public final class ExploreViewController: BaseViewController { public let exploreViewModel: ExploreViewModel diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Home/CollectionFolder/CollectionFolderListViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Home/CollectionFolder/CollectionFolderListViewController.swift index 1110274c..5e81cbf3 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Home/CollectionFolder/CollectionFolderListViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Home/CollectionFolder/CollectionFolderListViewController.swift @@ -12,6 +12,10 @@ import ViewModel import Domain +public protocol CollectionFolderListViewControllerFactory { + func makeCollectionFolderListViewController() -> CollectionFolderListViewController +} + public final class CollectionFolderListViewController: BaseViewController { // MARK: - Data diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Home/HomeViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Home/HomeViewController.swift index 18fe7501..3bf556bd 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Home/HomeViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Home/HomeViewController.swift @@ -12,11 +12,15 @@ import ViewModel import Domain +public protocol HomeViewControllerFactory { + func makeHomeViewController() -> HomeViewController +} + public final class HomeViewController: BaseViewController { private let viewModel: HomeViewModel - public init(viewModel: HomeViewModel, viewControllerFactory: ViewControllerFactory? = nil) { + public init(viewModel: HomeViewModel, viewControllerFactory: ViewControllerFactory) { self.viewModel = viewModel super.init(nibName: nil, bundle: nil) self.viewControllerFactory = viewControllerFactory diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Login/LoginViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Login/LoginViewController.swift index 76ad3e6f..849cf5b0 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Login/LoginViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Login/LoginViewController.swift @@ -12,6 +12,10 @@ import Domain import View import ViewModel +public protocol LoginViewControllerFactory { + func makeLoginViewController() -> LoginViewController +} + public final class LoginViewController: BaseViewController { // MARK: - ViewModel diff --git a/FLINT/Presentation/Sources/ViewController/Scene/MyViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/MyViewController.swift deleted file mode 100644 index 4947e5a8..00000000 --- a/FLINT/Presentation/Sources/ViewController/Scene/MyViewController.swift +++ /dev/null @@ -1,32 +0,0 @@ -// -// MyViewController.swift -// FLINT -// -// Created by 소은 on 1/6/26. -// - -import UIKit -import SnapKit -import Then - -public final class MyViewController: BaseViewController { - - private let titleLabel = UILabel().then { - $0.attributedText = .pretendard(.head1_sb_22, text: "My") - $0.textAlignment = .center - } - - public override func setUI() { - view.backgroundColor = .systemBackground - } - - public override func setHierarchy() { - view.addSubview(titleLabel) - } - - public override func setLayout() { - titleLabel.snp.makeConstraints { - $0.center.equalToSuperview() - } - } -} diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/Done/OnboardingDoneViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/Done/OnboardingDoneViewController.swift index c79df8e5..87fff128 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/Done/OnboardingDoneViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/Done/OnboardingDoneViewController.swift @@ -12,6 +12,10 @@ import Domain import View import ViewModel +public protocol OnboardingDoneViewControllerFactory { + func makeOnboardingDoneViewController(onboardingViewModel: OnboardingViewModel) -> OnboardingDoneViewController +} + public final class OnboardingDoneViewController: BaseViewController { // MARK: - ViewModel diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/FilmSelect/FilmSelectViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/FilmSelect/FilmSelectViewController.swift index 019e4042..0b367595 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/FilmSelect/FilmSelectViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/FilmSelect/FilmSelectViewController.swift @@ -14,7 +14,11 @@ import Domain import View import ViewModel -// TODO: - shadow & select logic +public protocol FilmSelectViewControllerFactory { + func makeFilmSelectViewController(onboardingViewModel: OnboardingViewModel) -> FilmSelectViewController +} + +// TODO: - shadow public final class FilmSelectViewController: BaseViewController { diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Nickname/NicknameViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/Nickname/NicknameViewController.swift similarity index 98% rename from FLINT/Presentation/Sources/ViewController/Scene/Nickname/NicknameViewController.swift rename to FLINT/Presentation/Sources/ViewController/Scene/Onboarding/Nickname/NicknameViewController.swift index fcccfef9..41509f94 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Nickname/NicknameViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/Nickname/NicknameViewController.swift @@ -14,6 +14,10 @@ import Domain import View import ViewModel +public protocol NicknameViewControllerFactory { + func makeNicknameViewController() -> NicknameViewController +} + public final class NicknameViewController: BaseViewController { // MARK: - ViewModel diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/OttSelect/OttSelectViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/OttSelect/OttSelectViewController.swift index 96df2419..a0e535f0 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/OttSelect/OttSelectViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/OttSelect/OttSelectViewController.swift @@ -12,6 +12,10 @@ import Domain import View import ViewModel +public protocol OttSelectViewControllerFactory { + func makeOttSelectViewController(onboardingViewModel: OnboardingViewModel) -> OttSelectViewController +} + public class OttSelectViewController: BaseViewController { // MARK: - ViewModel diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Profile/ProfileViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Profile/ProfileViewController.swift index a97833ee..0450f37d 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Profile/ProfileViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Profile/ProfileViewController.swift @@ -15,6 +15,11 @@ import Domain import View import ViewModel +public protocol ProfileViewControllerFactory { + func makeProfileViewController() -> ProfileViewController + func makeProfileViewController(target: ProfileViewModel.Target) -> ProfileViewController +} + public final class ProfileViewController: BaseViewController { diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Splash/SplashViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Splash/SplashViewController.swift index 491eb0d4..c3b974b3 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Splash/SplashViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Splash/SplashViewController.swift @@ -12,6 +12,10 @@ import Combine import View import ViewModel +public protocol SplashViewControllerFactory { + func makeSplashViewController() -> SplashViewController +} + public final class SplashViewController: BaseViewController { public init(viewControllerFactory: ViewControllerFactory) { diff --git a/FLINT/Presentation/Sources/ViewController/TabBar/TabBarViewController.swift b/FLINT/Presentation/Sources/ViewController/TabBar/TabBarViewController.swift index 37763eeb..48681779 100644 --- a/FLINT/Presentation/Sources/ViewController/TabBar/TabBarViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/TabBar/TabBarViewController.swift @@ -12,6 +12,10 @@ import Then import View +public protocol TabBarViewControllerFactory { + func makeTabBarViewController() -> TabBarViewController +} + public class TabBarViewController: UIViewController { // MARK: - DI From 011f3b78df1bbaf109d47c1c9ea495336dfb8e90 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Sat, 31 Jan 2026 14:45:46 +0900 Subject: [PATCH 02/45] =?UTF-8?q?[refactor]=20di=20factory=20=ED=98=95?= =?UTF-8?q?=EC=8B=9D=20=ED=86=B5=EC=9D=BC=20=EC=9E=91=EC=97=85=20=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FLINT/FLINT/Dependency/DIContainer.swift | 51 +++++++------------ .../Factory/APIProvider/AuthAPIFactory.swift | 8 +++ .../BookmarkAPIProviderFactory.swift | 23 +++++++++ .../APIProvider/CollectionAPIFactory.swift | 8 +++ .../APIProvider/SearchAPIFactory.swift | 8 +++ .../Factory/APIProvider/UserAPIFactory.swift | 8 +++ .../Factory/CollectionDetailFactory.swift | 2 +- .../BookmarkRepositoryFactory.swift | 22 +------- .../Service/BookmarkServiceFactory.swift | 26 ++++++++++ .../TokenStorage/TokenStorageFactory.swift | 8 +++ .../FetchBookmarkedUserUseCaseFactory.swift} | 8 +-- .../UseCase/UserProfileUseCaseFactory.swift | 24 +++++++++ 12 files changed, 134 insertions(+), 62 deletions(-) create mode 100644 FLINT/FLINT/Dependency/Factory/APIProvider/BookmarkAPIProviderFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/Service/BookmarkServiceFactory.swift rename FLINT/FLINT/Dependency/Factory/{BookmarkFactory.swift => UseCase/FetchBookmarkedUserUseCaseFactory.swift} (86%) create mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/UserProfileUseCaseFactory.swift diff --git a/FLINT/FLINT/Dependency/DIContainer.swift b/FLINT/FLINT/Dependency/DIContainer.swift index 9c9c9c6d..07b59665 100644 --- a/FLINT/FLINT/Dependency/DIContainer.swift +++ b/FLINT/FLINT/Dependency/DIContainer.swift @@ -15,44 +15,53 @@ import Data import Domain import Presentation -typealias DependencyFactory = ViewControllerFactory & OnboardingViewModelFactory & ExploreViewModelFactory & CreateCollectionFactory & AddContentSelectViewModelFactory & ProfileFactory & HomeFactory & CollectionDetailFactory & LoginViewModelFactory +typealias DependencyFactory = ViewControllerFactory & + + OnboardingViewModelFactory & + ExploreViewModelFactory & + CreateCollectionFactory & + AddContentSelectViewModelFactory & + ProfileFactory & + HomeFactory & + CollectionDetailFactory & + LoginViewModelFactory final class DIContainer: DependencyFactory { // MARK: - Root Dependency -// private lazy var tokenStorage: TokenStorage = DefaultTokenStorage() - private lazy var tokenStorage: TokenStorage = TestTokenStorage() +// lazy var tokenStorage: TokenStorage = DefaultTokenStorage() + lazy var tokenStorage: TokenStorage = TestTokenStorage() private lazy var authInterceptor: AuthInterceptor = AuthInterceptor(tokenStorage: tokenStorage) private lazy var networkLoggerPlugin: NetworkLoggerPlugin = NetworkLoggerPlugin() - private lazy var userAPIProvider = MoyaProvider( + lazy var userAPIProvider = MoyaProvider( session: Session(interceptor: authInterceptor), plugins: [ networkLoggerPlugin ] ) - private lazy var collectionAPIProvider = MoyaProvider( + lazy var collectionAPIProvider = MoyaProvider( session: Session(interceptor: authInterceptor), plugins: [ networkLoggerPlugin ] ) - private lazy var searchAPIProvider = MoyaProvider( + lazy var searchAPIProvider = MoyaProvider( session: Session(interceptor: authInterceptor), plugins: [ networkLoggerPlugin ] ) - private lazy var bookmarkAPIProvider = MoyaProvider( + lazy var bookmarkAPIProvider = MoyaProvider( session: Session(interceptor: authInterceptor), plugins: [ networkLoggerPlugin ] ) - private lazy var authAPIProvider = MoyaProvider( + lazy var authAPIProvider = MoyaProvider( session: Session(interceptor: authInterceptor), plugins: [ networkLoggerPlugin @@ -72,32 +81,6 @@ final class DIContainer: DependencyFactory { // tokenStorage.clearAll() } - // MARK: - Root Dependency Injection - - func makeTokenStorage() -> TokenStorage { - return tokenStorage - } - - func makeUserAPIProvider() -> MoyaProvider { - return userAPIProvider - } - - func makeSearchAPIProvider() -> MoyaProvider { - return searchAPIProvider - } - - func makeCollectionAPIProvider() -> MoyaProvider { - return collectionAPIProvider - } - - func makeBookmarkAPIProvider() -> MoyaProvider { - return bookmarkAPIProvider - } - - func makeAuthAPIProvider() -> MoyaProvider { - return authAPIProvider - } - func makeHomeAPIProvider() -> MoyaProvider { return homeAPIProvider } diff --git a/FLINT/FLINT/Dependency/Factory/APIProvider/AuthAPIFactory.swift b/FLINT/FLINT/Dependency/Factory/APIProvider/AuthAPIFactory.swift index 082fe532..911f5198 100644 --- a/FLINT/FLINT/Dependency/Factory/APIProvider/AuthAPIFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/APIProvider/AuthAPIFactory.swift @@ -12,5 +12,13 @@ import Moya import Data protocol AuthAPIFactory { + var authAPIProvider: MoyaProvider { get set } + func makeAuthAPIProvider() -> MoyaProvider } + +extension AuthAPIFactory { + func makeAuthAPIProvider() -> MoyaProvider { + return authAPIProvider + } +} diff --git a/FLINT/FLINT/Dependency/Factory/APIProvider/BookmarkAPIProviderFactory.swift b/FLINT/FLINT/Dependency/Factory/APIProvider/BookmarkAPIProviderFactory.swift new file mode 100644 index 00000000..95341bfc --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/APIProvider/BookmarkAPIProviderFactory.swift @@ -0,0 +1,23 @@ +// +// BookmarkAPIProviderFactory.swift +// FLINT +// +// Created by 김호성 on 2026.01.31. +// + +import Foundation +import Moya + +import Data + +protocol BookmarkAPIProviderFactory { + var bookmarkAPIProvider: MoyaProvider { get set } + + func makeBookmarkAPIProvider() -> MoyaProvider +} + +extension BookmarkAPIProviderFactory { + func makeBookmarkAPIProvider() -> MoyaProvider { + return bookmarkAPIProvider + } +} diff --git a/FLINT/FLINT/Dependency/Factory/APIProvider/CollectionAPIFactory.swift b/FLINT/FLINT/Dependency/Factory/APIProvider/CollectionAPIFactory.swift index c4ac4e1a..5d8840ff 100644 --- a/FLINT/FLINT/Dependency/Factory/APIProvider/CollectionAPIFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/APIProvider/CollectionAPIFactory.swift @@ -12,5 +12,13 @@ import Moya import Data protocol CollectionAPIFactory { + var collectionAPIProvider: MoyaProvider { get set } + func makeCollectionAPIProvider() -> MoyaProvider } + +extension CollectionAPIFactory { + func makeCollectionAPIProvider() -> MoyaProvider { + return collectionAPIProvider + } +} diff --git a/FLINT/FLINT/Dependency/Factory/APIProvider/SearchAPIFactory.swift b/FLINT/FLINT/Dependency/Factory/APIProvider/SearchAPIFactory.swift index 1f56a58b..86c289e9 100644 --- a/FLINT/FLINT/Dependency/Factory/APIProvider/SearchAPIFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/APIProvider/SearchAPIFactory.swift @@ -12,5 +12,13 @@ import Moya import Data protocol SearchAPIFactory { + var searchAPIProvider: MoyaProvider { get set } + func makeSearchAPIProvider() -> MoyaProvider } + +extension SearchAPIFactory { + func makeSearchAPIProvider() -> MoyaProvider { + return searchAPIProvider + } +} diff --git a/FLINT/FLINT/Dependency/Factory/APIProvider/UserAPIFactory.swift b/FLINT/FLINT/Dependency/Factory/APIProvider/UserAPIFactory.swift index 92430ff5..f29fb4a5 100644 --- a/FLINT/FLINT/Dependency/Factory/APIProvider/UserAPIFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/APIProvider/UserAPIFactory.swift @@ -12,5 +12,13 @@ import Moya import Data protocol UserAPIFactory { + var userAPIProvider: MoyaProvider { get set } + func makeUserAPIProvider() -> MoyaProvider } + +extension UserAPIFactory { + func makeUserAPIProvider() -> MoyaProvider { + return userAPIProvider + } +} diff --git a/FLINT/FLINT/Dependency/Factory/CollectionDetailFactory.swift b/FLINT/FLINT/Dependency/Factory/CollectionDetailFactory.swift index 619e1fcd..277373b8 100644 --- a/FLINT/FLINT/Dependency/Factory/CollectionDetailFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/CollectionDetailFactory.swift @@ -11,7 +11,7 @@ import Data import Domain import Presentation -protocol CollectionDetailFactory: CollectionRepositoryFactory, BookmarkFactory { +protocol CollectionDetailFactory: CollectionRepositoryFactory, FetchBookmarkedUserUseCaseFactory { // MARK: - UseCase func makeCollectionDetailUseCase(collectionRepository: CollectionRepository) -> CollectionDetailUseCase diff --git a/FLINT/FLINT/Dependency/Factory/Repository/BookmarkRepositoryFactory.swift b/FLINT/FLINT/Dependency/Factory/Repository/BookmarkRepositoryFactory.swift index e2d25e69..e17dd987 100644 --- a/FLINT/FLINT/Dependency/Factory/Repository/BookmarkRepositoryFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Repository/BookmarkRepositoryFactory.swift @@ -6,39 +6,19 @@ // import Foundation -import Moya import Data import Domain -protocol BookmarkRepositoryFactory { - func makeBookmarkAPIProvider() -> MoyaProvider - - // Service - func makeBookmarkService() -> BookmarkService - func makeBookmarkService(provider: MoyaProvider) -> BookmarkService - - // Repository +protocol BookmarkRepositoryFactory: BookmarkServiceFactory { func makeBookmarkRepository() -> BookmarkRepository func makeBookmarkRepository(bookmarkService: BookmarkService) -> BookmarkRepository } extension BookmarkRepositoryFactory { - - // Service - func makeBookmarkService() -> BookmarkService { - return makeBookmarkService(provider: makeBookmarkAPIProvider()) - } - - func makeBookmarkService(provider: MoyaProvider) -> BookmarkService { - return DefaultBookmarkService(provider: provider) - } - - // Repository func makeBookmarkRepository() -> BookmarkRepository { return makeBookmarkRepository(bookmarkService: makeBookmarkService()) } - func makeBookmarkRepository(bookmarkService: BookmarkService) -> BookmarkRepository { return DefaultBookmarkRepository(bookmarkService: bookmarkService) } diff --git a/FLINT/FLINT/Dependency/Factory/Service/BookmarkServiceFactory.swift b/FLINT/FLINT/Dependency/Factory/Service/BookmarkServiceFactory.swift new file mode 100644 index 00000000..307559dd --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/Service/BookmarkServiceFactory.swift @@ -0,0 +1,26 @@ +// +// BookmarkServiceFactory.swift +// FLINT +// +// Created by 김호성 on 2026.01.31. +// + +import Foundation + +import Moya + +import Data + +protocol BookmarkServiceFactory: BookmarkAPIProviderFactory { + func makeBookmarkService() -> BookmarkService + func makeBookmarkService(provider: MoyaProvider) -> BookmarkService +} + +extension BookmarkServiceFactory { + func makeBookmarkService() -> BookmarkService { + return makeBookmarkService(provider: makeBookmarkAPIProvider()) + } + func makeBookmarkService(provider: MoyaProvider) -> BookmarkService { + return DefaultBookmarkService(provider: provider) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/TokenStorage/TokenStorageFactory.swift b/FLINT/FLINT/Dependency/Factory/TokenStorage/TokenStorageFactory.swift index 6bc916f5..66d70f7d 100644 --- a/FLINT/FLINT/Dependency/Factory/TokenStorage/TokenStorageFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/TokenStorage/TokenStorageFactory.swift @@ -10,5 +10,13 @@ import Foundation import Data protocol TokenStorageFactory { + var tokenStorage: TokenStorage { get set } + func makeTokenStorage() -> TokenStorage } + +extension TokenStorageFactory { + func makeTokenStorage() -> TokenStorage { + return tokenStorage + } +} diff --git a/FLINT/FLINT/Dependency/Factory/BookmarkFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/FetchBookmarkedUserUseCaseFactory.swift similarity index 86% rename from FLINT/FLINT/Dependency/Factory/BookmarkFactory.swift rename to FLINT/FLINT/Dependency/Factory/UseCase/FetchBookmarkedUserUseCaseFactory.swift index 89b4f38d..84dd9db7 100644 --- a/FLINT/FLINT/Dependency/Factory/BookmarkFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/FetchBookmarkedUserUseCaseFactory.swift @@ -12,19 +12,15 @@ import Data import Domain import Presentation -protocol BookmarkFactory: BookmarkRepositoryFactory { - - // UseCase +protocol FetchBookmarkedUserUseCaseFactory: BookmarkRepositoryFactory { func makeFetchBookmarkedUserUseCase() -> FetchBookmarkedUserUseCase func makeFetchBookmarkedUserUseCase(bookmarkRepository: BookmarkRepository) -> FetchBookmarkedUserUseCase } -extension BookmarkFactory { - +extension FetchBookmarkedUserUseCaseFactory { func makeFetchBookmarkedUserUseCase() -> FetchBookmarkedUserUseCase { return makeFetchBookmarkedUserUseCase(bookmarkRepository: makeBookmarkRepository()) } - func makeFetchBookmarkedUserUseCase(bookmarkRepository: BookmarkRepository) -> FetchBookmarkedUserUseCase { return DefaultFetchBookmarkedUserUseCase(bookmarkRepository: bookmarkRepository) } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/UserProfileUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/UserProfileUseCaseFactory.swift new file mode 100644 index 00000000..f0f08ed6 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/UseCase/UserProfileUseCaseFactory.swift @@ -0,0 +1,24 @@ +// +// UserProfileUseCaseFactory.swift +// FLINT +// +// Created by 김호성 on 2026.01.31. +// + +import Foundation + +import Domain + +protocol UserProfileUseCaseFactory: UserRepositoryFactory { + func makeUserProfileUseCase() -> UserProfileUseCase + func makeUserProfileUseCase(userRepository: UserRepository) -> UserProfileUseCase +} + +extension UserProfileUseCaseFactory { + func makeUserProfileUseCase() -> UserProfileUseCase { + return makeUserProfileUseCase(userRepository: makeUserRepository()) + } + func makeUserProfileUseCase(userRepository: UserRepository) -> UserProfileUseCase { + return DefaultUserProfileUseCase(userRepository: userRepository) + } +} From 9c1a2fd397a9c939b24e131f384ec80f4418f5cf Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Mon, 2 Feb 2026 16:31:06 +0900 Subject: [PATCH 03/45] =?UTF-8?q?[refactor]=20di=20factory=20=ED=98=95?= =?UTF-8?q?=EC=8B=9D=20=ED=86=B5=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FLINT/FLINT/Dependency/DIContainer.swift | 19 ++- .../Factory/APIProvider/HomeAPIFactory.swift | 24 ++++ .../Factory/CreateCollectionFactory.swift | 41 ------- .../Dependency/Factory/HomeFactory.swift | 112 ------------------ .../Dependency/Factory/ProfileFactory.swift | 53 --------- .../Repository/HomeRepositoryFactory.swift | 25 ++++ .../Factory/Service/HomeServiceFactory.swift | 26 ++++ .../CollectionDetailUseCaseFactory.swift | 24 ++++ .../CreateCollectionUseCaseFactory.swift | 24 ++++ ...tchWatchingCollectionsUseCaseFactory.swift | 24 ++++ .../Factory/UseCase/HomeUseCaseFactory.swift | 24 ++++ ...llectionDetailViewControllerFactory+.swift | 2 +- ...tionFolderListViewControllerFactory+.swift | 5 +- ...eateCollectionViewControllerFactory+.swift | 2 +- .../HomeViewControllerFactory+.swift | 2 +- .../ProfileViewControllerFactory+.swift | 2 +- .../CollectionDetailViewModelFactory.swift} | 27 +---- .../CollectionFolderListViewModel.swift | 7 -- ...CollectionFolderListViewModelFactory.swift | 25 ++++ .../CreateCollectionViewModelFactory.swift | 25 ++++ .../ViewModel/HomeViewModelFactory.swift | 43 +++++++ .../ViewModel/ProfileViewModelFactory.swift | 33 ++++++ 22 files changed, 316 insertions(+), 253 deletions(-) create mode 100644 FLINT/FLINT/Dependency/Factory/APIProvider/HomeAPIFactory.swift delete mode 100644 FLINT/FLINT/Dependency/Factory/CreateCollectionFactory.swift delete mode 100644 FLINT/FLINT/Dependency/Factory/HomeFactory.swift delete mode 100644 FLINT/FLINT/Dependency/Factory/ProfileFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/Repository/HomeRepositoryFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/Service/HomeServiceFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/CollectionDetailUseCaseFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/CreateCollectionUseCaseFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/FetchWatchingCollectionsUseCaseFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/HomeUseCaseFactory.swift rename FLINT/FLINT/Dependency/Factory/{CollectionDetailFactory.swift => ViewModel/CollectionDetailViewModelFactory.swift} (53%) delete mode 100644 FLINT/FLINT/Dependency/Factory/ViewModel/CollectionFolderListViewModel.swift create mode 100644 FLINT/FLINT/Dependency/Factory/ViewModel/CollectionFolderListViewModelFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/ViewModel/CreateCollectionViewModelFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/ViewModel/HomeViewModelFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/ViewModel/ProfileViewModelFactory.swift diff --git a/FLINT/FLINT/Dependency/DIContainer.swift b/FLINT/FLINT/Dependency/DIContainer.swift index 07b59665..b47cf314 100644 --- a/FLINT/FLINT/Dependency/DIContainer.swift +++ b/FLINT/FLINT/Dependency/DIContainer.swift @@ -17,14 +17,17 @@ import Presentation typealias DependencyFactory = ViewControllerFactory & + LoginViewModelFactory & OnboardingViewModelFactory & + + HomeViewModelFactory & ExploreViewModelFactory & - CreateCollectionFactory & + ProfileViewModelFactory & + + CreateCollectionViewModelFactory & AddContentSelectViewModelFactory & - ProfileFactory & - HomeFactory & - CollectionDetailFactory & - LoginViewModelFactory + CollectionFolderListViewModelFactory & + CollectionDetailViewModelFactory final class DIContainer: DependencyFactory { @@ -68,7 +71,7 @@ final class DIContainer: DependencyFactory { ] ) - private lazy var homeAPIProvider = MoyaProvider( + lazy var homeAPIProvider = MoyaProvider( session: Session(interceptor: authInterceptor), plugins: [ networkLoggerPlugin @@ -80,8 +83,4 @@ final class DIContainer: DependencyFactory { init() { // tokenStorage.clearAll() } - - func makeHomeAPIProvider() -> MoyaProvider { - return homeAPIProvider - } } diff --git a/FLINT/FLINT/Dependency/Factory/APIProvider/HomeAPIFactory.swift b/FLINT/FLINT/Dependency/Factory/APIProvider/HomeAPIFactory.swift new file mode 100644 index 00000000..fa8bd8af --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/APIProvider/HomeAPIFactory.swift @@ -0,0 +1,24 @@ +// +// HomeAPIFactory.swift +// FLINT +// +// Created by 김호성 on 2026.01.31. +// + +import Foundation + +import Moya + +import Data + +protocol HomeAPIFactory { + var homeAPIProvider: MoyaProvider { get set } + + func makeHomeAPIProvider() -> MoyaProvider +} + +extension HomeAPIFactory { + func makeHomeAPIProvider() -> MoyaProvider { + return homeAPIProvider + } +} diff --git a/FLINT/FLINT/Dependency/Factory/CreateCollectionFactory.swift b/FLINT/FLINT/Dependency/Factory/CreateCollectionFactory.swift deleted file mode 100644 index 3868bace..00000000 --- a/FLINT/FLINT/Dependency/Factory/CreateCollectionFactory.swift +++ /dev/null @@ -1,41 +0,0 @@ -// -// CreateCollectionFactory.swift -// FLINT -// - -import Foundation -import Moya - -import Data -import Domain -import Presentation - -protocol CreateCollectionFactory: CollectionRepositoryFactory { - - // UseCase - func makeCreateCollectionUseCase() -> CreateCollectionUseCase - func makeCreateCollectionUseCase(collectionRepository: CollectionRepository) -> CreateCollectionUseCase - - // ViewModel - func makeCreateCollectionViewModel() -> CreateCollectionViewModel - func makeCreateCollectionViewModel(createCollectionUseCase: CreateCollectionUseCase) -> CreateCollectionViewModel -} - -extension CreateCollectionFactory { - - func makeCreateCollectionUseCase() -> CreateCollectionUseCase { - return makeCreateCollectionUseCase(collectionRepository: makeCollectionRepository()) - } - - func makeCreateCollectionUseCase(collectionRepository: CollectionRepository) -> CreateCollectionUseCase { - return DefaultCreateCollectionUseCase(collectionRepository: collectionRepository) - } - - func makeCreateCollectionViewModel() -> CreateCollectionViewModel { - return makeCreateCollectionViewModel(createCollectionUseCase: makeCreateCollectionUseCase()) - } - - func makeCreateCollectionViewModel(createCollectionUseCase: CreateCollectionUseCase) -> CreateCollectionViewModel { - return DefaultCreateCollectionViewModel(createCollectionUseCase: createCollectionUseCase) - } -} diff --git a/FLINT/FLINT/Dependency/Factory/HomeFactory.swift b/FLINT/FLINT/Dependency/Factory/HomeFactory.swift deleted file mode 100644 index e12126f1..00000000 --- a/FLINT/FLINT/Dependency/Factory/HomeFactory.swift +++ /dev/null @@ -1,112 +0,0 @@ -// -// HomeFactory.swift -// FLINT -// - -import Foundation -import Moya - -import Data -import Domain -import Presentation - -// MARK: - HomeFactory - -protocol HomeFactory: ProfileFactory, CreateCollectionFactory { - - // MARK: - Home (Recommended) - - // Root Dependency - func makeHomeAPIProvider() -> MoyaProvider - - // Service - func makeHomeService() -> HomeService - func makeHomeService(homeAPIProvider: MoyaProvider) -> HomeService - - // Repository - func makeHomeRepository() -> HomeRepository - func makeHomeRepository(homeService: HomeService) -> HomeRepository - - // UseCase - func makeHomeUseCase() -> HomeUseCase - func makeHomeUseCase(homeRepository: HomeRepository) -> HomeUseCase - - // MARK: - Watching Collections (Collection Swagger) - - // UseCase - func makeFetchWatchingCollectionsUseCase() -> FetchWatchingCollectionsUseCase - func makeFetchWatchingCollectionsUseCase(collectionRepository: CollectionRepository) -> FetchWatchingCollectionsUseCase - - // MARK: - ViewModel - - func makeHomeViewModel() -> HomeViewModel - func makeHomeViewModel( - homeUseCase: HomeUseCase, - userProfileUseCase: UserProfileUseCase, - fetchWatchingCollectionsUseCase: FetchWatchingCollectionsUseCase - ) -> HomeViewModel -} - -// MARK: - Default Implementations - -extension HomeFactory { - - // MARK: - Home (Recommended) - - func makeHomeService() -> HomeService { - makeHomeService(homeAPIProvider: makeHomeAPIProvider()) - } - - func makeHomeService(homeAPIProvider: MoyaProvider) -> HomeService { - DefaultHomeService(provider: homeAPIProvider) - } - - func makeHomeRepository() -> HomeRepository { - makeHomeRepository(homeService: makeHomeService()) - } - - func makeHomeRepository(homeService: HomeService) -> HomeRepository { - DefaultHomeRepository(homeService: homeService) - } - - func makeHomeUseCase() -> HomeUseCase { - makeHomeUseCase(homeRepository: makeHomeRepository()) - } - - func makeHomeUseCase(homeRepository: HomeRepository) -> HomeUseCase { - DefaultHomeUseCase(homeRepository: homeRepository) - } - - // MARK: - Watching Collections (Collection Swagger) - - func makeFetchWatchingCollectionsUseCase() -> FetchWatchingCollectionsUseCase { - makeFetchWatchingCollectionsUseCase(collectionRepository: makeCollectionRepository()) - } - - func makeFetchWatchingCollectionsUseCase(collectionRepository: CollectionRepository) -> FetchWatchingCollectionsUseCase { - DefaultFetchWatchingCollectionsUseCase(collectionRepository: collectionRepository) - } - - // MARK: - ViewModel - - func makeHomeViewModel() -> HomeViewModel { - makeHomeViewModel( - homeUseCase: makeHomeUseCase(), - userProfileUseCase: makeUserProfileUseCase(), - fetchWatchingCollectionsUseCase: makeFetchWatchingCollectionsUseCase() - ) - } - - func makeHomeViewModel( - homeUseCase: HomeUseCase, - userProfileUseCase: UserProfileUseCase, - fetchWatchingCollectionsUseCase: FetchWatchingCollectionsUseCase - ) -> HomeViewModel { - HomeViewModel( - homeUseCase: homeUseCase, - userProfileUseCase: userProfileUseCase, - fetchWatchingCollectionsUseCase: fetchWatchingCollectionsUseCase, - initialUserName: "얀비" - ) - } -} diff --git a/FLINT/FLINT/Dependency/Factory/ProfileFactory.swift b/FLINT/FLINT/Dependency/Factory/ProfileFactory.swift deleted file mode 100644 index e6ab9290..00000000 --- a/FLINT/FLINT/Dependency/Factory/ProfileFactory.swift +++ /dev/null @@ -1,53 +0,0 @@ -// -// ProfileFactory.swift -// FLINT -// -// Created by 진소은 on 1/22/26. -// -import Foundation - -import Moya - -import Data -import Domain -import Presentation - -protocol ProfileFactory: UserRepositoryFactory { - - // MARK: - UseCase - func makeUserProfileUseCase() -> UserProfileUseCase - func makeUserProfileUseCase(userRepository: UserRepository) -> UserProfileUseCase - - // MARK: - ViewModel - func makeProfileViewModel() -> ProfileViewModel - func makeProfileViewModel( - target: ProfileViewModel.Target - ) -> ProfileViewModel -} - -extension ProfileFactory { - - // MARK: - UseCase - func makeUserProfileUseCase() -> UserProfileUseCase { - return makeUserProfileUseCase(userRepository: makeUserRepository()) - } - - func makeUserProfileUseCase(userRepository: UserRepository) -> UserProfileUseCase { - return DefaultUserProfileUseCase(userRepository: userRepository) - } - - // MARK: - ViewModel - - func makeProfileViewModel() -> ProfileViewModel { - makeProfileViewModel(target: .me) - } - - func makeProfileViewModel( - target: ProfileViewModel.Target - ) -> ProfileViewModel { - ProfileViewModel( - target: target, - userProfileUseCase: makeUserProfileUseCase() - ) - } -} diff --git a/FLINT/FLINT/Dependency/Factory/Repository/HomeRepositoryFactory.swift b/FLINT/FLINT/Dependency/Factory/Repository/HomeRepositoryFactory.swift new file mode 100644 index 00000000..50e03173 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/Repository/HomeRepositoryFactory.swift @@ -0,0 +1,25 @@ +// +// HomeRepositoryFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.02. +// + +import Foundation + +import Data +import Domain + +protocol HomeRepositoryFactory: HomeServiceFactory { + func makeHomeRepository() -> HomeRepository + func makeHomeRepository(homeService: HomeService) -> HomeRepository +} + +extension HomeRepositoryFactory { + func makeHomeRepository() -> HomeRepository { + return makeHomeRepository(homeService: makeHomeService()) + } + func makeHomeRepository(homeService: HomeService) -> HomeRepository { + return DefaultHomeRepository(homeService: homeService) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/Service/HomeServiceFactory.swift b/FLINT/FLINT/Dependency/Factory/Service/HomeServiceFactory.swift new file mode 100644 index 00000000..26afd2ac --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/Service/HomeServiceFactory.swift @@ -0,0 +1,26 @@ +// +// HomeServiceFactory.swift +// FLINT +// +// Created by 김호성 on 2026.01.31. +// + +import Foundation + +import Moya + +import Data + +protocol HomeServiceFactory: HomeAPIFactory { + func makeHomeService() -> HomeService + func makeHomeService(homeAPIProvider: MoyaProvider) -> HomeService +} + +extension HomeServiceFactory { + func makeHomeService() -> HomeService { + return makeHomeService(homeAPIProvider: makeHomeAPIProvider()) + } + func makeHomeService(homeAPIProvider: MoyaProvider) -> HomeService { + return DefaultHomeService(provider: homeAPIProvider) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/CollectionDetailUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/CollectionDetailUseCaseFactory.swift new file mode 100644 index 00000000..2fb3a9e6 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/UseCase/CollectionDetailUseCaseFactory.swift @@ -0,0 +1,24 @@ +// +// CollectionDetailUseCaseFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.02. +// + +import Foundation + +import Domain + +protocol CollectionDetailUseCaseFactory: CollectionRepositoryFactory { + func makeCollectionDetailUseCase(collectionRepository: CollectionRepository) -> CollectionDetailUseCase + func makeCollectionDetailUseCase() -> CollectionDetailUseCase +} + +extension CollectionDetailUseCaseFactory { + func makeCollectionDetailUseCase() -> CollectionDetailUseCase { + return makeCollectionDetailUseCase(collectionRepository: makeCollectionRepository()) + } + func makeCollectionDetailUseCase(collectionRepository: CollectionRepository) -> CollectionDetailUseCase { + return DefaultCollectionDetailUseCase(collectionRepository: collectionRepository) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/CreateCollectionUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/CreateCollectionUseCaseFactory.swift new file mode 100644 index 00000000..2b78012c --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/UseCase/CreateCollectionUseCaseFactory.swift @@ -0,0 +1,24 @@ +// +// CreateCollectionUseCaseFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.02. +// + +import Foundation + +import Domain + +protocol CreateCollectionUseCaseFactory: CollectionRepositoryFactory { + func makeCreateCollectionUseCase() -> CreateCollectionUseCase + func makeCreateCollectionUseCase(collectionRepository: CollectionRepository) -> CreateCollectionUseCase +} + +extension CreateCollectionUseCaseFactory { + func makeCreateCollectionUseCase() -> CreateCollectionUseCase { + return makeCreateCollectionUseCase(collectionRepository: makeCollectionRepository()) + } + func makeCreateCollectionUseCase(collectionRepository: CollectionRepository) -> CreateCollectionUseCase { + return DefaultCreateCollectionUseCase(collectionRepository: collectionRepository) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/FetchWatchingCollectionsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/FetchWatchingCollectionsUseCaseFactory.swift new file mode 100644 index 00000000..c3dcb30c --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/UseCase/FetchWatchingCollectionsUseCaseFactory.swift @@ -0,0 +1,24 @@ +// +// FetchWatchingCollectionsUseCaseFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.02. +// + +import Foundation + +import Domain + +protocol FetchWatchingCollectionsUseCaseFactory: CollectionRepositoryFactory { + func makeFetchWatchingCollectionsUseCase() -> FetchWatchingCollectionsUseCase + func makeFetchWatchingCollectionsUseCase(collectionRepository: CollectionRepository) -> FetchWatchingCollectionsUseCase +} + +extension FetchWatchingCollectionsUseCaseFactory { + func makeFetchWatchingCollectionsUseCase() -> FetchWatchingCollectionsUseCase { + return makeFetchWatchingCollectionsUseCase(collectionRepository: makeCollectionRepository()) + } + func makeFetchWatchingCollectionsUseCase(collectionRepository: CollectionRepository) -> FetchWatchingCollectionsUseCase { + return DefaultFetchWatchingCollectionsUseCase(collectionRepository: collectionRepository) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/HomeUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/HomeUseCaseFactory.swift new file mode 100644 index 00000000..e2db3a5a --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/UseCase/HomeUseCaseFactory.swift @@ -0,0 +1,24 @@ +// +// HomeUseCaseFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.02. +// + +import Foundation + +import Domain + +protocol HomeUseCaseFactory: HomeRepositoryFactory { + func makeHomeUseCase() -> HomeUseCase + func makeHomeUseCase(homeRepository: HomeRepository) -> HomeUseCase +} + +extension HomeUseCaseFactory { + func makeHomeUseCase() -> HomeUseCase { + return makeHomeUseCase(homeRepository: makeHomeRepository()) + } + func makeHomeUseCase(homeRepository: HomeRepository) -> HomeUseCase { + return DefaultHomeUseCase(homeRepository: homeRepository) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/ViewController/CollectionDetailViewControllerFactory+.swift b/FLINT/FLINT/Dependency/Factory/ViewController/CollectionDetailViewControllerFactory+.swift index f849aa39..40ee1c14 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewController/CollectionDetailViewControllerFactory+.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewController/CollectionDetailViewControllerFactory+.swift @@ -9,7 +9,7 @@ import Foundation import Presentation -extension CollectionDetailViewControllerFactory where Self: CollectionDetailFactory & ViewControllerFactory { +extension CollectionDetailViewControllerFactory where Self: CollectionDetailViewModelFactory & ViewControllerFactory { func makeCollectionDetailViewController(collectionId: Int64) -> CollectionDetailViewController { return CollectionDetailViewController(viewModel: makeCollectionDetailViewModel(collectionId: collectionId), viewControllerFactory: self) } diff --git a/FLINT/FLINT/Dependency/Factory/ViewController/CollectionFolderListViewControllerFactory+.swift b/FLINT/FLINT/Dependency/Factory/ViewController/CollectionFolderListViewControllerFactory+.swift index 1f5ed29a..adace326 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewController/CollectionFolderListViewControllerFactory+.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewController/CollectionFolderListViewControllerFactory+.swift @@ -9,9 +9,8 @@ import Foundation import Presentation -extension CollectionFolderListViewControllerFactory where Self: HomeFactory & ViewControllerFactory { +extension CollectionFolderListViewControllerFactory where Self: CollectionFolderListViewModelFactory & ViewControllerFactory { func makeCollectionFolderListViewController() -> CollectionFolderListViewController { - let vm = CollectionFolderListViewModel(fetchWatchingCollectionsUseCase: makeFetchWatchingCollectionsUseCase()) - return CollectionFolderListViewController(viewModel: vm, viewControllerFactory: self) + return CollectionFolderListViewController(viewModel: makeCollectionFolderListViewModel(), viewControllerFactory: self) } } diff --git a/FLINT/FLINT/Dependency/Factory/ViewController/CreateCollectionViewControllerFactory+.swift b/FLINT/FLINT/Dependency/Factory/ViewController/CreateCollectionViewControllerFactory+.swift index 4c717023..5a83079a 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewController/CreateCollectionViewControllerFactory+.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewController/CreateCollectionViewControllerFactory+.swift @@ -9,7 +9,7 @@ import Foundation import Presentation -extension CreateCollectionViewControllerFactory where Self: CreateCollectionFactory & ViewControllerFactory { +extension CreateCollectionViewControllerFactory where Self: CreateCollectionViewModelFactory & ViewControllerFactory { func makeCreateCollectionViewController() -> CreateCollectionViewController { let vm = makeCreateCollectionViewModel() return CreateCollectionViewController(viewModel: vm, viewControllerFactory: self) diff --git a/FLINT/FLINT/Dependency/Factory/ViewController/HomeViewControllerFactory+.swift b/FLINT/FLINT/Dependency/Factory/ViewController/HomeViewControllerFactory+.swift index b11866f0..bcb7768c 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewController/HomeViewControllerFactory+.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewController/HomeViewControllerFactory+.swift @@ -9,7 +9,7 @@ import Foundation import Presentation -extension HomeViewControllerFactory where Self: HomeFactory & ViewControllerFactory { +extension HomeViewControllerFactory where Self: HomeViewModelFactory & ViewControllerFactory { func makeHomeViewController() -> HomeViewController { return HomeViewController(viewModel: makeHomeViewModel(), viewControllerFactory: self) } diff --git a/FLINT/FLINT/Dependency/Factory/ViewController/ProfileViewControllerFactory+.swift b/FLINT/FLINT/Dependency/Factory/ViewController/ProfileViewControllerFactory+.swift index 3fbee8a2..b6d6bdab 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewController/ProfileViewControllerFactory+.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewController/ProfileViewControllerFactory+.swift @@ -9,7 +9,7 @@ import Foundation import Presentation -extension ProfileViewControllerFactory where Self: ProfileFactory & ViewControllerFactory { +extension ProfileViewControllerFactory where Self: ProfileViewModelFactory & ViewControllerFactory { func makeProfileViewController() -> ProfileViewController { makeProfileViewController(target: .me) } diff --git a/FLINT/FLINT/Dependency/Factory/CollectionDetailFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionDetailViewModelFactory.swift similarity index 53% rename from FLINT/FLINT/Dependency/Factory/CollectionDetailFactory.swift rename to FLINT/FLINT/Dependency/Factory/ViewModel/CollectionDetailViewModelFactory.swift index 277373b8..9f8e18d6 100644 --- a/FLINT/FLINT/Dependency/Factory/CollectionDetailFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionDetailViewModelFactory.swift @@ -1,23 +1,16 @@ // -// CollectionDetailFactory.swift +// CollectionDetailViewModel.swift // FLINT // -// Created by 진소은 on 1/23/26. +// Created by 김호성 on 2026.02.02. // import Foundation -import Data import Domain import Presentation -protocol CollectionDetailFactory: CollectionRepositoryFactory, FetchBookmarkedUserUseCaseFactory { - - // MARK: - UseCase - func makeCollectionDetailUseCase(collectionRepository: CollectionRepository) -> CollectionDetailUseCase - func makeCollectionDetailUseCase() -> CollectionDetailUseCase - - // MARK: - ViewModel +protocol CollectionDetailViewModelFactory: CollectionDetailUseCaseFactory, FetchBookmarkedUserUseCaseFactory { func makeCollectionDetailViewModel(collectionId: Int64) -> CollectionDetailViewModel func makeCollectionDetailViewModel( collectionId: Int64, @@ -25,25 +18,13 @@ protocol CollectionDetailFactory: CollectionRepositoryFactory, FetchBookmarkedUs ) -> CollectionDetailViewModel } -extension CollectionDetailFactory { - - // MARK: - UseCase - func makeCollectionDetailUseCase() -> CollectionDetailUseCase { - return makeCollectionDetailUseCase(collectionRepository: makeCollectionRepository()) - } - - func makeCollectionDetailUseCase(collectionRepository: CollectionRepository) -> CollectionDetailUseCase { - return DefaultCollectionDetailUseCase(collectionRepository: collectionRepository) - } - - // MARK: - ViewModel +extension CollectionDetailViewModelFactory { func makeCollectionDetailViewModel(collectionId: Int64) -> CollectionDetailViewModel { return makeCollectionDetailViewModel( collectionId: collectionId, collectionDetailUseCase: makeCollectionDetailUseCase() ) } - func makeCollectionDetailViewModel( collectionId: Int64, collectionDetailUseCase: CollectionDetailUseCase diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionFolderListViewModel.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionFolderListViewModel.swift deleted file mode 100644 index 92dac4b6..00000000 --- a/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionFolderListViewModel.swift +++ /dev/null @@ -1,7 +0,0 @@ -// -// CollectionFolderListViewModel.swift -// FLINT -// -// Created by 소은 on 1/24/26. -// - diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionFolderListViewModelFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionFolderListViewModelFactory.swift new file mode 100644 index 00000000..e51f8564 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionFolderListViewModelFactory.swift @@ -0,0 +1,25 @@ +// +// CollectionFolderListViewModelFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.02. +// + +import Foundation + +import Domain +import Presentation + +protocol CollectionFolderListViewModelFactory: FetchWatchingCollectionsUseCaseFactory { + func makeCollectionFolderListViewModel() -> CollectionFolderListViewModel + func makeCollectionFolderListViewModel(fetchWatchingCollectionsUseCase: FetchWatchingCollectionsUseCase) -> CollectionFolderListViewModel +} + +extension CollectionFolderListViewModelFactory { + func makeCollectionFolderListViewModel() -> CollectionFolderListViewModel { + return makeCollectionFolderListViewModel(fetchWatchingCollectionsUseCase: makeFetchWatchingCollectionsUseCase()) + } + func makeCollectionFolderListViewModel(fetchWatchingCollectionsUseCase: FetchWatchingCollectionsUseCase) -> CollectionFolderListViewModel { + return CollectionFolderListViewModel(fetchWatchingCollectionsUseCase: fetchWatchingCollectionsUseCase) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/CreateCollectionViewModelFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/CreateCollectionViewModelFactory.swift new file mode 100644 index 00000000..18cb24c0 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/CreateCollectionViewModelFactory.swift @@ -0,0 +1,25 @@ +// +// CreateCollectionViewModel.swift +// FLINT +// +// Created by 김호성 on 2026.02.02. +// + +import Foundation + +import Domain +import Presentation + +protocol CreateCollectionViewModelFactory: CreateCollectionUseCaseFactory { + func makeCreateCollectionViewModel() -> CreateCollectionViewModel + func makeCreateCollectionViewModel(createCollectionUseCase: CreateCollectionUseCase) -> CreateCollectionViewModel +} + +extension CreateCollectionViewModelFactory { + func makeCreateCollectionViewModel() -> CreateCollectionViewModel { + return makeCreateCollectionViewModel(createCollectionUseCase: makeCreateCollectionUseCase()) + } + func makeCreateCollectionViewModel(createCollectionUseCase: CreateCollectionUseCase) -> CreateCollectionViewModel { + return DefaultCreateCollectionViewModel(createCollectionUseCase: createCollectionUseCase) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/HomeViewModelFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/HomeViewModelFactory.swift new file mode 100644 index 00000000..3425cfcf --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/HomeViewModelFactory.swift @@ -0,0 +1,43 @@ +// +// HomeViewModelFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.02. +// + +import Foundation + +import Domain +import Presentation + +protocol HomeViewModelFactory: HomeUseCaseFactory, UserProfileUseCaseFactory, FetchWatchingCollectionsUseCaseFactory { + func makeHomeViewModel() -> HomeViewModel + func makeHomeViewModel( + homeUseCase: HomeUseCase, + userProfileUseCase: UserProfileUseCase, + fetchWatchingCollectionsUseCase: FetchWatchingCollectionsUseCase + ) -> HomeViewModel +} + +extension HomeViewModelFactory { + func makeHomeViewModel() -> HomeViewModel { + return makeHomeViewModel( + homeUseCase: makeHomeUseCase(), + userProfileUseCase: makeUserProfileUseCase(), + fetchWatchingCollectionsUseCase: makeFetchWatchingCollectionsUseCase() + ) + } + + func makeHomeViewModel( + homeUseCase: HomeUseCase, + userProfileUseCase: UserProfileUseCase, + fetchWatchingCollectionsUseCase: FetchWatchingCollectionsUseCase + ) -> HomeViewModel { + return HomeViewModel( + homeUseCase: homeUseCase, + userProfileUseCase: userProfileUseCase, + fetchWatchingCollectionsUseCase: fetchWatchingCollectionsUseCase, + initialUserName: "얀비" + ) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/ProfileViewModelFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/ProfileViewModelFactory.swift new file mode 100644 index 00000000..94bdd973 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/ProfileViewModelFactory.swift @@ -0,0 +1,33 @@ +// +// ProfileViewModelFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.02. +// + +import Foundation + +import Domain +import Presentation + +protocol ProfileViewModelFactory: UserProfileUseCaseFactory { + func makeProfileViewModel() -> ProfileViewModel + func makeProfileViewModel( + target: ProfileViewModel.Target + ) -> ProfileViewModel +} + +extension ProfileViewModelFactory { + func makeProfileViewModel() -> ProfileViewModel { + return makeProfileViewModel(target: .me) + } + + func makeProfileViewModel( + target: ProfileViewModel.Target + ) -> ProfileViewModel { + return ProfileViewModel( + target: target, + userProfileUseCase: makeUserProfileUseCase() + ) + } +} From 9325c065e722713d46dadaf9a4e39b784a50da98 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Wed, 4 Feb 2026 00:47:18 +0900 Subject: [PATCH 04/45] =?UTF-8?q?[refactor]=20API=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81=20=EC=9E=91=EC=97=85=20=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * AuthAPI 리팩 완료 * BookmarkAPI 리팩 완료 * CollectionAPI 리팩 완료 --- .../Data/Sources/Networking/API/AuthAPI.swift | 19 +++++++++----- .../Sources/Networking/API/BookmarkAPI.swift | 20 +++++--------- .../Networking/API/CollectionAPI.swift | 26 +++++++------------ 3 files changed, 28 insertions(+), 37 deletions(-) diff --git a/FLINT/Data/Sources/Networking/API/AuthAPI.swift b/FLINT/Data/Sources/Networking/API/AuthAPI.swift index 061fc20f..4dcd80d8 100644 --- a/FLINT/Data/Sources/Networking/API/AuthAPI.swift +++ b/FLINT/Data/Sources/Networking/API/AuthAPI.swift @@ -17,8 +17,9 @@ public enum AuthAPI { case logout case logoutAll case refresh - case signup(_ signupInfoEntity: SignupRequestDTO) - case socialVerify(_socialVerifyRequestDTO: SocialVerifyRequestDTO) + case signup(userInfo: SignupRequestDTO) + case socialVerify(socialAuthCredential: SocialVerifyRequestDTO) + case withdraw } extension AuthAPI: TargetType { @@ -31,6 +32,8 @@ extension AuthAPI: TargetType { return "TODO" case .socialVerify: return "/api/v1/auth/social/verify" + case .withdraw: + return "/api/v1/auth/withdraw" } } @@ -38,17 +41,19 @@ extension AuthAPI: TargetType { switch self { case .logout, .logoutAll, .refresh, .signup, .socialVerify: return .post + case .withdraw: + return .delete } } public var task: Moya.Task { switch self { - case .signup(let signupInfoEntity): - return .requestJSONEncodable(signupInfoEntity) - case .logout, .logoutAll, .refresh: + case .signup(let userInfo): + return .requestJSONEncodable(userInfo) + case .socialVerify(let socialAuthCredential): + return .requestJSONEncodable(socialAuthCredential) + case .logout, .logoutAll, .refresh, .withdraw: return .requestPlain - case .socialVerify(let socialVerifyRequestDTO): - return .requestJSONEncodable(socialVerifyRequestDTO) } } } diff --git a/FLINT/Data/Sources/Networking/API/BookmarkAPI.swift b/FLINT/Data/Sources/Networking/API/BookmarkAPI.swift index 048ceabb..5f865d56 100644 --- a/FLINT/Data/Sources/Networking/API/BookmarkAPI.swift +++ b/FLINT/Data/Sources/Networking/API/BookmarkAPI.swift @@ -12,42 +12,36 @@ import Domain import Moya public enum BookmarkAPI { - case toggleCollectionBookmark(_ collectionId: Int64) - case toggleContentBookmark(_ contentId: Int64) case fetchCollectionBookmarkUsers(collectionId: Int64) + case toggleCollectionBookmark(collectionId: Int64) + case toggleContentBookmark(contentId: Int64) } extension BookmarkAPI: TargetType { public var path: String { switch self { + case .fetchCollectionBookmarkUsers(let collectionId): + return "/api/v1/bookmarks/\(collectionId)" case .toggleCollectionBookmark(let collectionId): return "/api/v1/bookmarks/collections/\(collectionId)" case .toggleContentBookmark(let contentId): return "/api/v1/bookmarks/contents/\(contentId)" - case let .fetchCollectionBookmarkUsers(collectionId): - return "/api/v1/bookmarks/\(collectionId)" } } public var method: Moya.Method { switch self { - case .toggleCollectionBookmark: - return .post - case .toggleContentBookmark: - return .post case .fetchCollectionBookmarkUsers: return .get + case .toggleCollectionBookmark, .toggleContentBookmark: + return .post } } public var task: Moya.Task { switch self { - case .toggleCollectionBookmark: - return .requestPlain - case .toggleContentBookmark: - return .requestPlain - case .fetchCollectionBookmarkUsers: + case .fetchCollectionBookmarkUsers, .toggleCollectionBookmark, .toggleContentBookmark: return .requestPlain } } diff --git a/FLINT/Data/Sources/Networking/API/CollectionAPI.swift b/FLINT/Data/Sources/Networking/API/CollectionAPI.swift index 041363d0..ec7b7998 100644 --- a/FLINT/Data/Sources/Networking/API/CollectionAPI.swift +++ b/FLINT/Data/Sources/Networking/API/CollectionAPI.swift @@ -12,37 +12,31 @@ import Domain import Moya public enum CollectionAPI { - case fetchCollections(cursor: UInt?, size: Int) - case createCollection(_ request: CreateCollectionEntity) + case fetchCollections(cursor: Int64?, size: Int32) + case createCollection(collectionInfo: CreateCollectionEntity) case fetchCollectionDetail(collectionId: Int64) - case fetchWatchingCollections + case fetchRecentCollections } extension CollectionAPI: TargetType { public var path: String { switch self { - case .fetchCollections: - return "/api/v1/collections" - case .createCollection: + case .fetchCollections, .createCollection: return "/api/v1/collections" case let .fetchCollectionDetail(collectionId): return "/api/v1/collections/\(collectionId)" - case let .fetchWatchingCollections: + case .fetchRecentCollections: return "/api/v1/collections/recent" } } public var method: Moya.Method { switch self { - case .fetchCollections: + case .fetchCollections, .fetchCollectionDetail, .fetchRecentCollections: return .get case .createCollection: return .post - case .fetchCollectionDetail: - return .get - case .fetchWatchingCollections: - return .get } } @@ -59,11 +53,9 @@ extension CollectionAPI: TargetType { parameters: parameters, encoding: URLEncoding.queryString ) - case .createCollection(let request): - return .requestJSONEncodable(request) - case .fetchCollectionDetail: - return .requestPlain - case .fetchWatchingCollections: + case .createCollection(let collectionInfo): + return .requestJSONEncodable(collectionInfo) + case .fetchCollectionDetail, .fetchRecentCollections: return .requestPlain } } From 7193226843e48474c12972ec9631b38bf6c85a0e Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Wed, 4 Feb 2026 00:55:02 +0900 Subject: [PATCH 05/45] =?UTF-8?q?[chore]=20import=20=EC=BB=A8=EB=B2=A4?= =?UTF-8?q?=EC=85=98=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FLINT/Data/Sources/Networking/API/BookmarkAPI.swift | 4 ++-- FLINT/Data/Sources/Networking/API/CollectionAPI.swift | 4 ++-- FLINT/Data/Sources/Networking/API/ContentAPI.swift | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/FLINT/Data/Sources/Networking/API/BookmarkAPI.swift b/FLINT/Data/Sources/Networking/API/BookmarkAPI.swift index 5f865d56..fb13b8cc 100644 --- a/FLINT/Data/Sources/Networking/API/BookmarkAPI.swift +++ b/FLINT/Data/Sources/Networking/API/BookmarkAPI.swift @@ -7,10 +7,10 @@ import Foundation -import Domain - import Moya +import Domain + public enum BookmarkAPI { case fetchCollectionBookmarkUsers(collectionId: Int64) case toggleCollectionBookmark(collectionId: Int64) diff --git a/FLINT/Data/Sources/Networking/API/CollectionAPI.swift b/FLINT/Data/Sources/Networking/API/CollectionAPI.swift index ec7b7998..65d71041 100644 --- a/FLINT/Data/Sources/Networking/API/CollectionAPI.swift +++ b/FLINT/Data/Sources/Networking/API/CollectionAPI.swift @@ -7,10 +7,10 @@ import Foundation -import Domain - import Moya +import Domain + public enum CollectionAPI { case fetchCollections(cursor: Int64?, size: Int32) case createCollection(collectionInfo: CreateCollectionEntity) diff --git a/FLINT/Data/Sources/Networking/API/ContentAPI.swift b/FLINT/Data/Sources/Networking/API/ContentAPI.swift index 91d0739d..db5d5307 100644 --- a/FLINT/Data/Sources/Networking/API/ContentAPI.swift +++ b/FLINT/Data/Sources/Networking/API/ContentAPI.swift @@ -5,7 +5,6 @@ // Created by 소은 on 1/21/26. // - import Foundation import Moya From a5140d820d6fb7dc4d70041d207f664352d64ede Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Wed, 4 Feb 2026 19:52:11 +0900 Subject: [PATCH 06/45] =?UTF-8?q?[refactor]=20API=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Data/Sources/Networking/API/AuthAPI.swift | 4 +- .../Sources/Networking/API/BookmarkAPI.swift | 6 +- .../Networking/API/CollectionAPI.swift | 4 +- .../Sources/Networking/API/ContentAPI.swift | 11 +- .../Sources/Networking/API/SearchAPI.swift | 5 +- .../Data/Sources/Networking/API/UserAPI.swift | 101 ++++++------------ 6 files changed, 52 insertions(+), 79 deletions(-) diff --git a/FLINT/Data/Sources/Networking/API/AuthAPI.swift b/FLINT/Data/Sources/Networking/API/AuthAPI.swift index 4dcd80d8..3dfaea74 100644 --- a/FLINT/Data/Sources/Networking/API/AuthAPI.swift +++ b/FLINT/Data/Sources/Networking/API/AuthAPI.swift @@ -48,9 +48,9 @@ extension AuthAPI: TargetType { public var task: Moya.Task { switch self { - case .signup(let userInfo): + case let .signup(userInfo): return .requestJSONEncodable(userInfo) - case .socialVerify(let socialAuthCredential): + case let .socialVerify(socialAuthCredential): return .requestJSONEncodable(socialAuthCredential) case .logout, .logoutAll, .refresh, .withdraw: return .requestPlain diff --git a/FLINT/Data/Sources/Networking/API/BookmarkAPI.swift b/FLINT/Data/Sources/Networking/API/BookmarkAPI.swift index fb13b8cc..37fa104a 100644 --- a/FLINT/Data/Sources/Networking/API/BookmarkAPI.swift +++ b/FLINT/Data/Sources/Networking/API/BookmarkAPI.swift @@ -21,11 +21,11 @@ extension BookmarkAPI: TargetType { public var path: String { switch self { - case .fetchCollectionBookmarkUsers(let collectionId): + case let .fetchCollectionBookmarkUsers(collectionId): return "/api/v1/bookmarks/\(collectionId)" - case .toggleCollectionBookmark(let collectionId): + case let .toggleCollectionBookmark(collectionId): return "/api/v1/bookmarks/collections/\(collectionId)" - case .toggleContentBookmark(let contentId): + case let .toggleContentBookmark(contentId): return "/api/v1/bookmarks/contents/\(contentId)" } } diff --git a/FLINT/Data/Sources/Networking/API/CollectionAPI.swift b/FLINT/Data/Sources/Networking/API/CollectionAPI.swift index 65d71041..2450a642 100644 --- a/FLINT/Data/Sources/Networking/API/CollectionAPI.swift +++ b/FLINT/Data/Sources/Networking/API/CollectionAPI.swift @@ -42,7 +42,7 @@ extension CollectionAPI: TargetType { public var task: Moya.Task { switch self { - case .fetchCollections(let cursor, let size): + case let .fetchCollections(cursor, size): var parameters: [String: Any] = [ "size": size, ] @@ -53,7 +53,7 @@ extension CollectionAPI: TargetType { parameters: parameters, encoding: URLEncoding.queryString ) - case .createCollection(let collectionInfo): + case let .createCollection(collectionInfo): return .requestJSONEncodable(collectionInfo) case .fetchCollectionDetail, .fetchRecentCollections: return .requestPlain diff --git a/FLINT/Data/Sources/Networking/API/ContentAPI.swift b/FLINT/Data/Sources/Networking/API/ContentAPI.swift index db5d5307..4f2542b2 100644 --- a/FLINT/Data/Sources/Networking/API/ContentAPI.swift +++ b/FLINT/Data/Sources/Networking/API/ContentAPI.swift @@ -12,28 +12,31 @@ import Moya import Domain public enum ContentAPI { - case fetchOTTPlatforms(_ contentId: Int64) + case fetchMyBookmarkedContents + case fetchOTTPlatformsForContent(contentId: Int64) } extension ContentAPI: TargetType { public var path: String { switch self { - case .fetchOTTPlatforms(let contentId): + case .fetchMyBookmarkedContents: + return "/api/v1/contents/bookmarks" + case let .fetchOTTPlatformsForContent(contentId): return "/api/v1/contents/ott/\(contentId)" } } public var method: Moya.Method { switch self { - case .fetchOTTPlatforms: + case .fetchMyBookmarkedContents, .fetchOTTPlatformsForContent: return .get } } public var task: Moya.Task { switch self { - case .fetchOTTPlatforms: + case .fetchMyBookmarkedContents, .fetchOTTPlatformsForContent: return .requestPlain } } diff --git a/FLINT/Data/Sources/Networking/API/SearchAPI.swift b/FLINT/Data/Sources/Networking/API/SearchAPI.swift index 72b9fac5..a634bece 100644 --- a/FLINT/Data/Sources/Networking/API/SearchAPI.swift +++ b/FLINT/Data/Sources/Networking/API/SearchAPI.swift @@ -12,7 +12,8 @@ import Moya import Domain public enum SearchAPI { - case searchContents(_ keyword: String?) + /// keyword가 nil인 경우 인기 순 작품 리스트를 받는다. + case searchContents(keyword: String?) } extension SearchAPI: TargetType { @@ -33,7 +34,7 @@ extension SearchAPI: TargetType { public var task: Moya.Task { switch self { - case .searchContents(let keyword): + case let .searchContents(keyword): var parameters: [String: Any] = [:] if let keyword { parameters["keyword"] = keyword diff --git a/FLINT/Data/Sources/Networking/API/UserAPI.swift b/FLINT/Data/Sources/Networking/API/UserAPI.swift index 0cbf7363..c9a8c64f 100644 --- a/FLINT/Data/Sources/Networking/API/UserAPI.swift +++ b/FLINT/Data/Sources/Networking/API/UserAPI.swift @@ -12,99 +12,68 @@ import Moya import Domain public enum UserAPI { - case checkNickname(_ nickname: String) case fetchUserProfile(userId: Int64) - case fetchMyProfile - case fetchMyKeywords - case fetchUserKeywords(userId: Int64) - case fetchMyCollections + case fetchUserBookmarkedCollections(userId: Int64) + case fetchUserBookmarkedContents(userId: Int64) case fetchUserCollections(userId: Int64) + case fetchUserKeywords(userId: Int64) + + case fetchMyProfile case fetchMyBookmarkedCollections - case fetchBookmarkedCollections(userId: Int64) - case fetchMyBookmarkedContents - case fetchBookmarkedContents(userId: Int64) + case fetchMyCollections + case fetchMyKeywords + case recalculateMyKeywords + + case checkNickname(_ nickname: String) } extension UserAPI: TargetType { public var path: String { switch self { - case .checkNickname: - return "/api/v1/users/nickname/check" case let .fetchUserProfile(userId): return "/api/v1/users/\(userId)" - case .fetchMyProfile: - return "/api/v1/users/me" - case .fetchMyKeywords: - return "/api/v1/users/me/keywords" - case let .fetchUserKeywords(userId): - return "/api/v1/users/\(userId)/keywords" - case .fetchMyCollections: - return "/api/v1/users/me/collections" + case let .fetchUserBookmarkedCollections(userId): + return "/api/v1/users/\(userId)/bookmarked-collections" + case let .fetchUserBookmarkedContents(userId): + return "/api/v1/users/\(userId)/bookmarked-contents" case let .fetchUserCollections(userId): return "/api/v1/users/\(userId)/collections" + case let .fetchUserKeywords(userId): + return "/api/v1/users/\(userId)/keywords" + + case .fetchMyProfile: + return "/api/v1/users/me" case .fetchMyBookmarkedCollections: return "/api/v1/users/me/bookmarked-collections" - case let .fetchBookmarkedCollections(userId): - return "/api/v1/users/\(userId)/bookmarked-collections" - case .fetchMyBookmarkedContents: - return "/api/v1/contents/bookmarks" - case let .fetchBookmarkedContents(userId): - return "/api/v1/users/\(userId)/bookmarked-contents" + case .fetchMyCollections: + return "/api/v1/users/me/collections" + case .fetchMyKeywords: + return "/api/v1/users/me/keywords" + case .recalculateMyKeywords: + return "/api/v1/users/me/keywords/recalculate" + + case .checkNickname: + return "/api/v1/users/nickname/check" } } public var method: Moya.Method { switch self { - case .checkNickname: - return .get - case .fetchUserProfile: - return .get - case .fetchMyProfile: - return .get - case .fetchMyKeywords: - return .get - case .fetchUserKeywords: - return .get - case .fetchUserCollections: - return .get - case .fetchMyCollections: - return .get - case .fetchMyBookmarkedCollections: - return .get - case .fetchBookmarkedCollections: - return .get - case .fetchMyBookmarkedContents: - return .get - case .fetchBookmarkedContents: + case .fetchUserProfile, .fetchUserBookmarkedCollections, .fetchUserBookmarkedContents, .fetchUserCollections, .fetchUserKeywords, .fetchMyProfile, .fetchMyBookmarkedCollections, .fetchMyCollections, .fetchMyKeywords, .checkNickname: return .get + case .recalculateMyKeywords: + return .patch } } public var task: Moya.Task { switch self { - case .checkNickname(let nickname): + case let .checkNickname(nickname): return .requestParameters( parameters: ["nickname": nickname], - encoding: URLEncoding.queryString) - case .fetchUserProfile: - return .requestPlain - case .fetchMyProfile: - return .requestPlain - case .fetchMyKeywords: - return .requestPlain - case .fetchUserKeywords: - return .requestPlain - case .fetchUserCollections: - return .requestPlain - case .fetchMyCollections: - return .requestPlain - case .fetchMyBookmarkedCollections: - return .requestPlain - case .fetchBookmarkedCollections: - return .requestPlain - case .fetchMyBookmarkedContents: - return .requestPlain - case .fetchBookmarkedContents: + encoding: URLEncoding.queryString + ) + case .fetchUserProfile, .fetchUserBookmarkedCollections, .fetchUserBookmarkedContents, .fetchUserCollections, .fetchUserKeywords, .fetchMyProfile, .fetchMyBookmarkedCollections, .fetchMyCollections, .fetchMyKeywords, .recalculateMyKeywords: return .requestPlain } } From db4e60e51034554aed6e73603668bb5162809d6f Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Wed, 4 Feb 2026 19:56:02 +0900 Subject: [PATCH 07/45] =?UTF-8?q?[chore]=20=EC=A3=BC=EC=84=9D=20=EB=B0=8F?= =?UTF-8?q?=20=EA=B0=9C=ED=96=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FLINT/Data/Sources/Networking/API/AuthAPI.swift | 3 +-- FLINT/Data/Sources/Networking/API/BookmarkAPI.swift | 1 - FLINT/Data/Sources/Networking/API/CollectionAPI.swift | 2 -- FLINT/Data/Sources/Networking/API/ContentAPI.swift | 2 -- FLINT/Data/Sources/Networking/API/HomeAPI.swift | 1 - FLINT/Data/Sources/Networking/API/SearchAPI.swift | 3 +-- FLINT/Data/Sources/Networking/API/UserAPI.swift | 2 +- 7 files changed, 3 insertions(+), 11 deletions(-) diff --git a/FLINT/Data/Sources/Networking/API/AuthAPI.swift b/FLINT/Data/Sources/Networking/API/AuthAPI.swift index 3dfaea74..b6f2467f 100644 --- a/FLINT/Data/Sources/Networking/API/AuthAPI.swift +++ b/FLINT/Data/Sources/Networking/API/AuthAPI.swift @@ -1,5 +1,5 @@ // -// File.swift +// AuthAPI.swift // Data // // Created by 김호성 on 2026.01.21. @@ -23,7 +23,6 @@ public enum AuthAPI { } extension AuthAPI: TargetType { - public var path: String { switch self { case .signup: diff --git a/FLINT/Data/Sources/Networking/API/BookmarkAPI.swift b/FLINT/Data/Sources/Networking/API/BookmarkAPI.swift index 37fa104a..c0cbff6a 100644 --- a/FLINT/Data/Sources/Networking/API/BookmarkAPI.swift +++ b/FLINT/Data/Sources/Networking/API/BookmarkAPI.swift @@ -18,7 +18,6 @@ public enum BookmarkAPI { } extension BookmarkAPI: TargetType { - public var path: String { switch self { case let .fetchCollectionBookmarkUsers(collectionId): diff --git a/FLINT/Data/Sources/Networking/API/CollectionAPI.swift b/FLINT/Data/Sources/Networking/API/CollectionAPI.swift index 2450a642..167ad937 100644 --- a/FLINT/Data/Sources/Networking/API/CollectionAPI.swift +++ b/FLINT/Data/Sources/Networking/API/CollectionAPI.swift @@ -19,7 +19,6 @@ public enum CollectionAPI { } extension CollectionAPI: TargetType { - public var path: String { switch self { case .fetchCollections, .createCollection: @@ -60,4 +59,3 @@ extension CollectionAPI: TargetType { } } } - diff --git a/FLINT/Data/Sources/Networking/API/ContentAPI.swift b/FLINT/Data/Sources/Networking/API/ContentAPI.swift index 4f2542b2..a8173751 100644 --- a/FLINT/Data/Sources/Networking/API/ContentAPI.swift +++ b/FLINT/Data/Sources/Networking/API/ContentAPI.swift @@ -17,7 +17,6 @@ public enum ContentAPI { } extension ContentAPI: TargetType { - public var path: String { switch self { case .fetchMyBookmarkedContents: @@ -41,4 +40,3 @@ extension ContentAPI: TargetType { } } } - diff --git a/FLINT/Data/Sources/Networking/API/HomeAPI.swift b/FLINT/Data/Sources/Networking/API/HomeAPI.swift index 248ceaba..b8b66399 100644 --- a/FLINT/Data/Sources/Networking/API/HomeAPI.swift +++ b/FLINT/Data/Sources/Networking/API/HomeAPI.swift @@ -16,7 +16,6 @@ public enum HomeAPI { } extension HomeAPI: TargetType { - public var path: String { switch self { case .fetchRecommendedCollections: diff --git a/FLINT/Data/Sources/Networking/API/SearchAPI.swift b/FLINT/Data/Sources/Networking/API/SearchAPI.swift index a634bece..2e9b609a 100644 --- a/FLINT/Data/Sources/Networking/API/SearchAPI.swift +++ b/FLINT/Data/Sources/Networking/API/SearchAPI.swift @@ -1,5 +1,5 @@ // -// SearchContentsAPI.swift +// SearchAPI.swift // Data // // Created by 소은 on 1/20/26. @@ -17,7 +17,6 @@ public enum SearchAPI { } extension SearchAPI: TargetType { - public var path: String { switch self { case .searchContents: diff --git a/FLINT/Data/Sources/Networking/API/UserAPI.swift b/FLINT/Data/Sources/Networking/API/UserAPI.swift index c9a8c64f..0dc7b425 100644 --- a/FLINT/Data/Sources/Networking/API/UserAPI.swift +++ b/FLINT/Data/Sources/Networking/API/UserAPI.swift @@ -1,5 +1,5 @@ // -// File.swift +// UserAPI.swift // Data // // Created by 김호성 on 2026.01.19. From dc8dd01fc0c82586b80b47902c7ec9d677d9c9d2 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Thu, 5 Feb 2026 14:23:27 +0900 Subject: [PATCH 08/45] =?UTF-8?q?[refactor]=20Auth=20DTO=20=EB=A6=AC?= =?UTF-8?q?=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * unwrap 함수 단순화 --- FLINT/Data/Sources/DTO/Auth/SignupDTO.swift | 10 +++++----- FLINT/Data/Sources/DTO/Auth/SignupRequestDTO.swift | 2 +- FLINT/Data/Sources/DTO/Auth/SocialRegisterDTO.swift | 13 ------------- .../Sources/DTO/Auth/SocialVerifyRequestDTO.swift | 2 +- .../Sources/DTO/Auth/SocialVerifyResponseDTO.swift | 11 +---------- FLINT/Data/Sources/DTO/Base/Unwrap.swift | 13 ++++++------- 6 files changed, 14 insertions(+), 37 deletions(-) delete mode 100644 FLINT/Data/Sources/DTO/Auth/SocialRegisterDTO.swift diff --git a/FLINT/Data/Sources/DTO/Auth/SignupDTO.swift b/FLINT/Data/Sources/DTO/Auth/SignupDTO.swift index 0692df63..e4080763 100644 --- a/FLINT/Data/Sources/DTO/Auth/SignupDTO.swift +++ b/FLINT/Data/Sources/DTO/Auth/SignupDTO.swift @@ -1,5 +1,5 @@ // -// File.swift +// SignupDTO.swift // Data // // Created by 김호성 on 2026.01.21. @@ -19,16 +19,16 @@ extension SignupDTO { public var loginEntity: LoginEntity { get throws { return try LoginEntity( - accessToken: unwrap(accessToken, key: CodingKeys.accessToken), - refreshToken: unwrap(refreshToken, key: CodingKeys.refreshToken), - userId: unwrap(userId, key: CodingKeys.userId) + accessToken: unwrap(accessToken), + refreshToken: unwrap(refreshToken), + userId: unwrap(userId) ) } } public var userIdValue: String { get throws { - return try unwrap(userId, key: CodingKeys.userId) + return try unwrap(userId) } } } diff --git a/FLINT/Data/Sources/DTO/Auth/SignupRequestDTO.swift b/FLINT/Data/Sources/DTO/Auth/SignupRequestDTO.swift index f8873627..8a25fd6e 100644 --- a/FLINT/Data/Sources/DTO/Auth/SignupRequestDTO.swift +++ b/FLINT/Data/Sources/DTO/Auth/SignupRequestDTO.swift @@ -1,5 +1,5 @@ // -// File.swift +// SignupRequestDTO.swift // Data // // Created by 김호성 on 2026.01.23. diff --git a/FLINT/Data/Sources/DTO/Auth/SocialRegisterDTO.swift b/FLINT/Data/Sources/DTO/Auth/SocialRegisterDTO.swift deleted file mode 100644 index 18400a77..00000000 --- a/FLINT/Data/Sources/DTO/Auth/SocialRegisterDTO.swift +++ /dev/null @@ -1,13 +0,0 @@ -// -// File.swift -// Data -// -// Created by 김호성 on 2026.01.23. -// - -import Foundation - -struct SocialRegisterDTO { - public let isRegistered: Bool? - public let tempToken: String? -} diff --git a/FLINT/Data/Sources/DTO/Auth/SocialVerifyRequestDTO.swift b/FLINT/Data/Sources/DTO/Auth/SocialVerifyRequestDTO.swift index 16bcb5c4..989a6878 100644 --- a/FLINT/Data/Sources/DTO/Auth/SocialVerifyRequestDTO.swift +++ b/FLINT/Data/Sources/DTO/Auth/SocialVerifyRequestDTO.swift @@ -1,5 +1,5 @@ // -// File.swift +// SocialVerifyRequestDTO.swift // Data // // Created by 김호성 on 2026.01.23. diff --git a/FLINT/Data/Sources/DTO/Auth/SocialVerifyResponseDTO.swift b/FLINT/Data/Sources/DTO/Auth/SocialVerifyResponseDTO.swift index c78acbbb..cb98ee2d 100644 --- a/FLINT/Data/Sources/DTO/Auth/SocialVerifyResponseDTO.swift +++ b/FLINT/Data/Sources/DTO/Auth/SocialVerifyResponseDTO.swift @@ -1,5 +1,5 @@ // -// File.swift +// SocialVerifyResponseDTO.swift // Data // // Created by 김호성 on 2026.01.23. @@ -16,15 +16,6 @@ public struct SocialVerifyResponseDTO: Codable { public let userId: String? public let nickname: String? public let tempToken: String? - - public init(isRegistered: Bool, accessToken: String?, refreshToken: String?, userId: String?, nickname: String?, tempToken: String?) { - self.isRegistered = isRegistered - self.accessToken = accessToken - self.refreshToken = refreshToken - self.userId = userId - self.nickname = nickname - self.tempToken = tempToken - } } extension SocialVerifyResponseDTO { diff --git a/FLINT/Data/Sources/DTO/Base/Unwrap.swift b/FLINT/Data/Sources/DTO/Base/Unwrap.swift index 957097e2..080232f0 100644 --- a/FLINT/Data/Sources/DTO/Base/Unwrap.swift +++ b/FLINT/Data/Sources/DTO/Base/Unwrap.swift @@ -21,12 +21,11 @@ public enum DTOMappingError: Error, LocalizedError { } } -public func unwrap( - _ value: T?, - key: CodingKey? = nil -) throws -> T { - guard let value else { - throw DTOMappingError.missingField(key?.stringValue) +extension Decodable { + public func unwrap(_ value: T?) throws -> T { + guard let value else { + throw DTOMappingError.missingField("\(self)") + } + return value } - return value } From 49e036d7e3569d6d022b0339d76ee466e6454112 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Thu, 5 Feb 2026 14:32:42 +0900 Subject: [PATCH 09/45] =?UTF-8?q?[refactor]=20Auth,=20Bookmark=20Service?= =?UTF-8?q?=20=EB=A6=AC=ED=8C=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bookmark/CollectionBookmarkUsersDTO.swift | 46 +++--------------- ....swift => AnyPublisher+BaseResponse.swift} | 6 +-- .../Networking/Service/AuthService.swift | 21 +++++---- .../Networking/Service/BookmarkService.swift | 47 +++++++++---------- 4 files changed, 43 insertions(+), 77 deletions(-) rename FLINT/Data/Sources/Networking/Extension/{AnyPublisher+.swift => AnyPublisher+BaseResponse.swift} (75%) diff --git a/FLINT/Data/Sources/DTO/Bookmark/CollectionBookmarkUsersDTO.swift b/FLINT/Data/Sources/DTO/Bookmark/CollectionBookmarkUsersDTO.swift index d3645e25..bb4ebfd9 100644 --- a/FLINT/Data/Sources/DTO/Bookmark/CollectionBookmarkUsersDTO.swift +++ b/FLINT/Data/Sources/DTO/Bookmark/CollectionBookmarkUsersDTO.swift @@ -10,59 +10,25 @@ import Foundation import Entity public struct CollectionBookmarkUsersDTO: Codable { - public let status: Int? - public let message: String? - public let data: DataDTO? - - public init(status: Int?, message: String?, data: DataDTO?) { - self.status = status - self.message = message - self.data = data - } + public let bookmarkCount: Int? + public let userList: [UserDTO]? } -// MARK: - Nested DTOs public extension CollectionBookmarkUsersDTO { - - struct DataDTO: Codable { - public let bookmarkCount: Int? - public let userList: [UserDTO]? - - public init(bookmarkCount: Int?, userList: [UserDTO]?) { - self.bookmarkCount = bookmarkCount - self.userList = userList - } - } - struct UserDTO: Codable { public let userId: String? public let nickName: String? public let profileImageUrl: String? public let userRole: String? - - public init(userId: String?, nickName: String?, profileImageUrl: String?, userRole: String?) { - self.userId = userId - self.nickName = nickName - self.profileImageUrl = profileImageUrl - self.userRole = userRole - } } } extension CollectionBookmarkUsersDTO { public var entity: CollectionBookmarkUsersEntity { get throws { - return try unwrap(data).entity - } - } -} - -extension CollectionBookmarkUsersDTO.DataDTO { - public var entity: CollectionBookmarkUsersEntity { - get throws { - return CollectionBookmarkUsersEntity( + return try CollectionBookmarkUsersEntity( bookmarkCount: bookmarkCount ?? 0, - users: try (userList ?? []).map { try $0.entity } + users: userList?.map({ try $0.entity }) ?? [] ) } } @@ -71,8 +37,8 @@ extension CollectionBookmarkUsersDTO.DataDTO { extension CollectionBookmarkUsersDTO.UserDTO { public var entity: CollectionBookmarkUserEntity { get throws { - return CollectionBookmarkUserEntity( - userId: userId ?? "", + return try CollectionBookmarkUserEntity( + userId: unwrap(userId), nickname: nickName ?? "", profileImageUrl: URL(string: profileImageUrl ?? ""), userRole: userRole ?? "" diff --git a/FLINT/Data/Sources/Networking/Extension/AnyPublisher+.swift b/FLINT/Data/Sources/Networking/Extension/AnyPublisher+BaseResponse.swift similarity index 75% rename from FLINT/Data/Sources/Networking/Extension/AnyPublisher+.swift rename to FLINT/Data/Sources/Networking/Extension/AnyPublisher+BaseResponse.swift index a0c63837..e385abf2 100644 --- a/FLINT/Data/Sources/Networking/Extension/AnyPublisher+.swift +++ b/FLINT/Data/Sources/Networking/Extension/AnyPublisher+BaseResponse.swift @@ -1,5 +1,5 @@ // -// File.swift +// AnyPublisher+BaseResponse.swift // Data // // Created by 김호성 on 2026.01.20. @@ -8,15 +8,15 @@ import Combine import Foundation -import Moya import CombineMoya +import Moya import Domain import DTO public extension AnyPublisher where Output == Response, Failure == MoyaError { - func extractData(_ type: D.Type, atKeyPath keyPath: String? = nil, using decoder: JSONDecoder = JSONDecoder(), failsOnEmptyData: Bool = true) -> AnyPublisher { + func mapBaseResponseData(_ type: D.Type, atKeyPath keyPath: String? = nil, using decoder: JSONDecoder = JSONDecoder(), failsOnEmptyData: Bool = true) -> AnyPublisher { return map(BaseResponse.self) .tryMap({ baseResponse in Log.d(baseResponse) diff --git a/FLINT/Data/Sources/Networking/Service/AuthService.swift b/FLINT/Data/Sources/Networking/Service/AuthService.swift index 79dfaf1c..275de409 100644 --- a/FLINT/Data/Sources/Networking/Service/AuthService.swift +++ b/FLINT/Data/Sources/Networking/Service/AuthService.swift @@ -15,10 +15,10 @@ import Domain import DTO - public protocol AuthService { func signup(_ signupInfoEntity: SignupInfoEntity) -> AnyPublisher func socialVerify(socialVerifyRequestDTO: SocialVerifyRequestDTO) -> AnyPublisher + func withDraw() -> AnyPublisher } public final class DefaultAuthService: AuthService { @@ -36,9 +36,8 @@ public final class DefaultAuthService: AuthService { return Fail(error: TokenError.noToken).eraseToAnyPublisher() } let signupRequestDTO = SignupRequestDTO(tempToken: tempToken, signupEntity: signupInfoEntity) - Log.d(signupRequestDTO) - return authAPIProvider.requestPublisher(.signup(signupRequestDTO)) - .extractData(SignupDTO.self) + return authAPIProvider.requestPublisher(.signup(userInfo: signupRequestDTO)) + .mapBaseResponseData(SignupDTO.self) .tryMap({ [weak self] in let loginEntity = try $0.loginEntity self?.tokenStorage.save(loginEntity.accessToken, type: .accessToken) @@ -49,18 +48,15 @@ public final class DefaultAuthService: AuthService { } public func socialVerify(socialVerifyRequestDTO: SocialVerifyRequestDTO) -> AnyPublisher { - return authAPIProvider.requestPublisher(.socialVerify(_socialVerifyRequestDTO: socialVerifyRequestDTO)) - .extractData(SocialVerifyResponseDTO.self) + return authAPIProvider.requestPublisher(.socialVerify(socialAuthCredential: socialVerifyRequestDTO)) + .mapBaseResponseData(SocialVerifyResponseDTO.self) .map({ [weak self] socialVerifyResponseDTO in - Log.d(socialVerifyResponseDTO) guard let self, let isRegister = socialVerifyResponseDTO.isRegistered else { return socialVerifyResponseDTO } if !isRegister, let tempToken = socialVerifyResponseDTO.tempToken { - Log.d(tempToken) tokenStorage.save(tempToken, type: .tempToken) } else if let accessToken = socialVerifyResponseDTO.accessToken, let refreshToken = socialVerifyResponseDTO.refreshToken { - Log.d(accessToken) tokenStorage.save(accessToken, type: .accessToken) tokenStorage.save(refreshToken, type: .refreshToken) } @@ -68,4 +64,11 @@ public final class DefaultAuthService: AuthService { }) .eraseToAnyPublisher() } + + public func withDraw() -> AnyPublisher { + authAPIProvider.requestPublisher(.withdraw) + .mapBaseResponseData(BlankData.self) + .map({ _ in }) + .eraseToAnyPublisher() + } } diff --git a/FLINT/Data/Sources/Networking/Service/BookmarkService.swift b/FLINT/Data/Sources/Networking/Service/BookmarkService.swift index 3a6a14b7..02b8b8c9 100644 --- a/FLINT/Data/Sources/Networking/Service/BookmarkService.swift +++ b/FLINT/Data/Sources/Networking/Service/BookmarkService.swift @@ -5,8 +5,6 @@ // Created by 소은 on 1/21/26. // - - import Combine import Foundation @@ -18,34 +16,33 @@ import Domain import DTO public protocol BookmarkService { - func toggleCollectionBookmark(_ collectionId: Int64) -> AnyPublisher - func toggleContentBookmark(_ contentId: Int64) -> AnyPublisher - - func fetchCollectionBookmarkUsers(_ collectionId: Int64) - -> AnyPublisher + func fetchCollectionBookmarkUsers(collectionId: Int64) + -> AnyPublisher + func toggleCollectionBookmark(collectionId: Int64) -> AnyPublisher + func toggleContentBookmark(contentId: Int64) -> AnyPublisher } public final class DefaultBookmarkService: BookmarkService { - - private let provider: MoyaProvider - - public init(provider: MoyaProvider) { - self.provider = provider + + private let bookmarkAPIProvider: MoyaProvider + + public init(bookmarkAPIProvider: MoyaProvider) { + self.bookmarkAPIProvider = bookmarkAPIProvider } - - public func toggleCollectionBookmark(_ collectionId: Int64) -> AnyPublisher { - provider.requestPublisher(.toggleCollectionBookmark(collectionId)) - .extractData(Bool.self) + + public func fetchCollectionBookmarkUsers(collectionId: Int64) + -> AnyPublisher { + return bookmarkAPIProvider.requestPublisher(.fetchCollectionBookmarkUsers(collectionId: collectionId)) + .mapBaseResponseData(CollectionBookmarkUsersDTO.self) } - - public func toggleContentBookmark(_ contentId: Int64) -> AnyPublisher { - provider.requestPublisher(.toggleContentBookmark(contentId)) - .extractData(Bool.self) + + public func toggleCollectionBookmark(collectionId: Int64) -> AnyPublisher { + bookmarkAPIProvider.requestPublisher(.toggleCollectionBookmark(collectionId: collectionId)) + .mapBaseResponseData(Bool.self) } - - public func fetchCollectionBookmarkUsers(_ collectionId: Int64) - -> AnyPublisher { - provider.requestPublisher(.fetchCollectionBookmarkUsers(collectionId: collectionId)) - .extractData(CollectionBookmarkUsersDTO.DataDTO.self) + + public func toggleContentBookmark(contentId: Int64) -> AnyPublisher { + bookmarkAPIProvider.requestPublisher(.toggleContentBookmark(contentId: contentId)) + .mapBaseResponseData(Bool.self) } } From 8265757f3ff2618d31a3bbeaa48b00e391a0b6e9 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Thu, 5 Feb 2026 14:34:02 +0900 Subject: [PATCH 10/45] =?UTF-8?q?[comment]=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EB=AA=85=20=EC=A3=BC=EC=84=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FLINT/Data/Sources/DTO/Base/BaseResponse.swift | 2 +- FLINT/Data/Sources/DTO/Base/Unwrap.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FLINT/Data/Sources/DTO/Base/BaseResponse.swift b/FLINT/Data/Sources/DTO/Base/BaseResponse.swift index e8b3903b..cd097c8a 100644 --- a/FLINT/Data/Sources/DTO/Base/BaseResponse.swift +++ b/FLINT/Data/Sources/DTO/Base/BaseResponse.swift @@ -1,5 +1,5 @@ // -// BaseResponseDTO.swift +// BaseResponse.swift // FLINT // // Created by 진소은 on 1/10/26. diff --git a/FLINT/Data/Sources/DTO/Base/Unwrap.swift b/FLINT/Data/Sources/DTO/Base/Unwrap.swift index 080232f0..e59ef5db 100644 --- a/FLINT/Data/Sources/DTO/Base/Unwrap.swift +++ b/FLINT/Data/Sources/DTO/Base/Unwrap.swift @@ -1,5 +1,5 @@ // -// File.swift +// Unwrap.swift // Data // // Created by 김호성 on 2026.01.21. From 89ad95d277991adb8fe3e052246ed9471a7c000e Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Thu, 5 Feb 2026 22:22:22 +0900 Subject: [PATCH 11/45] =?UTF-8?q?[refactor]=20Collection=20Service=20?= =?UTF-8?q?=EB=A6=AC=ED=8C=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DTO/Collection/CollectionDetailDTO.swift | 40 ++++---------- ...onsDTO.swift => PagedCollectionsDTO.swift} | 19 +++---- .../RecentViewedCollectionsDTO.swift | 55 +++++++++++++++++++ .../Collection/WatchiingCollectionsDTO.swift | 55 ------------------- .../Networking/API/CollectionAPI.swift | 8 +-- .../Networking/Service/BookmarkService.swift | 6 +- .../Service/CollectionService.swift | 46 +++++++--------- 7 files changed, 99 insertions(+), 130 deletions(-) rename FLINT/Data/Sources/DTO/Collection/{CollectionsDTO.swift => PagedCollectionsDTO.swift} (74%) create mode 100644 FLINT/Data/Sources/DTO/Collection/RecentViewedCollectionsDTO.swift delete mode 100644 FLINT/Data/Sources/DTO/Collection/WatchiingCollectionsDTO.swift diff --git a/FLINT/Data/Sources/DTO/Collection/CollectionDetailDTO.swift b/FLINT/Data/Sources/DTO/Collection/CollectionDetailDTO.swift index c2c0f21e..d88bdfd9 100644 --- a/FLINT/Data/Sources/DTO/Collection/CollectionDetailDTO.swift +++ b/FLINT/Data/Sources/DTO/Collection/CollectionDetailDTO.swift @@ -10,40 +10,24 @@ import Foundation import Entity public struct CollectionDetailDTO: Codable { - - public let status: Int? - public let message: String? - public let data: DataDTO? - - public init(status: Int?, message: String?, data: DataDTO?) { - self.status = status - self.message = message - self.data = data - } + public let id: String? + public let title: String? + public let description: String? + public let thumbnailUrl: String? + public let createdAt: String? + public let isBookmarked: Bool? + public let author: AuthorDTO? + public let contents: [ContentDTO]? } -// MARK: - Nested DTOs - public extension CollectionDetailDTO { - - struct DataDTO: Codable { - public let id: String? - public let title: String? - public let description: String? - public let thumbnailUrl: String? - public let createdAt: String? - public let isBookmarked: Bool? - public let author: AuthorDTO? - public let contents: [ContentDTO]? - } - struct AuthorDTO: Codable { public let id: String? public let nickname: String? public let profileImageUrl: String? public let userRole: String? } - + struct ContentDTO: Codable { public let id: String? public let title: String? @@ -57,7 +41,7 @@ public extension CollectionDetailDTO { } } -extension CollectionDetailDTO.DataDTO { +extension CollectionDetailDTO { public var entity: CollectionDetailEntity { get throws { return try CollectionDetailEntity( @@ -67,8 +51,8 @@ extension CollectionDetailDTO.DataDTO { thumbnailUrl: URL(string: thumbnailUrl ?? ""), createdAt: createdAt ?? "", isBookmarked: isBookmarked ?? false, - author: try author?.entity, - contents: try (contents ?? []).map { try $0.entity } + author: author?.entity, + contents: contents?.map { try $0.entity } ?? [] ) } } diff --git a/FLINT/Data/Sources/DTO/Collection/CollectionsDTO.swift b/FLINT/Data/Sources/DTO/Collection/PagedCollectionsDTO.swift similarity index 74% rename from FLINT/Data/Sources/DTO/Collection/CollectionsDTO.swift rename to FLINT/Data/Sources/DTO/Collection/PagedCollectionsDTO.swift index bce08488..9fd89369 100644 --- a/FLINT/Data/Sources/DTO/Collection/CollectionsDTO.swift +++ b/FLINT/Data/Sources/DTO/Collection/PagedCollectionsDTO.swift @@ -1,5 +1,5 @@ // -// File.swift +// PagedCollectionsDTO.swift // Data // // Created by 김호성 on 2026.01.22. @@ -9,17 +9,12 @@ import Foundation import Domain -public struct CollectionsDTO: Codable { +public struct PagedCollectionsDTO: Codable { public let data: [CollectionDTO]? public let meta: CollectionsMetaDTO? - - public init(data: [CollectionDTO]?, meta: CollectionsMetaDTO?) { - self.data = data - self.meta = meta - } } -extension CollectionsDTO { +extension PagedCollectionsDTO { public struct CollectionDTO: Codable { public let collectionId: String? public let imageUrl: String? @@ -28,7 +23,7 @@ extension CollectionsDTO { } } -extension CollectionsDTO { +extension PagedCollectionsDTO { public struct CollectionsMetaDTO: Codable { public let type: String? public let returned: Int? @@ -36,7 +31,7 @@ extension CollectionsDTO { } } -extension CollectionsDTO { +extension PagedCollectionsDTO { public var entity: CollectionPagingEntity { get throws { return try CollectionPagingEntity( @@ -47,11 +42,11 @@ extension CollectionsDTO { } } -extension CollectionsDTO.CollectionDTO { +extension PagedCollectionsDTO.CollectionDTO { public var entity: ExploreInfoEntity { get throws { return try ExploreInfoEntity( - id: unwrap(collectionId, key: CodingKeys.collectionId), + id: unwrap(collectionId), imageUrl: URL(string: imageUrl ?? ""), title: contentTitle ?? "", description: contentDescription ?? "" diff --git a/FLINT/Data/Sources/DTO/Collection/RecentViewedCollectionsDTO.swift b/FLINT/Data/Sources/DTO/Collection/RecentViewedCollectionsDTO.swift new file mode 100644 index 00000000..9430cb3d --- /dev/null +++ b/FLINT/Data/Sources/DTO/Collection/RecentViewedCollectionsDTO.swift @@ -0,0 +1,55 @@ +// +// RecentViewedCollectionsDTO.swift +// Data +// +// Created by 소은 on 1/24/26. +// + +import Foundation +import Entity + +public struct RecentViewedCollectionsDTO: Codable { + public let collections: [CollectionDTO]? +} + +public extension RecentViewedCollectionsDTO { + struct CollectionDTO: Codable { + public let id: String? + public let thumbnailUrl: String? + public let title: String? + public let description: String? + public let imageList: [String]? + public let bookmarkCount: Int? + public let isBookmarked: Bool? + public let userId: String? + public let nickname: String? + public let profileImageUrl: String? + } +} + +public extension RecentViewedCollectionsDTO { + var entities: [CollectionEntity] { + get throws { + return try collections?.compactMap { try $0.entity } ?? [] + } + } +} + +public extension RecentViewedCollectionsDTO.CollectionDTO { + var entity: CollectionEntity { + get throws { + return try CollectionEntity( + id: unwrap(id), + thumbnailUrl: thumbnailUrl ?? "", + title: title ?? "", + description: description ?? "", + imageList: imageList ?? [], + bookmarkCount: bookmarkCount ?? 0, + isBookmarked: isBookmarked ?? false, + userId: unwrap(userId), + nickname: nickname ?? "", + profileImageUrl: profileImageUrl ?? "" + ) + } + } +} diff --git a/FLINT/Data/Sources/DTO/Collection/WatchiingCollectionsDTO.swift b/FLINT/Data/Sources/DTO/Collection/WatchiingCollectionsDTO.swift deleted file mode 100644 index c7828626..00000000 --- a/FLINT/Data/Sources/DTO/Collection/WatchiingCollectionsDTO.swift +++ /dev/null @@ -1,55 +0,0 @@ -// -// WatchiingCollectionDTO.swift -// Data -// -// Created by 소은 on 1/24/26. -// - -import Foundation -import Entity - -public struct WatchingCollectionsDTO: Codable { - public let collections: [CollectionDTO]? -} - -public extension WatchingCollectionsDTO { - - struct CollectionDTO: Codable { - public let id: String? - public let thumbnailUrl: String? - public let title: String? - public let description: String? - public let imageList: [String]? - public let bookmarkCount: Int? - public let isBookmarked: Bool? - public let userId: String? - public let nickname: String? - public let profileImageUrl: String? - } -} - -// DTO -> Entity -public extension WatchingCollectionsDTO { - var entities: [CollectionEntity] { - (collections ?? []).compactMap { $0.entity } - } -} - -public extension WatchingCollectionsDTO.CollectionDTO { - var entity: CollectionEntity? { - guard let id, let title, let userId, let nickname else { return nil } - - return CollectionEntity( - id: id, - thumbnailUrl: thumbnailUrl ?? "", - title: title, - description: description ?? "", - imageList: imageList ?? [], - bookmarkCount: bookmarkCount ?? 0, - isBookmarked: isBookmarked ?? false, - userId: userId, - nickname: nickname, - profileImageUrl: profileImageUrl ?? "" - ) - } -} diff --git a/FLINT/Data/Sources/Networking/API/CollectionAPI.swift b/FLINT/Data/Sources/Networking/API/CollectionAPI.swift index 167ad937..01e41785 100644 --- a/FLINT/Data/Sources/Networking/API/CollectionAPI.swift +++ b/FLINT/Data/Sources/Networking/API/CollectionAPI.swift @@ -15,7 +15,7 @@ public enum CollectionAPI { case fetchCollections(cursor: Int64?, size: Int32) case createCollection(collectionInfo: CreateCollectionEntity) case fetchCollectionDetail(collectionId: Int64) - case fetchRecentCollections + case fetchRecentViewedCollections } extension CollectionAPI: TargetType { @@ -25,14 +25,14 @@ extension CollectionAPI: TargetType { return "/api/v1/collections" case let .fetchCollectionDetail(collectionId): return "/api/v1/collections/\(collectionId)" - case .fetchRecentCollections: + case .fetchRecentViewedCollections: return "/api/v1/collections/recent" } } public var method: Moya.Method { switch self { - case .fetchCollections, .fetchCollectionDetail, .fetchRecentCollections: + case .fetchCollections, .fetchCollectionDetail, .fetchRecentViewedCollections: return .get case .createCollection: return .post @@ -54,7 +54,7 @@ extension CollectionAPI: TargetType { ) case let .createCollection(collectionInfo): return .requestJSONEncodable(collectionInfo) - case .fetchCollectionDetail, .fetchRecentCollections: + case .fetchCollectionDetail, .fetchRecentViewedCollections: return .requestPlain } } diff --git a/FLINT/Data/Sources/Networking/Service/BookmarkService.swift b/FLINT/Data/Sources/Networking/Service/BookmarkService.swift index 02b8b8c9..e139dd8e 100644 --- a/FLINT/Data/Sources/Networking/Service/BookmarkService.swift +++ b/FLINT/Data/Sources/Networking/Service/BookmarkService.swift @@ -16,8 +16,7 @@ import Domain import DTO public protocol BookmarkService { - func fetchCollectionBookmarkUsers(collectionId: Int64) - -> AnyPublisher + func fetchCollectionBookmarkUsers(collectionId: Int64) -> AnyPublisher func toggleCollectionBookmark(collectionId: Int64) -> AnyPublisher func toggleContentBookmark(contentId: Int64) -> AnyPublisher } @@ -30,8 +29,7 @@ public final class DefaultBookmarkService: BookmarkService { self.bookmarkAPIProvider = bookmarkAPIProvider } - public func fetchCollectionBookmarkUsers(collectionId: Int64) - -> AnyPublisher { + public func fetchCollectionBookmarkUsers(collectionId: Int64) -> AnyPublisher { return bookmarkAPIProvider.requestPublisher(.fetchCollectionBookmarkUsers(collectionId: collectionId)) .mapBaseResponseData(CollectionBookmarkUsersDTO.self) } diff --git a/FLINT/Data/Sources/Networking/Service/CollectionService.swift b/FLINT/Data/Sources/Networking/Service/CollectionService.swift index 04add454..ccda2c25 100644 --- a/FLINT/Data/Sources/Networking/Service/CollectionService.swift +++ b/FLINT/Data/Sources/Networking/Service/CollectionService.swift @@ -16,46 +16,38 @@ import Domain import DTO public protocol CollectionService { - func fetchCollections(cursor: UInt?, size: Int) -> AnyPublisher - func createCollection(_ entity: CreateCollectionEntity) -> AnyPublisher - func fetchCollectionDetail(collectionId: Int64) -> AnyPublisher - func fetchWatchingCollections() -> AnyPublisher + func fetchCollections(cursor: Int64?, size: Int32) -> AnyPublisher + func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher + func fetchCollectionDetail(collectionId: Int64) -> AnyPublisher + func fetchWatchingCollections() -> AnyPublisher } public final class DefaultCollectionService: CollectionService { - private let provider: MoyaProvider + private let collectionAPIProvider: MoyaProvider - public init(provider: MoyaProvider) { - self.provider = provider + public init(collectionAPIProvider: MoyaProvider) { + self.collectionAPIProvider = collectionAPIProvider } - public func fetchCollections(cursor: UInt?, size: Int) -> AnyPublisher { - return provider.requestPublisher(.fetchCollections(cursor: cursor, size: size)) - .extractData(CollectionsDTO.self) + public func fetchCollections(cursor: Int64?, size: Int32) -> AnyPublisher { + return collectionAPIProvider.requestPublisher(.fetchCollections(cursor: cursor, size: size)) + .mapBaseResponseData(PagedCollectionsDTO.self) } - public func createCollection(_ entity: CreateCollectionEntity) -> AnyPublisher { - return provider.requestPublisher(.createCollection(entity)) - .handleEvents(receiveOutput: { response in - if response.statusCode == 404 { - let body = String(data: response.data, encoding: .utf8) ?? "" - print("404 body:", body) - } - }) - .eraseToAnyPublisher() - .extractData(CreateCollectionResponseDTO.self) + public func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher { + return collectionAPIProvider.requestPublisher(.createCollection(collectionInfo: collectionInfo)) + .mapBaseResponseData(CreateCollectionResponseDTO.self) .map { _ in () } .eraseToAnyPublisher() } - public func fetchCollectionDetail(collectionId: Int64) -> AnyPublisher { - provider.requestPublisher(.fetchCollectionDetail(collectionId: collectionId)) - .extractData(CollectionDetailDTO.DataDTO.self) + public func fetchCollectionDetail(collectionId: Int64) -> AnyPublisher { + return collectionAPIProvider.requestPublisher(.fetchCollectionDetail(collectionId: collectionId)) + .mapBaseResponseData(CollectionDetailDTO.self) } - public func fetchWatchingCollections() -> AnyPublisher { - return provider.requestPublisher(.fetchWatchingCollections) - .extractData(WatchingCollectionsDTO.self) - .eraseToAnyPublisher() + public func fetchWatchingCollections() -> AnyPublisher { + return collectionAPIProvider.requestPublisher(.fetchRecentViewedCollections) + .mapBaseResponseData(RecentViewedCollectionsDTO.self) } } From 9e76410045f82f7c516cc35d9be23b367a2c8728 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Thu, 5 Feb 2026 23:03:18 +0900 Subject: [PATCH 12/45] =?UTF-8?q?[refactor]=20DTO=20Foldering=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 이전에는 Swagger UI 기준으로 나눴으나, 여러 API에서 사용되는 DTO의 경우 폴더링하기 애매하여 DTO 폴더링 기준을 도메인 기준으로 나누는 것으로 변경하였음. --- .../Sources/DTO/{User => Auth}/NicknameCheckDTO.swift | 2 +- .../HomeRecommendedCollectionsDTO.swift | 0 .../DTO/{User => Collection}/UserCollectionsDTO.swift | 4 ++-- .../Sources/DTO/{User => Content}/ContentsDTO.swift | 10 ++++------ FLINT/Data/Sources/DTO/Content/OTTPlatformsDTO.swift | 4 ++-- .../DTO/{Search => Content}/SearchContentsDTO.swift | 0 .../CollectionBookmarkUsersDTO.swift | 1 - FLINT/Data/Sources/DTO/User/KeywordDTO.swift | 3 +-- FLINT/Data/Sources/DTO/User/UserProfileDTO.swift | 2 +- 9 files changed, 11 insertions(+), 15 deletions(-) rename FLINT/Data/Sources/DTO/{User => Auth}/NicknameCheckDTO.swift (81%) rename FLINT/Data/Sources/DTO/{Home => Collection}/HomeRecommendedCollectionsDTO.swift (100%) rename FLINT/Data/Sources/DTO/{User => Collection}/UserCollectionsDTO.swift (93%) rename FLINT/Data/Sources/DTO/{User => Content}/ContentsDTO.swift (82%) rename FLINT/Data/Sources/DTO/{Search => Content}/SearchContentsDTO.swift (100%) rename FLINT/Data/Sources/DTO/{Bookmark => User}/CollectionBookmarkUsersDTO.swift (99%) diff --git a/FLINT/Data/Sources/DTO/User/NicknameCheckDTO.swift b/FLINT/Data/Sources/DTO/Auth/NicknameCheckDTO.swift similarity index 81% rename from FLINT/Data/Sources/DTO/User/NicknameCheckDTO.swift rename to FLINT/Data/Sources/DTO/Auth/NicknameCheckDTO.swift index 0b81c4d2..55d5d73b 100644 --- a/FLINT/Data/Sources/DTO/User/NicknameCheckDTO.swift +++ b/FLINT/Data/Sources/DTO/Auth/NicknameCheckDTO.swift @@ -16,7 +16,7 @@ public struct NicknameCheckDTO: Codable { extension NicknameCheckDTO { public var isAvailable: Bool { get throws { - return try unwrap(available, key: CodingKeys.available) + return try unwrap(available) } } } diff --git a/FLINT/Data/Sources/DTO/Home/HomeRecommendedCollectionsDTO.swift b/FLINT/Data/Sources/DTO/Collection/HomeRecommendedCollectionsDTO.swift similarity index 100% rename from FLINT/Data/Sources/DTO/Home/HomeRecommendedCollectionsDTO.swift rename to FLINT/Data/Sources/DTO/Collection/HomeRecommendedCollectionsDTO.swift diff --git a/FLINT/Data/Sources/DTO/User/UserCollectionsDTO.swift b/FLINT/Data/Sources/DTO/Collection/UserCollectionsDTO.swift similarity index 93% rename from FLINT/Data/Sources/DTO/User/UserCollectionsDTO.swift rename to FLINT/Data/Sources/DTO/Collection/UserCollectionsDTO.swift index 69e30250..ddd3497a 100644 --- a/FLINT/Data/Sources/DTO/User/UserCollectionsDTO.swift +++ b/FLINT/Data/Sources/DTO/Collection/UserCollectionsDTO.swift @@ -32,14 +32,14 @@ public extension UserCollectionsDTO.CollectionDTO { var entity: CollectionEntity { get throws { return try CollectionEntity( - id: unwrap(id, key: CodingKeys.id), + id: unwrap(id), thumbnailUrl: thumbnailUrl ?? "", title: title ?? "", description: description ?? "", imageList: imageList ?? [], bookmarkCount: bookmarkCount ?? 0, isBookmarked: isBookmarked ?? false, - userId: userId ?? "", + userId: unwrap(userId), nickname: nickname ?? "", profileImageUrl: profileImageUrl ?? "" ) diff --git a/FLINT/Data/Sources/DTO/User/ContentsDTO.swift b/FLINT/Data/Sources/DTO/Content/ContentsDTO.swift similarity index 82% rename from FLINT/Data/Sources/DTO/User/ContentsDTO.swift rename to FLINT/Data/Sources/DTO/Content/ContentsDTO.swift index 298389a1..727424f7 100644 --- a/FLINT/Data/Sources/DTO/User/ContentsDTO.swift +++ b/FLINT/Data/Sources/DTO/Content/ContentsDTO.swift @@ -21,24 +21,22 @@ public extension ContentsDTO { public let year: Int? public let getOttSimpleList: [OttSimpleDTO]? } - + struct OttSimpleDTO: Codable { public let ottName: String? public let logoUrl: String? } } -// MARK: - DTO -> Entity - public extension ContentsDTO.ContentDTO { var entity: ContentInfoEntity { get throws { return try ContentInfoEntity( - id: unwrap(id, key: CodingKeys.id), + id: unwrap(id), title: title ?? "", imageUrl: imageUrl ?? "", year: year ?? 0, - ottList: try (getOttSimpleList ?? []).map { try $0.entity } + ottList: getOttSimpleList?.map { try $0.entity } ?? [] ) } } @@ -48,7 +46,7 @@ public extension ContentsDTO.OttSimpleDTO { var entity: OttSimpleEntity { get throws { return try OttSimpleEntity( - ottName: unwrap(ottName, key: CodingKeys.ottName), + ottName: unwrap(ottName), logoUrl: logoUrl ?? "" ) } diff --git a/FLINT/Data/Sources/DTO/Content/OTTPlatformsDTO.swift b/FLINT/Data/Sources/DTO/Content/OTTPlatformsDTO.swift index c8c19110..69786aa9 100644 --- a/FLINT/Data/Sources/DTO/Content/OTTPlatformsDTO.swift +++ b/FLINT/Data/Sources/DTO/Content/OTTPlatformsDTO.swift @@ -1,5 +1,5 @@ // -// FetchOTTPlatformsDTO.swift +// OTTPlatformsDTO.swift // Data // // Created by 소은 on 1/21/26. @@ -34,7 +34,7 @@ extension OTTPlatformsDTO.OTTPlatformDTO { public var entity: OTTPlatformEntity { get throws { return try OTTPlatformEntity( - ottId: unwrap(ottId, key: CodingKeys.ottId), + ottId: unwrap(ottId), name: name ?? "", logoUrl: logoUrl ?? "", contentUrl: contentUrl ?? "" diff --git a/FLINT/Data/Sources/DTO/Search/SearchContentsDTO.swift b/FLINT/Data/Sources/DTO/Content/SearchContentsDTO.swift similarity index 100% rename from FLINT/Data/Sources/DTO/Search/SearchContentsDTO.swift rename to FLINT/Data/Sources/DTO/Content/SearchContentsDTO.swift diff --git a/FLINT/Data/Sources/DTO/Bookmark/CollectionBookmarkUsersDTO.swift b/FLINT/Data/Sources/DTO/User/CollectionBookmarkUsersDTO.swift similarity index 99% rename from FLINT/Data/Sources/DTO/Bookmark/CollectionBookmarkUsersDTO.swift rename to FLINT/Data/Sources/DTO/User/CollectionBookmarkUsersDTO.swift index bb4ebfd9..5ce88838 100644 --- a/FLINT/Data/Sources/DTO/Bookmark/CollectionBookmarkUsersDTO.swift +++ b/FLINT/Data/Sources/DTO/User/CollectionBookmarkUsersDTO.swift @@ -43,6 +43,5 @@ extension CollectionBookmarkUsersDTO.UserDTO { profileImageUrl: URL(string: profileImageUrl ?? ""), userRole: userRole ?? "" ) - } } } diff --git a/FLINT/Data/Sources/DTO/User/KeywordDTO.swift b/FLINT/Data/Sources/DTO/User/KeywordDTO.swift index 1721ed75..eb08cc27 100644 --- a/FLINT/Data/Sources/DTO/User/KeywordDTO.swift +++ b/FLINT/Data/Sources/DTO/User/KeywordDTO.swift @@ -8,7 +8,6 @@ import Foundation import Entity -// Data 모듈 public struct KeywordsDTO: Codable { public let keywords: [KeywordDTO]? @@ -27,7 +26,7 @@ extension KeywordDTO { get throws { return try KeywordEntity( color: color ?? "", - rank: unwrap(rank, key: CodingKeys.rank), + rank: unwrap(rank), name: name ?? "", percentage: percentage ?? 0, imageUrl: imageUrl ?? "" diff --git a/FLINT/Data/Sources/DTO/User/UserProfileDTO.swift b/FLINT/Data/Sources/DTO/User/UserProfileDTO.swift index 35f9c919..61c0f2df 100644 --- a/FLINT/Data/Sources/DTO/User/UserProfileDTO.swift +++ b/FLINT/Data/Sources/DTO/User/UserProfileDTO.swift @@ -20,7 +20,7 @@ extension UserProfileDTO { public var entity: UserProfileEntity { get throws { return try UserProfileEntity( - id: unwrap(id, key: CodingKeys.id), + id: unwrap(id), nickname: nickname ?? "", profileImageUrl: profileImageUrl ?? "", isFliner: isFliner ?? false From f107a52f2eb00106b80571240e28b1e980129066 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Fri, 6 Feb 2026 15:07:16 +0900 Subject: [PATCH 13/45] =?UTF-8?q?[refactor]=20Service=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/DTO/Auth/SignupRequestDTO.swift | 2 +- .../DTO/Collection/CollectionDetailDTO.swift | 6 +- .../HomeRecommendedCollectionsDTO.swift | 33 ++++---- .../DTO/Collection/PagedCollectionsDTO.swift | 2 +- .../RecentViewedCollectionsDTO.swift | 15 ++-- .../DTO/Collection/UserCollectionsDTO.swift | 8 +- .../Sources/DTO/Content/ContentsDTO.swift | 14 ++-- .../DTO/Content/SearchContentsDTO.swift | 4 +- .../DTO/User/CollectionBookmarkUsersDTO.swift | 5 +- FLINT/Data/Sources/DTO/User/KeywordDTO.swift | 16 ++-- .../Data/Sources/Networking/API/AuthAPI.swift | 2 - .../Sources/Networking/API/BookmarkAPI.swift | 2 - .../Sources/Networking/API/ContentAPI.swift | 2 - .../Data/Sources/Networking/API/HomeAPI.swift | 2 - .../Sources/Networking/API/SearchAPI.swift | 2 - .../Data/Sources/Networking/API/UserAPI.swift | 2 - .../Networking/Service/BookmarkService.swift | 2 - .../Networking/Service/ContentService.swift | 25 +++--- .../Networking/Service/HomeService.swift | 13 ++- .../Networking/Service/SearchService.swift | 17 ++-- .../Networking/Service/UserService.swift | 83 ++++++++++--------- 21 files changed, 127 insertions(+), 130 deletions(-) diff --git a/FLINT/Data/Sources/DTO/Auth/SignupRequestDTO.swift b/FLINT/Data/Sources/DTO/Auth/SignupRequestDTO.swift index 8a25fd6e..3a256ef7 100644 --- a/FLINT/Data/Sources/DTO/Auth/SignupRequestDTO.swift +++ b/FLINT/Data/Sources/DTO/Auth/SignupRequestDTO.swift @@ -7,7 +7,7 @@ import Foundation -import Domain +import Entity public struct SignupRequestDTO: Codable { public let tempToken: String diff --git a/FLINT/Data/Sources/DTO/Collection/CollectionDetailDTO.swift b/FLINT/Data/Sources/DTO/Collection/CollectionDetailDTO.swift index d88bdfd9..bc1beae3 100644 --- a/FLINT/Data/Sources/DTO/Collection/CollectionDetailDTO.swift +++ b/FLINT/Data/Sources/DTO/Collection/CollectionDetailDTO.swift @@ -20,15 +20,15 @@ public struct CollectionDetailDTO: Codable { public let contents: [ContentDTO]? } -public extension CollectionDetailDTO { - struct AuthorDTO: Codable { +extension CollectionDetailDTO { + public struct AuthorDTO: Codable { public let id: String? public let nickname: String? public let profileImageUrl: String? public let userRole: String? } - struct ContentDTO: Codable { + public struct ContentDTO: Codable { public let id: String? public let title: String? public let imageUrl: String? diff --git a/FLINT/Data/Sources/DTO/Collection/HomeRecommendedCollectionsDTO.swift b/FLINT/Data/Sources/DTO/Collection/HomeRecommendedCollectionsDTO.swift index 69f54822..0772d218 100644 --- a/FLINT/Data/Sources/DTO/Collection/HomeRecommendedCollectionsDTO.swift +++ b/FLINT/Data/Sources/DTO/Collection/HomeRecommendedCollectionsDTO.swift @@ -5,7 +5,6 @@ // Created by 소은 on 1/20/26. // -import Combine import Foundation import Entity @@ -14,8 +13,8 @@ public struct HomeRecommendedCollectionsDTO: Codable { public let collections: [CollectionDTO]? } -public extension HomeRecommendedCollectionsDTO { - struct CollectionDTO: Codable { +extension HomeRecommendedCollectionsDTO { + public struct CollectionDTO: Codable { public let id: String? public let thumbnailUrl: String? public let title: String? @@ -29,20 +28,24 @@ public extension HomeRecommendedCollectionsDTO { } } -public extension HomeRecommendedCollectionsDTO { - var entities: [CollectionInfoEntity] { - (collections ?? []).map { $0.entity } +extension HomeRecommendedCollectionsDTO { + public var entities: [CollectionInfoEntity] { + get throws { + return try collections?.map { try $0.entity } ?? [] + } } } -public extension HomeRecommendedCollectionsDTO.CollectionDTO { - var entity: CollectionInfoEntity { - CollectionInfoEntity( - id: id ?? "", - imageUrlString: thumbnailUrl ?? "", - profileImageUrlString: profileUrl ?? "", - title: title ?? "", - userName: nickname ?? "" - ) +extension HomeRecommendedCollectionsDTO.CollectionDTO { + public var entity: CollectionInfoEntity { + get throws { + return try CollectionInfoEntity( + id: unwrap(id), + imageUrlString: thumbnailUrl ?? "", + profileImageUrlString: profileUrl ?? "", + title: title ?? "", + userName: nickname ?? "" + ) + } } } diff --git a/FLINT/Data/Sources/DTO/Collection/PagedCollectionsDTO.swift b/FLINT/Data/Sources/DTO/Collection/PagedCollectionsDTO.swift index 9fd89369..98228867 100644 --- a/FLINT/Data/Sources/DTO/Collection/PagedCollectionsDTO.swift +++ b/FLINT/Data/Sources/DTO/Collection/PagedCollectionsDTO.swift @@ -7,7 +7,7 @@ import Foundation -import Domain +import Entity public struct PagedCollectionsDTO: Codable { public let data: [CollectionDTO]? diff --git a/FLINT/Data/Sources/DTO/Collection/RecentViewedCollectionsDTO.swift b/FLINT/Data/Sources/DTO/Collection/RecentViewedCollectionsDTO.swift index 9430cb3d..d23d89dc 100644 --- a/FLINT/Data/Sources/DTO/Collection/RecentViewedCollectionsDTO.swift +++ b/FLINT/Data/Sources/DTO/Collection/RecentViewedCollectionsDTO.swift @@ -6,14 +6,17 @@ // import Foundation + import Entity +// TODO: - RecentViewedCollectionsDTO & HomeRecommendedCollectionsDTO & UserCollectionsDTO 유사 + public struct RecentViewedCollectionsDTO: Codable { public let collections: [CollectionDTO]? } -public extension RecentViewedCollectionsDTO { - struct CollectionDTO: Codable { +extension RecentViewedCollectionsDTO { + public struct CollectionDTO: Codable { public let id: String? public let thumbnailUrl: String? public let title: String? @@ -27,16 +30,16 @@ public extension RecentViewedCollectionsDTO { } } -public extension RecentViewedCollectionsDTO { - var entities: [CollectionEntity] { +extension RecentViewedCollectionsDTO { + public var entities: [CollectionEntity] { get throws { return try collections?.compactMap { try $0.entity } ?? [] } } } -public extension RecentViewedCollectionsDTO.CollectionDTO { - var entity: CollectionEntity { +extension RecentViewedCollectionsDTO.CollectionDTO { + public var entity: CollectionEntity { get throws { return try CollectionEntity( id: unwrap(id), diff --git a/FLINT/Data/Sources/DTO/Collection/UserCollectionsDTO.swift b/FLINT/Data/Sources/DTO/Collection/UserCollectionsDTO.swift index ddd3497a..f98b858f 100644 --- a/FLINT/Data/Sources/DTO/Collection/UserCollectionsDTO.swift +++ b/FLINT/Data/Sources/DTO/Collection/UserCollectionsDTO.swift @@ -13,8 +13,8 @@ public struct UserCollectionsDTO: Codable { public let collections: [CollectionDTO]? } -public extension UserCollectionsDTO { - struct CollectionDTO: Codable { +extension UserCollectionsDTO { + public struct CollectionDTO: Codable { public let id: String? public let thumbnailUrl: String? public let title: String? @@ -28,8 +28,8 @@ public extension UserCollectionsDTO { } } -public extension UserCollectionsDTO.CollectionDTO { - var entity: CollectionEntity { +extension UserCollectionsDTO.CollectionDTO { + public var entity: CollectionEntity { get throws { return try CollectionEntity( id: unwrap(id), diff --git a/FLINT/Data/Sources/DTO/Content/ContentsDTO.swift b/FLINT/Data/Sources/DTO/Content/ContentsDTO.swift index 727424f7..39c076a5 100644 --- a/FLINT/Data/Sources/DTO/Content/ContentsDTO.swift +++ b/FLINT/Data/Sources/DTO/Content/ContentsDTO.swift @@ -13,8 +13,8 @@ public struct ContentsDTO: Codable { public let contents: [ContentDTO]? } -public extension ContentsDTO { - struct ContentDTO: Codable { +extension ContentsDTO { + public struct ContentDTO: Codable { public let id: String? public let title: String? public let imageUrl: String? @@ -22,14 +22,14 @@ public extension ContentsDTO { public let getOttSimpleList: [OttSimpleDTO]? } - struct OttSimpleDTO: Codable { + public struct OttSimpleDTO: Codable { public let ottName: String? public let logoUrl: String? } } -public extension ContentsDTO.ContentDTO { - var entity: ContentInfoEntity { +extension ContentsDTO.ContentDTO { + public var entity: ContentInfoEntity { get throws { return try ContentInfoEntity( id: unwrap(id), @@ -42,8 +42,8 @@ public extension ContentsDTO.ContentDTO { } } -public extension ContentsDTO.OttSimpleDTO { - var entity: OttSimpleEntity { +extension ContentsDTO.OttSimpleDTO { + public var entity: OttSimpleEntity { get throws { return try OttSimpleEntity( ottName: unwrap(ottName), diff --git a/FLINT/Data/Sources/DTO/Content/SearchContentsDTO.swift b/FLINT/Data/Sources/DTO/Content/SearchContentsDTO.swift index a3f411e8..b700240d 100644 --- a/FLINT/Data/Sources/DTO/Content/SearchContentsDTO.swift +++ b/FLINT/Data/Sources/DTO/Content/SearchContentsDTO.swift @@ -13,8 +13,8 @@ public struct SearchContentsDTO: Codable { public let contents: [ContentDTO]? } -public extension SearchContentsDTO { - struct ContentDTO: Codable { +extension SearchContentsDTO { + public struct ContentDTO: Codable { public let id: String? public let title: String? public let author: String? diff --git a/FLINT/Data/Sources/DTO/User/CollectionBookmarkUsersDTO.swift b/FLINT/Data/Sources/DTO/User/CollectionBookmarkUsersDTO.swift index 5ce88838..4fb7b368 100644 --- a/FLINT/Data/Sources/DTO/User/CollectionBookmarkUsersDTO.swift +++ b/FLINT/Data/Sources/DTO/User/CollectionBookmarkUsersDTO.swift @@ -14,8 +14,8 @@ public struct CollectionBookmarkUsersDTO: Codable { public let userList: [UserDTO]? } -public extension CollectionBookmarkUsersDTO { - struct UserDTO: Codable { +extension CollectionBookmarkUsersDTO { + public struct UserDTO: Codable { public let userId: String? public let nickName: String? public let profileImageUrl: String? @@ -43,5 +43,6 @@ extension CollectionBookmarkUsersDTO.UserDTO { profileImageUrl: URL(string: profileImageUrl ?? ""), userRole: userRole ?? "" ) + } } } diff --git a/FLINT/Data/Sources/DTO/User/KeywordDTO.swift b/FLINT/Data/Sources/DTO/User/KeywordDTO.swift index eb08cc27..868b3e44 100644 --- a/FLINT/Data/Sources/DTO/User/KeywordDTO.swift +++ b/FLINT/Data/Sources/DTO/User/KeywordDTO.swift @@ -13,15 +13,17 @@ public struct KeywordsDTO: Codable { public let keywords: [KeywordDTO]? } -public struct KeywordDTO: Codable { - public let color: String? - public let rank: Int? - public let name: String? - public let percentage: Int? - public let imageUrl: String? +extension KeywordsDTO { + public struct KeywordDTO: Codable { + public let color: String? + public let rank: Int? + public let name: String? + public let percentage: Int? + public let imageUrl: String? + } } -extension KeywordDTO { +extension KeywordsDTO.KeywordDTO { public var entity: KeywordEntity { get throws { return try KeywordEntity( diff --git a/FLINT/Data/Sources/Networking/API/AuthAPI.swift b/FLINT/Data/Sources/Networking/API/AuthAPI.swift index b6f2467f..e9f26dbb 100644 --- a/FLINT/Data/Sources/Networking/API/AuthAPI.swift +++ b/FLINT/Data/Sources/Networking/API/AuthAPI.swift @@ -9,8 +9,6 @@ import Foundation import Moya -import Domain - import DTO public enum AuthAPI { diff --git a/FLINT/Data/Sources/Networking/API/BookmarkAPI.swift b/FLINT/Data/Sources/Networking/API/BookmarkAPI.swift index c0cbff6a..70e59f76 100644 --- a/FLINT/Data/Sources/Networking/API/BookmarkAPI.swift +++ b/FLINT/Data/Sources/Networking/API/BookmarkAPI.swift @@ -9,8 +9,6 @@ import Foundation import Moya -import Domain - public enum BookmarkAPI { case fetchCollectionBookmarkUsers(collectionId: Int64) case toggleCollectionBookmark(collectionId: Int64) diff --git a/FLINT/Data/Sources/Networking/API/ContentAPI.swift b/FLINT/Data/Sources/Networking/API/ContentAPI.swift index a8173751..6d5a3af4 100644 --- a/FLINT/Data/Sources/Networking/API/ContentAPI.swift +++ b/FLINT/Data/Sources/Networking/API/ContentAPI.swift @@ -9,8 +9,6 @@ import Foundation import Moya -import Domain - public enum ContentAPI { case fetchMyBookmarkedContents case fetchOTTPlatformsForContent(contentId: Int64) diff --git a/FLINT/Data/Sources/Networking/API/HomeAPI.swift b/FLINT/Data/Sources/Networking/API/HomeAPI.swift index b8b66399..e0cfed3b 100644 --- a/FLINT/Data/Sources/Networking/API/HomeAPI.swift +++ b/FLINT/Data/Sources/Networking/API/HomeAPI.swift @@ -9,8 +9,6 @@ import Foundation import Moya -import Domain - public enum HomeAPI { case fetchRecommendedCollections } diff --git a/FLINT/Data/Sources/Networking/API/SearchAPI.swift b/FLINT/Data/Sources/Networking/API/SearchAPI.swift index 2e9b609a..5ae0e55c 100644 --- a/FLINT/Data/Sources/Networking/API/SearchAPI.swift +++ b/FLINT/Data/Sources/Networking/API/SearchAPI.swift @@ -9,8 +9,6 @@ import Foundation import Moya -import Domain - public enum SearchAPI { /// keyword가 nil인 경우 인기 순 작품 리스트를 받는다. case searchContents(keyword: String?) diff --git a/FLINT/Data/Sources/Networking/API/UserAPI.swift b/FLINT/Data/Sources/Networking/API/UserAPI.swift index 0dc7b425..944d17b5 100644 --- a/FLINT/Data/Sources/Networking/API/UserAPI.swift +++ b/FLINT/Data/Sources/Networking/API/UserAPI.swift @@ -9,8 +9,6 @@ import Foundation import Moya -import Domain - public enum UserAPI { case fetchUserProfile(userId: Int64) case fetchUserBookmarkedCollections(userId: Int64) diff --git a/FLINT/Data/Sources/Networking/Service/BookmarkService.swift b/FLINT/Data/Sources/Networking/Service/BookmarkService.swift index e139dd8e..76743535 100644 --- a/FLINT/Data/Sources/Networking/Service/BookmarkService.swift +++ b/FLINT/Data/Sources/Networking/Service/BookmarkService.swift @@ -11,8 +11,6 @@ import Foundation import CombineMoya import Moya -import Domain - import DTO public protocol BookmarkService { diff --git a/FLINT/Data/Sources/Networking/Service/ContentService.swift b/FLINT/Data/Sources/Networking/Service/ContentService.swift index 0e882e07..8f21a532 100644 --- a/FLINT/Data/Sources/Networking/Service/ContentService.swift +++ b/FLINT/Data/Sources/Networking/Service/ContentService.swift @@ -4,31 +4,36 @@ // // Created by 소은 on 1/21/26. // + import Combine import Foundation import CombineMoya import Moya -import Domain - import DTO public protocol ContentService { - func fetchOTTPlatforms(_ contentId: Int64) -> AnyPublisher + func fetchMyBookmarkedContents() -> AnyPublisher + func fetchOTTPlatformsForContent(contentId: Int64) -> AnyPublisher } public final class DefaultContentService: ContentService { - private let provider: MoyaProvider + private let contentAPIProvider: MoyaProvider - public init(provider: MoyaProvider) { - self.provider = provider + public init(contentAPIProvider: MoyaProvider) { + self.contentAPIProvider = contentAPIProvider } - - public func fetchOTTPlatforms(_ contentId: Int64) -> AnyPublisher { - return provider.requestPublisher(.fetchOTTPlatforms(contentId)) - .extractData(OTTPlatformsDTO.self) + + public func fetchMyBookmarkedContents() -> AnyPublisher { + return contentAPIProvider.requestPublisher(.fetchMyBookmarkedContents) + .mapBaseResponseData(ContentsDTO.self) + } + + public func fetchOTTPlatformsForContent(contentId: Int64) -> AnyPublisher { + return contentAPIProvider.requestPublisher(.fetchOTTPlatformsForContent(contentId: contentId)) + .mapBaseResponseData(OTTPlatformsDTO.self) } } diff --git a/FLINT/Data/Sources/Networking/Service/HomeService.swift b/FLINT/Data/Sources/Networking/Service/HomeService.swift index 4e137857..bc9ea1d4 100644 --- a/FLINT/Data/Sources/Networking/Service/HomeService.swift +++ b/FLINT/Data/Sources/Networking/Service/HomeService.swift @@ -11,8 +11,6 @@ import Foundation import CombineMoya import Moya -import Domain - import DTO public protocol HomeService { @@ -21,16 +19,15 @@ public protocol HomeService { public final class DefaultHomeService: HomeService { - private let provider: MoyaProvider + private let homeAPIProvider: MoyaProvider - public init(provider: MoyaProvider) { - self.provider = provider + public init(homeAPIProvider: MoyaProvider) { + self.homeAPIProvider = homeAPIProvider } public func fetchRecommendedCollections() -> AnyPublisher { - provider.requestPublisher(.fetchRecommendedCollections) - .extractData(HomeRecommendedCollectionsDTO.self) - .eraseToAnyPublisher() + homeAPIProvider.requestPublisher(.fetchRecommendedCollections) + .mapBaseResponseData(HomeRecommendedCollectionsDTO.self) } } diff --git a/FLINT/Data/Sources/Networking/Service/SearchService.swift b/FLINT/Data/Sources/Networking/Service/SearchService.swift index cb1827e5..ff9cbc70 100644 --- a/FLINT/Data/Sources/Networking/Service/SearchService.swift +++ b/FLINT/Data/Sources/Networking/Service/SearchService.swift @@ -11,26 +11,23 @@ import Foundation import CombineMoya import Moya -import Domain - import DTO public protocol SearchService { - func searchContents(_ keyword: String?) -> AnyPublisher + func searchContents(keyword: String?) -> AnyPublisher } public final class DefaultSearchService: SearchService { - private let provider: MoyaProvider + private let searchAPIProvider: MoyaProvider - public init(provider: MoyaProvider) { - self.provider = provider + public init(searchAPIProvider: MoyaProvider) { + self.searchAPIProvider = searchAPIProvider } - public func searchContents(_ keyword: String?) -> AnyPublisher { - provider.requestPublisher(.searchContents(keyword)) - .extractData(SearchContentsDTO.self) - .eraseToAnyPublisher() + public func searchContents(keyword: String?) -> AnyPublisher { + searchAPIProvider.requestPublisher(.searchContents(keyword: keyword)) + .mapBaseResponseData(SearchContentsDTO.self) } } diff --git a/FLINT/Data/Sources/Networking/Service/UserService.swift b/FLINT/Data/Sources/Networking/Service/UserService.swift index 9ba41d46..d2a2f7f5 100644 --- a/FLINT/Data/Sources/Networking/Service/UserService.swift +++ b/FLINT/Data/Sources/Networking/Service/UserService.swift @@ -11,22 +11,22 @@ import Foundation import CombineMoya import Moya -import Domain - import DTO public protocol UserService { - func checkNickname(_ nickname: String) -> AnyPublisher func fetchUserProfile(userId: Int64) -> AnyPublisher - func fetchMyProfile() -> AnyPublisher - func fetchMyKeywords() -> AnyPublisher - func fetchUserKeywords(userId: Int64) -> AnyPublisher - func fetchMyCollections() -> AnyPublisher + func fetchUserBookmarkedCollections(userId: Int64) -> AnyPublisher + func fetchUserBookmarkedContents(userId: Int64) -> AnyPublisher func fetchUserCollections(userId: Int64) -> AnyPublisher + func fetchUserKeywords(userId: Int64) -> AnyPublisher + + func fetchMyProfile() -> AnyPublisher func fetchMyBookmarkedCollections() -> AnyPublisher - func fetchBookmarkedCollections(userId: Int64) -> AnyPublisher - func fetchMyBookmarkedContents() -> AnyPublisher - func fetchBookmarkedContents(userId: Int64) -> AnyPublisher + func fetchMyCollections() -> AnyPublisher + func fetchMyKeywords() -> AnyPublisher + func recalculateMyKeywords() -> AnyPublisher + + func checkNickname(_ nickname: String) -> AnyPublisher } public final class DefaultUserService: UserService { @@ -37,57 +37,60 @@ public final class DefaultUserService: UserService { self.userAPIProvider = userAPIProvider } - public func checkNickname(_ nickname: String) -> AnyPublisher { - return userAPIProvider.requestPublisher(.checkNickname(nickname)) - .extractData(NicknameCheckDTO.self) - } - public func fetchUserProfile(userId: Int64) -> AnyPublisher { return userAPIProvider.requestPublisher(.fetchUserProfile(userId: userId)) - .extractData(UserProfileDTO.self) + .mapBaseResponseData(UserProfileDTO.self) } - public func fetchMyProfile() -> AnyPublisher { - return userAPIProvider.requestPublisher(.fetchMyProfile) - .extractData(UserProfileDTO.self) + public func fetchUserBookmarkedCollections(userId: Int64) -> AnyPublisher { + return userAPIProvider.requestPublisher(.fetchUserBookmarkedCollections(userId: userId)) + .mapBaseResponseData(UserCollectionsDTO.self) } - public func fetchMyKeywords() -> AnyPublisher { - return userAPIProvider.requestPublisher(.fetchMyKeywords) - .extractData(KeywordsDTO.self) + public func fetchUserBookmarkedContents(userId: Int64) -> AnyPublisher { + return userAPIProvider.requestPublisher(.fetchUserBookmarkedContents(userId: userId)) + .mapBaseResponseData(ContentsDTO.self) } public func fetchUserKeywords(userId: Int64) -> AnyPublisher { return userAPIProvider.requestPublisher(.fetchUserKeywords(userId: userId)) - .extractData(KeywordsDTO.self) - } - - public func fetchMyCollections() -> AnyPublisher { - return userAPIProvider.requestPublisher(.fetchMyCollections) - .extractData(UserCollectionsDTO.self) + .mapBaseResponseData(KeywordsDTO.self) } - + public func fetchUserCollections(userId: Int64) -> AnyPublisher { return userAPIProvider.requestPublisher(.fetchUserCollections(userId: userId)) - .extractData(UserCollectionsDTO.self) + .mapBaseResponseData(UserCollectionsDTO.self) + } + + public func fetchMyProfile() -> AnyPublisher { + return userAPIProvider.requestPublisher(.fetchMyProfile) + .mapBaseResponseData(UserProfileDTO.self) } + public func fetchMyBookmarkedCollections() -> AnyPublisher { return userAPIProvider.requestPublisher(.fetchMyBookmarkedCollections) - .extractData(UserCollectionsDTO.self) + .mapBaseResponseData(UserCollectionsDTO.self) + } + + public func fetchMyCollections() -> AnyPublisher { + return userAPIProvider.requestPublisher(.fetchMyCollections) + .mapBaseResponseData(UserCollectionsDTO.self) } - public func fetchBookmarkedCollections(userId: Int64) -> AnyPublisher { - return userAPIProvider.requestPublisher(.fetchBookmarkedCollections(userId: userId)) - .extractData(UserCollectionsDTO.self) + public func fetchMyKeywords() -> AnyPublisher { + return userAPIProvider.requestPublisher(.fetchMyKeywords) + .mapBaseResponseData(KeywordsDTO.self) } - public func fetchMyBookmarkedContents() -> AnyPublisher { - return userAPIProvider.requestPublisher(.fetchMyBookmarkedContents) - .extractData(ContentsDTO.self) + public func recalculateMyKeywords() -> AnyPublisher { + return userAPIProvider.requestPublisher(.recalculateMyKeywords) + .mapBaseResponseData(BlankData.self) + .map({ _ in }) + .eraseToAnyPublisher() } - public func fetchBookmarkedContents(userId: Int64) -> AnyPublisher { - return userAPIProvider.requestPublisher(.fetchBookmarkedContents(userId: userId)) - .extractData(ContentsDTO.self) + public func checkNickname(_ nickname: String) -> AnyPublisher { + return userAPIProvider.requestPublisher(.checkNickname(nickname)) + .mapBaseResponseData(NicknameCheckDTO.self) } } From 9d8595cdb1bcbee00070b0e9553d71988837ffa7 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Fri, 6 Feb 2026 15:10:25 +0900 Subject: [PATCH 14/45] =?UTF-8?q?[chore]=20parameter=EB=AA=85=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Networking/Service/AuthService.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/FLINT/Data/Sources/Networking/Service/AuthService.swift b/FLINT/Data/Sources/Networking/Service/AuthService.swift index 275de409..26e031ac 100644 --- a/FLINT/Data/Sources/Networking/Service/AuthService.swift +++ b/FLINT/Data/Sources/Networking/Service/AuthService.swift @@ -16,8 +16,8 @@ import Domain import DTO public protocol AuthService { - func signup(_ signupInfoEntity: SignupInfoEntity) -> AnyPublisher - func socialVerify(socialVerifyRequestDTO: SocialVerifyRequestDTO) -> AnyPublisher + func signup(userInfo: SignupInfoEntity) -> AnyPublisher + func socialVerify(socialAuthCredential: SocialVerifyRequestDTO) -> AnyPublisher func withDraw() -> AnyPublisher } @@ -31,11 +31,11 @@ public final class DefaultAuthService: AuthService { self.authAPIProvider = authAPIProvider } - public func signup(_ signupInfoEntity: SignupInfoEntity) -> AnyPublisher { + public func signup(userInfo: SignupInfoEntity) -> AnyPublisher { guard let tempToken = tokenStorage.load(type: .tempToken) else { return Fail(error: TokenError.noToken).eraseToAnyPublisher() } - let signupRequestDTO = SignupRequestDTO(tempToken: tempToken, signupEntity: signupInfoEntity) + let signupRequestDTO = SignupRequestDTO(tempToken: tempToken, signupEntity: userInfo) return authAPIProvider.requestPublisher(.signup(userInfo: signupRequestDTO)) .mapBaseResponseData(SignupDTO.self) .tryMap({ [weak self] in @@ -47,8 +47,8 @@ public final class DefaultAuthService: AuthService { .eraseToAnyPublisher() } - public func socialVerify(socialVerifyRequestDTO: SocialVerifyRequestDTO) -> AnyPublisher { - return authAPIProvider.requestPublisher(.socialVerify(socialAuthCredential: socialVerifyRequestDTO)) + public func socialVerify(socialAuthCredential: SocialVerifyRequestDTO) -> AnyPublisher { + return authAPIProvider.requestPublisher(.socialVerify(socialAuthCredential: socialAuthCredential)) .mapBaseResponseData(SocialVerifyResponseDTO.self) .map({ [weak self] socialVerifyResponseDTO in guard let self, let isRegister = socialVerifyResponseDTO.isRegistered else { From f5dcf9bba4679049c19ff1887f87ffeb1037b917 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Fri, 6 Feb 2026 23:41:55 +0900 Subject: [PATCH 15/45] =?UTF-8?q?[refactor]=20Repository=20=EB=A6=AC?= =?UTF-8?q?=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DTO/Collection/UserCollectionsDTO.swift | 8 ++ .../Sources/DTO/Content/ContentsDTO.swift | 8 ++ FLINT/Data/Sources/DTO/User/KeywordDTO.swift | 8 ++ .../Sources/Networking/NetworkConfig.swift | 2 +- .../Networking/Service/AuthService.swift | 2 +- .../Networking/Service/SearchService.swift | 2 +- .../Networking/Service/UserService.swift | 2 +- .../TokenStorage/TokenStorage.swift | 2 +- .../{Auth => }/AuthRepositoryImpl.swift | 14 ++- .../Bookmark/BookmarkRepositoryImpl.swift | 39 ------- .../BookmarkRepositoryImpl.swift | 37 ++++++ .../CollectionRepositoryImpl.swift | 11 +- .../Content/ContentRepositoryImpl.swift | 31 ----- .../ContentRepositoryImpl.swift | 36 ++++++ ...onsImpl.swift => HomeRepositoryImpl.swift} | 10 +- .../{Search => }/SearchRepositoryImpl.swift | 6 +- .../User/UserRepositoryImpl.swift | 106 ------------------ .../RepositoryImpl/UserRepositoryImpl.swift | 87 ++++++++++++++ .../Sources/Repository/AuthRepository.swift | 7 +- .../Repository/BookmarkRepository.swift | 8 +- .../Repository/CollectionRepository.swift | 4 +- .../Repository/ContentRepository.swift | 3 +- .../Sources/Repository/HomeRepository.swift | 1 - .../Sources/Repository/SearchRepository.swift | 4 +- .../Sources/Repository/UserRepository.swift | 20 ++-- 25 files changed, 235 insertions(+), 223 deletions(-) rename FLINT/Data/Sources/RepositoryImpl/{Auth => }/AuthRepositoryImpl.swift (50%) delete mode 100644 FLINT/Data/Sources/RepositoryImpl/Bookmark/BookmarkRepositoryImpl.swift create mode 100644 FLINT/Data/Sources/RepositoryImpl/BookmarkRepositoryImpl.swift rename FLINT/Data/Sources/RepositoryImpl/{Collection => }/CollectionRepositoryImpl.swift (69%) delete mode 100644 FLINT/Data/Sources/RepositoryImpl/Content/ContentRepositoryImpl.swift create mode 100644 FLINT/Data/Sources/RepositoryImpl/ContentRepositoryImpl.swift rename FLINT/Data/Sources/RepositoryImpl/{Home/HomeRecommendedCollectionsImpl.swift => HomeRepositoryImpl.swift} (81%) rename FLINT/Data/Sources/RepositoryImpl/{Search => }/SearchRepositoryImpl.swift (70%) delete mode 100644 FLINT/Data/Sources/RepositoryImpl/User/UserRepositoryImpl.swift create mode 100644 FLINT/Data/Sources/RepositoryImpl/UserRepositoryImpl.swift diff --git a/FLINT/Data/Sources/DTO/Collection/UserCollectionsDTO.swift b/FLINT/Data/Sources/DTO/Collection/UserCollectionsDTO.swift index f98b858f..a008540f 100644 --- a/FLINT/Data/Sources/DTO/Collection/UserCollectionsDTO.swift +++ b/FLINT/Data/Sources/DTO/Collection/UserCollectionsDTO.swift @@ -28,6 +28,14 @@ extension UserCollectionsDTO { } } +extension UserCollectionsDTO { + public var entities: [CollectionEntity] { + get throws { + return try collections?.map { try $0.entity } ?? [] + } + } +} + extension UserCollectionsDTO.CollectionDTO { public var entity: CollectionEntity { get throws { diff --git a/FLINT/Data/Sources/DTO/Content/ContentsDTO.swift b/FLINT/Data/Sources/DTO/Content/ContentsDTO.swift index 39c076a5..9b14499c 100644 --- a/FLINT/Data/Sources/DTO/Content/ContentsDTO.swift +++ b/FLINT/Data/Sources/DTO/Content/ContentsDTO.swift @@ -28,6 +28,14 @@ extension ContentsDTO { } } +extension ContentsDTO { + public var entities: [ContentInfoEntity] { + get throws { + return try contents?.map { try $0.entity } ?? [] + } + } +} + extension ContentsDTO.ContentDTO { public var entity: ContentInfoEntity { get throws { diff --git a/FLINT/Data/Sources/DTO/User/KeywordDTO.swift b/FLINT/Data/Sources/DTO/User/KeywordDTO.swift index 868b3e44..c2a5d9cb 100644 --- a/FLINT/Data/Sources/DTO/User/KeywordDTO.swift +++ b/FLINT/Data/Sources/DTO/User/KeywordDTO.swift @@ -23,6 +23,14 @@ extension KeywordsDTO { } } +extension KeywordsDTO { + public var entities: [KeywordEntity] { + get throws { + return try keywords?.map { try $0.entity } ?? [] + } + } +} + extension KeywordsDTO.KeywordDTO { public var entity: KeywordEntity { get throws { diff --git a/FLINT/Data/Sources/Networking/NetworkConfig.swift b/FLINT/Data/Sources/Networking/NetworkConfig.swift index 15b65e5b..c355bd10 100644 --- a/FLINT/Data/Sources/Networking/NetworkConfig.swift +++ b/FLINT/Data/Sources/Networking/NetworkConfig.swift @@ -1,5 +1,5 @@ // -// File.swift +// NetworkConfig.swift // Data // // Created by 김호성 on 2026.01.20. diff --git a/FLINT/Data/Sources/Networking/Service/AuthService.swift b/FLINT/Data/Sources/Networking/Service/AuthService.swift index 26e031ac..06b9ee9f 100644 --- a/FLINT/Data/Sources/Networking/Service/AuthService.swift +++ b/FLINT/Data/Sources/Networking/Service/AuthService.swift @@ -1,5 +1,5 @@ // -// File.swift +// AuthService.swift // Data // // Created by 김호성 on 2026.01.21. diff --git a/FLINT/Data/Sources/Networking/Service/SearchService.swift b/FLINT/Data/Sources/Networking/Service/SearchService.swift index ff9cbc70..88bc4aaf 100644 --- a/FLINT/Data/Sources/Networking/Service/SearchService.swift +++ b/FLINT/Data/Sources/Networking/Service/SearchService.swift @@ -1,5 +1,5 @@ // -// SearchContentsService.swift +// SearchService.swift // Data // // Created by 소은 on 1/20/26. diff --git a/FLINT/Data/Sources/Networking/Service/UserService.swift b/FLINT/Data/Sources/Networking/Service/UserService.swift index d2a2f7f5..12c10699 100644 --- a/FLINT/Data/Sources/Networking/Service/UserService.swift +++ b/FLINT/Data/Sources/Networking/Service/UserService.swift @@ -1,5 +1,5 @@ // -// File.swift +// UserService.swift // Data // // Created by 김호성 on 2026.01.19. diff --git a/FLINT/Data/Sources/Networking/TokenStorage/TokenStorage.swift b/FLINT/Data/Sources/Networking/TokenStorage/TokenStorage.swift index 2636b4f8..47ea5d58 100644 --- a/FLINT/Data/Sources/Networking/TokenStorage/TokenStorage.swift +++ b/FLINT/Data/Sources/Networking/TokenStorage/TokenStorage.swift @@ -1,5 +1,5 @@ // -// File.swift +// TokenStorage.swift // Data // // Created by 김호성 on 2026.01.21. diff --git a/FLINT/Data/Sources/RepositoryImpl/Auth/AuthRepositoryImpl.swift b/FLINT/Data/Sources/RepositoryImpl/AuthRepositoryImpl.swift similarity index 50% rename from FLINT/Data/Sources/RepositoryImpl/Auth/AuthRepositoryImpl.swift rename to FLINT/Data/Sources/RepositoryImpl/AuthRepositoryImpl.swift index f14e1a00..c7647ec8 100644 --- a/FLINT/Data/Sources/RepositoryImpl/Auth/AuthRepositoryImpl.swift +++ b/FLINT/Data/Sources/RepositoryImpl/AuthRepositoryImpl.swift @@ -1,5 +1,5 @@ // -// File.swift +// AuthRepositoryImpl.swift // Data // // Created by 김호성 on 2026.01.21. @@ -21,15 +21,19 @@ public final class DefaultAuthRepository: AuthRepository { self.authService = authService } - public func signup(_ signupInfoEntity: SignupInfoEntity) -> AnyPublisher { - return authService.signup(signupInfoEntity) + public func signup(userInfo: SignupInfoEntity) -> AnyPublisher { + return authService.signup(userInfo: userInfo) .tryMap({ try $0.userIdValue }) .eraseToAnyPublisher() } - public func socialVerify(socialVerifyEntity: SocialVerifyEntity) -> AnyPublisher { - return authService.socialVerify(socialVerifyRequestDTO: SocialVerifyRequestDTO(entity: socialVerifyEntity)) + public func socialVerify(socialAuthCredential: SocialVerifyEntity) -> AnyPublisher { + return authService.socialVerify(socialAuthCredential: SocialVerifyRequestDTO(entity: socialAuthCredential)) .tryMap({ try $0.entity }) .eraseToAnyPublisher() } + + public func withDraw() -> AnyPublisher { + return authService.withDraw() + } } diff --git a/FLINT/Data/Sources/RepositoryImpl/Bookmark/BookmarkRepositoryImpl.swift b/FLINT/Data/Sources/RepositoryImpl/Bookmark/BookmarkRepositoryImpl.swift deleted file mode 100644 index cc879937..00000000 --- a/FLINT/Data/Sources/RepositoryImpl/Bookmark/BookmarkRepositoryImpl.swift +++ /dev/null @@ -1,39 +0,0 @@ -// -// DefaultBookmarkRepository.swift -// Data -// -// Created by 소은 on 1/21/26. -// - -import Combine -import Foundation - -import Domain - -import DTO -import Networking - -public final class DefaultBookmarkRepository: BookmarkRepository { - - private let bookmarkService: BookmarkService - - public init(bookmarkService: BookmarkService) { - self.bookmarkService = bookmarkService - } - - public func toggleCollectionBookmark(_ collectionId: Int64) -> AnyPublisher { - return bookmarkService.toggleCollectionBookmark(collectionId) - } - - public func toggleContentBookmark(_ contentId: Int64) -> AnyPublisher { - return bookmarkService.toggleContentBookmark(contentId) - } - - public func fetchCollectionBookmarkUsers(_ collectionId: Int64) - -> AnyPublisher { - bookmarkService.fetchCollectionBookmarkUsers(collectionId) - .tryMap { try $0.entity } - .eraseToAnyPublisher() - } - -} diff --git a/FLINT/Data/Sources/RepositoryImpl/BookmarkRepositoryImpl.swift b/FLINT/Data/Sources/RepositoryImpl/BookmarkRepositoryImpl.swift new file mode 100644 index 00000000..e1961aaf --- /dev/null +++ b/FLINT/Data/Sources/RepositoryImpl/BookmarkRepositoryImpl.swift @@ -0,0 +1,37 @@ +// +// BookmarkRepositoryImpl.swift +// Data +// +// Created by 소은 on 1/21/26. +// + +import Combine +import Foundation + +import Domain + +import DTO +import Networking + +public final class DefaultBookmarkRepository: BookmarkRepository { + + private let bookmarkService: BookmarkService + + public init(bookmarkService: BookmarkService) { + self.bookmarkService = bookmarkService + } + + public func fetchCollectionBookmarkUsers(collectionId: Int64) -> AnyPublisher { + return bookmarkService.fetchCollectionBookmarkUsers(collectionId: collectionId) + .tryMap { try $0.entity } + .eraseToAnyPublisher() + } + + public func toggleCollectionBookmark(collectionId: Int64) -> AnyPublisher { + return bookmarkService.toggleCollectionBookmark(collectionId: collectionId) + } + + public func toggleContentBookmark(contentId: Int64) -> AnyPublisher { + return bookmarkService.toggleContentBookmark(contentId: contentId) + } +} diff --git a/FLINT/Data/Sources/RepositoryImpl/Collection/CollectionRepositoryImpl.swift b/FLINT/Data/Sources/RepositoryImpl/CollectionRepositoryImpl.swift similarity index 69% rename from FLINT/Data/Sources/RepositoryImpl/Collection/CollectionRepositoryImpl.swift rename to FLINT/Data/Sources/RepositoryImpl/CollectionRepositoryImpl.swift index dda1d94a..1f998841 100644 --- a/FLINT/Data/Sources/RepositoryImpl/Collection/CollectionRepositoryImpl.swift +++ b/FLINT/Data/Sources/RepositoryImpl/CollectionRepositoryImpl.swift @@ -21,26 +21,25 @@ public final class DefaultCollectionRepository: CollectionRepository { self.collectionService = collectionService } - public func fetchCollections(cursor: UInt?, size: Int) -> AnyPublisher { + public func fetchCollections(cursor: Int64?, size: Int32) -> AnyPublisher { return collectionService.fetchCollections(cursor: cursor, size: size) .tryMap({ try $0.entity }) .eraseToAnyPublisher() } - public func createCollection(_ entity: CreateCollectionEntity) -> AnyPublisher { - return collectionService.createCollection(entity) + public func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher { + return collectionService.createCollection(collectionInfo: collectionInfo) } public func fetchCollectionDetail(collectionId: Int64) -> AnyPublisher { - collectionService.fetchCollectionDetail(collectionId: collectionId) + return collectionService.fetchCollectionDetail(collectionId: collectionId) .tryMap { try $0.entity } .eraseToAnyPublisher() } public func fetchWatchingCollections() -> AnyPublisher<[CollectionEntity], Error> { return collectionService.fetchWatchingCollections() - .map(\.entities) + .tryMap { try $0.entities } .eraseToAnyPublisher() } - } diff --git a/FLINT/Data/Sources/RepositoryImpl/Content/ContentRepositoryImpl.swift b/FLINT/Data/Sources/RepositoryImpl/Content/ContentRepositoryImpl.swift deleted file mode 100644 index 5d4a74d2..00000000 --- a/FLINT/Data/Sources/RepositoryImpl/Content/ContentRepositoryImpl.swift +++ /dev/null @@ -1,31 +0,0 @@ -// -// ContentRepository.swift -// Data -// -// Created by 소은 on 1/21/26. -// - - -import Combine -import Foundation - -import Domain - -import DTO -import Networking - -public final class DefaultContentRepository: ContentRepository { - - private let contentService: ContentService - - public init(contentService: ContentService) { - self.contentService = contentService - } - - public func fetchOTTPlatforms(_ contentId: Int64) -> AnyPublisher<[OTTPlatformEntity], Error> { - return contentService.fetchOTTPlatforms(contentId) - .tryMap({ try $0.entity }) - .eraseToAnyPublisher() - } -} - diff --git a/FLINT/Data/Sources/RepositoryImpl/ContentRepositoryImpl.swift b/FLINT/Data/Sources/RepositoryImpl/ContentRepositoryImpl.swift new file mode 100644 index 00000000..b2906f2c --- /dev/null +++ b/FLINT/Data/Sources/RepositoryImpl/ContentRepositoryImpl.swift @@ -0,0 +1,36 @@ +// +// ContentRepositoryImpl.swift +// Data +// +// Created by 소은 on 1/21/26. +// + + +import Combine +import Foundation + +import Domain + +import DTO +import Networking + +public final class DefaultContentRepository: ContentRepository { + + private let contentService: ContentService + + public init(contentService: ContentService) { + self.contentService = contentService + } + + public func fetchMyBookmarkedContents() -> AnyPublisher<[ContentInfoEntity], Error> { + return contentService.fetchMyBookmarkedContents() + .tryMap { try $0.entities } + .eraseToAnyPublisher() + } + + public func fetchOTTPlatformsForContent(contentId: Int64) -> AnyPublisher<[OTTPlatformEntity], Error> { + return contentService.fetchOTTPlatformsForContent(contentId: contentId) + .tryMap({ try $0.entity }) + .eraseToAnyPublisher() + } +} diff --git a/FLINT/Data/Sources/RepositoryImpl/Home/HomeRecommendedCollectionsImpl.swift b/FLINT/Data/Sources/RepositoryImpl/HomeRepositoryImpl.swift similarity index 81% rename from FLINT/Data/Sources/RepositoryImpl/Home/HomeRecommendedCollectionsImpl.swift rename to FLINT/Data/Sources/RepositoryImpl/HomeRepositoryImpl.swift index ed9828b3..c9c821a3 100644 --- a/FLINT/Data/Sources/RepositoryImpl/Home/HomeRecommendedCollectionsImpl.swift +++ b/FLINT/Data/Sources/RepositoryImpl/HomeRepositoryImpl.swift @@ -14,16 +14,16 @@ import DTO import Networking public final class DefaultHomeRepository: HomeRepository { - + private let homeService: HomeService - + public init(homeService: HomeService) { self.homeService = homeService } - + public func fetchRecommendedCollections() -> AnyPublisher<[CollectionInfoEntity], Error> { - homeService.fetchRecommendedCollections() - .map { $0.entities } + return homeService.fetchRecommendedCollections() + .tryMap { try $0.entities } .eraseToAnyPublisher() } } diff --git a/FLINT/Data/Sources/RepositoryImpl/Search/SearchRepositoryImpl.swift b/FLINT/Data/Sources/RepositoryImpl/SearchRepositoryImpl.swift similarity index 70% rename from FLINT/Data/Sources/RepositoryImpl/Search/SearchRepositoryImpl.swift rename to FLINT/Data/Sources/RepositoryImpl/SearchRepositoryImpl.swift index 734a4ad5..4f4b1152 100644 --- a/FLINT/Data/Sources/RepositoryImpl/Search/SearchRepositoryImpl.swift +++ b/FLINT/Data/Sources/RepositoryImpl/SearchRepositoryImpl.swift @@ -1,5 +1,5 @@ // -// SearchContentsImpl.swift +// SearchRepositoryImpl.swift // Data // // Created by 소은 on 1/20/26. @@ -21,8 +21,8 @@ public final class DefaultSearchRepository: SearchRepository { self.searchService = searchService } - public func searchContents(_ keyword: String?) -> AnyPublisher<[ContentEntity], Error> { - searchService.searchContents(keyword) + public func searchContents(keyword: String?) -> AnyPublisher<[ContentEntity], Error> { + return searchService.searchContents(keyword: keyword) .tryMap({ try $0.entities }) .eraseToAnyPublisher() } diff --git a/FLINT/Data/Sources/RepositoryImpl/User/UserRepositoryImpl.swift b/FLINT/Data/Sources/RepositoryImpl/User/UserRepositoryImpl.swift deleted file mode 100644 index c36da857..00000000 --- a/FLINT/Data/Sources/RepositoryImpl/User/UserRepositoryImpl.swift +++ /dev/null @@ -1,106 +0,0 @@ -// -// File.swift -// Data -// -// Created by 김호성 on 2026.01.19. -// - -import Combine -import Foundation - -import Domain - -import DTO -import Networking - -public final class DefaultUserRepository: UserRepository { - - private let userService: UserService - - public init(userService: UserService) { - self.userService = userService - } - - public func checkNickname(_ nickname: String) -> AnyPublisher { - userService.checkNickname(nickname) - .tryMap({ try $0.isAvailable }) - .eraseToAnyPublisher() - } - - public func fetchUserProfile(userId: Int64) -> AnyPublisher { - userService.fetchUserProfile(userId: userId) - .tryMap { try $0.entity } - .eraseToAnyPublisher() - } - - public func fetchMyProfile() -> AnyPublisher { - userService.fetchMyProfile() - .tryMap { try $0.entity } - .eraseToAnyPublisher() - } - - public func fetchMyKeywords() -> AnyPublisher<[KeywordEntity], Error> { - userService.fetchMyKeywords() - .tryMap { dto in - try (dto.keywords ?? []).map { try $0.entity } - } - .eraseToAnyPublisher() - } - - public func fetchUserKeywords(userId: Int64) -> AnyPublisher<[KeywordEntity], Error> { - userService.fetchUserKeywords(userId: userId) - .tryMap { dto in - try (dto.keywords ?? []).map { try $0.entity } - } - .eraseToAnyPublisher() - } - - public func fetchMyCollections() -> AnyPublisher<[CollectionEntity], Error> { - userService.fetchMyCollections() - .tryMap { dto in - try (dto.collections ?? []).map { try $0.entity } - } - .eraseToAnyPublisher() - } - - public func fetchUserCollections(userId: Int64) -> AnyPublisher<[CollectionEntity], Error> { - userService.fetchUserCollections(userId: userId) - .tryMap { dto in - try (dto.collections ?? []).map { try $0.entity } - } - .eraseToAnyPublisher() - } - - public func fetchMyBookmarkedCollections() -> AnyPublisher<[CollectionEntity], Error> { - userService.fetchMyBookmarkedCollections() - .tryMap { dto in - try (dto.collections ?? []).map { try $0.entity } - } - .eraseToAnyPublisher() - } - - public func fetchBookmarkedCollections(userId: Int64) -> AnyPublisher<[CollectionEntity], Error> { - userService.fetchBookmarkedCollections(userId: userId) - .tryMap { dto in - try (dto.collections ?? []).map { try $0.entity } - } - .eraseToAnyPublisher() - } - - public func fetchMyBookmarkedContents() -> AnyPublisher<[ContentInfoEntity], Error> { - userService.fetchMyBookmarkedContents() - .tryMap { dto in - try (dto.contents ?? []).map { try $0.entity } - } - .eraseToAnyPublisher() - } - - public func fetchBookmarkedContents(userId: Int64) -> AnyPublisher<[ContentInfoEntity], Error> { - userService.fetchBookmarkedContents(userId: userId) - .tryMap { dto in - try (dto.contents ?? []).map { try $0.entity } - } - .eraseToAnyPublisher() - } - -} diff --git a/FLINT/Data/Sources/RepositoryImpl/UserRepositoryImpl.swift b/FLINT/Data/Sources/RepositoryImpl/UserRepositoryImpl.swift new file mode 100644 index 00000000..2c5a41c0 --- /dev/null +++ b/FLINT/Data/Sources/RepositoryImpl/UserRepositoryImpl.swift @@ -0,0 +1,87 @@ +// +// UserRepositoryImpl.swift +// Data +// +// Created by 김호성 on 2026.01.19. +// + +import Combine +import Foundation + +import Domain + +import DTO +import Networking + +public final class DefaultUserRepository: UserRepository { + + private let userService: UserService + + public init(userService: UserService) { + self.userService = userService + } + + public func fetchUserProfile(userId: Int64) -> AnyPublisher { + return userService.fetchUserProfile(userId: userId) + .tryMap { try $0.entity } + .eraseToAnyPublisher() + } + + public func fetchUserBookmarkedCollections(userId: Int64) -> AnyPublisher<[CollectionEntity], Error> { + return userService.fetchUserBookmarkedCollections(userId: userId) + .tryMap { try $0.entities } + .eraseToAnyPublisher() + } + + public func fetchUserBookmarkedContents(userId: Int64) -> AnyPublisher<[ContentInfoEntity], Error> { + return userService.fetchUserBookmarkedContents(userId: userId) + .tryMap { try $0.entities } + .eraseToAnyPublisher() + } + + public func fetchUserCollections(userId: Int64) -> AnyPublisher<[CollectionEntity], Error> { + return userService.fetchUserCollections(userId: userId) + .tryMap { try $0.entities } + .eraseToAnyPublisher() + } + + public func fetchUserKeywords(userId: Int64) -> AnyPublisher<[KeywordEntity], Error> { + return userService.fetchUserKeywords(userId: userId) + .tryMap { try $0.entities } + .eraseToAnyPublisher() + } + + public func fetchMyProfile() -> AnyPublisher { + return userService.fetchMyProfile() + .tryMap { try $0.entity } + .eraseToAnyPublisher() + } + + public func fetchMyBookmarkedCollections() -> AnyPublisher<[CollectionEntity], Error> { + return userService.fetchMyBookmarkedCollections() + .tryMap { try $0.entities } + .eraseToAnyPublisher() + } + + public func fetchMyCollections() -> AnyPublisher<[CollectionEntity], Error> { + return userService.fetchMyCollections() + .tryMap { try $0.entities } + .eraseToAnyPublisher() + } + + public func fetchMyKeywords() -> AnyPublisher<[KeywordEntity], Error> { + return userService.fetchMyKeywords() + .tryMap { try $0.entities } + .eraseToAnyPublisher() + } + + public func recalculateMyKeywords() -> AnyPublisher { + return userService.recalculateMyKeywords() + } + + public func checkNickname(_ nickname: String) -> AnyPublisher { + return userService.checkNickname(nickname) + .tryMap({ try $0.isAvailable }) + .eraseToAnyPublisher() + } +} diff --git a/FLINT/Domain/Sources/Repository/AuthRepository.swift b/FLINT/Domain/Sources/Repository/AuthRepository.swift index 363a23c9..7ab15d08 100644 --- a/FLINT/Domain/Sources/Repository/AuthRepository.swift +++ b/FLINT/Domain/Sources/Repository/AuthRepository.swift @@ -1,5 +1,5 @@ // -// File.swift +// AuthRepository.swift // Domain // // Created by 김호성 on 2026.01.21. @@ -11,6 +11,7 @@ import Foundation import Entity public protocol AuthRepository { - func signup(_ signupInfoEntity: SignupInfoEntity) -> AnyPublisher - func socialVerify(socialVerifyEntity: SocialVerifyEntity) -> AnyPublisher + func signup(userInfo: SignupInfoEntity) -> AnyPublisher + func socialVerify(socialAuthCredential: SocialVerifyEntity) -> AnyPublisher + func withDraw() -> AnyPublisher } diff --git a/FLINT/Domain/Sources/Repository/BookmarkRepository.swift b/FLINT/Domain/Sources/Repository/BookmarkRepository.swift index 85e0b4a8..f06080f0 100644 --- a/FLINT/Domain/Sources/Repository/BookmarkRepository.swift +++ b/FLINT/Domain/Sources/Repository/BookmarkRepository.swift @@ -11,9 +11,7 @@ import Foundation import Entity public protocol BookmarkRepository { - func toggleCollectionBookmark(_ collectionId: Int64) -> AnyPublisher - - func toggleContentBookmark(_ contentId: Int64) -> AnyPublisher - - func fetchCollectionBookmarkUsers(_ collectionId: Int64) -> AnyPublisher + func fetchCollectionBookmarkUsers(collectionId: Int64) -> AnyPublisher + func toggleCollectionBookmark(collectionId: Int64) -> AnyPublisher + func toggleContentBookmark(contentId: Int64) -> AnyPublisher } diff --git a/FLINT/Domain/Sources/Repository/CollectionRepository.swift b/FLINT/Domain/Sources/Repository/CollectionRepository.swift index 0a79baf9..6c5ec40e 100644 --- a/FLINT/Domain/Sources/Repository/CollectionRepository.swift +++ b/FLINT/Domain/Sources/Repository/CollectionRepository.swift @@ -11,8 +11,8 @@ import Foundation import Entity public protocol CollectionRepository { - func fetchCollections(cursor: UInt?, size: Int) -> AnyPublisher - func createCollection(_ entity: CreateCollectionEntity) -> AnyPublisher + func fetchCollections(cursor: Int64?, size: Int32) -> AnyPublisher + func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher func fetchCollectionDetail(collectionId: Int64) -> AnyPublisher func fetchWatchingCollections() -> AnyPublisher<[CollectionEntity], Error> } diff --git a/FLINT/Domain/Sources/Repository/ContentRepository.swift b/FLINT/Domain/Sources/Repository/ContentRepository.swift index 1e1324be..2b8f1ab1 100644 --- a/FLINT/Domain/Sources/Repository/ContentRepository.swift +++ b/FLINT/Domain/Sources/Repository/ContentRepository.swift @@ -11,5 +11,6 @@ import Foundation import Entity public protocol ContentRepository { - func fetchOTTPlatforms(_ contentId: Int64) -> AnyPublisher<[OTTPlatformEntity], Error> + func fetchMyBookmarkedContents() -> AnyPublisher<[ContentInfoEntity], Error> + func fetchOTTPlatformsForContent(contentId: Int64) -> AnyPublisher<[OTTPlatformEntity], Error> } diff --git a/FLINT/Domain/Sources/Repository/HomeRepository.swift b/FLINT/Domain/Sources/Repository/HomeRepository.swift index dfad235e..f7118a55 100644 --- a/FLINT/Domain/Sources/Repository/HomeRepository.swift +++ b/FLINT/Domain/Sources/Repository/HomeRepository.swift @@ -10,7 +10,6 @@ import Foundation import Entity - public protocol HomeRepository { func fetchRecommendedCollections() -> AnyPublisher<[CollectionInfoEntity], Error> } diff --git a/FLINT/Domain/Sources/Repository/SearchRepository.swift b/FLINT/Domain/Sources/Repository/SearchRepository.swift index 48222fdf..4b46e5f6 100644 --- a/FLINT/Domain/Sources/Repository/SearchRepository.swift +++ b/FLINT/Domain/Sources/Repository/SearchRepository.swift @@ -1,5 +1,5 @@ // -// SearchContentsRepository.swift +// SearchRepository.swift // Domain // // Created by 소은 on 1/20/26. @@ -10,5 +10,5 @@ import Combine import Entity public protocol SearchRepository { - func searchContents(_ keyword: String?) -> AnyPublisher<[ContentEntity], Error> + func searchContents(keyword: String?) -> AnyPublisher<[ContentEntity], Error> } diff --git a/FLINT/Domain/Sources/Repository/UserRepository.swift b/FLINT/Domain/Sources/Repository/UserRepository.swift index 56d4ac60..32805f39 100644 --- a/FLINT/Domain/Sources/Repository/UserRepository.swift +++ b/FLINT/Domain/Sources/Repository/UserRepository.swift @@ -1,5 +1,5 @@ // -// File.swift +// UserRepository.swift // Domain // // Created by 김호성 on 2026.01.20. @@ -11,15 +11,17 @@ import Foundation import Entity public protocol UserRepository { - func checkNickname(_ nickname: String) -> AnyPublisher func fetchUserProfile(userId: Int64) -> AnyPublisher - func fetchMyProfile() -> AnyPublisher - func fetchMyKeywords() -> AnyPublisher<[KeywordEntity], Error> - func fetchUserKeywords(userId: Int64) -> AnyPublisher<[KeywordEntity], Error> - func fetchMyCollections() -> AnyPublisher<[CollectionEntity], Error> + func fetchUserBookmarkedCollections(userId: Int64) -> AnyPublisher<[CollectionEntity], Error> + func fetchUserBookmarkedContents(userId: Int64) -> AnyPublisher<[ContentInfoEntity], Error> func fetchUserCollections(userId: Int64) -> AnyPublisher<[CollectionEntity], Error> + func fetchUserKeywords(userId: Int64) -> AnyPublisher<[KeywordEntity], Error> + + func fetchMyProfile() -> AnyPublisher func fetchMyBookmarkedCollections() -> AnyPublisher<[CollectionEntity], Error> - func fetchBookmarkedCollections(userId: Int64) -> AnyPublisher<[CollectionEntity], Error> - func fetchMyBookmarkedContents() -> AnyPublisher<[ContentInfoEntity], Error> - func fetchBookmarkedContents(userId: Int64) -> AnyPublisher<[ContentInfoEntity], Error> + func fetchMyCollections() -> AnyPublisher<[CollectionEntity], Error> + func fetchMyKeywords() -> AnyPublisher<[KeywordEntity], Error> + func recalculateMyKeywords() -> AnyPublisher + + func checkNickname(_ nickname: String) -> AnyPublisher } From 3ea20b8f0a2faf652dbe32a68aee67976a94df11 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Fri, 6 Feb 2026 23:53:10 +0900 Subject: [PATCH 16/45] =?UTF-8?q?[chore]=20return=20=EB=AA=85=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FLINT/Data/Sources/Networking/Service/BookmarkService.swift | 4 ++-- FLINT/Data/Sources/Networking/Service/HomeService.swift | 2 +- FLINT/Data/Sources/Networking/Service/SearchService.swift | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/FLINT/Data/Sources/Networking/Service/BookmarkService.swift b/FLINT/Data/Sources/Networking/Service/BookmarkService.swift index 76743535..cab7e148 100644 --- a/FLINT/Data/Sources/Networking/Service/BookmarkService.swift +++ b/FLINT/Data/Sources/Networking/Service/BookmarkService.swift @@ -33,12 +33,12 @@ public final class DefaultBookmarkService: BookmarkService { } public func toggleCollectionBookmark(collectionId: Int64) -> AnyPublisher { - bookmarkAPIProvider.requestPublisher(.toggleCollectionBookmark(collectionId: collectionId)) + return bookmarkAPIProvider.requestPublisher(.toggleCollectionBookmark(collectionId: collectionId)) .mapBaseResponseData(Bool.self) } public func toggleContentBookmark(contentId: Int64) -> AnyPublisher { - bookmarkAPIProvider.requestPublisher(.toggleContentBookmark(contentId: contentId)) + return bookmarkAPIProvider.requestPublisher(.toggleContentBookmark(contentId: contentId)) .mapBaseResponseData(Bool.self) } } diff --git a/FLINT/Data/Sources/Networking/Service/HomeService.swift b/FLINT/Data/Sources/Networking/Service/HomeService.swift index bc9ea1d4..39bc275b 100644 --- a/FLINT/Data/Sources/Networking/Service/HomeService.swift +++ b/FLINT/Data/Sources/Networking/Service/HomeService.swift @@ -26,7 +26,7 @@ public final class DefaultHomeService: HomeService { } public func fetchRecommendedCollections() -> AnyPublisher { - homeAPIProvider.requestPublisher(.fetchRecommendedCollections) + return homeAPIProvider.requestPublisher(.fetchRecommendedCollections) .mapBaseResponseData(HomeRecommendedCollectionsDTO.self) } } diff --git a/FLINT/Data/Sources/Networking/Service/SearchService.swift b/FLINT/Data/Sources/Networking/Service/SearchService.swift index 88bc4aaf..2f4ce298 100644 --- a/FLINT/Data/Sources/Networking/Service/SearchService.swift +++ b/FLINT/Data/Sources/Networking/Service/SearchService.swift @@ -26,7 +26,7 @@ public final class DefaultSearchService: SearchService { } public func searchContents(keyword: String?) -> AnyPublisher { - searchAPIProvider.requestPublisher(.searchContents(keyword: keyword)) + return searchAPIProvider.requestPublisher(.searchContents(keyword: keyword)) .mapBaseResponseData(SearchContentsDTO.self) } } From 48d4a93f999e43dcbce83c035a25b81a510b34d5 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Sat, 7 Feb 2026 00:00:20 +0900 Subject: [PATCH 17/45] =?UTF-8?q?[chore]=20=EA=B0=9C=ED=96=89=20=EC=A0=95?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FLINT/Data/Sources/RepositoryImpl/ContentRepositoryImpl.swift | 1 - FLINT/Domain/Sources/Repository/HomeRepository.swift | 1 - 2 files changed, 2 deletions(-) diff --git a/FLINT/Data/Sources/RepositoryImpl/ContentRepositoryImpl.swift b/FLINT/Data/Sources/RepositoryImpl/ContentRepositoryImpl.swift index b2906f2c..1518b918 100644 --- a/FLINT/Data/Sources/RepositoryImpl/ContentRepositoryImpl.swift +++ b/FLINT/Data/Sources/RepositoryImpl/ContentRepositoryImpl.swift @@ -5,7 +5,6 @@ // Created by 소은 on 1/21/26. // - import Combine import Foundation diff --git a/FLINT/Domain/Sources/Repository/HomeRepository.swift b/FLINT/Domain/Sources/Repository/HomeRepository.swift index f7118a55..a4c70c7b 100644 --- a/FLINT/Domain/Sources/Repository/HomeRepository.swift +++ b/FLINT/Domain/Sources/Repository/HomeRepository.swift @@ -13,4 +13,3 @@ import Entity public protocol HomeRepository { func fetchRecommendedCollections() -> AnyPublisher<[CollectionInfoEntity], Error> } - From 5d0d1cacfd12a0fe3defa3e42b4d0943d093271b Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Sat, 7 Feb 2026 14:44:46 +0900 Subject: [PATCH 18/45] =?UTF-8?q?[refactor]=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EB=AA=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FLINT/Data/Sources/Networking/Service/CollectionService.swift | 4 ++-- .../Sources/RepositoryImpl/CollectionRepositoryImpl.swift | 4 ++-- FLINT/Domain/Sources/Repository/CollectionRepository.swift | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/FLINT/Data/Sources/Networking/Service/CollectionService.swift b/FLINT/Data/Sources/Networking/Service/CollectionService.swift index ccda2c25..2ebfe82f 100644 --- a/FLINT/Data/Sources/Networking/Service/CollectionService.swift +++ b/FLINT/Data/Sources/Networking/Service/CollectionService.swift @@ -19,7 +19,7 @@ public protocol CollectionService { func fetchCollections(cursor: Int64?, size: Int32) -> AnyPublisher func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher func fetchCollectionDetail(collectionId: Int64) -> AnyPublisher - func fetchWatchingCollections() -> AnyPublisher + func fetchRecentViewedCollections() -> AnyPublisher } public final class DefaultCollectionService: CollectionService { @@ -46,7 +46,7 @@ public final class DefaultCollectionService: CollectionService { .mapBaseResponseData(CollectionDetailDTO.self) } - public func fetchWatchingCollections() -> AnyPublisher { + public func fetchRecentViewedCollections() -> AnyPublisher { return collectionAPIProvider.requestPublisher(.fetchRecentViewedCollections) .mapBaseResponseData(RecentViewedCollectionsDTO.self) } diff --git a/FLINT/Data/Sources/RepositoryImpl/CollectionRepositoryImpl.swift b/FLINT/Data/Sources/RepositoryImpl/CollectionRepositoryImpl.swift index 1f998841..1065825b 100644 --- a/FLINT/Data/Sources/RepositoryImpl/CollectionRepositoryImpl.swift +++ b/FLINT/Data/Sources/RepositoryImpl/CollectionRepositoryImpl.swift @@ -37,8 +37,8 @@ public final class DefaultCollectionRepository: CollectionRepository { .eraseToAnyPublisher() } - public func fetchWatchingCollections() -> AnyPublisher<[CollectionEntity], Error> { - return collectionService.fetchWatchingCollections() + public func fetchRecentViewedCollections() -> AnyPublisher<[CollectionEntity], Error> { + return collectionService.fetchRecentViewedCollections() .tryMap { try $0.entities } .eraseToAnyPublisher() } diff --git a/FLINT/Domain/Sources/Repository/CollectionRepository.swift b/FLINT/Domain/Sources/Repository/CollectionRepository.swift index 6c5ec40e..82fe6863 100644 --- a/FLINT/Domain/Sources/Repository/CollectionRepository.swift +++ b/FLINT/Domain/Sources/Repository/CollectionRepository.swift @@ -14,5 +14,5 @@ public protocol CollectionRepository { func fetchCollections(cursor: Int64?, size: Int32) -> AnyPublisher func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher func fetchCollectionDetail(collectionId: Int64) -> AnyPublisher - func fetchWatchingCollections() -> AnyPublisher<[CollectionEntity], Error> + func fetchRecentViewedCollections() -> AnyPublisher<[CollectionEntity], Error> } From 39d56347471c0c8a236026838d6274c82f6dd227 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Sun, 8 Feb 2026 22:23:56 +0900 Subject: [PATCH 19/45] =?UTF-8?q?[refactor]=20Data=20=EA=B3=84=EC=B8=B5=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fetchCreatedCollections --- FLINT/Data/Sources/Networking/API/UserAPI.swift | 12 ++++++------ .../Sources/Networking/Service/UserService.swift | 12 ++++++------ .../Sources/RepositoryImpl/UserRepositoryImpl.swift | 8 ++++---- FLINT/Domain/Sources/Repository/UserRepository.swift | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/FLINT/Data/Sources/Networking/API/UserAPI.swift b/FLINT/Data/Sources/Networking/API/UserAPI.swift index 944d17b5..96d34c2c 100644 --- a/FLINT/Data/Sources/Networking/API/UserAPI.swift +++ b/FLINT/Data/Sources/Networking/API/UserAPI.swift @@ -13,12 +13,12 @@ public enum UserAPI { case fetchUserProfile(userId: Int64) case fetchUserBookmarkedCollections(userId: Int64) case fetchUserBookmarkedContents(userId: Int64) - case fetchUserCollections(userId: Int64) + case fetchUserCreatedCollections(userId: Int64) case fetchUserKeywords(userId: Int64) case fetchMyProfile case fetchMyBookmarkedCollections - case fetchMyCollections + case fetchMyCreatedCollections case fetchMyKeywords case recalculateMyKeywords @@ -34,7 +34,7 @@ extension UserAPI: TargetType { return "/api/v1/users/\(userId)/bookmarked-collections" case let .fetchUserBookmarkedContents(userId): return "/api/v1/users/\(userId)/bookmarked-contents" - case let .fetchUserCollections(userId): + case let .fetchUserCreatedCollections(userId): return "/api/v1/users/\(userId)/collections" case let .fetchUserKeywords(userId): return "/api/v1/users/\(userId)/keywords" @@ -43,7 +43,7 @@ extension UserAPI: TargetType { return "/api/v1/users/me" case .fetchMyBookmarkedCollections: return "/api/v1/users/me/bookmarked-collections" - case .fetchMyCollections: + case .fetchMyCreatedCollections: return "/api/v1/users/me/collections" case .fetchMyKeywords: return "/api/v1/users/me/keywords" @@ -57,7 +57,7 @@ extension UserAPI: TargetType { public var method: Moya.Method { switch self { - case .fetchUserProfile, .fetchUserBookmarkedCollections, .fetchUserBookmarkedContents, .fetchUserCollections, .fetchUserKeywords, .fetchMyProfile, .fetchMyBookmarkedCollections, .fetchMyCollections, .fetchMyKeywords, .checkNickname: + case .fetchUserProfile, .fetchUserBookmarkedCollections, .fetchUserBookmarkedContents, .fetchUserCreatedCollections, .fetchUserKeywords, .fetchMyProfile, .fetchMyBookmarkedCollections, .fetchMyCreatedCollections, .fetchMyKeywords, .checkNickname: return .get case .recalculateMyKeywords: return .patch @@ -71,7 +71,7 @@ extension UserAPI: TargetType { parameters: ["nickname": nickname], encoding: URLEncoding.queryString ) - case .fetchUserProfile, .fetchUserBookmarkedCollections, .fetchUserBookmarkedContents, .fetchUserCollections, .fetchUserKeywords, .fetchMyProfile, .fetchMyBookmarkedCollections, .fetchMyCollections, .fetchMyKeywords, .recalculateMyKeywords: + case .fetchUserProfile, .fetchUserBookmarkedCollections, .fetchUserBookmarkedContents, .fetchUserCreatedCollections, .fetchUserKeywords, .fetchMyProfile, .fetchMyBookmarkedCollections, .fetchMyCreatedCollections, .fetchMyKeywords, .recalculateMyKeywords: return .requestPlain } } diff --git a/FLINT/Data/Sources/Networking/Service/UserService.swift b/FLINT/Data/Sources/Networking/Service/UserService.swift index 12c10699..c2685026 100644 --- a/FLINT/Data/Sources/Networking/Service/UserService.swift +++ b/FLINT/Data/Sources/Networking/Service/UserService.swift @@ -17,12 +17,12 @@ public protocol UserService { func fetchUserProfile(userId: Int64) -> AnyPublisher func fetchUserBookmarkedCollections(userId: Int64) -> AnyPublisher func fetchUserBookmarkedContents(userId: Int64) -> AnyPublisher - func fetchUserCollections(userId: Int64) -> AnyPublisher + func fetchUserCreatedCollections(userId: Int64) -> AnyPublisher func fetchUserKeywords(userId: Int64) -> AnyPublisher func fetchMyProfile() -> AnyPublisher func fetchMyBookmarkedCollections() -> AnyPublisher - func fetchMyCollections() -> AnyPublisher + func fetchMyCreatedCollections() -> AnyPublisher func fetchMyKeywords() -> AnyPublisher func recalculateMyKeywords() -> AnyPublisher @@ -57,8 +57,8 @@ public final class DefaultUserService: UserService { .mapBaseResponseData(KeywordsDTO.self) } - public func fetchUserCollections(userId: Int64) -> AnyPublisher { - return userAPIProvider.requestPublisher(.fetchUserCollections(userId: userId)) + public func fetchUserCreatedCollections(userId: Int64) -> AnyPublisher { + return userAPIProvider.requestPublisher(.fetchUserCreatedCollections(userId: userId)) .mapBaseResponseData(UserCollectionsDTO.self) } @@ -72,8 +72,8 @@ public final class DefaultUserService: UserService { .mapBaseResponseData(UserCollectionsDTO.self) } - public func fetchMyCollections() -> AnyPublisher { - return userAPIProvider.requestPublisher(.fetchMyCollections) + public func fetchMyCreatedCollections() -> AnyPublisher { + return userAPIProvider.requestPublisher(.fetchMyCreatedCollections) .mapBaseResponseData(UserCollectionsDTO.self) } diff --git a/FLINT/Data/Sources/RepositoryImpl/UserRepositoryImpl.swift b/FLINT/Data/Sources/RepositoryImpl/UserRepositoryImpl.swift index 2c5a41c0..e6222f14 100644 --- a/FLINT/Data/Sources/RepositoryImpl/UserRepositoryImpl.swift +++ b/FLINT/Data/Sources/RepositoryImpl/UserRepositoryImpl.swift @@ -39,8 +39,8 @@ public final class DefaultUserRepository: UserRepository { .eraseToAnyPublisher() } - public func fetchUserCollections(userId: Int64) -> AnyPublisher<[CollectionEntity], Error> { - return userService.fetchUserCollections(userId: userId) + public func fetchUserCreatedCollections(userId: Int64) -> AnyPublisher<[CollectionEntity], Error> { + return userService.fetchUserCreatedCollections(userId: userId) .tryMap { try $0.entities } .eraseToAnyPublisher() } @@ -63,8 +63,8 @@ public final class DefaultUserRepository: UserRepository { .eraseToAnyPublisher() } - public func fetchMyCollections() -> AnyPublisher<[CollectionEntity], Error> { - return userService.fetchMyCollections() + public func fetchMyCreatedCollections() -> AnyPublisher<[CollectionEntity], Error> { + return userService.fetchMyCreatedCollections() .tryMap { try $0.entities } .eraseToAnyPublisher() } diff --git a/FLINT/Domain/Sources/Repository/UserRepository.swift b/FLINT/Domain/Sources/Repository/UserRepository.swift index 32805f39..5be3578d 100644 --- a/FLINT/Domain/Sources/Repository/UserRepository.swift +++ b/FLINT/Domain/Sources/Repository/UserRepository.swift @@ -14,12 +14,12 @@ public protocol UserRepository { func fetchUserProfile(userId: Int64) -> AnyPublisher func fetchUserBookmarkedCollections(userId: Int64) -> AnyPublisher<[CollectionEntity], Error> func fetchUserBookmarkedContents(userId: Int64) -> AnyPublisher<[ContentInfoEntity], Error> - func fetchUserCollections(userId: Int64) -> AnyPublisher<[CollectionEntity], Error> + func fetchUserCreatedCollections(userId: Int64) -> AnyPublisher<[CollectionEntity], Error> func fetchUserKeywords(userId: Int64) -> AnyPublisher<[KeywordEntity], Error> func fetchMyProfile() -> AnyPublisher func fetchMyBookmarkedCollections() -> AnyPublisher<[CollectionEntity], Error> - func fetchMyCollections() -> AnyPublisher<[CollectionEntity], Error> + func fetchMyCreatedCollections() -> AnyPublisher<[CollectionEntity], Error> func fetchMyKeywords() -> AnyPublisher<[KeywordEntity], Error> func recalculateMyKeywords() -> AnyPublisher From 42660848b9d46de73da564ca71768d37737e4a1a Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Sun, 8 Feb 2026 22:25:57 +0900 Subject: [PATCH 20/45] =?UTF-8?q?[refactor]=20UserProfileUseCase=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...O.swift => SocialVerifyResultEntity.swift} | 2 +- .../Sources/Entity/User/UserTarget.swift | 13 ++++ .../FetchBookmarkedCollectionsUseCase.swift | 34 +++++++++ .../FetchBookmarkedContentsUseCase.swift | 36 +++++++++ .../FetchCreatedCollectionsUseCase.swift | 34 +++++++++ .../Profile/FetchKeywordsUseCase.swift | 34 +++++++++ .../UseCase/Profile/FetchProfileUseCase.swift | 34 +++++++++ .../UseCase/Profile/UserProfileUseCase.swift | 75 ------------------- 8 files changed, 186 insertions(+), 76 deletions(-) rename FLINT/Domain/Sources/Entity/SocialVerify/{SocialVerifyResponseDTO.swift => SocialVerifyResultEntity.swift} (92%) create mode 100644 FLINT/Domain/Sources/Entity/User/UserTarget.swift create mode 100644 FLINT/Domain/Sources/UseCase/Profile/FetchBookmarkedCollectionsUseCase.swift create mode 100644 FLINT/Domain/Sources/UseCase/Profile/FetchBookmarkedContentsUseCase.swift create mode 100644 FLINT/Domain/Sources/UseCase/Profile/FetchCreatedCollectionsUseCase.swift create mode 100644 FLINT/Domain/Sources/UseCase/Profile/FetchKeywordsUseCase.swift create mode 100644 FLINT/Domain/Sources/UseCase/Profile/FetchProfileUseCase.swift delete mode 100644 FLINT/Domain/Sources/UseCase/Profile/UserProfileUseCase.swift diff --git a/FLINT/Domain/Sources/Entity/SocialVerify/SocialVerifyResponseDTO.swift b/FLINT/Domain/Sources/Entity/SocialVerify/SocialVerifyResultEntity.swift similarity index 92% rename from FLINT/Domain/Sources/Entity/SocialVerify/SocialVerifyResponseDTO.swift rename to FLINT/Domain/Sources/Entity/SocialVerify/SocialVerifyResultEntity.swift index 0bc9da0a..66a3832f 100644 --- a/FLINT/Domain/Sources/Entity/SocialVerify/SocialVerifyResponseDTO.swift +++ b/FLINT/Domain/Sources/Entity/SocialVerify/SocialVerifyResultEntity.swift @@ -1,5 +1,5 @@ // -// File.swift +// SocialVerifyResultEntity.swift // Data // // Created by 김호성 on 2026.01.23. diff --git a/FLINT/Domain/Sources/Entity/User/UserTarget.swift b/FLINT/Domain/Sources/Entity/User/UserTarget.swift new file mode 100644 index 00000000..60477ad4 --- /dev/null +++ b/FLINT/Domain/Sources/Entity/User/UserTarget.swift @@ -0,0 +1,13 @@ +// +// UserTarget.swift +// Domain +// +// Created by 김호성 on 2026.02.08. +// + +import Foundation + +public enum UserTarget { + case me + case user(id: Int64) +} diff --git a/FLINT/Domain/Sources/UseCase/Profile/FetchBookmarkedCollectionsUseCase.swift b/FLINT/Domain/Sources/UseCase/Profile/FetchBookmarkedCollectionsUseCase.swift new file mode 100644 index 00000000..a0ca5440 --- /dev/null +++ b/FLINT/Domain/Sources/UseCase/Profile/FetchBookmarkedCollectionsUseCase.swift @@ -0,0 +1,34 @@ +// +// FetchBookmarkedCollectionsUseCase.swift +// Domain +// +// Created by 김호성 on 2026.02.08. +// + +import Combine +import Foundation + +import Entity +import Repository + +public protocol FetchBookmarkedCollectionsUseCase { + func fetchBookmarkedCollections(for target: UserTarget) -> AnyPublisher<[CollectionEntity], Error> +} + +public final class DefaultFetchBookmarkedCollectionsUseCase: FetchBookmarkedCollectionsUseCase { + + private let userRepository: UserRepository + + public init(userRepository: UserRepository) { + self.userRepository = userRepository + } + + public func fetchBookmarkedCollections(for target: UserTarget) -> AnyPublisher<[CollectionEntity], Error> { + switch target { + case .me: + return userRepository.fetchMyBookmarkedCollections() + case let .user(id): + return userRepository.fetchUserBookmarkedCollections(userId: id) + } + } +} diff --git a/FLINT/Domain/Sources/UseCase/Profile/FetchBookmarkedContentsUseCase.swift b/FLINT/Domain/Sources/UseCase/Profile/FetchBookmarkedContentsUseCase.swift new file mode 100644 index 00000000..ca7183eb --- /dev/null +++ b/FLINT/Domain/Sources/UseCase/Profile/FetchBookmarkedContentsUseCase.swift @@ -0,0 +1,36 @@ +// +// FetchBookmarkedContentsUseCase.swift +// Domain +// +// Created by 김호성 on 2026.02.08. +// + +import Combine +import Foundation + +import Entity +import Repository + +public protocol FetchBookmarkedContentsUseCase { + func fetchBookmarkedContents(for target: UserTarget) -> AnyPublisher<[ContentInfoEntity], Error> +} + +public final class DefaultFetchBookmarkedContentsUseCase: FetchBookmarkedContentsUseCase { + + private let contentRepository: ContentRepository + private let userRepository: UserRepository + + public init(contentRepository: ContentRepository, userRepository: UserRepository) { + self.contentRepository = contentRepository + self.userRepository = userRepository + } + + public func fetchBookmarkedContents(for target: UserTarget) -> AnyPublisher<[ContentInfoEntity], Error> { + switch target { + case .me: + return contentRepository.fetchMyBookmarkedContents() + case let .user(id): + return userRepository.fetchUserBookmarkedContents(userId: id) + } + } +} diff --git a/FLINT/Domain/Sources/UseCase/Profile/FetchCreatedCollectionsUseCase.swift b/FLINT/Domain/Sources/UseCase/Profile/FetchCreatedCollectionsUseCase.swift new file mode 100644 index 00000000..73d90640 --- /dev/null +++ b/FLINT/Domain/Sources/UseCase/Profile/FetchCreatedCollectionsUseCase.swift @@ -0,0 +1,34 @@ +// +// FetchCreatedCollectionsUseCase.swift +// Domain +// +// Created by 김호성 on 2026.02.08. +// + +import Combine +import Foundation + +import Entity +import Repository + +public protocol FetchCreatedCollectionsUseCase { + func fetchCreatedCollections(for target: UserTarget) -> AnyPublisher<[CollectionEntity], Error> +} + +public final class DefaultFetchCreatedCollectionsUseCase: FetchCreatedCollectionsUseCase { + + private let userRepository: UserRepository + + public init(userRepository: UserRepository) { + self.userRepository = userRepository + } + + public func fetchCreatedCollections(for target: UserTarget) -> AnyPublisher<[CollectionEntity], Error> { + switch target { + case .me: + return userRepository.fetchMyCreatedCollections() + case let .user(id): + return userRepository.fetchUserCreatedCollections(userId: id) + } + } +} diff --git a/FLINT/Domain/Sources/UseCase/Profile/FetchKeywordsUseCase.swift b/FLINT/Domain/Sources/UseCase/Profile/FetchKeywordsUseCase.swift new file mode 100644 index 00000000..0573f9d9 --- /dev/null +++ b/FLINT/Domain/Sources/UseCase/Profile/FetchKeywordsUseCase.swift @@ -0,0 +1,34 @@ +// +// FetchKeywordsUseCase.swift +// Domain +// +// Created by 김호성 on 2026.02.08. +// + +import Combine +import Foundation + +import Entity +import Repository + +public protocol FetchKeywordsUseCase { + func fetchKeywords(for target: UserTarget) -> AnyPublisher<[KeywordEntity], Error> +} + +public final class DefaultFetchKeywordsUseCase: FetchKeywordsUseCase { + + private let userRepository: UserRepository + + public init(userRepository: UserRepository) { + self.userRepository = userRepository + } + + public func fetchKeywords(for target: UserTarget) -> AnyPublisher<[KeywordEntity], Error> { + switch target { + case .me: + return userRepository.fetchMyKeywords() + case let .user(id): + return userRepository.fetchUserKeywords(userId: id) + } + } +} diff --git a/FLINT/Domain/Sources/UseCase/Profile/FetchProfileUseCase.swift b/FLINT/Domain/Sources/UseCase/Profile/FetchProfileUseCase.swift new file mode 100644 index 00000000..619341ff --- /dev/null +++ b/FLINT/Domain/Sources/UseCase/Profile/FetchProfileUseCase.swift @@ -0,0 +1,34 @@ +// +// FetchProfileUseCase.swift +// Domain +// +// Created by 김호성 on 2026.02.08. +// + +import Combine +import Foundation + +import Entity +import Repository + +public protocol FetchProfileUseCase { + func fetchProfile(for target: UserTarget) -> AnyPublisher +} + +public final class DefaultFetchProfileUseCase: FetchProfileUseCase { + + private let userRepository: UserRepository + + public init(userRepository: UserRepository) { + self.userRepository = userRepository + } + + public func fetchProfile(for target: UserTarget) -> AnyPublisher { + switch target { + case .me: + return userRepository.fetchMyProfile() + case let .user(id): + return userRepository.fetchUserProfile(userId: id) + } + } +} diff --git a/FLINT/Domain/Sources/UseCase/Profile/UserProfileUseCase.swift b/FLINT/Domain/Sources/UseCase/Profile/UserProfileUseCase.swift deleted file mode 100644 index a7dfc0c4..00000000 --- a/FLINT/Domain/Sources/UseCase/Profile/UserProfileUseCase.swift +++ /dev/null @@ -1,75 +0,0 @@ -// -// UserProfileUseCase.swift -// Domain -// -// Created by 진소은 on 1/22/26. -// - - -import Combine -import Foundation - -import Entity -import Repository - -public protocol UserProfileUseCase { - func fetchUserProfile(userId: Int64) -> AnyPublisher - func fetchMyProfile() -> AnyPublisher - func fetchMyKeywords() -> AnyPublisher<[KeywordEntity], Error> - func fetchUserKeywords(userId: Int64) -> AnyPublisher<[KeywordEntity], Error> - func fetchMyCollections() -> AnyPublisher<[CollectionEntity], Error> - func fetchUserCollections(userId: Int64) -> AnyPublisher<[CollectionEntity], Error> - func fetchMyBookmarkedCollections() -> AnyPublisher<[CollectionEntity], Error> - func fetchBookmarkedCollections(userId: Int64) -> AnyPublisher<[CollectionEntity], Error> - func fetchMyBookmarkedContents() -> AnyPublisher<[ContentInfoEntity], Error> - func fetchBookmarkedContents(userId: Int64) -> AnyPublisher<[ContentInfoEntity], Error> -} - -public final class DefaultUserProfileUseCase: UserProfileUseCase { - - private let userRepository: UserRepository - - public init(userRepository: UserRepository) { - self.userRepository = userRepository - } - - public func fetchUserProfile(userId: Int64) -> AnyPublisher { - return userRepository.fetchUserProfile(userId: userId) - } - - public func fetchMyProfile() -> AnyPublisher { - return userRepository.fetchMyProfile() - } - - public func fetchUserKeywords(userId: Int64) -> AnyPublisher<[KeywordEntity], Error> { - return userRepository.fetchUserKeywords(userId: userId) - } - - public func fetchMyKeywords() -> AnyPublisher<[KeywordEntity], Error> { - return userRepository.fetchMyKeywords() - } - - public func fetchMyCollections() -> AnyPublisher<[CollectionEntity], Error> { - userRepository.fetchMyCollections() - } - - public func fetchUserCollections(userId: Int64) -> AnyPublisher<[CollectionEntity], Error> { - userRepository.fetchUserCollections(userId: userId) - } - - public func fetchMyBookmarkedCollections() -> AnyPublisher<[CollectionEntity], Error> { - return userRepository.fetchMyBookmarkedCollections() - } - - public func fetchBookmarkedCollections(userId: Int64) -> AnyPublisher<[CollectionEntity], Error> { - return userRepository.fetchBookmarkedCollections(userId: userId) - } - - public func fetchMyBookmarkedContents() -> AnyPublisher<[ContentInfoEntity], Error> { - return userRepository.fetchMyBookmarkedContents() - } - - public func fetchBookmarkedContents(userId: Int64) -> AnyPublisher<[ContentInfoEntity], Error> { - return userRepository.fetchBookmarkedContents(userId: userId) - } -} From 28971ca23ff4cf33a8e2f6d6eab0567e2c0c36cf Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Sun, 8 Feb 2026 22:30:16 +0900 Subject: [PATCH 21/45] =?UTF-8?q?[refactor]=20Auth=20UseCase=20=EB=A6=AC?= =?UTF-8?q?=ED=8C=A9=ED=86=A0=EB=A7=81=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/Signup/SignupInfoEntity.swift | 2 +- .../SocialVerify/SocialLoginEntity.swift | 22 -------------- .../Entity/SocialVerify/SocialLoginType.swift | 2 +- .../SocialVerify/SocialVerifyEntity.swift | 2 +- .../{Signup => Auth}/SignupUseCase.swift | 8 ++--- .../SocialVerifyUseCase.swift | 8 ++--- .../UseCase/Auth/WithDrawUseCase.swift | 29 +++++++++++++++++++ 7 files changed, 40 insertions(+), 33 deletions(-) delete mode 100644 FLINT/Domain/Sources/Entity/SocialVerify/SocialLoginEntity.swift rename FLINT/Domain/Sources/UseCase/{Signup => Auth}/SignupUseCase.swift (61%) rename FLINT/Domain/Sources/UseCase/{SocialVerify => Auth}/SocialVerifyUseCase.swift (53%) create mode 100644 FLINT/Domain/Sources/UseCase/Auth/WithDrawUseCase.swift diff --git a/FLINT/Domain/Sources/Entity/Signup/SignupInfoEntity.swift b/FLINT/Domain/Sources/Entity/Signup/SignupInfoEntity.swift index 3211b694..c851125a 100644 --- a/FLINT/Domain/Sources/Entity/Signup/SignupInfoEntity.swift +++ b/FLINT/Domain/Sources/Entity/Signup/SignupInfoEntity.swift @@ -1,5 +1,5 @@ // -// File.swift +// SignupInfoEntity.swift // Domain // // Created by 김호성 on 2026.01.21. diff --git a/FLINT/Domain/Sources/Entity/SocialVerify/SocialLoginEntity.swift b/FLINT/Domain/Sources/Entity/SocialVerify/SocialLoginEntity.swift deleted file mode 100644 index 5b477c1a..00000000 --- a/FLINT/Domain/Sources/Entity/SocialVerify/SocialLoginEntity.swift +++ /dev/null @@ -1,22 +0,0 @@ -// -// File.swift -// Domain -// -// Created by 김호성 on 2026.01.23. -// - -import Foundation - -public struct SocialLoginEntity { - public let accessToken: String - public let refreshToken: String - public let userId: String - public let nickname: String - - public init(accessToken: String, refreshToken: String, userId: String, nickname: String) { - self.accessToken = accessToken - self.refreshToken = refreshToken - self.userId = userId - self.nickname = nickname - } -} diff --git a/FLINT/Domain/Sources/Entity/SocialVerify/SocialLoginType.swift b/FLINT/Domain/Sources/Entity/SocialVerify/SocialLoginType.swift index f57ad09a..c9eefe89 100644 --- a/FLINT/Domain/Sources/Entity/SocialVerify/SocialLoginType.swift +++ b/FLINT/Domain/Sources/Entity/SocialVerify/SocialLoginType.swift @@ -1,5 +1,5 @@ // -// File.swift +// SocialLoginType.swift // Domain // // Created by 김호성 on 2026.01.23. diff --git a/FLINT/Domain/Sources/Entity/SocialVerify/SocialVerifyEntity.swift b/FLINT/Domain/Sources/Entity/SocialVerify/SocialVerifyEntity.swift index 22a1d8de..adee98b4 100644 --- a/FLINT/Domain/Sources/Entity/SocialVerify/SocialVerifyEntity.swift +++ b/FLINT/Domain/Sources/Entity/SocialVerify/SocialVerifyEntity.swift @@ -1,5 +1,5 @@ // -// File.swift +// SocialVerifyEntity.swift // Domain // // Created by 김호성 on 2026.01.23. diff --git a/FLINT/Domain/Sources/UseCase/Signup/SignupUseCase.swift b/FLINT/Domain/Sources/UseCase/Auth/SignupUseCase.swift similarity index 61% rename from FLINT/Domain/Sources/UseCase/Signup/SignupUseCase.swift rename to FLINT/Domain/Sources/UseCase/Auth/SignupUseCase.swift index ac4af143..56ecdfa8 100644 --- a/FLINT/Domain/Sources/UseCase/Signup/SignupUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Auth/SignupUseCase.swift @@ -1,5 +1,5 @@ // -// File.swift +// SignupUseCase.swift // Domain // // Created by 김호성 on 2026.01.21. @@ -12,7 +12,7 @@ import Entity import Repository public protocol SignupUseCase { - func signup(_ signupInfoEntity: SignupInfoEntity) -> AnyPublisher + func signup(userInfo: SignupInfoEntity) -> AnyPublisher } public final class DefaultSignupUseCase: SignupUseCase { @@ -23,7 +23,7 @@ public final class DefaultSignupUseCase: SignupUseCase { self.authRepository = authRepository } - public func signup(_ signupInfoEntity: SignupInfoEntity) -> AnyPublisher { - return authRepository.signup(signupInfoEntity) + public func signup(userInfo: SignupInfoEntity) -> AnyPublisher { + return authRepository.signup(userInfo: userInfo) } } diff --git a/FLINT/Domain/Sources/UseCase/SocialVerify/SocialVerifyUseCase.swift b/FLINT/Domain/Sources/UseCase/Auth/SocialVerifyUseCase.swift similarity index 53% rename from FLINT/Domain/Sources/UseCase/SocialVerify/SocialVerifyUseCase.swift rename to FLINT/Domain/Sources/UseCase/Auth/SocialVerifyUseCase.swift index b6e6bcac..55ab581b 100644 --- a/FLINT/Domain/Sources/UseCase/SocialVerify/SocialVerifyUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Auth/SocialVerifyUseCase.swift @@ -1,5 +1,5 @@ // -// File.swift +// SocialVerifyUseCase.swift // Domain // // Created by 김호성 on 2026.01.23. @@ -12,7 +12,7 @@ import Entity import Repository public protocol SocialVerifyUseCase { - func socialVerify(socialVerifyEntity: SocialVerifyEntity) -> AnyPublisher + func socialVerify(socialAuthCredential: SocialVerifyEntity) -> AnyPublisher } public final class DefaultSocialVerifyUseCase: SocialVerifyUseCase { @@ -23,7 +23,7 @@ public final class DefaultSocialVerifyUseCase: SocialVerifyUseCase { self.authRepository = authRepository } - public func socialVerify(socialVerifyEntity: SocialVerifyEntity) -> AnyPublisher { - return authRepository.socialVerify(socialVerifyEntity: socialVerifyEntity) + public func socialVerify(socialAuthCredential: SocialVerifyEntity) -> AnyPublisher { + return authRepository.socialVerify(socialAuthCredential: socialAuthCredential) } } diff --git a/FLINT/Domain/Sources/UseCase/Auth/WithDrawUseCase.swift b/FLINT/Domain/Sources/UseCase/Auth/WithDrawUseCase.swift new file mode 100644 index 00000000..e4ecda74 --- /dev/null +++ b/FLINT/Domain/Sources/UseCase/Auth/WithDrawUseCase.swift @@ -0,0 +1,29 @@ +// +// WithDrawUseCase.swift +// Domain +// +// Created by 김호성 on 2026.01.24. +// + +import Combine +import Foundation + +import Entity +import Repository + +public protocol WithDrawUseCase { + func withDraw() -> AnyPublisher +} + +public final class DefaultWithDrawUseCase: WithDrawUseCase { + + private let authRepository: AuthRepository + + public init(authRepository: AuthRepository) { + self.authRepository = authRepository + } + + public func withDraw() -> AnyPublisher { + return authRepository.withDraw() + } +} From 908b5ba9a0e048d178c4ddf8f16c40a4bf79161e Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Sun, 8 Feb 2026 22:31:47 +0900 Subject: [PATCH 22/45] =?UTF-8?q?[refactor]=20Bookmark=20UseCase=20?= =?UTF-8?q?=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ToggleContentBookmarkUseCase.swift | 29 ------------------- ...FetchCollectionBookmarkUsersUseCase.swift} | 15 ++++------ .../ToggleCollectionBookmarkUseCase.swift | 7 ++--- .../ToggleContentBookmarkUseCase.swift | 29 +++++++++++++++++++ 4 files changed, 38 insertions(+), 42 deletions(-) delete mode 100644 FLINT/Domain/Sources/UseCase/Bookmark/ToggleContentBookmarkUseCase.swift rename FLINT/Domain/Sources/UseCase/{Bookmark/FetchBookmarkedUserUseCase.swift => Collection/FetchCollectionBookmarkUsersUseCase.swift} (50%) rename FLINT/Domain/Sources/UseCase/{Bookmark => Collection}/ToggleCollectionBookmarkUseCase.swift (73%) create mode 100644 FLINT/Domain/Sources/UseCase/Content/ToggleContentBookmarkUseCase.swift diff --git a/FLINT/Domain/Sources/UseCase/Bookmark/ToggleContentBookmarkUseCase.swift b/FLINT/Domain/Sources/UseCase/Bookmark/ToggleContentBookmarkUseCase.swift deleted file mode 100644 index bd95959a..00000000 --- a/FLINT/Domain/Sources/UseCase/Bookmark/ToggleContentBookmarkUseCase.swift +++ /dev/null @@ -1,29 +0,0 @@ -// -// ToggleContentBookmarkUseCase.swift -// Domain -// -// Created by 소은 on 1/21/26. -// - -import Combine -import Foundation - -import Entity -import Repository - -public protocol ToggleContentBookmarkUseCase { - func toggleContentBookmark(_ contentId: Int64) -> AnyPublisher -} - -public class DefaultToggleContentBookmarkUseCase: ToggleContentBookmarkUseCase { - - let repository: BookmarkRepository - - public init(repository: BookmarkRepository) { - self.repository = repository - } - - public func toggleContentBookmark(_ contentId: Int64) -> AnyPublisher { - return repository.toggleContentBookmark(contentId) - } -} diff --git a/FLINT/Domain/Sources/UseCase/Bookmark/FetchBookmarkedUserUseCase.swift b/FLINT/Domain/Sources/UseCase/Collection/FetchCollectionBookmarkUsersUseCase.swift similarity index 50% rename from FLINT/Domain/Sources/UseCase/Bookmark/FetchBookmarkedUserUseCase.swift rename to FLINT/Domain/Sources/UseCase/Collection/FetchCollectionBookmarkUsersUseCase.swift index f5c67a3f..d0303093 100644 --- a/FLINT/Domain/Sources/UseCase/Bookmark/FetchBookmarkedUserUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Collection/FetchCollectionBookmarkUsersUseCase.swift @@ -5,19 +5,17 @@ // Created by 진소은 on 1/23/26. // -import Foundation - import Combine +import Foundation import Entity import Repository -public protocol FetchBookmarkedUserUseCase { - func execute(collectionId: Int64) - -> AnyPublisher +public protocol FetchCollectionBookmarkUsersUseCase { + func fetchCollectionBookmarkUsers(collectionId: Int64) -> AnyPublisher } -public final class DefaultFetchBookmarkedUserUseCase: FetchBookmarkedUserUseCase { +public final class DefaultFetchCollectionBookmarkUsersUseCase: FetchCollectionBookmarkUsersUseCase { private let bookmarkRepository: BookmarkRepository @@ -25,8 +23,7 @@ public final class DefaultFetchBookmarkedUserUseCase: FetchBookmarkedUserUseCase self.bookmarkRepository = bookmarkRepository } - public func execute(collectionId: Int64) - -> AnyPublisher { - return bookmarkRepository.fetchCollectionBookmarkUsers(collectionId) + public func fetchCollectionBookmarkUsers(collectionId: Int64) -> AnyPublisher { + return bookmarkRepository.fetchCollectionBookmarkUsers(collectionId: collectionId) } } diff --git a/FLINT/Domain/Sources/UseCase/Bookmark/ToggleCollectionBookmarkUseCase.swift b/FLINT/Domain/Sources/UseCase/Collection/ToggleCollectionBookmarkUseCase.swift similarity index 73% rename from FLINT/Domain/Sources/UseCase/Bookmark/ToggleCollectionBookmarkUseCase.swift rename to FLINT/Domain/Sources/UseCase/Collection/ToggleCollectionBookmarkUseCase.swift index 06dc889d..c1b1b21b 100644 --- a/FLINT/Domain/Sources/UseCase/Bookmark/ToggleCollectionBookmarkUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Collection/ToggleCollectionBookmarkUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol ToggleCollectionBookmarkUseCase { - func toggleCollectionBookmark(_ collectionId: Int64) -> AnyPublisher + func toggleCollectionBookmark(collectionId: Int64) -> AnyPublisher } public class DefaultToggleCollectionBookmarkUseCase: ToggleCollectionBookmarkUseCase { @@ -23,8 +23,7 @@ public class DefaultToggleCollectionBookmarkUseCase: ToggleCollectionBookmarkUse self.bookmarkRepository = bookmarkRepository } - public func toggleCollectionBookmark(_ collectionId: Int64) -> AnyPublisher { - return bookmarkRepository.toggleCollectionBookmark(collectionId) + public func toggleCollectionBookmark(collectionId: Int64) -> AnyPublisher { + return bookmarkRepository.toggleCollectionBookmark(collectionId: collectionId) } } - diff --git a/FLINT/Domain/Sources/UseCase/Content/ToggleContentBookmarkUseCase.swift b/FLINT/Domain/Sources/UseCase/Content/ToggleContentBookmarkUseCase.swift new file mode 100644 index 00000000..3592133c --- /dev/null +++ b/FLINT/Domain/Sources/UseCase/Content/ToggleContentBookmarkUseCase.swift @@ -0,0 +1,29 @@ +// +// ToggleContentBookmarkUseCase.swift +// Domain +// +// Created by 소은 on 1/21/26. +// + +import Combine +import Foundation + +import Entity +import Repository + +public protocol ToggleContentBookmarkUseCase { + func toggleContentBookmark(contentId: Int64) -> AnyPublisher +} + +public class DefaultToggleContentBookmarkUseCase: ToggleContentBookmarkUseCase { + + private let bookmarkRepository: BookmarkRepository + + public init(bookmarkRepository: BookmarkRepository) { + self.bookmarkRepository = bookmarkRepository + } + + public func toggleContentBookmark(contentId: Int64) -> AnyPublisher { + return bookmarkRepository.toggleContentBookmark(contentId: contentId) + } +} From 70bc09c82276bbafc55277cbf3aa662ef6687583 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Sun, 8 Feb 2026 22:33:25 +0900 Subject: [PATCH 23/45] =?UTF-8?q?[refactor]=20Collection=20UseCase=20?= =?UTF-8?q?=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/Collection/CreateCollectionEntity.swift | 5 +---- .../Entity/Collection/ExploreInfoEntity.swift | 2 +- .../Collection/CreateCollectionUseCase.swift | 6 +++--- ...se.swift => FetchCollectionDetailUseCase.swift} | 12 ++++++------ .../FetchCollectionsUseCase.swift} | 10 +++++----- ...t => FetchRecentViewedCollectionsUseCase.swift} | 14 +++++++------- 6 files changed, 23 insertions(+), 26 deletions(-) rename FLINT/Domain/Sources/UseCase/Collection/{CollectionDetailUseCase.swift => FetchCollectionDetailUseCase.swift} (77%) rename FLINT/Domain/Sources/UseCase/{Explore/ExploreUseCase.swift => Collection/FetchCollectionsUseCase.swift} (55%) rename FLINT/Domain/Sources/UseCase/Collection/{FetchWatchingCollectionsListUseCase.swift => FetchRecentViewedCollectionsUseCase.swift} (63%) diff --git a/FLINT/Domain/Sources/Entity/Collection/CreateCollectionEntity.swift b/FLINT/Domain/Sources/Entity/Collection/CreateCollectionEntity.swift index 3bdb1215..70d8407f 100644 --- a/FLINT/Domain/Sources/Entity/Collection/CreateCollectionEntity.swift +++ b/FLINT/Domain/Sources/Entity/Collection/CreateCollectionEntity.swift @@ -35,10 +35,7 @@ public extension CreateCollectionEntity { public let isSpoiler: Bool public let reason: String - public init(contentId: Int64, - isSpoiler: Bool, - reason: String - ) { + public init(contentId: Int64, isSpoiler: Bool, reason: String) { self.contentId = contentId self.isSpoiler = isSpoiler self.reason = reason diff --git a/FLINT/Domain/Sources/Entity/Collection/ExploreInfoEntity.swift b/FLINT/Domain/Sources/Entity/Collection/ExploreInfoEntity.swift index c7cbefd1..34b251be 100644 --- a/FLINT/Domain/Sources/Entity/Collection/ExploreInfoEntity.swift +++ b/FLINT/Domain/Sources/Entity/Collection/ExploreInfoEntity.swift @@ -1,5 +1,5 @@ // -// File.swift +// ExploreInfoEntity.swift // Domain // // Created by 김호성 on 2026.01.22. diff --git a/FLINT/Domain/Sources/UseCase/Collection/CreateCollectionUseCase.swift b/FLINT/Domain/Sources/UseCase/Collection/CreateCollectionUseCase.swift index 75ec82eb..d35c525c 100644 --- a/FLINT/Domain/Sources/UseCase/Collection/CreateCollectionUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Collection/CreateCollectionUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol CreateCollectionUseCase { - func createCollection(_ entity: CreateCollectionEntity) -> AnyPublisher + func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher } public class DefaultCreateCollectionUseCase: CreateCollectionUseCase { @@ -23,7 +23,7 @@ public class DefaultCreateCollectionUseCase: CreateCollectionUseCase { self.collectionRepository = collectionRepository } - public func createCollection(_ entity: CreateCollectionEntity) -> AnyPublisher { - return collectionRepository.createCollection(entity) + public func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher { + return collectionRepository.createCollection(collectionInfo: collectionInfo) } } diff --git a/FLINT/Domain/Sources/UseCase/Collection/CollectionDetailUseCase.swift b/FLINT/Domain/Sources/UseCase/Collection/FetchCollectionDetailUseCase.swift similarity index 77% rename from FLINT/Domain/Sources/UseCase/Collection/CollectionDetailUseCase.swift rename to FLINT/Domain/Sources/UseCase/Collection/FetchCollectionDetailUseCase.swift index d0ce2a37..4f92556a 100644 --- a/FLINT/Domain/Sources/UseCase/Collection/CollectionDetailUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Collection/FetchCollectionDetailUseCase.swift @@ -1,5 +1,5 @@ // -// CollectionDetailUseCase.swift +// FetchCollectionDetailUseCase.swift // Domain // // Created by 진소은 on 1/23/26. @@ -11,18 +11,18 @@ import Foundation import Entity import Repository -public protocol CollectionDetailUseCase { +public protocol FetchCollectionDetailUseCase { func fetchCollectionDetail(collectionId: Int64) -> AnyPublisher } -public class DefaultCollectionDetailUseCase: CollectionDetailUseCase { - +public class DefaultFetchCollectionDetailUseCase: FetchCollectionDetailUseCase { + private let collectionRepository: CollectionRepository - + public init(collectionRepository: CollectionRepository) { self.collectionRepository = collectionRepository } - + public func fetchCollectionDetail(collectionId: Int64) -> AnyPublisher { return collectionRepository.fetchCollectionDetail(collectionId: collectionId) } diff --git a/FLINT/Domain/Sources/UseCase/Explore/ExploreUseCase.swift b/FLINT/Domain/Sources/UseCase/Collection/FetchCollectionsUseCase.swift similarity index 55% rename from FLINT/Domain/Sources/UseCase/Explore/ExploreUseCase.swift rename to FLINT/Domain/Sources/UseCase/Collection/FetchCollectionsUseCase.swift index b636bb9f..48f0efe6 100644 --- a/FLINT/Domain/Sources/UseCase/Explore/ExploreUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Collection/FetchCollectionsUseCase.swift @@ -1,5 +1,5 @@ // -// File.swift +// FetchCollectionsUseCase.swift // Domain // // Created by 김호성 on 2026.01.22. @@ -11,11 +11,11 @@ import Foundation import Entity import Repository -public protocol ExploreUseCase { - func fetchExplore(cursor: UInt?) -> AnyPublisher +public protocol FetchCollectionsUseCase { + func fetchExplore(cursor: Int64?) -> AnyPublisher } -public final class DefaultExploreUseCase: ExploreUseCase { +public final class DefaultFetchCollectionsUseCase: FetchCollectionsUseCase { private let collectionRepository: CollectionRepository @@ -23,7 +23,7 @@ public final class DefaultExploreUseCase: ExploreUseCase { self.collectionRepository = collectionRepository } - public func fetchExplore(cursor: UInt?) -> AnyPublisher { + public func fetchExplore(cursor: Int64?) -> AnyPublisher { collectionRepository.fetchCollections(cursor: cursor, size: 3) } } diff --git a/FLINT/Domain/Sources/UseCase/Collection/FetchWatchingCollectionsListUseCase.swift b/FLINT/Domain/Sources/UseCase/Collection/FetchRecentViewedCollectionsUseCase.swift similarity index 63% rename from FLINT/Domain/Sources/UseCase/Collection/FetchWatchingCollectionsListUseCase.swift rename to FLINT/Domain/Sources/UseCase/Collection/FetchRecentViewedCollectionsUseCase.swift index 638c5345..446f4dda 100644 --- a/FLINT/Domain/Sources/UseCase/Collection/FetchWatchingCollectionsListUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Collection/FetchRecentViewedCollectionsUseCase.swift @@ -1,5 +1,5 @@ // -// WatchingCollections.swift +// FetchRecentViewedCollectionsUseCase.swift // Domain // // Created by 소은 on 1/24/26. @@ -11,19 +11,19 @@ import Foundation import Entity import Repository -public protocol FetchWatchingCollectionsUseCase { +public protocol FetchRecentViewedCollectionsUseCase { func fetchWatchingCollections() -> AnyPublisher<[CollectionEntity], Error> } -public final class DefaultFetchWatchingCollectionsUseCase: FetchWatchingCollectionsUseCase { - +public final class DefaultFetchRecentViewedCollectionsUseCase: FetchRecentViewedCollectionsUseCase { + private let collectionRepository: CollectionRepository - + public init(collectionRepository: CollectionRepository) { self.collectionRepository = collectionRepository } - + public func fetchWatchingCollections() -> AnyPublisher<[CollectionEntity], Error> { - collectionRepository.fetchWatchingCollections() + return collectionRepository.fetchRecentViewedCollections() } } From f8e5f4c4658dc442d1502186dd610b9783e79581 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Sun, 8 Feb 2026 22:53:31 +0900 Subject: [PATCH 24/45] =?UTF-8?q?[refactor]=20Home=20Entity=20=EB=A6=AC?= =?UTF-8?q?=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HomeRecommendedCollectionsDTO.swift | 4 +- .../Collection/CollectionInfoEntity.swift | 24 ++++++++ .../Entity/Home/CollectionInfoEntity.swift | 33 ----------- .../HomeRecommendedCollectionsEntity.swift | 58 ------------------- 4 files changed, 26 insertions(+), 93 deletions(-) create mode 100644 FLINT/Domain/Sources/Entity/Collection/CollectionInfoEntity.swift delete mode 100644 FLINT/Domain/Sources/Entity/Home/CollectionInfoEntity.swift delete mode 100644 FLINT/Domain/Sources/Entity/Home/HomeRecommendedCollectionsEntity.swift diff --git a/FLINT/Data/Sources/DTO/Collection/HomeRecommendedCollectionsDTO.swift b/FLINT/Data/Sources/DTO/Collection/HomeRecommendedCollectionsDTO.swift index 0772d218..4dd3ea8f 100644 --- a/FLINT/Data/Sources/DTO/Collection/HomeRecommendedCollectionsDTO.swift +++ b/FLINT/Data/Sources/DTO/Collection/HomeRecommendedCollectionsDTO.swift @@ -41,8 +41,8 @@ extension HomeRecommendedCollectionsDTO.CollectionDTO { get throws { return try CollectionInfoEntity( id: unwrap(id), - imageUrlString: thumbnailUrl ?? "", - profileImageUrlString: profileUrl ?? "", + imageUrl: URL(string: thumbnailUrl ?? ""), + profileImageUrl: URL(string: profileUrl ?? ""), title: title ?? "", userName: nickname ?? "" ) diff --git a/FLINT/Domain/Sources/Entity/Collection/CollectionInfoEntity.swift b/FLINT/Domain/Sources/Entity/Collection/CollectionInfoEntity.swift new file mode 100644 index 00000000..07f6c846 --- /dev/null +++ b/FLINT/Domain/Sources/Entity/Collection/CollectionInfoEntity.swift @@ -0,0 +1,24 @@ +// +// CollectionInfoEntity.swift +// Domain +// +// Created by 소은 on 1/22/26. +// + +import Foundation + +public struct CollectionInfoEntity { + public let id: String + public let imageUrl: URL? + public let profileImageUrl: URL? + public let title: String + public let userName: String + + public init(id: String, imageUrl: URL?, profileImageUrl: URL?, title: String, userName: String) { + self.id = id + self.imageUrl = imageUrl + self.profileImageUrl = profileImageUrl + self.title = title + self.userName = userName + } +} diff --git a/FLINT/Domain/Sources/Entity/Home/CollectionInfoEntity.swift b/FLINT/Domain/Sources/Entity/Home/CollectionInfoEntity.swift deleted file mode 100644 index a2c4040b..00000000 --- a/FLINT/Domain/Sources/Entity/Home/CollectionInfoEntity.swift +++ /dev/null @@ -1,33 +0,0 @@ -// -// File.swift -// Domain -// -// Created by 소은 on 1/22/26. -// - -import Foundation - -public struct CollectionInfoEntity { - public let id: String? - public let imageUrlString: String - public let profileImageUrlString: String - public let title: String - public let userName: String - - public init( - id: String, - imageUrlString: String, - profileImageUrlString: String, - title: String, - userName: String - ) { - self.id = id - self.imageUrlString = imageUrlString - self.profileImageUrlString = profileImageUrlString - self.title = title - self.userName = userName - } - - public var imageURL: URL? { URL(string: imageUrlString) } - public var profileImageURL: URL? { URL(string: profileImageUrlString) } -} diff --git a/FLINT/Domain/Sources/Entity/Home/HomeRecommendedCollectionsEntity.swift b/FLINT/Domain/Sources/Entity/Home/HomeRecommendedCollectionsEntity.swift deleted file mode 100644 index c3cf4772..00000000 --- a/FLINT/Domain/Sources/Entity/Home/HomeRecommendedCollectionsEntity.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// HomeRecommendedCollectionsEntity.swift -// Domain -// -// Created by 소은 on 1/20/26. -// - -import Foundation - -public struct HomeRecommendedCollectionsEntity { - - public let collections: [HomeRecommendedCollectionEntity] - - public init(collections: [HomeRecommendedCollectionEntity]) { - self.collections = collections - } -} - -public extension HomeRecommendedCollectionsEntity { - - struct HomeRecommendedCollectionEntity { - - public let id: String - public let thumbnailUrl: String - public let title: String - public let description: String - public let imageList: [String] - public let bookmarkCount: Int - public let isBookmarked: Bool - public let userId: String - public let nickname: String - public let profileUrl: String - - public init( - id: String, - thumbnailUrl: String, - title: String, - description: String, - imageList: [String], - bookmarkCount: Int, - isBookmarked: Bool, - userId: String, - nickname: String, - profileUrl: String - ) { - self.id = id - self.thumbnailUrl = thumbnailUrl - self.title = title - self.description = description - self.imageList = imageList - self.bookmarkCount = bookmarkCount - self.isBookmarked = isBookmarked - self.userId = userId - self.nickname = nickname - self.profileUrl = profileUrl - } - } -} From 5630b5e246b26545a3bdb43673f7fbcec4d89e72 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Sun, 8 Feb 2026 23:02:15 +0900 Subject: [PATCH 25/45] =?UTF-8?q?[refactor]=20Content=20UseCase=20?= =?UTF-8?q?=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FetchOTTPlatformsForContentUseCase.swift | 29 +++++++++++++++++++ .../Content/FetchOTTPlatformsUseCase.swift | 29 ------------------- 2 files changed, 29 insertions(+), 29 deletions(-) create mode 100644 FLINT/Domain/Sources/UseCase/Content/FetchOTTPlatformsForContentUseCase.swift delete mode 100644 FLINT/Domain/Sources/UseCase/Content/FetchOTTPlatformsUseCase.swift diff --git a/FLINT/Domain/Sources/UseCase/Content/FetchOTTPlatformsForContentUseCase.swift b/FLINT/Domain/Sources/UseCase/Content/FetchOTTPlatformsForContentUseCase.swift new file mode 100644 index 00000000..a7e0cc28 --- /dev/null +++ b/FLINT/Domain/Sources/UseCase/Content/FetchOTTPlatformsForContentUseCase.swift @@ -0,0 +1,29 @@ +// +// FetchOTTPlatformsForContentUseCase.swift +// Domain +// +// Created by 소은 on 1/21/26. +// + +import Combine +import Foundation + +import Entity +import Repository + +public protocol FetchOTTPlatformsForContentUseCase { + func fetchOTTPlatformsForContent(contentId: Int64) -> AnyPublisher<[OTTPlatformEntity], Error> +} + +public class DefaultFetchOTTPlatformsForContentUseCase: FetchOTTPlatformsForContentUseCase { + + private let contentRepository: ContentRepository + + public init(contentRepository: ContentRepository) { + self.contentRepository = contentRepository + } + + public func fetchOTTPlatformsForContent(contentId: Int64) -> AnyPublisher<[OTTPlatformEntity], Error> { + return contentRepository.fetchOTTPlatformsForContent(contentId: contentId) + } +} diff --git a/FLINT/Domain/Sources/UseCase/Content/FetchOTTPlatformsUseCase.swift b/FLINT/Domain/Sources/UseCase/Content/FetchOTTPlatformsUseCase.swift deleted file mode 100644 index 86a45f58..00000000 --- a/FLINT/Domain/Sources/UseCase/Content/FetchOTTPlatformsUseCase.swift +++ /dev/null @@ -1,29 +0,0 @@ -// -// FetchOTTPlatformsUseCase.swift -// Domain -// -// Created by 소은 on 1/21/26. -// - -import Combine -import Foundation - -import Entity -import Repository - -public protocol FetchOTTPlatformsUseCase { - func fetchOTTPlatforms(_ contentId: Int64) -> AnyPublisher<[OTTPlatformEntity], Error> -} - -public class DefaultFetchOTTPlatformsUseCase: FetchOTTPlatformsUseCase { - - private let contentRepository: ContentRepository - - public init(contentRepository: ContentRepository) { - self.contentRepository = contentRepository - } - - public func fetchOTTPlatforms(_ contentId: Int64) -> AnyPublisher<[OTTPlatformEntity], Error> { - return contentRepository.fetchOTTPlatforms(contentId) - } -} From 17ea8c85c9b7c8242f3552a8e4e756f563be78aa Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Sun, 8 Feb 2026 23:02:58 +0900 Subject: [PATCH 26/45] =?UTF-8?q?[refactor]=20Home=20UseCase=20=EB=A6=AC?= =?UTF-8?q?=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FetchRecommendedCollectionsUseCase.swift} | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) rename FLINT/Domain/Sources/UseCase/{Home/HomeUseCase.swift => Collection/FetchRecommendedCollectionsUseCase.swift} (67%) diff --git a/FLINT/Domain/Sources/UseCase/Home/HomeUseCase.swift b/FLINT/Domain/Sources/UseCase/Collection/FetchRecommendedCollectionsUseCase.swift similarity index 67% rename from FLINT/Domain/Sources/UseCase/Home/HomeUseCase.swift rename to FLINT/Domain/Sources/UseCase/Collection/FetchRecommendedCollectionsUseCase.swift index a2eabfec..0172748c 100644 --- a/FLINT/Domain/Sources/UseCase/Home/HomeUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Collection/FetchRecommendedCollectionsUseCase.swift @@ -1,20 +1,21 @@ // -// HomeUsecase.swift +// FetchRecommendedCollectionsUseCase.swift // Domain // -// Created by 소은 on 1/20/26. +// Created by 김호성 on 2026.02.08. // + import Combine import Foundation import Entity import Repository -public protocol HomeUseCase { +public protocol FetchRecommendedCollectionsUseCase { func fetchRecommendedCollections() -> AnyPublisher<[CollectionInfoEntity], Error> } -public class DefaultHomeUseCase: HomeUseCase { +public final class DefaultFetchRecommendedCollectionsUseCase: FetchRecommendedCollectionsUseCase { private let homeRepository: HomeRepository From f3101e74090d6ada3ab2549119265135bcc41d38 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Sun, 8 Feb 2026 23:03:29 +0900 Subject: [PATCH 27/45] =?UTF-8?q?[refactor]=20Search=20UseCase=20=EB=A6=AC?= =?UTF-8?q?=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UseCase/Content/ContentsUseCase.swift | 29 ------------------- .../Content/FetchPopularContentsUseCase.swift | 29 +++++++++++++++++++ .../SearchContentsUseCase.swift | 6 ++-- 3 files changed, 32 insertions(+), 32 deletions(-) delete mode 100644 FLINT/Domain/Sources/UseCase/Content/ContentsUseCase.swift create mode 100644 FLINT/Domain/Sources/UseCase/Content/FetchPopularContentsUseCase.swift rename FLINT/Domain/Sources/UseCase/{Search => Content}/SearchContentsUseCase.swift (65%) diff --git a/FLINT/Domain/Sources/UseCase/Content/ContentsUseCase.swift b/FLINT/Domain/Sources/UseCase/Content/ContentsUseCase.swift deleted file mode 100644 index 3744c8ce..00000000 --- a/FLINT/Domain/Sources/UseCase/Content/ContentsUseCase.swift +++ /dev/null @@ -1,29 +0,0 @@ -// -// File.swift -// Domain -// -// Created by 김호성 on 2026.01.22. -// - -import Combine -import Foundation - -import Entity -import Repository - -public protocol ContentsUseCase { - func fetchContents() -> AnyPublisher<[ContentEntity], Error> -} - -public class DefaultContentsUseCase: ContentsUseCase { - - private let searchRepository: SearchRepository - - public init(searchRepository: SearchRepository) { - self.searchRepository = searchRepository - } - - public func fetchContents() -> AnyPublisher<[ContentEntity], Error> { - return searchRepository.searchContents(nil) - } -} diff --git a/FLINT/Domain/Sources/UseCase/Content/FetchPopularContentsUseCase.swift b/FLINT/Domain/Sources/UseCase/Content/FetchPopularContentsUseCase.swift new file mode 100644 index 00000000..749e1b67 --- /dev/null +++ b/FLINT/Domain/Sources/UseCase/Content/FetchPopularContentsUseCase.swift @@ -0,0 +1,29 @@ +// +// FetchPopularContentsUseCase.swift +// Domain +// +// Created by 김호성 on 2026.01.22. +// + +import Combine +import Foundation + +import Entity +import Repository + +public protocol FetchPopularContentsUseCase { + func fetchPopularContents() -> AnyPublisher<[ContentEntity], Error> +} + +public class DefaultContentsUseCase: FetchPopularContentsUseCase { + + private let searchRepository: SearchRepository + + public init(searchRepository: SearchRepository) { + self.searchRepository = searchRepository + } + + public func fetchPopularContents() -> AnyPublisher<[ContentEntity], Error> { + return searchRepository.searchContents(keyword: nil) + } +} diff --git a/FLINT/Domain/Sources/UseCase/Search/SearchContentsUseCase.swift b/FLINT/Domain/Sources/UseCase/Content/SearchContentsUseCase.swift similarity index 65% rename from FLINT/Domain/Sources/UseCase/Search/SearchContentsUseCase.swift rename to FLINT/Domain/Sources/UseCase/Content/SearchContentsUseCase.swift index fdb68dcf..d8e3d59b 100644 --- a/FLINT/Domain/Sources/UseCase/Search/SearchContentsUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Content/SearchContentsUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol SearchContentsUseCase: AnyObject { - func searchContents(_ keyword: String) -> AnyPublisher<[ContentEntity], Error> + func searchContents(keyword: String) -> AnyPublisher<[ContentEntity], Error> } public class DefaultSearchContentsUseCase: SearchContentsUseCase { @@ -23,7 +23,7 @@ public class DefaultSearchContentsUseCase: SearchContentsUseCase { self.searchRepository = searchRepository } - public func searchContents(_ keyword: String) -> AnyPublisher<[ContentEntity], Error> { - return searchRepository.searchContents(keyword) + public func searchContents(keyword: String) -> AnyPublisher<[ContentEntity], Error> { + return searchRepository.searchContents(keyword: keyword) } } From 35d8eaf6e8f2ac09ca556ca33c395a16dad80478 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Sun, 8 Feb 2026 23:06:59 +0900 Subject: [PATCH 28/45] =?UTF-8?q?[refactor]=20nickname=20=EB=A6=AC?= =?UTF-8?q?=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/Nickname/NicknameCheckEntity.swift | 16 ---------------- .../Sources/Entity/Nickname/NicknameState.swift | 2 +- ...eUseCase.swift => CheckNicknameUseCase.swift} | 6 +++--- 3 files changed, 4 insertions(+), 20 deletions(-) delete mode 100644 FLINT/Domain/Sources/Entity/Nickname/NicknameCheckEntity.swift rename FLINT/Domain/Sources/UseCase/Nickname/{NicknameUseCase.swift => CheckNicknameUseCase.swift} (78%) diff --git a/FLINT/Domain/Sources/Entity/Nickname/NicknameCheckEntity.swift b/FLINT/Domain/Sources/Entity/Nickname/NicknameCheckEntity.swift deleted file mode 100644 index 91f349a9..00000000 --- a/FLINT/Domain/Sources/Entity/Nickname/NicknameCheckEntity.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// File.swift -// Domain -// -// Created by 김호성 on 2026.01.20. -// - -import Foundation - -public struct NicknameCheckEntity { - public let available: Bool - - public init(available: Bool) { - self.available = available - } -} diff --git a/FLINT/Domain/Sources/Entity/Nickname/NicknameState.swift b/FLINT/Domain/Sources/Entity/Nickname/NicknameState.swift index ba52e62c..4f3c7afa 100644 --- a/FLINT/Domain/Sources/Entity/Nickname/NicknameState.swift +++ b/FLINT/Domain/Sources/Entity/Nickname/NicknameState.swift @@ -1,5 +1,5 @@ // -// File.swift +// NicknameValidState.swift // Domain // // Created by 김호성 on 2026.01.22. diff --git a/FLINT/Domain/Sources/UseCase/Nickname/NicknameUseCase.swift b/FLINT/Domain/Sources/UseCase/Nickname/CheckNicknameUseCase.swift similarity index 78% rename from FLINT/Domain/Sources/UseCase/Nickname/NicknameUseCase.swift rename to FLINT/Domain/Sources/UseCase/Nickname/CheckNicknameUseCase.swift index 63d1e2fa..0511a1ed 100644 --- a/FLINT/Domain/Sources/UseCase/Nickname/NicknameUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Nickname/CheckNicknameUseCase.swift @@ -1,5 +1,5 @@ // -// File.swift +// CheckNicknameUseCase.swift // Domain // // Created by 김호성 on 2026.01.20. @@ -11,11 +11,11 @@ import Foundation import Entity import Repository -public protocol NicknameUseCase { +public protocol CheckNicknameUseCase { func checkNickname(_ nickname: String) -> AnyPublisher } -public final class DefaultNicknameUseCase: NicknameUseCase { +public final class DefaultCheckNicknameUseCase: CheckNicknameUseCase { private let userRepository: UserRepository From 5f640919de2eadf5333c5be743a5049cf5960a99 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Mon, 9 Feb 2026 11:50:51 +0900 Subject: [PATCH 29/45] =?UTF-8?q?[refactor]=20Auth=20Entity=20=EB=A6=AC?= =?UTF-8?q?=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FLINT/Domain/Sources/Entity/{ => Auth}/Login/LoginEntity.swift | 2 +- .../Sources/Entity/{ => Auth}/Signup/SignupInfoEntity.swift | 0 .../Entity/{ => Auth}/SocialVerify/SocialLoginType.swift | 0 .../Entity/{ => Auth}/SocialVerify/SocialVerifyEntity.swift | 0 .../{ => Auth}/SocialVerify/SocialVerifyResultEntity.swift | 0 5 files changed, 1 insertion(+), 1 deletion(-) rename FLINT/Domain/Sources/Entity/{ => Auth}/Login/LoginEntity.swift (94%) rename FLINT/Domain/Sources/Entity/{ => Auth}/Signup/SignupInfoEntity.swift (100%) rename FLINT/Domain/Sources/Entity/{ => Auth}/SocialVerify/SocialLoginType.swift (100%) rename FLINT/Domain/Sources/Entity/{ => Auth}/SocialVerify/SocialVerifyEntity.swift (100%) rename FLINT/Domain/Sources/Entity/{ => Auth}/SocialVerify/SocialVerifyResultEntity.swift (100%) diff --git a/FLINT/Domain/Sources/Entity/Login/LoginEntity.swift b/FLINT/Domain/Sources/Entity/Auth/Login/LoginEntity.swift similarity index 94% rename from FLINT/Domain/Sources/Entity/Login/LoginEntity.swift rename to FLINT/Domain/Sources/Entity/Auth/Login/LoginEntity.swift index 0ca05372..d3f45ed5 100644 --- a/FLINT/Domain/Sources/Entity/Login/LoginEntity.swift +++ b/FLINT/Domain/Sources/Entity/Auth/Login/LoginEntity.swift @@ -1,5 +1,5 @@ // -// File.swift +// LoginEntity.swift // Domain // // Created by 김호성 on 2026.01.21. diff --git a/FLINT/Domain/Sources/Entity/Signup/SignupInfoEntity.swift b/FLINT/Domain/Sources/Entity/Auth/Signup/SignupInfoEntity.swift similarity index 100% rename from FLINT/Domain/Sources/Entity/Signup/SignupInfoEntity.swift rename to FLINT/Domain/Sources/Entity/Auth/Signup/SignupInfoEntity.swift diff --git a/FLINT/Domain/Sources/Entity/SocialVerify/SocialLoginType.swift b/FLINT/Domain/Sources/Entity/Auth/SocialVerify/SocialLoginType.swift similarity index 100% rename from FLINT/Domain/Sources/Entity/SocialVerify/SocialLoginType.swift rename to FLINT/Domain/Sources/Entity/Auth/SocialVerify/SocialLoginType.swift diff --git a/FLINT/Domain/Sources/Entity/SocialVerify/SocialVerifyEntity.swift b/FLINT/Domain/Sources/Entity/Auth/SocialVerify/SocialVerifyEntity.swift similarity index 100% rename from FLINT/Domain/Sources/Entity/SocialVerify/SocialVerifyEntity.swift rename to FLINT/Domain/Sources/Entity/Auth/SocialVerify/SocialVerifyEntity.swift diff --git a/FLINT/Domain/Sources/Entity/SocialVerify/SocialVerifyResultEntity.swift b/FLINT/Domain/Sources/Entity/Auth/SocialVerify/SocialVerifyResultEntity.swift similarity index 100% rename from FLINT/Domain/Sources/Entity/SocialVerify/SocialVerifyResultEntity.swift rename to FLINT/Domain/Sources/Entity/Auth/SocialVerify/SocialVerifyResultEntity.swift From 48f62a5760b390596fe9201da735a5461ecce120 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Mon, 9 Feb 2026 12:18:01 +0900 Subject: [PATCH 30/45] =?UTF-8?q?[refactor]=20Entity=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DTO/Collection/CollectionDTO.swift | 54 +++++++++++++++++++ .../DTO/Collection/CollectionDetailDTO.swift | 8 +-- .../DTO/Collection/CreateCollectionDTO.swift | 20 +++++++ .../CreateCollectionResponseDTO.swift | 12 ----- .../HomeRecommendedCollectionsDTO.swift | 31 +---------- .../DTO/Collection/PagedCollectionsDTO.swift | 2 +- .../RecentViewedCollectionsDTO.swift | 38 +------------ .../DTO/Collection/UserCollectionsDTO.swift | 36 +------------ .../Service/CollectionService.swift | 5 +- .../CollectionRepositoryImpl.swift | 4 +- .../CollectionBookmarkUsersEntity.swift | 20 ++----- .../Collection/CollectionDetailEntity.swift | 25 ++------- .../CollectionEntity.swift | 10 ++-- .../Collection/CollectionPagingEntity.swift | 6 +-- .../Entity/Content/ContentEntity.swift | 4 +- .../{User => Content}/ContentInfoEntity.swift | 0 .../Entity/Content/OTTPlatformEntity.swift | 6 +-- .../Sources/Entity/{ => Content}/Ott.swift | 0 .../Sources/Entity/User/KeywordEntity.swift | 4 +- .../{Nickname => User}/NicknameState.swift | 0 .../Entity/User/UserProfileEntity.swift | 8 +-- .../Domain/Sources/Entity/User/UserRole.swift | 19 +++++++ .../Repository/CollectionRepository.swift | 2 +- 23 files changed, 132 insertions(+), 182 deletions(-) create mode 100644 FLINT/Data/Sources/DTO/Collection/CollectionDTO.swift create mode 100644 FLINT/Data/Sources/DTO/Collection/CreateCollectionDTO.swift delete mode 100644 FLINT/Data/Sources/DTO/Collection/CreateCollectionResponseDTO.swift rename FLINT/Domain/Sources/Entity/{User => Collection}/CollectionEntity.swift (87%) rename FLINT/Domain/Sources/Entity/{User => Content}/ContentInfoEntity.swift (100%) rename FLINT/Domain/Sources/Entity/{ => Content}/Ott.swift (100%) rename FLINT/Domain/Sources/Entity/{Nickname => User}/NicknameState.swift (100%) create mode 100644 FLINT/Domain/Sources/Entity/User/UserRole.swift diff --git a/FLINT/Data/Sources/DTO/Collection/CollectionDTO.swift b/FLINT/Data/Sources/DTO/Collection/CollectionDTO.swift new file mode 100644 index 00000000..3b1167ae --- /dev/null +++ b/FLINT/Data/Sources/DTO/Collection/CollectionDTO.swift @@ -0,0 +1,54 @@ +// +// CollectionDTO.swift +// Data +// +// Created by 김호성 on 2026.02.09. +// + +import Foundation + +import Entity + +public struct CollectionDTO: Codable { + public let id: String? + public let thumbnailUrl: String? + public let title: String? + public let description: String? + public let imageList: [String]? + public let bookmarkCount: Int? + public let isBookmarked: Bool? + public let userId: String? + public let nickname: String? + public let profileImageUrl: String? +} + +extension CollectionDTO { + public var collectionEntity: CollectionEntity { + get throws { + return try CollectionEntity( + id: unwrap(id), + thumbnailUrl: URL(string: thumbnailUrl ?? ""), + title: title ?? "", + description: description ?? "", + imageList: imageList ?? [], + bookmarkCount: bookmarkCount ?? 0, + isBookmarked: isBookmarked ?? false, + userId: unwrap(userId), + nickname: nickname ?? "", + profileImageUrl: URL(string: profileImageUrl ?? "") + ) + } + } + + public var collectionInfoEntity: CollectionInfoEntity { + get throws { + return try CollectionInfoEntity( + id: unwrap(id), + imageUrl: URL(string: thumbnailUrl ?? ""), + profileImageUrl: URL(string: profileImageUrl ?? ""), + title: title ?? "", + userName: nickname ?? "" + ) + } + } +} diff --git a/FLINT/Data/Sources/DTO/Collection/CollectionDetailDTO.swift b/FLINT/Data/Sources/DTO/Collection/CollectionDetailDTO.swift index bc1beae3..ae2d9515 100644 --- a/FLINT/Data/Sources/DTO/Collection/CollectionDetailDTO.swift +++ b/FLINT/Data/Sources/DTO/Collection/CollectionDetailDTO.swift @@ -51,7 +51,7 @@ extension CollectionDetailDTO { thumbnailUrl: URL(string: thumbnailUrl ?? ""), createdAt: createdAt ?? "", isBookmarked: isBookmarked ?? false, - author: author?.entity, + author: unwrap(author?.entity), contents: contents?.map { try $0.entity } ?? [] ) } @@ -59,13 +59,13 @@ extension CollectionDetailDTO { } extension CollectionDetailDTO.AuthorDTO { - public var entity: CollectionAuthorEntity { + public var entity: UserProfileEntity { get throws { - return try CollectionAuthorEntity( + return try UserProfileEntity( id: unwrap(id), nickname: nickname ?? "", profileImageUrl: URL(string: profileImageUrl ?? ""), - userRole: userRole ?? "" + role: unwrap(UserRole(rawValue: userRole ?? "")) ) } } diff --git a/FLINT/Data/Sources/DTO/Collection/CreateCollectionDTO.swift b/FLINT/Data/Sources/DTO/Collection/CreateCollectionDTO.swift new file mode 100644 index 00000000..db3882bd --- /dev/null +++ b/FLINT/Data/Sources/DTO/Collection/CreateCollectionDTO.swift @@ -0,0 +1,20 @@ +// +// CreateCollectionDTO.swift +// DTO +// +// Created by 소은 on 1/23/26. +// + +import Foundation + +public struct CreateCollectionDTO: Codable { + public let collectionId: String? +} + +extension CreateCollectionDTO { + public var createdCollectionId: Int64 { + get throws { + return try unwrap(Int64(collectionId ?? "")) + } + } +} diff --git a/FLINT/Data/Sources/DTO/Collection/CreateCollectionResponseDTO.swift b/FLINT/Data/Sources/DTO/Collection/CreateCollectionResponseDTO.swift deleted file mode 100644 index 2c2bccda..00000000 --- a/FLINT/Data/Sources/DTO/Collection/CreateCollectionResponseDTO.swift +++ /dev/null @@ -1,12 +0,0 @@ -// -// CreateCollectionResponseDTO.swift -// DTO -// -// Created by 소은 on 1/23/26. -// - -import Foundation - -public struct CreateCollectionResponseDTO: Codable { - public let collectionId: String? -} diff --git a/FLINT/Data/Sources/DTO/Collection/HomeRecommendedCollectionsDTO.swift b/FLINT/Data/Sources/DTO/Collection/HomeRecommendedCollectionsDTO.swift index 4dd3ea8f..c5e9b592 100644 --- a/FLINT/Data/Sources/DTO/Collection/HomeRecommendedCollectionsDTO.swift +++ b/FLINT/Data/Sources/DTO/Collection/HomeRecommendedCollectionsDTO.swift @@ -13,39 +13,10 @@ public struct HomeRecommendedCollectionsDTO: Codable { public let collections: [CollectionDTO]? } -extension HomeRecommendedCollectionsDTO { - public struct CollectionDTO: Codable { - public let id: String? - public let thumbnailUrl: String? - public let title: String? - public let description: String? - public let imageList: [String]? - public let bookmarkCount: Int? - public let isBookmarked: Bool? - public let userId: String? - public let nickname: String? - public let profileUrl: String? - } -} - extension HomeRecommendedCollectionsDTO { public var entities: [CollectionInfoEntity] { get throws { - return try collections?.map { try $0.entity } ?? [] - } - } -} - -extension HomeRecommendedCollectionsDTO.CollectionDTO { - public var entity: CollectionInfoEntity { - get throws { - return try CollectionInfoEntity( - id: unwrap(id), - imageUrl: URL(string: thumbnailUrl ?? ""), - profileImageUrl: URL(string: profileUrl ?? ""), - title: title ?? "", - userName: nickname ?? "" - ) + return try collections?.map { try $0.collectionInfoEntity } ?? [] } } } diff --git a/FLINT/Data/Sources/DTO/Collection/PagedCollectionsDTO.swift b/FLINT/Data/Sources/DTO/Collection/PagedCollectionsDTO.swift index 98228867..43862bb5 100644 --- a/FLINT/Data/Sources/DTO/Collection/PagedCollectionsDTO.swift +++ b/FLINT/Data/Sources/DTO/Collection/PagedCollectionsDTO.swift @@ -36,7 +36,7 @@ extension PagedCollectionsDTO { get throws { return try CollectionPagingEntity( collections: data?.map({ try $0.entity }) ?? [], - cursor: unwrap(UInt(unwrap(meta?.nextCursor))) + cursor: unwrap(Int64(meta?.nextCursor ?? "")) ) } } diff --git a/FLINT/Data/Sources/DTO/Collection/RecentViewedCollectionsDTO.swift b/FLINT/Data/Sources/DTO/Collection/RecentViewedCollectionsDTO.swift index d23d89dc..68d09729 100644 --- a/FLINT/Data/Sources/DTO/Collection/RecentViewedCollectionsDTO.swift +++ b/FLINT/Data/Sources/DTO/Collection/RecentViewedCollectionsDTO.swift @@ -9,50 +9,14 @@ import Foundation import Entity -// TODO: - RecentViewedCollectionsDTO & HomeRecommendedCollectionsDTO & UserCollectionsDTO 유사 - public struct RecentViewedCollectionsDTO: Codable { public let collections: [CollectionDTO]? } -extension RecentViewedCollectionsDTO { - public struct CollectionDTO: Codable { - public let id: String? - public let thumbnailUrl: String? - public let title: String? - public let description: String? - public let imageList: [String]? - public let bookmarkCount: Int? - public let isBookmarked: Bool? - public let userId: String? - public let nickname: String? - public let profileImageUrl: String? - } -} - extension RecentViewedCollectionsDTO { public var entities: [CollectionEntity] { get throws { - return try collections?.compactMap { try $0.entity } ?? [] - } - } -} - -extension RecentViewedCollectionsDTO.CollectionDTO { - public var entity: CollectionEntity { - get throws { - return try CollectionEntity( - id: unwrap(id), - thumbnailUrl: thumbnailUrl ?? "", - title: title ?? "", - description: description ?? "", - imageList: imageList ?? [], - bookmarkCount: bookmarkCount ?? 0, - isBookmarked: isBookmarked ?? false, - userId: unwrap(userId), - nickname: nickname ?? "", - profileImageUrl: profileImageUrl ?? "" - ) + return try collections?.compactMap { try $0.collectionEntity } ?? [] } } } diff --git a/FLINT/Data/Sources/DTO/Collection/UserCollectionsDTO.swift b/FLINT/Data/Sources/DTO/Collection/UserCollectionsDTO.swift index a008540f..681ca501 100644 --- a/FLINT/Data/Sources/DTO/Collection/UserCollectionsDTO.swift +++ b/FLINT/Data/Sources/DTO/Collection/UserCollectionsDTO.swift @@ -13,44 +13,10 @@ public struct UserCollectionsDTO: Codable { public let collections: [CollectionDTO]? } -extension UserCollectionsDTO { - public struct CollectionDTO: Codable { - public let id: String? - public let thumbnailUrl: String? - public let title: String? - public let description: String? - public let imageList: [String]? - public let bookmarkCount: Int? - public let isBookmarked: Bool? - public let userId: String? - public let nickname: String? - public let profileImageUrl: String? - } -} - extension UserCollectionsDTO { public var entities: [CollectionEntity] { get throws { - return try collections?.map { try $0.entity } ?? [] - } - } -} - -extension UserCollectionsDTO.CollectionDTO { - public var entity: CollectionEntity { - get throws { - return try CollectionEntity( - id: unwrap(id), - thumbnailUrl: thumbnailUrl ?? "", - title: title ?? "", - description: description ?? "", - imageList: imageList ?? [], - bookmarkCount: bookmarkCount ?? 0, - isBookmarked: isBookmarked ?? false, - userId: unwrap(userId), - nickname: nickname ?? "", - profileImageUrl: profileImageUrl ?? "" - ) + return try collections?.map { try $0.collectionEntity } ?? [] } } } diff --git a/FLINT/Data/Sources/Networking/Service/CollectionService.swift b/FLINT/Data/Sources/Networking/Service/CollectionService.swift index 2ebfe82f..8093d927 100644 --- a/FLINT/Data/Sources/Networking/Service/CollectionService.swift +++ b/FLINT/Data/Sources/Networking/Service/CollectionService.swift @@ -17,7 +17,7 @@ import DTO public protocol CollectionService { func fetchCollections(cursor: Int64?, size: Int32) -> AnyPublisher - func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher + func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher func fetchCollectionDetail(collectionId: Int64) -> AnyPublisher func fetchRecentViewedCollections() -> AnyPublisher } @@ -34,10 +34,9 @@ public final class DefaultCollectionService: CollectionService { .mapBaseResponseData(PagedCollectionsDTO.self) } - public func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher { + public func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher { return collectionAPIProvider.requestPublisher(.createCollection(collectionInfo: collectionInfo)) .mapBaseResponseData(CreateCollectionResponseDTO.self) - .map { _ in () } .eraseToAnyPublisher() } diff --git a/FLINT/Data/Sources/RepositoryImpl/CollectionRepositoryImpl.swift b/FLINT/Data/Sources/RepositoryImpl/CollectionRepositoryImpl.swift index 1065825b..be2dd5ca 100644 --- a/FLINT/Data/Sources/RepositoryImpl/CollectionRepositoryImpl.swift +++ b/FLINT/Data/Sources/RepositoryImpl/CollectionRepositoryImpl.swift @@ -27,8 +27,10 @@ public final class DefaultCollectionRepository: CollectionRepository { .eraseToAnyPublisher() } - public func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher { + public func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher { return collectionService.createCollection(collectionInfo: collectionInfo) + .tryMap { try $0.createdCollectionId } + .eraseToAnyPublisher() } public func fetchCollectionDetail(collectionId: Int64) -> AnyPublisher { diff --git a/FLINT/Domain/Sources/Entity/Bookmark/CollectionBookmarkUsersEntity.swift b/FLINT/Domain/Sources/Entity/Bookmark/CollectionBookmarkUsersEntity.swift index 852e6d32..0f8791be 100644 --- a/FLINT/Domain/Sources/Entity/Bookmark/CollectionBookmarkUsersEntity.swift +++ b/FLINT/Domain/Sources/Entity/Bookmark/CollectionBookmarkUsersEntity.swift @@ -7,26 +7,12 @@ import Foundation -public struct CollectionBookmarkUsersEntity: Equatable { +public struct CollectionBookmarkUsersEntity { public let bookmarkCount: Int - public let users: [CollectionBookmarkUserEntity] + public let users: [UserProfileEntity] - public init(bookmarkCount: Int, users: [CollectionBookmarkUserEntity]) { + public init(bookmarkCount: Int, users: [UserProfileEntity]) { self.bookmarkCount = bookmarkCount self.users = users } } - -public struct CollectionBookmarkUserEntity: Equatable { - public let userId: String - public let nickname: String - public let profileImageUrl: URL? - public let userRole: String - - public init(userId: String, nickname: String, profileImageUrl: URL?, userRole: String) { - self.userId = userId - self.nickname = nickname - self.profileImageUrl = profileImageUrl - self.userRole = userRole - } -} diff --git a/FLINT/Domain/Sources/Entity/Collection/CollectionDetailEntity.swift b/FLINT/Domain/Sources/Entity/Collection/CollectionDetailEntity.swift index b8e27646..e61fe7e4 100644 --- a/FLINT/Domain/Sources/Entity/Collection/CollectionDetailEntity.swift +++ b/FLINT/Domain/Sources/Entity/Collection/CollectionDetailEntity.swift @@ -7,14 +7,14 @@ import Foundation -public struct CollectionDetailEntity: Equatable { +public struct CollectionDetailEntity { public let id: String public let title: String public let description: String public let thumbnailUrl: URL? public let createdAt: String public let isBookmarked: Bool - public let author: CollectionAuthorEntity? + public let author: UserProfileEntity public let contents: [CollectionContentEntity] public init( @@ -24,7 +24,7 @@ public struct CollectionDetailEntity: Equatable { thumbnailUrl: URL?, createdAt: String, isBookmarked: Bool, - author: CollectionAuthorEntity?, + author: UserProfileEntity, contents: [CollectionContentEntity] ) { self.id = id @@ -38,25 +38,6 @@ public struct CollectionDetailEntity: Equatable { } } -public struct CollectionAuthorEntity: Equatable { - public let id: String - public let nickname: String - public let profileImageUrl: URL? - public let userRole: String - - public init( - id: String, - nickname: String, - profileImageUrl: URL?, - userRole: String - ) { - self.id = id - self.nickname = nickname - self.profileImageUrl = profileImageUrl - self.userRole = userRole - } -} - public struct CollectionContentEntity: Equatable { public let id: String public let title: String diff --git a/FLINT/Domain/Sources/Entity/User/CollectionEntity.swift b/FLINT/Domain/Sources/Entity/Collection/CollectionEntity.swift similarity index 87% rename from FLINT/Domain/Sources/Entity/User/CollectionEntity.swift rename to FLINT/Domain/Sources/Entity/Collection/CollectionEntity.swift index aac459a9..c6b0a1c5 100644 --- a/FLINT/Domain/Sources/Entity/User/CollectionEntity.swift +++ b/FLINT/Domain/Sources/Entity/Collection/CollectionEntity.swift @@ -9,7 +9,7 @@ import Foundation public struct CollectionEntity: Equatable { public let id: String - public let thumbnailUrl: String + public let thumbnailUrl: URL? public let title: String public let description: String public let imageList: [String] @@ -17,11 +17,11 @@ public struct CollectionEntity: Equatable { public let isBookmarked: Bool public let userId: String public let nickname: String - public let profileImageUrl: String - + public let profileImageUrl: URL? + public init( id: String, - thumbnailUrl: String, + thumbnailUrl: URL?, title: String, description: String, imageList: [String], @@ -29,7 +29,7 @@ public struct CollectionEntity: Equatable { isBookmarked: Bool, userId: String, nickname: String, - profileImageUrl: String + profileImageUrl: URL? ) { self.id = id self.thumbnailUrl = thumbnailUrl diff --git a/FLINT/Domain/Sources/Entity/Collection/CollectionPagingEntity.swift b/FLINT/Domain/Sources/Entity/Collection/CollectionPagingEntity.swift index 5f606e13..39da1752 100644 --- a/FLINT/Domain/Sources/Entity/Collection/CollectionPagingEntity.swift +++ b/FLINT/Domain/Sources/Entity/Collection/CollectionPagingEntity.swift @@ -1,5 +1,5 @@ // -// File.swift +// CollectionPagingEntity.swift // Domain // // Created by 김호성 on 2026.01.22. @@ -9,9 +9,9 @@ import Foundation public struct CollectionPagingEntity { public let collections: [ExploreInfoEntity] - public let cursor: UInt + public let cursor: Int64 - public init(collections: [ExploreInfoEntity], cursor: UInt) { + public init(collections: [ExploreInfoEntity], cursor: Int64) { self.collections = collections self.cursor = cursor } diff --git a/FLINT/Domain/Sources/Entity/Content/ContentEntity.swift b/FLINT/Domain/Sources/Entity/Content/ContentEntity.swift index 5067e9be..e12b438b 100644 --- a/FLINT/Domain/Sources/Entity/Content/ContentEntity.swift +++ b/FLINT/Domain/Sources/Entity/Content/ContentEntity.swift @@ -1,5 +1,5 @@ // -// File.swift +// ContentEntity.swift // Domain // // Created by 김호성 on 2026.01.22. @@ -7,7 +7,7 @@ import Foundation -public struct ContentEntity: Equatable { +public struct ContentEntity { public let id: String public let title: String public let author: String diff --git a/FLINT/Domain/Sources/Entity/User/ContentInfoEntity.swift b/FLINT/Domain/Sources/Entity/Content/ContentInfoEntity.swift similarity index 100% rename from FLINT/Domain/Sources/Entity/User/ContentInfoEntity.swift rename to FLINT/Domain/Sources/Entity/Content/ContentInfoEntity.swift diff --git a/FLINT/Domain/Sources/Entity/Content/OTTPlatformEntity.swift b/FLINT/Domain/Sources/Entity/Content/OTTPlatformEntity.swift index 100370f2..ae3190b0 100644 --- a/FLINT/Domain/Sources/Entity/Content/OTTPlatformEntity.swift +++ b/FLINT/Domain/Sources/Entity/Content/OTTPlatformEntity.swift @@ -10,10 +10,10 @@ import Foundation public struct OTTPlatformEntity { public let ottId: String public let name: String - public let logoUrl: String - public let contentUrl: String + public let logoUrl: URL? + public let contentUrl: URL? - public init(ottId: String, name: String, logoUrl: String, contentUrl: String) { + public init(ottId: String, name: String, logoUrl: URL?, contentUrl: URL?) { self.ottId = ottId self.name = name self.logoUrl = logoUrl diff --git a/FLINT/Domain/Sources/Entity/Ott.swift b/FLINT/Domain/Sources/Entity/Content/Ott.swift similarity index 100% rename from FLINT/Domain/Sources/Entity/Ott.swift rename to FLINT/Domain/Sources/Entity/Content/Ott.swift diff --git a/FLINT/Domain/Sources/Entity/User/KeywordEntity.swift b/FLINT/Domain/Sources/Entity/User/KeywordEntity.swift index e48d3760..ef407871 100644 --- a/FLINT/Domain/Sources/Entity/User/KeywordEntity.swift +++ b/FLINT/Domain/Sources/Entity/User/KeywordEntity.swift @@ -12,9 +12,9 @@ public struct KeywordEntity { public let rank: Int public let name: String public let percentage: Int - public let imageUrl: String + public let imageUrl: URL? - public init(color: String, rank: Int, name: String, percentage: Int, imageUrl: String) { + public init(color: String, rank: Int, name: String, percentage: Int, imageUrl: URL?) { self.color = color self.rank = rank self.name = name diff --git a/FLINT/Domain/Sources/Entity/Nickname/NicknameState.swift b/FLINT/Domain/Sources/Entity/User/NicknameState.swift similarity index 100% rename from FLINT/Domain/Sources/Entity/Nickname/NicknameState.swift rename to FLINT/Domain/Sources/Entity/User/NicknameState.swift diff --git a/FLINT/Domain/Sources/Entity/User/UserProfileEntity.swift b/FLINT/Domain/Sources/Entity/User/UserProfileEntity.swift index 66dd624c..402815d6 100644 --- a/FLINT/Domain/Sources/Entity/User/UserProfileEntity.swift +++ b/FLINT/Domain/Sources/Entity/User/UserProfileEntity.swift @@ -10,13 +10,13 @@ import Foundation public struct UserProfileEntity { public let id: String public let nickname: String - public let profileImageUrl: String - public let isFliner: Bool + public let profileImageUrl: URL? + public let role: UserRole - public init(id: String, nickname: String, profileImageUrl: String, isFliner: Bool) { + public init(id: String, nickname: String, profileImageUrl: URL?, role: UserRole) { self.id = id self.nickname = nickname self.profileImageUrl = profileImageUrl - self.isFliner = isFliner + self.role = role } } diff --git a/FLINT/Domain/Sources/Entity/User/UserRole.swift b/FLINT/Domain/Sources/Entity/User/UserRole.swift new file mode 100644 index 00000000..d427766f --- /dev/null +++ b/FLINT/Domain/Sources/Entity/User/UserRole.swift @@ -0,0 +1,19 @@ +// +// UserRole.swift +// Domain +// +// Created by 김호성 on 2026.02.08. +// + +import Foundation + +public enum UserRole: String { + /// 관리자 - 시스템 전체 관리 권한 + case admin = "ADMIN" + + /// 일반 사용자 - 컬렉션 생성 및 관리 가능 + case fliner = "FLINER" + + /// 게스트 사용자 - 조회만 가능 + case fling = "FLING" +} diff --git a/FLINT/Domain/Sources/Repository/CollectionRepository.swift b/FLINT/Domain/Sources/Repository/CollectionRepository.swift index 82fe6863..8d60e639 100644 --- a/FLINT/Domain/Sources/Repository/CollectionRepository.swift +++ b/FLINT/Domain/Sources/Repository/CollectionRepository.swift @@ -12,7 +12,7 @@ import Entity public protocol CollectionRepository { func fetchCollections(cursor: Int64?, size: Int32) -> AnyPublisher - func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher + func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher func fetchCollectionDetail(collectionId: Int64) -> AnyPublisher func fetchRecentViewedCollections() -> AnyPublisher<[CollectionEntity], Error> } From 5c8292719d50941eb3e43ff45d05c1af06a93fbd Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Mon, 9 Feb 2026 12:36:00 +0900 Subject: [PATCH 31/45] =?UTF-8?q?[refactor]=20LoginViewModel=20OnboardingV?= =?UTF-8?q?iewModel=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/Content/ContentEntity.swift | 2 +- .../CheckNicknameUseCase.swift | 0 .../{ => Auth}/SignupUseCaseFactory.swift | 0 .../SocialVerifyUseCaseFactory.swift | 0 .../UseCase/Auth/WithDrawUseCaseFactory.swift | 24 ++++++++++++++++ ...ublisher+.swift => Publisher+Thread.swift} | 2 +- .../Scene/Login/LoginViewModel.swift | 2 +- .../Onboarding/OnboardingViewModel.swift | 28 +++++++++---------- 8 files changed, 41 insertions(+), 17 deletions(-) rename FLINT/Domain/Sources/UseCase/{Nickname => Profile}/CheckNicknameUseCase.swift (100%) rename FLINT/FLINT/Dependency/Factory/UseCase/{ => Auth}/SignupUseCaseFactory.swift (100%) rename FLINT/FLINT/Dependency/Factory/UseCase/{ => Auth}/SocialVerifyUseCaseFactory.swift (100%) create mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/Auth/WithDrawUseCaseFactory.swift rename FLINT/Presentation/Sources/ViewModel/Extension/{Publisher+.swift => Publisher+Thread.swift} (92%) diff --git a/FLINT/Domain/Sources/Entity/Content/ContentEntity.swift b/FLINT/Domain/Sources/Entity/Content/ContentEntity.swift index e12b438b..45bcb18b 100644 --- a/FLINT/Domain/Sources/Entity/Content/ContentEntity.swift +++ b/FLINT/Domain/Sources/Entity/Content/ContentEntity.swift @@ -7,7 +7,7 @@ import Foundation -public struct ContentEntity { +public struct ContentEntity: Equatable { public let id: String public let title: String public let author: String diff --git a/FLINT/Domain/Sources/UseCase/Nickname/CheckNicknameUseCase.swift b/FLINT/Domain/Sources/UseCase/Profile/CheckNicknameUseCase.swift similarity index 100% rename from FLINT/Domain/Sources/UseCase/Nickname/CheckNicknameUseCase.swift rename to FLINT/Domain/Sources/UseCase/Profile/CheckNicknameUseCase.swift diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/SignupUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Auth/SignupUseCaseFactory.swift similarity index 100% rename from FLINT/FLINT/Dependency/Factory/UseCase/SignupUseCaseFactory.swift rename to FLINT/FLINT/Dependency/Factory/UseCase/Auth/SignupUseCaseFactory.swift diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/SocialVerifyUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Auth/SocialVerifyUseCaseFactory.swift similarity index 100% rename from FLINT/FLINT/Dependency/Factory/UseCase/SocialVerifyUseCaseFactory.swift rename to FLINT/FLINT/Dependency/Factory/UseCase/Auth/SocialVerifyUseCaseFactory.swift diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Auth/WithDrawUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Auth/WithDrawUseCaseFactory.swift new file mode 100644 index 00000000..7fb0adbb --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Auth/WithDrawUseCaseFactory.swift @@ -0,0 +1,24 @@ +// +// WithDrawUseCaseFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.09. +// + +import Foundation + +import Domain + +protocol WithDrawUseCaseFactory: AuthRepositoryFactory { + func makeWithDrawUseCase() -> WithDrawUseCase + func makeWithDrawUseCase(authRepository: AuthRepository) -> WithDrawUseCase +} + +extension WithDrawUseCaseFactory { + func makeWithDrawUseCase() -> WithDrawUseCase { + return makeWithDrawUseCase(authRepository: makeAuthRepository()) + } + func makeWithDrawUseCase(authRepository: AuthRepository) -> WithDrawUseCase { + return DefaultWithDrawUseCase(authRepository: authRepository) + } +} diff --git a/FLINT/Presentation/Sources/ViewModel/Extension/Publisher+.swift b/FLINT/Presentation/Sources/ViewModel/Extension/Publisher+Thread.swift similarity index 92% rename from FLINT/Presentation/Sources/ViewModel/Extension/Publisher+.swift rename to FLINT/Presentation/Sources/ViewModel/Extension/Publisher+Thread.swift index e61c0d85..babfed39 100644 --- a/FLINT/Presentation/Sources/ViewModel/Extension/Publisher+.swift +++ b/FLINT/Presentation/Sources/ViewModel/Extension/Publisher+Thread.swift @@ -1,5 +1,5 @@ // -// File.swift +// Publisher+Thread.swift // Presentation // // Created by 김호성 on 2026.01.20. diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/Login/LoginViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/Login/LoginViewModel.swift index a79baee5..14c663b3 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/Login/LoginViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/Login/LoginViewModel.swift @@ -47,7 +47,7 @@ public final class DefaultLoginViewModel: LoginViewModel { } if let accessToken = oauthToken?.accessToken { socialVerifyUseCase.socialVerify( - socialVerifyEntity: SocialVerifyEntity( + socialAuthCredential: SocialVerifyEntity( provider: .kakao, accessToken: accessToken ) diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/Onboarding/OnboardingViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/Onboarding/OnboardingViewModel.swift index 9c01d294..3537f0f0 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/Onboarding/OnboardingViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/Onboarding/OnboardingViewModel.swift @@ -15,10 +15,10 @@ public protocol OnboardingViewModelInput { func checkNickname(_ nickname: String) // film select - func fetchContents() + func fetchPopularContents() func searchContents(_ keyword: String) func clickContent(_ content: ContentEntity) - func deleteContent(_ content: ContentEntity) + func deleteContent(_ content: ContentEntity) // ott select func clickOtt(_ ott: Ott) @@ -46,8 +46,8 @@ public typealias OnboardingViewModel = OnboardingViewModelInput & OnboardingView public final class DefaultOnboardingViewModel: OnboardingViewModel { - private let nicknameUseCase: NicknameUseCase - private let contentsUseCase: ContentsUseCase + private let checkNicknameUseCase: CheckNicknameUseCase + private let fetchPopularContentsUseCase: FetchPopularContentsUseCase private let searchContentsUseCase: SearchContentsUseCase private let signupUseCase: SignupUseCase @@ -72,13 +72,13 @@ public final class DefaultOnboardingViewModel: OnboardingViewModel { private var cancellables: Set = Set() public init( - nicknameUseCase: NicknameUseCase, - contentsUseCase: ContentsUseCase, + checkNicknameUseCase: CheckNicknameUseCase, + fetchPopularContentsUseCase: FetchPopularContentsUseCase, searchContentsUseCase: SearchContentsUseCase, - signupUseCase: SignupUseCase + signupUseCase: SignupUseCase, ) { - self.nicknameUseCase = nicknameUseCase - self.contentsUseCase = contentsUseCase + self.checkNicknameUseCase = checkNicknameUseCase + self.fetchPopularContentsUseCase = fetchPopularContentsUseCase self.searchContentsUseCase = searchContentsUseCase self.signupUseCase = signupUseCase } @@ -88,7 +88,7 @@ public final class DefaultOnboardingViewModel: OnboardingViewModel { nicknameValidState.send(.invalid) return } - nicknameUseCase.checkNickname(nickname) + checkNicknameUseCase.checkNickname(nickname) .manageThread() .sinkHandledCompletion(receiveValue: { [weak self] isValidNickname in self?.nicknameValidState.send(isValidNickname ? .valid : .duplicate) @@ -99,8 +99,8 @@ public final class DefaultOnboardingViewModel: OnboardingViewModel { .store(in: &cancellables) } - public func fetchContents() { - contentsUseCase.fetchContents() + public func fetchPopularContents() { + fetchPopularContentsUseCase.fetchPopularContents() .manageThread() .sinkHandledCompletion { [weak self] contents in self?.contents.send(contents) @@ -109,7 +109,7 @@ public final class DefaultOnboardingViewModel: OnboardingViewModel { } public func searchContents(_ keyword: String) { - searchContentsUseCase.searchContents(keyword) + searchContentsUseCase.searchContents(keyword: keyword) .manageThread() .sinkHandledCompletion { [weak self] contents in self?.contents.send(contents) @@ -141,7 +141,7 @@ public final class DefaultOnboardingViewModel: OnboardingViewModel { public func signup() { signupUseCase.signup( - SignupInfoEntity( + userInfo: SignupInfoEntity( nickname: nickname.value, favoriteContentIds: selectedContents.value.compactMap({ content in Int(content.id) From 1806f4a01ef4b43d4206971f08b5ca2953162601 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Mon, 9 Feb 2026 14:09:41 +0900 Subject: [PATCH 32/45] =?UTF-8?q?[refactor]=20Collection=20UseCase=20Facto?= =?UTF-8?q?ry=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Collection/CreateCollectionUseCase.swift | 4 +-- .../ContentsUseCaseFactory.swift | 0 .../CreateCollectionUseCaseFactory.swift | 0 .../FetchCollectionDetailUseCaseFactory.swift | 24 +++++++++++++++++ .../FetchCollectionsUseCaseFactory.swift | 24 +++++++++++++++++ ...ecentViewedCollectionsUseCaseFactory.swift | 24 +++++++++++++++++ ...RecommendedCollectionsUseCaseFactory.swift | 24 +++++++++++++++++ ...ggleCollectionBookmarkUseCaseFactory.swift | 24 +++++++++++++++++ .../CollectionDetailUseCaseFactory.swift | 24 ----------------- .../UseCase/ExploreUseCaseFactory.swift | 24 ----------------- .../FetchBookmarkedUserUseCaseFactory.swift | 27 ------------------- ...ollectionBookmarkUsersUseCaseFactory.swift | 24 +++++++++++++++++ ...tchWatchingCollectionsUseCaseFactory.swift | 24 ----------------- .../OnboardingViewModelFactory.swift | 2 +- 14 files changed, 147 insertions(+), 102 deletions(-) rename FLINT/FLINT/Dependency/Factory/UseCase/{ => Collection}/ContentsUseCaseFactory.swift (100%) rename FLINT/FLINT/Dependency/Factory/UseCase/{ => Collection}/CreateCollectionUseCaseFactory.swift (100%) create mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionDetailUseCaseFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionsUseCaseFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchRecentViewedCollectionsUseCaseFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchRecommendedCollectionsUseCaseFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/Collection/ToggleCollectionBookmarkUseCaseFactory.swift delete mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/CollectionDetailUseCaseFactory.swift delete mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/ExploreUseCaseFactory.swift delete mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/FetchBookmarkedUserUseCaseFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/FetchCollectionBookmarkUsersUseCaseFactory.swift delete mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/FetchWatchingCollectionsUseCaseFactory.swift diff --git a/FLINT/Domain/Sources/UseCase/Collection/CreateCollectionUseCase.swift b/FLINT/Domain/Sources/UseCase/Collection/CreateCollectionUseCase.swift index d35c525c..568bd5c0 100644 --- a/FLINT/Domain/Sources/UseCase/Collection/CreateCollectionUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Collection/CreateCollectionUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol CreateCollectionUseCase { - func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher + func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher } public class DefaultCreateCollectionUseCase: CreateCollectionUseCase { @@ -23,7 +23,7 @@ public class DefaultCreateCollectionUseCase: CreateCollectionUseCase { self.collectionRepository = collectionRepository } - public func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher { + public func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher { return collectionRepository.createCollection(collectionInfo: collectionInfo) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/ContentsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/ContentsUseCaseFactory.swift similarity index 100% rename from FLINT/FLINT/Dependency/Factory/UseCase/ContentsUseCaseFactory.swift rename to FLINT/FLINT/Dependency/Factory/UseCase/Collection/ContentsUseCaseFactory.swift diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/CreateCollectionUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/CreateCollectionUseCaseFactory.swift similarity index 100% rename from FLINT/FLINT/Dependency/Factory/UseCase/CreateCollectionUseCaseFactory.swift rename to FLINT/FLINT/Dependency/Factory/UseCase/Collection/CreateCollectionUseCaseFactory.swift diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionDetailUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionDetailUseCaseFactory.swift new file mode 100644 index 00000000..f6a91b93 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionDetailUseCaseFactory.swift @@ -0,0 +1,24 @@ +// +// FetchCollectionDetailUseCaseFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.02. +// + +import Foundation + +import Domain + +protocol FetchCollectionDetailUseCaseFactory: CollectionRepositoryFactory { + func makeFetchCollectionDetailUseCase() -> FetchCollectionDetailUseCase + func makeFetchCollectionDetailUseCase(collectionRepository: CollectionRepository) -> FetchCollectionDetailUseCase +} + +extension FetchCollectionDetailUseCaseFactory { + func makeFetchCollectionDetailUseCase() -> FetchCollectionDetailUseCase { + return makeFetchCollectionDetailUseCase(collectionRepository: makeCollectionRepository()) + } + func makeFetchCollectionDetailUseCase(collectionRepository: CollectionRepository) -> FetchCollectionDetailUseCase { + return DefaultFetchCollectionDetailUseCase(collectionRepository: collectionRepository) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionsUseCaseFactory.swift new file mode 100644 index 00000000..7e6e938c --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionsUseCaseFactory.swift @@ -0,0 +1,24 @@ +// +// FetchCollectionsUseCaseFactory.swift +// FLINT +// +// Created by 김호성 on 2026.01.22. +// + +import Foundation + +import Domain + +protocol FetchCollectionsUseCaseFactory: CollectionRepositoryFactory { + func makeFetchCollectionsUseCase() -> FetchCollectionsUseCase + func makeFetchCollectionsUseCase(collectionRepository: CollectionRepository) -> FetchCollectionsUseCase +} + +extension FetchCollectionsUseCaseFactory { + func makeFetchCollectionsUseCase() -> FetchCollectionsUseCase { + return makeFetchCollectionsUseCase(collectionRepository: makeCollectionRepository()) + } + func makeFetchCollectionsUseCase(collectionRepository: CollectionRepository) -> FetchCollectionsUseCase { + return DefaultFetchCollectionsUseCase(collectionRepository: collectionRepository) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchRecentViewedCollectionsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchRecentViewedCollectionsUseCaseFactory.swift new file mode 100644 index 00000000..2e17afaa --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchRecentViewedCollectionsUseCaseFactory.swift @@ -0,0 +1,24 @@ +// +// FetchRecentViewedCollectionsUseCaseFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.09. +// + +import Foundation + +import Domain + +protocol FetchRecentViewedCollectionsUseCaseFactory: CollectionRepositoryFactory { + func makeFetchRecentViewedCollectionsUseCase() -> FetchRecentViewedCollectionsUseCase + func makeFetchRecentViewedCollectionsUseCase(collectionRepository: CollectionRepository) -> FetchRecentViewedCollectionsUseCase +} + +extension FetchRecentViewedCollectionsUseCaseFactory { + func makeFetchRecentViewedCollectionsUseCase() -> FetchRecentViewedCollectionsUseCase { + return makeFetchRecentViewedCollectionsUseCase(collectionRepository: makeCollectionRepository()) + } + func makeFetchRecentViewedCollectionsUseCase(collectionRepository: CollectionRepository) -> FetchRecentViewedCollectionsUseCase { + return DefaultFetchRecentViewedCollectionsUseCase(collectionRepository: collectionRepository) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchRecommendedCollectionsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchRecommendedCollectionsUseCaseFactory.swift new file mode 100644 index 00000000..16575e6b --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchRecommendedCollectionsUseCaseFactory.swift @@ -0,0 +1,24 @@ +// +// FetchRecommendedCollectionsUseCaseFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.09. +// + +import Foundation + +import Domain + +protocol FetchRecommendedCollectionsUseCaseFactory: HomeRepositoryFactory { + func makeFetchRecommendedCollectionsUseCase() -> FetchRecommendedCollectionsUseCase + func makeFetchRecommendedCollectionsUseCase(homeRepository: HomeRepository) -> FetchRecommendedCollectionsUseCase +} + +extension FetchRecommendedCollectionsUseCaseFactory { + func makeFetchRecommendedCollectionsUseCase() -> FetchRecommendedCollectionsUseCase { + return makeFetchRecommendedCollectionsUseCase(homeRepository: makeHomeRepository()) + } + func makeFetchRecommendedCollectionsUseCase(homeRepository: HomeRepository) -> FetchRecommendedCollectionsUseCase { + return DefaultFetchRecommendedCollectionsUseCase(homeRepository: homeRepository) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/ToggleCollectionBookmarkUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/ToggleCollectionBookmarkUseCaseFactory.swift new file mode 100644 index 00000000..961bfab3 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/ToggleCollectionBookmarkUseCaseFactory.swift @@ -0,0 +1,24 @@ +// +// ToggleCollectionBookmarkUseCaseFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.09. +// + +import Foundation + +import Domain + +protocol ToggleCollectionBookmarkUseCaseFactory: BookmarkRepositoryFactory { + func makeToggleCollectionBookmarkUseCase() -> ToggleCollectionBookmarkUseCase + func makeToggleCollectionBookmarkUseCase(bookmarkRepository: BookmarkRepository) -> ToggleCollectionBookmarkUseCase +} + +extension ToggleCollectionBookmarkUseCaseFactory { + func makeToggleCollectionBookmarkUseCase() -> ToggleCollectionBookmarkUseCase { + return makeToggleCollectionBookmarkUseCase(bookmarkRepository: makeBookmarkRepository()) + } + func makeToggleCollectionBookmarkUseCase(bookmarkRepository: BookmarkRepository) -> ToggleCollectionBookmarkUseCase { + return DefaultToggleCollectionBookmarkUseCase(bookmarkRepository: bookmarkRepository) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/CollectionDetailUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/CollectionDetailUseCaseFactory.swift deleted file mode 100644 index 2fb3a9e6..00000000 --- a/FLINT/FLINT/Dependency/Factory/UseCase/CollectionDetailUseCaseFactory.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// CollectionDetailUseCaseFactory.swift -// FLINT -// -// Created by 김호성 on 2026.02.02. -// - -import Foundation - -import Domain - -protocol CollectionDetailUseCaseFactory: CollectionRepositoryFactory { - func makeCollectionDetailUseCase(collectionRepository: CollectionRepository) -> CollectionDetailUseCase - func makeCollectionDetailUseCase() -> CollectionDetailUseCase -} - -extension CollectionDetailUseCaseFactory { - func makeCollectionDetailUseCase() -> CollectionDetailUseCase { - return makeCollectionDetailUseCase(collectionRepository: makeCollectionRepository()) - } - func makeCollectionDetailUseCase(collectionRepository: CollectionRepository) -> CollectionDetailUseCase { - return DefaultCollectionDetailUseCase(collectionRepository: collectionRepository) - } -} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/ExploreUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/ExploreUseCaseFactory.swift deleted file mode 100644 index 65766bf2..00000000 --- a/FLINT/FLINT/Dependency/Factory/UseCase/ExploreUseCaseFactory.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// File.swift -// FLINT -// -// Created by 김호성 on 2026.01.22. -// - -import Foundation - -import Domain - -protocol ExploreUseCaseFactory: CollectionRepositoryFactory { - func makeExploreUseCase() -> ExploreUseCase - func makeExploreUseCase(collectionRepository: CollectionRepository) -> ExploreUseCase -} - -extension ExploreUseCaseFactory { - func makeExploreUseCase() -> ExploreUseCase { - return makeExploreUseCase(collectionRepository: makeCollectionRepository()) - } - func makeExploreUseCase(collectionRepository: CollectionRepository) -> ExploreUseCase { - return DefaultExploreUseCase(collectionRepository: collectionRepository) - } -} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/FetchBookmarkedUserUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/FetchBookmarkedUserUseCaseFactory.swift deleted file mode 100644 index 84dd9db7..00000000 --- a/FLINT/FLINT/Dependency/Factory/UseCase/FetchBookmarkedUserUseCaseFactory.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// BookmarkFactory.swift -// FLINT -// -// Created by 진소은 on 1/23/26. -// - -import Foundation -import Moya - -import Data -import Domain -import Presentation - -protocol FetchBookmarkedUserUseCaseFactory: BookmarkRepositoryFactory { - func makeFetchBookmarkedUserUseCase() -> FetchBookmarkedUserUseCase - func makeFetchBookmarkedUserUseCase(bookmarkRepository: BookmarkRepository) -> FetchBookmarkedUserUseCase -} - -extension FetchBookmarkedUserUseCaseFactory { - func makeFetchBookmarkedUserUseCase() -> FetchBookmarkedUserUseCase { - return makeFetchBookmarkedUserUseCase(bookmarkRepository: makeBookmarkRepository()) - } - func makeFetchBookmarkedUserUseCase(bookmarkRepository: BookmarkRepository) -> FetchBookmarkedUserUseCase { - return DefaultFetchBookmarkedUserUseCase(bookmarkRepository: bookmarkRepository) - } -} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/FetchCollectionBookmarkUsersUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/FetchCollectionBookmarkUsersUseCaseFactory.swift new file mode 100644 index 00000000..d8eba708 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/UseCase/FetchCollectionBookmarkUsersUseCaseFactory.swift @@ -0,0 +1,24 @@ +// +// BookmarkFactory.swift +// FLINT +// +// Created by 진소은 on 1/23/26. +// + +import Foundation + +import Domain + +protocol FetchCollectionBookmarkUsersUseCaseFactory: BookmarkRepositoryFactory { + func makeFetchCollectionBookmarkUsersUseCase() -> FetchCollectionBookmarkUsersUseCase + func makeFetchCollectionBookmarkUsersUseCase(bookmarkRepository: BookmarkRepository) -> FetchCollectionBookmarkUsersUseCase +} + +extension FetchCollectionBookmarkUsersUseCaseFactory { + func makeFetchCollectionBookmarkUsersUseCase() -> FetchCollectionBookmarkUsersUseCase { + return makeFetchCollectionBookmarkUsersUseCase(bookmarkRepository: makeBookmarkRepository()) + } + func makeFetchCollectionBookmarkUsersUseCase(bookmarkRepository: BookmarkRepository) -> FetchCollectionBookmarkUsersUseCase { + return DefaultFetchCollectionBookmarkUsersUseCase(bookmarkRepository: bookmarkRepository) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/FetchWatchingCollectionsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/FetchWatchingCollectionsUseCaseFactory.swift deleted file mode 100644 index c3dcb30c..00000000 --- a/FLINT/FLINT/Dependency/Factory/UseCase/FetchWatchingCollectionsUseCaseFactory.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// FetchWatchingCollectionsUseCaseFactory.swift -// FLINT -// -// Created by 김호성 on 2026.02.02. -// - -import Foundation - -import Domain - -protocol FetchWatchingCollectionsUseCaseFactory: CollectionRepositoryFactory { - func makeFetchWatchingCollectionsUseCase() -> FetchWatchingCollectionsUseCase - func makeFetchWatchingCollectionsUseCase(collectionRepository: CollectionRepository) -> FetchWatchingCollectionsUseCase -} - -extension FetchWatchingCollectionsUseCaseFactory { - func makeFetchWatchingCollectionsUseCase() -> FetchWatchingCollectionsUseCase { - return makeFetchWatchingCollectionsUseCase(collectionRepository: makeCollectionRepository()) - } - func makeFetchWatchingCollectionsUseCase(collectionRepository: CollectionRepository) -> FetchWatchingCollectionsUseCase { - return DefaultFetchWatchingCollectionsUseCase(collectionRepository: collectionRepository) - } -} diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/OnboardingViewModelFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/OnboardingViewModelFactory.swift index 84181aff..4ad37040 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewModel/OnboardingViewModelFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/OnboardingViewModelFactory.swift @@ -1,5 +1,5 @@ // -// File.swift +// OnboardingViewModelFactory.swift // FLINT // // Created by 김호성 on 2026.01.22. From 922bbd8ce9b4eb34b336b982201147b531855314 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Mon, 9 Feb 2026 14:35:31 +0900 Subject: [PATCH 33/45] =?UTF-8?q?[refactor]=20Content=20UseCase=20Factory?= =?UTF-8?q?=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Content/FetchPopularContentsUseCase.swift | 2 +- ...ory.swift => AuthAPIProviderFactory.swift} | 6 ++--- ...ift => CollectionAPIProviderFactory.swift} | 4 +-- .../ContentAPIProviderFactory.swift | 24 +++++++++++++++++ ...ory.swift => HomeAPIProviderFactory.swift} | 6 ++--- ...y.swift => SearchAPIProviderFactory.swift} | 6 ++--- ...ory.swift => UserAPIProviderFactory.swift} | 6 ++--- .../CollectionRepositoryFactory.swift | 2 +- .../Repository/ContentRepositoryFactory.swift | 25 ++++++++++++++++++ .../Repository/UserRepositoryFactory.swift | 2 +- .../Factory/Service/AuthServiceFactory.swift | 2 +- .../Service/CollectionServiceFactory.swift | 4 +-- .../Service/ContentServiceFactory.swift | 26 +++++++++++++++++++ .../Factory/Service/HomeServiceFactory.swift | 2 +- .../Service/SearchServiceFactory.swift | 2 +- .../Factory/Service/UserServiceFactory.swift | 4 +-- ...OTTPlatformsForContentUseCaseFactory.swift | 24 +++++++++++++++++ .../FetchPopularContentsUseCaseFactory.swift | 24 +++++++++++++++++ .../SearchContentsUseCaseFactory.swift | 0 .../ToggleContentBookmarkUseCaseFactory.swift | 24 +++++++++++++++++ .../Factory/UseCase/HomeUseCaseFactory.swift | 24 ----------------- 21 files changed, 171 insertions(+), 48 deletions(-) rename FLINT/FLINT/Dependency/Factory/APIProvider/{AuthAPIFactory.swift => AuthAPIProviderFactory.swift} (76%) rename FLINT/FLINT/Dependency/Factory/APIProvider/{CollectionAPIFactory.swift => CollectionAPIProviderFactory.swift} (83%) create mode 100644 FLINT/FLINT/Dependency/Factory/APIProvider/ContentAPIProviderFactory.swift rename FLINT/FLINT/Dependency/Factory/APIProvider/{HomeAPIFactory.swift => HomeAPIProviderFactory.swift} (76%) rename FLINT/FLINT/Dependency/Factory/APIProvider/{SearchAPIFactory.swift => SearchAPIProviderFactory.swift} (75%) rename FLINT/FLINT/Dependency/Factory/APIProvider/{UserAPIFactory.swift => UserAPIProviderFactory.swift} (76%) create mode 100644 FLINT/FLINT/Dependency/Factory/Repository/ContentRepositoryFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/Service/ContentServiceFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchOTTPlatformsForContentUseCaseFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchPopularContentsUseCaseFactory.swift rename FLINT/FLINT/Dependency/Factory/UseCase/{ => Content}/SearchContentsUseCaseFactory.swift (100%) create mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/Content/ToggleContentBookmarkUseCaseFactory.swift delete mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/HomeUseCaseFactory.swift diff --git a/FLINT/Domain/Sources/UseCase/Content/FetchPopularContentsUseCase.swift b/FLINT/Domain/Sources/UseCase/Content/FetchPopularContentsUseCase.swift index 749e1b67..6acad23a 100644 --- a/FLINT/Domain/Sources/UseCase/Content/FetchPopularContentsUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Content/FetchPopularContentsUseCase.swift @@ -15,7 +15,7 @@ public protocol FetchPopularContentsUseCase { func fetchPopularContents() -> AnyPublisher<[ContentEntity], Error> } -public class DefaultContentsUseCase: FetchPopularContentsUseCase { +public class DefaultFetchPopularContentsUseCase: FetchPopularContentsUseCase { private let searchRepository: SearchRepository diff --git a/FLINT/FLINT/Dependency/Factory/APIProvider/AuthAPIFactory.swift b/FLINT/FLINT/Dependency/Factory/APIProvider/AuthAPIProviderFactory.swift similarity index 76% rename from FLINT/FLINT/Dependency/Factory/APIProvider/AuthAPIFactory.swift rename to FLINT/FLINT/Dependency/Factory/APIProvider/AuthAPIProviderFactory.swift index 911f5198..96580873 100644 --- a/FLINT/FLINT/Dependency/Factory/APIProvider/AuthAPIFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/APIProvider/AuthAPIProviderFactory.swift @@ -1,5 +1,5 @@ // -// AuthAPIFactory.swift +// AuthAPIProviderFactory.swift // FLINT // // Created by 김호성 on 2026.01.23. @@ -11,13 +11,13 @@ import Moya import Data -protocol AuthAPIFactory { +protocol AuthAPIProviderFactory { var authAPIProvider: MoyaProvider { get set } func makeAuthAPIProvider() -> MoyaProvider } -extension AuthAPIFactory { +extension AuthAPIProviderFactory { func makeAuthAPIProvider() -> MoyaProvider { return authAPIProvider } diff --git a/FLINT/FLINT/Dependency/Factory/APIProvider/CollectionAPIFactory.swift b/FLINT/FLINT/Dependency/Factory/APIProvider/CollectionAPIProviderFactory.swift similarity index 83% rename from FLINT/FLINT/Dependency/Factory/APIProvider/CollectionAPIFactory.swift rename to FLINT/FLINT/Dependency/Factory/APIProvider/CollectionAPIProviderFactory.swift index 5d8840ff..fb02d1fd 100644 --- a/FLINT/FLINT/Dependency/Factory/APIProvider/CollectionAPIFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/APIProvider/CollectionAPIProviderFactory.swift @@ -11,13 +11,13 @@ import Moya import Data -protocol CollectionAPIFactory { +protocol CollectionAPIProviderFactory { var collectionAPIProvider: MoyaProvider { get set } func makeCollectionAPIProvider() -> MoyaProvider } -extension CollectionAPIFactory { +extension CollectionAPIProviderFactory { func makeCollectionAPIProvider() -> MoyaProvider { return collectionAPIProvider } diff --git a/FLINT/FLINT/Dependency/Factory/APIProvider/ContentAPIProviderFactory.swift b/FLINT/FLINT/Dependency/Factory/APIProvider/ContentAPIProviderFactory.swift new file mode 100644 index 00000000..ec54d6a2 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/APIProvider/ContentAPIProviderFactory.swift @@ -0,0 +1,24 @@ +// +// ContentAPIProviderFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.09. +// + +import Foundation + +import Moya + +import Data + +protocol ContentAPIProviderFactory { + var contentAPIProvider: MoyaProvider { get set } + + func makeContentAPIProvider() -> MoyaProvider +} + +extension ContentAPIProviderFactory { + func makeContentAPIProvider() -> MoyaProvider { + return contentAPIProvider + } +} diff --git a/FLINT/FLINT/Dependency/Factory/APIProvider/HomeAPIFactory.swift b/FLINT/FLINT/Dependency/Factory/APIProvider/HomeAPIProviderFactory.swift similarity index 76% rename from FLINT/FLINT/Dependency/Factory/APIProvider/HomeAPIFactory.swift rename to FLINT/FLINT/Dependency/Factory/APIProvider/HomeAPIProviderFactory.swift index fa8bd8af..45cab367 100644 --- a/FLINT/FLINT/Dependency/Factory/APIProvider/HomeAPIFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/APIProvider/HomeAPIProviderFactory.swift @@ -1,5 +1,5 @@ // -// HomeAPIFactory.swift +// HomeAPIProviderFactory.swift // FLINT // // Created by 김호성 on 2026.01.31. @@ -11,13 +11,13 @@ import Moya import Data -protocol HomeAPIFactory { +protocol HomeAPIProviderFactory { var homeAPIProvider: MoyaProvider { get set } func makeHomeAPIProvider() -> MoyaProvider } -extension HomeAPIFactory { +extension HomeAPIProviderFactory { func makeHomeAPIProvider() -> MoyaProvider { return homeAPIProvider } diff --git a/FLINT/FLINT/Dependency/Factory/APIProvider/SearchAPIFactory.swift b/FLINT/FLINT/Dependency/Factory/APIProvider/SearchAPIProviderFactory.swift similarity index 75% rename from FLINT/FLINT/Dependency/Factory/APIProvider/SearchAPIFactory.swift rename to FLINT/FLINT/Dependency/Factory/APIProvider/SearchAPIProviderFactory.swift index 86c289e9..8ba2dc01 100644 --- a/FLINT/FLINT/Dependency/Factory/APIProvider/SearchAPIFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/APIProvider/SearchAPIProviderFactory.swift @@ -1,5 +1,5 @@ // -// SearchAPIFactory.swift +// SearchAPIProviderFactory.swift // FLINT // // Created by 김호성 on 2026.01.22. @@ -11,13 +11,13 @@ import Moya import Data -protocol SearchAPIFactory { +protocol SearchAPIProviderFactory { var searchAPIProvider: MoyaProvider { get set } func makeSearchAPIProvider() -> MoyaProvider } -extension SearchAPIFactory { +extension SearchAPIProviderFactory { func makeSearchAPIProvider() -> MoyaProvider { return searchAPIProvider } diff --git a/FLINT/FLINT/Dependency/Factory/APIProvider/UserAPIFactory.swift b/FLINT/FLINT/Dependency/Factory/APIProvider/UserAPIProviderFactory.swift similarity index 76% rename from FLINT/FLINT/Dependency/Factory/APIProvider/UserAPIFactory.swift rename to FLINT/FLINT/Dependency/Factory/APIProvider/UserAPIProviderFactory.swift index f29fb4a5..ab049839 100644 --- a/FLINT/FLINT/Dependency/Factory/APIProvider/UserAPIFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/APIProvider/UserAPIProviderFactory.swift @@ -1,5 +1,5 @@ // -// File.swift +// UserAPIProviderFactory.swift // FLINT // // Created by 김호성 on 2026.01.22. @@ -11,13 +11,13 @@ import Moya import Data -protocol UserAPIFactory { +protocol UserAPIProviderFactory { var userAPIProvider: MoyaProvider { get set } func makeUserAPIProvider() -> MoyaProvider } -extension UserAPIFactory { +extension UserAPIProviderFactory { func makeUserAPIProvider() -> MoyaProvider { return userAPIProvider } diff --git a/FLINT/FLINT/Dependency/Factory/Repository/CollectionRepositoryFactory.swift b/FLINT/FLINT/Dependency/Factory/Repository/CollectionRepositoryFactory.swift index 75fb9cd5..4238c2a8 100644 --- a/FLINT/FLINT/Dependency/Factory/Repository/CollectionRepositoryFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Repository/CollectionRepositoryFactory.swift @@ -1,5 +1,5 @@ // -// File.swift +// CollectionRepositoryFactory.swift // FLINT // // Created by 김호성 on 2026.01.22. diff --git a/FLINT/FLINT/Dependency/Factory/Repository/ContentRepositoryFactory.swift b/FLINT/FLINT/Dependency/Factory/Repository/ContentRepositoryFactory.swift new file mode 100644 index 00000000..5c494686 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/Repository/ContentRepositoryFactory.swift @@ -0,0 +1,25 @@ +// +// ContentRepositoryFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.09. +// + +import Foundation + +import Data +import Domain + +protocol ContentRepositoryFactory: ContentServiceFactory { + func makeContentRepository() -> ContentRepository + func makeContentRepository(contentService: ContentService) -> ContentRepository +} + +extension ContentRepositoryFactory { + func makeContentRepository() -> ContentRepository { + return makeContentRepository(contentService: makeContentService()) + } + func makeContentRepository(contentService: ContentService) -> ContentRepository { + return DefaultContentRepository(contentService: contentService) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/Repository/UserRepositoryFactory.swift b/FLINT/FLINT/Dependency/Factory/Repository/UserRepositoryFactory.swift index bc0d0a11..db0c9e42 100644 --- a/FLINT/FLINT/Dependency/Factory/Repository/UserRepositoryFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Repository/UserRepositoryFactory.swift @@ -1,5 +1,5 @@ // -// File.swift +// UserRepositoryFactory.swift // FLINT // // Created by 김호성 on 2026.01.22. diff --git a/FLINT/FLINT/Dependency/Factory/Service/AuthServiceFactory.swift b/FLINT/FLINT/Dependency/Factory/Service/AuthServiceFactory.swift index 13c40c88..928ea206 100644 --- a/FLINT/FLINT/Dependency/Factory/Service/AuthServiceFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Service/AuthServiceFactory.swift @@ -11,7 +11,7 @@ import Moya import Data -protocol AuthServiceFactory: AuthAPIFactory, TokenStorageFactory { +protocol AuthServiceFactory: AuthAPIProviderFactory, TokenStorageFactory { func makeAuthService() -> AuthService func makeAuthService(tokenStorage: TokenStorage, authAPIProvider: MoyaProvider) -> AuthService } diff --git a/FLINT/FLINT/Dependency/Factory/Service/CollectionServiceFactory.swift b/FLINT/FLINT/Dependency/Factory/Service/CollectionServiceFactory.swift index e4a471fd..81deb479 100644 --- a/FLINT/FLINT/Dependency/Factory/Service/CollectionServiceFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Service/CollectionServiceFactory.swift @@ -1,5 +1,5 @@ // -// File.swift +// CollectionServiceFactory.swift // FLINT // // Created by 김호성 on 2026.01.22. @@ -11,7 +11,7 @@ import Moya import Data -protocol CollectionServiceFactory: CollectionAPIFactory { +protocol CollectionServiceFactory: CollectionAPIProviderFactory { func makeCollectionService() -> CollectionService func makeCollectionService(exploreAPIProvider: MoyaProvider) -> CollectionService } diff --git a/FLINT/FLINT/Dependency/Factory/Service/ContentServiceFactory.swift b/FLINT/FLINT/Dependency/Factory/Service/ContentServiceFactory.swift new file mode 100644 index 00000000..150d256e --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/Service/ContentServiceFactory.swift @@ -0,0 +1,26 @@ +// +// ContentServiceFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.09. +// + +import Foundation + +import Moya + +import Data + +protocol ContentServiceFactory: ContentAPIProviderFactory { + func makeContentService() -> ContentService + func makeContentService(contentAPIProvider: MoyaProvider) -> ContentService +} + +extension ContentServiceFactory { + func makeContentService() -> ContentService { + return makeContentService(contentAPIProvider: makeContentAPIProvider()) + } + func makeContentService(contentAPIProvider: MoyaProvider) -> ContentService { + return DefaultContentService(contentAPIProvider: contentAPIProvider) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/Service/HomeServiceFactory.swift b/FLINT/FLINT/Dependency/Factory/Service/HomeServiceFactory.swift index 26afd2ac..c9208923 100644 --- a/FLINT/FLINT/Dependency/Factory/Service/HomeServiceFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Service/HomeServiceFactory.swift @@ -11,7 +11,7 @@ import Moya import Data -protocol HomeServiceFactory: HomeAPIFactory { +protocol HomeServiceFactory: HomeAPIProviderFactory { func makeHomeService() -> HomeService func makeHomeService(homeAPIProvider: MoyaProvider) -> HomeService } diff --git a/FLINT/FLINT/Dependency/Factory/Service/SearchServiceFactory.swift b/FLINT/FLINT/Dependency/Factory/Service/SearchServiceFactory.swift index c11adef7..6627ecec 100644 --- a/FLINT/FLINT/Dependency/Factory/Service/SearchServiceFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Service/SearchServiceFactory.swift @@ -11,7 +11,7 @@ import Moya import Data -protocol SearchServiceFactory: SearchAPIFactory { +protocol SearchServiceFactory: SearchAPIProviderFactory { func makeSearchService() -> SearchService func makeSearchService(searchAPIProvider: MoyaProvider) -> SearchService } diff --git a/FLINT/FLINT/Dependency/Factory/Service/UserServiceFactory.swift b/FLINT/FLINT/Dependency/Factory/Service/UserServiceFactory.swift index 88579ba1..b22147c4 100644 --- a/FLINT/FLINT/Dependency/Factory/Service/UserServiceFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Service/UserServiceFactory.swift @@ -1,5 +1,5 @@ // -// File.swift +// UserServiceFactory.swift // FLINT // // Created by 김호성 on 2026.01.22. @@ -11,7 +11,7 @@ import Moya import Data -protocol UserServiceFactory: UserAPIFactory { +protocol UserServiceFactory: UserAPIProviderFactory { func makeUserService() -> UserService func makeUserService(userAPIProvider: MoyaProvider) -> UserService } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchOTTPlatformsForContentUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchOTTPlatformsForContentUseCaseFactory.swift new file mode 100644 index 00000000..745b8bf4 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchOTTPlatformsForContentUseCaseFactory.swift @@ -0,0 +1,24 @@ +// +// FetchOTTPlatformsForContentUseCaseFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.09. +// + +import Foundation + +import Domain + +protocol FetchOTTPlatformsForContentUseCaseFactory: ContentRepositoryFactory { + func makeFetchOTTPlatformsForContentUseCase() -> FetchOTTPlatformsForContentUseCase + func makeFetchOTTPlatformsForContentUseCase(contentRepository: ContentRepository) -> FetchOTTPlatformsForContentUseCase +} + +extension FetchOTTPlatformsForContentUseCaseFactory { + func makeFetchOTTPlatformsForContentUseCase() -> FetchOTTPlatformsForContentUseCase { + return makeFetchOTTPlatformsForContentUseCase(contentRepository: makeContentRepository()) + } + func makeFetchOTTPlatformsForContentUseCase(contentRepository: ContentRepository) -> FetchOTTPlatformsForContentUseCase { + return DefaultFetchOTTPlatformsForContentUseCase(contentRepository: contentRepository) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchPopularContentsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchPopularContentsUseCaseFactory.swift new file mode 100644 index 00000000..8412702d --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchPopularContentsUseCaseFactory.swift @@ -0,0 +1,24 @@ +// +// FetchPopularContentsUseCaseFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.09. +// + +import Foundation + +import Domain + +protocol FetchPopularContentsUseCaseFactory: SearchRepositoryFactory { + func makeFetchPopularContentsUseCase() -> FetchPopularContentsUseCase + func makeFetchPopularContentsUseCase(searchRepository: SearchRepository) -> FetchPopularContentsUseCase +} + +extension FetchPopularContentsUseCaseFactory { + func makeFetchPopularContentsUseCase() -> FetchPopularContentsUseCase { + return makeFetchPopularContentsUseCase(searchRepository: makeSearchRepository()) + } + func makeFetchPopularContentsUseCase(searchRepository: SearchRepository) -> FetchPopularContentsUseCase { + return DefaultFetchPopularContentsUseCase(searchRepository: searchRepository) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/SearchContentsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Content/SearchContentsUseCaseFactory.swift similarity index 100% rename from FLINT/FLINT/Dependency/Factory/UseCase/SearchContentsUseCaseFactory.swift rename to FLINT/FLINT/Dependency/Factory/UseCase/Content/SearchContentsUseCaseFactory.swift diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Content/ToggleContentBookmarkUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Content/ToggleContentBookmarkUseCaseFactory.swift new file mode 100644 index 00000000..05eb05f4 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Content/ToggleContentBookmarkUseCaseFactory.swift @@ -0,0 +1,24 @@ +// +// ToggleContentBookmarkUseCaseFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.09. +// + +import Foundation + +import Domain + +protocol ToggleContentBookmarkUseCaseFactory: BookmarkRepositoryFactory { + func makeToggleContentBookmarkUseCase() -> ToggleContentBookmarkUseCase + func makeToggleContentBookmarkUseCase(bookmarkRepository: BookmarkRepository) -> ToggleContentBookmarkUseCase +} + +extension ToggleContentBookmarkUseCaseFactory { + func makeToggleContentBookmarkUseCase() -> ToggleContentBookmarkUseCase { + return makeToggleContentBookmarkUseCase(bookmarkRepository: makeBookmarkRepository()) + } + func makeToggleContentBookmarkUseCase(bookmarkRepository: BookmarkRepository) -> ToggleContentBookmarkUseCase { + return DefaultToggleCollectionBookmarkUseCase(bookmarkRepository: bookmarkRepository) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/HomeUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/HomeUseCaseFactory.swift deleted file mode 100644 index e2db3a5a..00000000 --- a/FLINT/FLINT/Dependency/Factory/UseCase/HomeUseCaseFactory.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// HomeUseCaseFactory.swift -// FLINT -// -// Created by 김호성 on 2026.02.02. -// - -import Foundation - -import Domain - -protocol HomeUseCaseFactory: HomeRepositoryFactory { - func makeHomeUseCase() -> HomeUseCase - func makeHomeUseCase(homeRepository: HomeRepository) -> HomeUseCase -} - -extension HomeUseCaseFactory { - func makeHomeUseCase() -> HomeUseCase { - return makeHomeUseCase(homeRepository: makeHomeRepository()) - } - func makeHomeUseCase(homeRepository: HomeRepository) -> HomeUseCase { - return DefaultHomeUseCase(homeRepository: homeRepository) - } -} From 2eaf4d95f0c33b352fc86bf620047a1b9f026a81 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Mon, 9 Feb 2026 17:01:42 +0900 Subject: [PATCH 34/45] =?UTF-8?q?[refactor]=20UseCase=20Factory=20?= =?UTF-8?q?=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Collection/ContentsUseCaseFactory.swift | 24 ------------------- ...hBookmarkedCollectionsUseCaseFactory.swift | 24 +++++++++++++++++++ ...ollectionBookmarkUsersUseCaseFactory.swift | 2 +- .../FetchCollectionsUseCaseFactory.swift | 24 ------------------- ...etchCreatedCollectionsUseCaseFactory.swift | 24 +++++++++++++++++++ ...etchExploreCollectionsUseCaseFactory.swift | 24 +++++++++++++++++++ ...etchBookmarkedContentsUseCaseFactory.swift | 24 +++++++++++++++++++ .../UseCase/NicknameUseCaseFactory.swift | 24 ------------------- .../Profile/CheckNicknameUseCaseFactory.swift | 24 +++++++++++++++++++ .../Profile/FetchKeywordsUseCaseFactory.swift | 24 +++++++++++++++++++ .../Profile/FetchProfileUseCaseFactory.swift | 24 +++++++++++++++++++ .../UseCase/UserProfileUseCaseFactory.swift | 24 ------------------- 12 files changed, 169 insertions(+), 97 deletions(-) delete mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/Collection/ContentsUseCaseFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchBookmarkedCollectionsUseCaseFactory.swift rename FLINT/FLINT/Dependency/Factory/UseCase/{ => Collection}/FetchCollectionBookmarkUsersUseCaseFactory.swift (94%) delete mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionsUseCaseFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCreatedCollectionsUseCaseFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchExploreCollectionsUseCaseFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchBookmarkedContentsUseCaseFactory.swift delete mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/NicknameUseCaseFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/Profile/CheckNicknameUseCaseFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/Profile/FetchKeywordsUseCaseFactory.swift create mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/Profile/FetchProfileUseCaseFactory.swift delete mode 100644 FLINT/FLINT/Dependency/Factory/UseCase/UserProfileUseCaseFactory.swift diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/ContentsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/ContentsUseCaseFactory.swift deleted file mode 100644 index 315451b5..00000000 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/ContentsUseCaseFactory.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// ContentsUseCase.swift -// FLINT -// -// Created by 김호성 on 2026.01.22. -// - -import Foundation - -import Domain - -protocol ContentsUseCaseFactory: SearchRepositoryFactory { - func makeContentsUseCase() -> ContentsUseCase - func makeContentsUseCase(searchRepository: SearchRepository) -> ContentsUseCase -} - -extension ContentsUseCaseFactory { - func makeContentsUseCase() -> ContentsUseCase { - return makeContentsUseCase(searchRepository: makeSearchRepository()) - } - func makeContentsUseCase(searchRepository: SearchRepository) -> ContentsUseCase { - return DefaultContentsUseCase(searchRepository: searchRepository) - } -} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchBookmarkedCollectionsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchBookmarkedCollectionsUseCaseFactory.swift new file mode 100644 index 00000000..06ce9ccd --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchBookmarkedCollectionsUseCaseFactory.swift @@ -0,0 +1,24 @@ +// +// FetchBookmarkedCollectionsUseCaseFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.09. +// + +import Foundation + +import Domain + +protocol FetchBookmarkedCollectionsUseCaseFactory: UserRepositoryFactory { + func makeFetchBookmarkedCollectionsUseCase() -> FetchBookmarkedCollectionsUseCase + func makeFetchBookmarkedCollectionsUseCase(userRepository: UserRepository) -> FetchBookmarkedCollectionsUseCase +} + +extension FetchBookmarkedCollectionsUseCaseFactory { + func makeFetchBookmarkedCollectionsUseCase() -> FetchBookmarkedCollectionsUseCase { + return makeFetchBookmarkedCollectionsUseCase(userRepository: makeUserRepository()) + } + func makeFetchBookmarkedCollectionsUseCase(userRepository: UserRepository) -> FetchBookmarkedCollectionsUseCase { + return DefaultFetchBookmarkedCollectionsUseCase(userRepository: userRepository) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/FetchCollectionBookmarkUsersUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionBookmarkUsersUseCaseFactory.swift similarity index 94% rename from FLINT/FLINT/Dependency/Factory/UseCase/FetchCollectionBookmarkUsersUseCaseFactory.swift rename to FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionBookmarkUsersUseCaseFactory.swift index d8eba708..9442a4f5 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/FetchCollectionBookmarkUsersUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionBookmarkUsersUseCaseFactory.swift @@ -1,5 +1,5 @@ // -// BookmarkFactory.swift +// FetchCollectionBookmarkUsersUseCaseFactory.swift // FLINT // // Created by 진소은 on 1/23/26. diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionsUseCaseFactory.swift deleted file mode 100644 index 7e6e938c..00000000 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionsUseCaseFactory.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// FetchCollectionsUseCaseFactory.swift -// FLINT -// -// Created by 김호성 on 2026.01.22. -// - -import Foundation - -import Domain - -protocol FetchCollectionsUseCaseFactory: CollectionRepositoryFactory { - func makeFetchCollectionsUseCase() -> FetchCollectionsUseCase - func makeFetchCollectionsUseCase(collectionRepository: CollectionRepository) -> FetchCollectionsUseCase -} - -extension FetchCollectionsUseCaseFactory { - func makeFetchCollectionsUseCase() -> FetchCollectionsUseCase { - return makeFetchCollectionsUseCase(collectionRepository: makeCollectionRepository()) - } - func makeFetchCollectionsUseCase(collectionRepository: CollectionRepository) -> FetchCollectionsUseCase { - return DefaultFetchCollectionsUseCase(collectionRepository: collectionRepository) - } -} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCreatedCollectionsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCreatedCollectionsUseCaseFactory.swift new file mode 100644 index 00000000..6ce01768 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCreatedCollectionsUseCaseFactory.swift @@ -0,0 +1,24 @@ +// +// FetchCreatedCollectionsUseCaseFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.09. +// + +import Foundation + +import Domain + +protocol FetchCreatedCollectionsUseCaseFactory: UserRepositoryFactory { + func makeFetchCreatedCollectionsUseCase() -> FetchCreatedCollectionsUseCase + func makeFetchCreatedCollectionsUseCase(userRepository: UserRepository) -> FetchCreatedCollectionsUseCase +} + +extension FetchKeywordsUseCaseFactory { + func makeFetchCreatedCollectionsUseCase() -> FetchCreatedCollectionsUseCase { + return makeFetchCreatedCollectionsUseCase(userRepository: makeUserRepository()) + } + func makeFetchCreatedCollectionsUseCase(userRepository: UserRepository) -> FetchCreatedCollectionsUseCase { + return DefaultFetchCreatedCollectionsUseCase(userRepository: userRepository) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchExploreCollectionsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchExploreCollectionsUseCaseFactory.swift new file mode 100644 index 00000000..d97a30fe --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchExploreCollectionsUseCaseFactory.swift @@ -0,0 +1,24 @@ +// +// FetchExploreCollectionsUseCaseFactory.swift +// FLINT +// +// Created by 김호성 on 2026.01.22. +// + +import Foundation + +import Domain + +protocol FetchExploreCollectionsUseCaseFactory: CollectionRepositoryFactory { + func makeFetchCollectionsUseCase() -> FetchExploreCollectionsUseCase + func makeFetchCollectionsUseCase(collectionRepository: CollectionRepository) -> FetchExploreCollectionsUseCase +} + +extension FetchExploreCollectionsUseCaseFactory { + func makeFetchCollectionsUseCase() -> FetchExploreCollectionsUseCase { + return makeFetchCollectionsUseCase(collectionRepository: makeCollectionRepository()) + } + func makeFetchCollectionsUseCase(collectionRepository: CollectionRepository) -> FetchExploreCollectionsUseCase { + return DefaultFetchExploreCollectionsUseCase(collectionRepository: collectionRepository) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchBookmarkedContentsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchBookmarkedContentsUseCaseFactory.swift new file mode 100644 index 00000000..471808bd --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchBookmarkedContentsUseCaseFactory.swift @@ -0,0 +1,24 @@ +// +// FetchBookmarkedContentsUseCaseFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.09. +// + +import Foundation + +import Domain + +protocol FetchBookmarkedContentsUseCaseFactory: ContentRepositoryFactory, UserRepositoryFactory { + func makeFetchBookmarkedContentsUseCase() -> FetchBookmarkedContentsUseCase + func makeFetchBookmarkedContentsUseCase(contentRepository: ContentRepository, userRepository: UserRepository) -> FetchBookmarkedContentsUseCase +} + +extension FetchBookmarkedContentsUseCaseFactory { + func makeFetchBookmarkedContentsUseCase() -> FetchBookmarkedContentsUseCase { + return makeFetchBookmarkedContentsUseCase(contentRepository: makeContentRepository(), userRepository: makeUserRepository()) + } + func makeFetchBookmarkedContentsUseCase(contentRepository: ContentRepository, userRepository: UserRepository) -> FetchBookmarkedContentsUseCase { + return DefaultFetchBookmarkedContentsUseCase(contentRepository: contentRepository, userRepository: userRepository) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/NicknameUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/NicknameUseCaseFactory.swift deleted file mode 100644 index c3123495..00000000 --- a/FLINT/FLINT/Dependency/Factory/UseCase/NicknameUseCaseFactory.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// File.swift -// FLINT -// -// Created by 김호성 on 2026.01.22. -// - -import Foundation - -import Domain - -protocol NicknameUseCaseFactory: UserRepositoryFactory { - func makeNicknameUseCase() -> NicknameUseCase - func makeNicknameUseCase(userRepository: UserRepository) -> NicknameUseCase -} - -extension NicknameUseCaseFactory { - func makeNicknameUseCase() -> NicknameUseCase { - return makeNicknameUseCase(userRepository: makeUserRepository()) - } - func makeNicknameUseCase(userRepository: UserRepository) -> NicknameUseCase { - return DefaultNicknameUseCase(userRepository: userRepository) - } -} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Profile/CheckNicknameUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Profile/CheckNicknameUseCaseFactory.swift new file mode 100644 index 00000000..16e0b2c4 --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Profile/CheckNicknameUseCaseFactory.swift @@ -0,0 +1,24 @@ +// +// CheckNicknameUseCaseFactory.swift +// FLINT +// +// Created by 김호성 on 2026.01.22. +// + +import Foundation + +import Domain + +protocol CheckNicknameUseCaseFactory: UserRepositoryFactory { + func makeCheckNicknameUseCase() -> CheckNicknameUseCase + func makeCheckNicknameUseCase(userRepository: UserRepository) -> CheckNicknameUseCase +} + +extension CheckNicknameUseCaseFactory { + func makeCheckNicknameUseCase() -> CheckNicknameUseCase { + return makeCheckNicknameUseCase(userRepository: makeUserRepository()) + } + func makeCheckNicknameUseCase(userRepository: UserRepository) -> CheckNicknameUseCase { + return DefaultCheckNicknameUseCase(userRepository: userRepository) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Profile/FetchKeywordsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Profile/FetchKeywordsUseCaseFactory.swift new file mode 100644 index 00000000..7a1a728a --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Profile/FetchKeywordsUseCaseFactory.swift @@ -0,0 +1,24 @@ +// +// FetchKeywordsUseCaseFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.09. +// + +import Foundation + +import Domain + +protocol FetchKeywordsUseCaseFactory: UserRepositoryFactory { + func makeFetchKeywordsUseCase() -> FetchKeywordsUseCase + func makeFetchKeywordsUseCase(userRepository: UserRepository) -> FetchKeywordsUseCase +} + +extension FetchKeywordsUseCaseFactory { + func makeFetchKeywordsUseCase() -> FetchKeywordsUseCase { + return makeFetchKeywordsUseCase(userRepository: makeUserRepository()) + } + func makeFetchKeywordsUseCase(userRepository: UserRepository) -> FetchKeywordsUseCase { + return DefaultFetchKeywordsUseCase(userRepository: userRepository) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Profile/FetchProfileUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Profile/FetchProfileUseCaseFactory.swift new file mode 100644 index 00000000..3814798a --- /dev/null +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Profile/FetchProfileUseCaseFactory.swift @@ -0,0 +1,24 @@ +// +// FetchProfileUseCaseFactory.swift +// FLINT +// +// Created by 김호성 on 2026.02.09. +// + +import Foundation + +import Domain + +protocol FetchProfileUseCaseFactory: UserRepositoryFactory { + func makeFetchProfileUseCase() -> FetchProfileUseCase + func makeFetchProfileUseCase(userRepository: UserRepository) -> FetchProfileUseCase +} + +extension FetchProfileUseCaseFactory { + func makeFetchProfileUseCase() -> FetchProfileUseCase { + return makeFetchKeywordsUseCase(userRepository: makeUserRepository()) + } + func makeFetchProfileUseCase(userRepository: UserRepository) -> FetchProfileUseCase { + return DefaultFetchProfileUseCase(userRepository: userRepository) + } +} diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/UserProfileUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/UserProfileUseCaseFactory.swift deleted file mode 100644 index f0f08ed6..00000000 --- a/FLINT/FLINT/Dependency/Factory/UseCase/UserProfileUseCaseFactory.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// UserProfileUseCaseFactory.swift -// FLINT -// -// Created by 김호성 on 2026.01.31. -// - -import Foundation - -import Domain - -protocol UserProfileUseCaseFactory: UserRepositoryFactory { - func makeUserProfileUseCase() -> UserProfileUseCase - func makeUserProfileUseCase(userRepository: UserRepository) -> UserProfileUseCase -} - -extension UserProfileUseCaseFactory { - func makeUserProfileUseCase() -> UserProfileUseCase { - return makeUserProfileUseCase(userRepository: makeUserRepository()) - } - func makeUserProfileUseCase(userRepository: UserRepository) -> UserProfileUseCase { - return DefaultUserProfileUseCase(userRepository: userRepository) - } -} From e2f569cabad15348ab884645e380623221642981 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Mon, 9 Feb 2026 18:36:23 +0900 Subject: [PATCH 35/45] =?UTF-8?q?[refactor]=20=EB=B9=8C=EB=93=9C=20?= =?UTF-8?q?=EC=84=B1=EA=B3=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DTO/Collection/CollectionDetailDTO.swift | 2 +- .../Sources/DTO/Content/OTTPlatformsDTO.swift | 4 +- .../DTO/User/CollectionBookmarkUsersDTO.swift | 8 +- FLINT/Data/Sources/DTO/User/KeywordDTO.swift | 4 +- .../Sources/DTO/User/UserProfileDTO.swift | 4 +- .../Service/CollectionService.swift | 2 +- .../CollectionBookmarkUsersEntity.swift | 2 +- .../Collection/CollectionDetailEntity.swift | 2 +- .../Entity/Collection/ExploreInfoEntity.swift | 2 +- .../Sources/Entity/User/KeywordColor.swift | 16 ++ .../Sources/Entity/User/KeywordEntity.swift | 4 +- .../Entity/User/UserProfileEntity.swift | 2 +- .../Domain/Sources/Entity/User/UserRole.swift | 4 +- .../FetchBookmarkedCollectionsUseCase.swift | 0 .../FetchCreatedCollectionsUseCase.swift | 0 ...t => FetchExploreCollectionsUseCase.swift} | 10 +- .../FetchBookmarkedContentsUseCase.swift | 0 FLINT/FLINT/Dependency/DIContainer.swift | 6 + .../Service/BookmarkServiceFactory.swift | 8 +- .../Service/CollectionServiceFactory.swift | 8 +- .../Factory/Service/HomeServiceFactory.swift | 2 +- .../Service/SearchServiceFactory.swift | 2 +- ...etchExploreCollectionsUseCaseFactory.swift | 10 +- .../ToggleContentBookmarkUseCaseFactory.swift | 2 +- .../Profile/FetchProfileUseCaseFactory.swift | 2 +- .../ProfileViewControllerFactory+.swift | 3 +- .../AddContentSelectViewModelFactory.swift | 10 +- .../CollectionDetailViewModelFactory.swift | 15 +- ...CollectionFolderListViewModelFactory.swift | 10 +- .../ViewModel/ExploreViewModelFactory.swift | 12 +- .../ViewModel/HomeViewModelFactory.swift | 33 ++- .../OnboardingViewModelFactory.swift | 12 +- .../ViewModel/ProfileViewModelFactory.swift | 38 ++- .../MoreNoMoreCollectionItemCell.swift | 8 +- .../MoreNoMoreCollectionTableViewCell.swift | 6 +- .../PreferenceKeyword/KeywordColor+.swift | 22 ++ .../PreferenceKeyword/KeywordColor.swift | 45 --- .../PreferenceKeyword/PreferenceChip.swift | 26 +- .../PreferenceChipStyle.swift | 2 + .../PreferenceExampleView.swift | 16 +- .../PreferenceRankedChipView.swift | 6 +- .../PreferenceRankedChipTableViewCell.swift | 11 +- .../Profile/ProfileHeaderTableViewCell.swift | 4 +- .../CollectionDetailViewController.swift | 10 +- .../Scene/Explore/ExploreViewController.swift | 61 ++++- .../CollectionFolderListViewController.swift | 4 +- .../Scene/Home/HomeViewController.swift | 5 +- .../Scene/Login/LoginViewController.swift | 1 - .../FilmSelect/FilmSelectViewController.swift | 4 +- .../Scene/Profile/ProfileViewController.swift | 14 +- .../Scene/Splash/SplashViewController.swift | 3 +- .../CollectionDetailViewModel.swift | 17 +- .../AddContentSelectViewModel.swift | 10 +- .../CreateCollectionViewModel.swift | 4 +- .../Scene/Explore/ExploreViewModel.swift | 14 +- .../Home/CollectionFolderListViewModel.swift | 8 +- .../ViewModel/Scene/Home/HomeViewModel.swift | 74 ++--- .../Scene/Login/LoginViewModel.swift | 4 +- .../Onboarding/OnboardingViewModel.swift | 2 +- .../Scene/Profile/ProfileViewModel.swift | 258 +++++++----------- .../Scene/Splash/SplashViewModel.swift | 50 ---- 61 files changed, 438 insertions(+), 490 deletions(-) create mode 100644 FLINT/Domain/Sources/Entity/User/KeywordColor.swift rename FLINT/Domain/Sources/UseCase/{Profile => Collection}/FetchBookmarkedCollectionsUseCase.swift (100%) rename FLINT/Domain/Sources/UseCase/{Profile => Collection}/FetchCreatedCollectionsUseCase.swift (100%) rename FLINT/Domain/Sources/UseCase/Collection/{FetchCollectionsUseCase.swift => FetchExploreCollectionsUseCase.swift} (51%) rename FLINT/Domain/Sources/UseCase/{Profile => Content}/FetchBookmarkedContentsUseCase.swift (100%) create mode 100644 FLINT/Presentation/Sources/View/Component/PreferenceKeyword/KeywordColor+.swift delete mode 100644 FLINT/Presentation/Sources/View/Component/PreferenceKeyword/KeywordColor.swift delete mode 100644 FLINT/Presentation/Sources/ViewModel/Scene/Splash/SplashViewModel.swift diff --git a/FLINT/Data/Sources/DTO/Collection/CollectionDetailDTO.swift b/FLINT/Data/Sources/DTO/Collection/CollectionDetailDTO.swift index ae2d9515..818a477d 100644 --- a/FLINT/Data/Sources/DTO/Collection/CollectionDetailDTO.swift +++ b/FLINT/Data/Sources/DTO/Collection/CollectionDetailDTO.swift @@ -65,7 +65,7 @@ extension CollectionDetailDTO.AuthorDTO { id: unwrap(id), nickname: nickname ?? "", profileImageUrl: URL(string: profileImageUrl ?? ""), - role: unwrap(UserRole(rawValue: userRole ?? "")) + role: UserRole(rawValue: userRole ?? "") ?? .unknown ) } } diff --git a/FLINT/Data/Sources/DTO/Content/OTTPlatformsDTO.swift b/FLINT/Data/Sources/DTO/Content/OTTPlatformsDTO.swift index 69786aa9..a05d983d 100644 --- a/FLINT/Data/Sources/DTO/Content/OTTPlatformsDTO.swift +++ b/FLINT/Data/Sources/DTO/Content/OTTPlatformsDTO.swift @@ -36,8 +36,8 @@ extension OTTPlatformsDTO.OTTPlatformDTO { return try OTTPlatformEntity( ottId: unwrap(ottId), name: name ?? "", - logoUrl: logoUrl ?? "", - contentUrl: contentUrl ?? "" + logoUrl: URL(string: logoUrl ?? ""), + contentUrl: URL(string: contentUrl ?? "") ) } } diff --git a/FLINT/Data/Sources/DTO/User/CollectionBookmarkUsersDTO.swift b/FLINT/Data/Sources/DTO/User/CollectionBookmarkUsersDTO.swift index 4fb7b368..e4011207 100644 --- a/FLINT/Data/Sources/DTO/User/CollectionBookmarkUsersDTO.swift +++ b/FLINT/Data/Sources/DTO/User/CollectionBookmarkUsersDTO.swift @@ -35,13 +35,13 @@ extension CollectionBookmarkUsersDTO { } extension CollectionBookmarkUsersDTO.UserDTO { - public var entity: CollectionBookmarkUserEntity { + public var entity: UserProfileEntity { get throws { - return try CollectionBookmarkUserEntity( - userId: unwrap(userId), + return try UserProfileEntity( + id: unwrap(userId), nickname: nickName ?? "", profileImageUrl: URL(string: profileImageUrl ?? ""), - userRole: userRole ?? "" + role: UserRole(rawValue: userRole ?? "") ?? .unknown ) } } diff --git a/FLINT/Data/Sources/DTO/User/KeywordDTO.swift b/FLINT/Data/Sources/DTO/User/KeywordDTO.swift index c2a5d9cb..129798b0 100644 --- a/FLINT/Data/Sources/DTO/User/KeywordDTO.swift +++ b/FLINT/Data/Sources/DTO/User/KeywordDTO.swift @@ -35,11 +35,11 @@ extension KeywordsDTO.KeywordDTO { public var entity: KeywordEntity { get throws { return try KeywordEntity( - color: color ?? "", + color: unwrap(KeywordColor(rawValue: color ?? "")), rank: unwrap(rank), name: name ?? "", percentage: percentage ?? 0, - imageUrl: imageUrl ?? "" + imageUrl: URL(string: imageUrl ?? "") ) } } diff --git a/FLINT/Data/Sources/DTO/User/UserProfileDTO.swift b/FLINT/Data/Sources/DTO/User/UserProfileDTO.swift index 61c0f2df..7ab6b046 100644 --- a/FLINT/Data/Sources/DTO/User/UserProfileDTO.swift +++ b/FLINT/Data/Sources/DTO/User/UserProfileDTO.swift @@ -22,8 +22,8 @@ extension UserProfileDTO { return try UserProfileEntity( id: unwrap(id), nickname: nickname ?? "", - profileImageUrl: profileImageUrl ?? "", - isFliner: isFliner ?? false + profileImageUrl: URL(string: profileImageUrl ?? ""), + role: (isFliner ?? false) ? .fliner : .unknown ) } } diff --git a/FLINT/Data/Sources/Networking/Service/CollectionService.swift b/FLINT/Data/Sources/Networking/Service/CollectionService.swift index 8093d927..2fddf0a6 100644 --- a/FLINT/Data/Sources/Networking/Service/CollectionService.swift +++ b/FLINT/Data/Sources/Networking/Service/CollectionService.swift @@ -36,7 +36,7 @@ public final class DefaultCollectionService: CollectionService { public func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher { return collectionAPIProvider.requestPublisher(.createCollection(collectionInfo: collectionInfo)) - .mapBaseResponseData(CreateCollectionResponseDTO.self) + .mapBaseResponseData(CreateCollectionDTO.self) .eraseToAnyPublisher() } diff --git a/FLINT/Domain/Sources/Entity/Bookmark/CollectionBookmarkUsersEntity.swift b/FLINT/Domain/Sources/Entity/Bookmark/CollectionBookmarkUsersEntity.swift index 0f8791be..1ceb7366 100644 --- a/FLINT/Domain/Sources/Entity/Bookmark/CollectionBookmarkUsersEntity.swift +++ b/FLINT/Domain/Sources/Entity/Bookmark/CollectionBookmarkUsersEntity.swift @@ -7,7 +7,7 @@ import Foundation -public struct CollectionBookmarkUsersEntity { +public struct CollectionBookmarkUsersEntity: Equatable { public let bookmarkCount: Int public let users: [UserProfileEntity] diff --git a/FLINT/Domain/Sources/Entity/Collection/CollectionDetailEntity.swift b/FLINT/Domain/Sources/Entity/Collection/CollectionDetailEntity.swift index e61fe7e4..563b3856 100644 --- a/FLINT/Domain/Sources/Entity/Collection/CollectionDetailEntity.swift +++ b/FLINT/Domain/Sources/Entity/Collection/CollectionDetailEntity.swift @@ -7,7 +7,7 @@ import Foundation -public struct CollectionDetailEntity { +public struct CollectionDetailEntity: Equatable { public let id: String public let title: String public let description: String diff --git a/FLINT/Domain/Sources/Entity/Collection/ExploreInfoEntity.swift b/FLINT/Domain/Sources/Entity/Collection/ExploreInfoEntity.swift index 34b251be..9bde9209 100644 --- a/FLINT/Domain/Sources/Entity/Collection/ExploreInfoEntity.swift +++ b/FLINT/Domain/Sources/Entity/Collection/ExploreInfoEntity.swift @@ -7,7 +7,7 @@ import Foundation -public struct ExploreInfoEntity { +public struct ExploreInfoEntity: Equatable, Hashable, Sendable { public let id: String public let imageUrl: URL? public let title: String diff --git a/FLINT/Domain/Sources/Entity/User/KeywordColor.swift b/FLINT/Domain/Sources/Entity/User/KeywordColor.swift new file mode 100644 index 00000000..3007625e --- /dev/null +++ b/FLINT/Domain/Sources/Entity/User/KeywordColor.swift @@ -0,0 +1,16 @@ +// +// KeywordColor.swift +// Domain +// +// Created by 김호성 on 2026.02.09. +// + +import Foundation + +public enum KeywordColor: String, Decodable { + case pink = "PINK" + case green = "GREEN" + case orange = "ORANGE" + case yellow = "YELLOW" + case blue = "BLUE" +} diff --git a/FLINT/Domain/Sources/Entity/User/KeywordEntity.swift b/FLINT/Domain/Sources/Entity/User/KeywordEntity.swift index ef407871..adf636de 100644 --- a/FLINT/Domain/Sources/Entity/User/KeywordEntity.swift +++ b/FLINT/Domain/Sources/Entity/User/KeywordEntity.swift @@ -8,13 +8,13 @@ import Foundation public struct KeywordEntity { - public let color: String + public let color: KeywordColor public let rank: Int public let name: String public let percentage: Int public let imageUrl: URL? - public init(color: String, rank: Int, name: String, percentage: Int, imageUrl: URL?) { + public init(color: KeywordColor, rank: Int, name: String, percentage: Int, imageUrl: URL?) { self.color = color self.rank = rank self.name = name diff --git a/FLINT/Domain/Sources/Entity/User/UserProfileEntity.swift b/FLINT/Domain/Sources/Entity/User/UserProfileEntity.swift index 402815d6..2a9c838c 100644 --- a/FLINT/Domain/Sources/Entity/User/UserProfileEntity.swift +++ b/FLINT/Domain/Sources/Entity/User/UserProfileEntity.swift @@ -7,7 +7,7 @@ import Foundation -public struct UserProfileEntity { +public struct UserProfileEntity: Equatable { public let id: String public let nickname: String public let profileImageUrl: URL? diff --git a/FLINT/Domain/Sources/Entity/User/UserRole.swift b/FLINT/Domain/Sources/Entity/User/UserRole.swift index d427766f..9e5081ad 100644 --- a/FLINT/Domain/Sources/Entity/User/UserRole.swift +++ b/FLINT/Domain/Sources/Entity/User/UserRole.swift @@ -7,7 +7,7 @@ import Foundation -public enum UserRole: String { +public enum UserRole: String, Equatable { /// 관리자 - 시스템 전체 관리 권한 case admin = "ADMIN" @@ -16,4 +16,6 @@ public enum UserRole: String { /// 게스트 사용자 - 조회만 가능 case fling = "FLING" + + case unknown } diff --git a/FLINT/Domain/Sources/UseCase/Profile/FetchBookmarkedCollectionsUseCase.swift b/FLINT/Domain/Sources/UseCase/Collection/FetchBookmarkedCollectionsUseCase.swift similarity index 100% rename from FLINT/Domain/Sources/UseCase/Profile/FetchBookmarkedCollectionsUseCase.swift rename to FLINT/Domain/Sources/UseCase/Collection/FetchBookmarkedCollectionsUseCase.swift diff --git a/FLINT/Domain/Sources/UseCase/Profile/FetchCreatedCollectionsUseCase.swift b/FLINT/Domain/Sources/UseCase/Collection/FetchCreatedCollectionsUseCase.swift similarity index 100% rename from FLINT/Domain/Sources/UseCase/Profile/FetchCreatedCollectionsUseCase.swift rename to FLINT/Domain/Sources/UseCase/Collection/FetchCreatedCollectionsUseCase.swift diff --git a/FLINT/Domain/Sources/UseCase/Collection/FetchCollectionsUseCase.swift b/FLINT/Domain/Sources/UseCase/Collection/FetchExploreCollectionsUseCase.swift similarity index 51% rename from FLINT/Domain/Sources/UseCase/Collection/FetchCollectionsUseCase.swift rename to FLINT/Domain/Sources/UseCase/Collection/FetchExploreCollectionsUseCase.swift index 48f0efe6..f6b76178 100644 --- a/FLINT/Domain/Sources/UseCase/Collection/FetchCollectionsUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Collection/FetchExploreCollectionsUseCase.swift @@ -1,5 +1,5 @@ // -// FetchCollectionsUseCase.swift +// FetchExploreCollectionsUseCase.swift // Domain // // Created by 김호성 on 2026.01.22. @@ -11,11 +11,11 @@ import Foundation import Entity import Repository -public protocol FetchCollectionsUseCase { - func fetchExplore(cursor: Int64?) -> AnyPublisher +public protocol FetchExploreCollectionsUseCase { + func fetchExploreCollections(cursor: Int64?) -> AnyPublisher } -public final class DefaultFetchCollectionsUseCase: FetchCollectionsUseCase { +public final class DefaultFetchExploreCollectionsUseCase: FetchExploreCollectionsUseCase { private let collectionRepository: CollectionRepository @@ -23,7 +23,7 @@ public final class DefaultFetchCollectionsUseCase: FetchCollectionsUseCase { self.collectionRepository = collectionRepository } - public func fetchExplore(cursor: Int64?) -> AnyPublisher { + public func fetchExploreCollections(cursor: Int64?) -> AnyPublisher { collectionRepository.fetchCollections(cursor: cursor, size: 3) } } diff --git a/FLINT/Domain/Sources/UseCase/Profile/FetchBookmarkedContentsUseCase.swift b/FLINT/Domain/Sources/UseCase/Content/FetchBookmarkedContentsUseCase.swift similarity index 100% rename from FLINT/Domain/Sources/UseCase/Profile/FetchBookmarkedContentsUseCase.swift rename to FLINT/Domain/Sources/UseCase/Content/FetchBookmarkedContentsUseCase.swift diff --git a/FLINT/FLINT/Dependency/DIContainer.swift b/FLINT/FLINT/Dependency/DIContainer.swift index b47cf314..bdc057c9 100644 --- a/FLINT/FLINT/Dependency/DIContainer.swift +++ b/FLINT/FLINT/Dependency/DIContainer.swift @@ -39,6 +39,12 @@ final class DIContainer: DependencyFactory { private lazy var authInterceptor: AuthInterceptor = AuthInterceptor(tokenStorage: tokenStorage) private lazy var networkLoggerPlugin: NetworkLoggerPlugin = NetworkLoggerPlugin() + lazy var contentAPIProvider = MoyaProvider( + session: Session(interceptor: authInterceptor), + plugins: [ + networkLoggerPlugin + ] + ) lazy var userAPIProvider = MoyaProvider( session: Session(interceptor: authInterceptor), plugins: [ diff --git a/FLINT/FLINT/Dependency/Factory/Service/BookmarkServiceFactory.swift b/FLINT/FLINT/Dependency/Factory/Service/BookmarkServiceFactory.swift index 307559dd..0b724d86 100644 --- a/FLINT/FLINT/Dependency/Factory/Service/BookmarkServiceFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Service/BookmarkServiceFactory.swift @@ -13,14 +13,14 @@ import Data protocol BookmarkServiceFactory: BookmarkAPIProviderFactory { func makeBookmarkService() -> BookmarkService - func makeBookmarkService(provider: MoyaProvider) -> BookmarkService + func makeBookmarkService(bookmarkAPIProvider: MoyaProvider) -> BookmarkService } extension BookmarkServiceFactory { func makeBookmarkService() -> BookmarkService { - return makeBookmarkService(provider: makeBookmarkAPIProvider()) + return makeBookmarkService(bookmarkAPIProvider: makeBookmarkAPIProvider()) } - func makeBookmarkService(provider: MoyaProvider) -> BookmarkService { - return DefaultBookmarkService(provider: provider) + func makeBookmarkService(bookmarkAPIProvider: MoyaProvider) -> BookmarkService { + return DefaultBookmarkService(bookmarkAPIProvider: bookmarkAPIProvider) } } diff --git a/FLINT/FLINT/Dependency/Factory/Service/CollectionServiceFactory.swift b/FLINT/FLINT/Dependency/Factory/Service/CollectionServiceFactory.swift index 81deb479..b231ed7b 100644 --- a/FLINT/FLINT/Dependency/Factory/Service/CollectionServiceFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Service/CollectionServiceFactory.swift @@ -13,14 +13,14 @@ import Data protocol CollectionServiceFactory: CollectionAPIProviderFactory { func makeCollectionService() -> CollectionService - func makeCollectionService(exploreAPIProvider: MoyaProvider) -> CollectionService + func makeCollectionService(collectionAPIProvider: MoyaProvider) -> CollectionService } extension CollectionServiceFactory { func makeCollectionService() -> CollectionService { - return makeCollectionService(exploreAPIProvider: makeCollectionAPIProvider()) + return makeCollectionService(collectionAPIProvider: makeCollectionAPIProvider()) } - func makeCollectionService(exploreAPIProvider: MoyaProvider) -> CollectionService { - return DefaultCollectionService(provider: exploreAPIProvider) + func makeCollectionService(collectionAPIProvider: MoyaProvider) -> CollectionService { + return DefaultCollectionService(collectionAPIProvider: collectionAPIProvider) } } diff --git a/FLINT/FLINT/Dependency/Factory/Service/HomeServiceFactory.swift b/FLINT/FLINT/Dependency/Factory/Service/HomeServiceFactory.swift index c9208923..76801699 100644 --- a/FLINT/FLINT/Dependency/Factory/Service/HomeServiceFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Service/HomeServiceFactory.swift @@ -21,6 +21,6 @@ extension HomeServiceFactory { return makeHomeService(homeAPIProvider: makeHomeAPIProvider()) } func makeHomeService(homeAPIProvider: MoyaProvider) -> HomeService { - return DefaultHomeService(provider: homeAPIProvider) + return DefaultHomeService(homeAPIProvider: homeAPIProvider) } } diff --git a/FLINT/FLINT/Dependency/Factory/Service/SearchServiceFactory.swift b/FLINT/FLINT/Dependency/Factory/Service/SearchServiceFactory.swift index 6627ecec..897c7e28 100644 --- a/FLINT/FLINT/Dependency/Factory/Service/SearchServiceFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Service/SearchServiceFactory.swift @@ -21,6 +21,6 @@ extension SearchServiceFactory { return makeSearchService(searchAPIProvider: makeSearchAPIProvider()) } func makeSearchService(searchAPIProvider: MoyaProvider) -> SearchService { - return DefaultSearchService(provider: searchAPIProvider) + return DefaultSearchService(searchAPIProvider: searchAPIProvider) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchExploreCollectionsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchExploreCollectionsUseCaseFactory.swift index d97a30fe..c886186e 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchExploreCollectionsUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchExploreCollectionsUseCaseFactory.swift @@ -10,15 +10,15 @@ import Foundation import Domain protocol FetchExploreCollectionsUseCaseFactory: CollectionRepositoryFactory { - func makeFetchCollectionsUseCase() -> FetchExploreCollectionsUseCase - func makeFetchCollectionsUseCase(collectionRepository: CollectionRepository) -> FetchExploreCollectionsUseCase + func makeFetchExploreCollectionsUseCase() -> FetchExploreCollectionsUseCase + func makeFetchExploreCollectionsUseCase(collectionRepository: CollectionRepository) -> FetchExploreCollectionsUseCase } extension FetchExploreCollectionsUseCaseFactory { - func makeFetchCollectionsUseCase() -> FetchExploreCollectionsUseCase { - return makeFetchCollectionsUseCase(collectionRepository: makeCollectionRepository()) + func makeFetchExploreCollectionsUseCase() -> FetchExploreCollectionsUseCase { + return makeFetchExploreCollectionsUseCase(collectionRepository: makeCollectionRepository()) } - func makeFetchCollectionsUseCase(collectionRepository: CollectionRepository) -> FetchExploreCollectionsUseCase { + func makeFetchExploreCollectionsUseCase(collectionRepository: CollectionRepository) -> FetchExploreCollectionsUseCase { return DefaultFetchExploreCollectionsUseCase(collectionRepository: collectionRepository) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Content/ToggleContentBookmarkUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Content/ToggleContentBookmarkUseCaseFactory.swift index 05eb05f4..5526e86b 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Content/ToggleContentBookmarkUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Content/ToggleContentBookmarkUseCaseFactory.swift @@ -19,6 +19,6 @@ extension ToggleContentBookmarkUseCaseFactory { return makeToggleContentBookmarkUseCase(bookmarkRepository: makeBookmarkRepository()) } func makeToggleContentBookmarkUseCase(bookmarkRepository: BookmarkRepository) -> ToggleContentBookmarkUseCase { - return DefaultToggleCollectionBookmarkUseCase(bookmarkRepository: bookmarkRepository) + return DefaultToggleContentBookmarkUseCase(bookmarkRepository: bookmarkRepository) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Profile/FetchProfileUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Profile/FetchProfileUseCaseFactory.swift index 3814798a..f5065b44 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Profile/FetchProfileUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Profile/FetchProfileUseCaseFactory.swift @@ -16,7 +16,7 @@ protocol FetchProfileUseCaseFactory: UserRepositoryFactory { extension FetchProfileUseCaseFactory { func makeFetchProfileUseCase() -> FetchProfileUseCase { - return makeFetchKeywordsUseCase(userRepository: makeUserRepository()) + return makeFetchProfileUseCase(userRepository: makeUserRepository()) } func makeFetchProfileUseCase(userRepository: UserRepository) -> FetchProfileUseCase { return DefaultFetchProfileUseCase(userRepository: userRepository) diff --git a/FLINT/FLINT/Dependency/Factory/ViewController/ProfileViewControllerFactory+.swift b/FLINT/FLINT/Dependency/Factory/ViewController/ProfileViewControllerFactory+.swift index b6d6bdab..9b04e531 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewController/ProfileViewControllerFactory+.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewController/ProfileViewControllerFactory+.swift @@ -7,6 +7,7 @@ import Foundation +import Domain import Presentation extension ProfileViewControllerFactory where Self: ProfileViewModelFactory & ViewControllerFactory { @@ -15,7 +16,7 @@ extension ProfileViewControllerFactory where Self: ProfileViewModelFactory & Vie } func makeProfileViewController( - target: ProfileViewModel.Target = .me + target: UserTarget = .me ) -> ProfileViewController { return ProfileViewController( profileViewModel: makeProfileViewModel(target: target), diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/AddContentSelectViewModelFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/AddContentSelectViewModelFactory.swift index e5db071b..f36f9610 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewModel/AddContentSelectViewModelFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/AddContentSelectViewModelFactory.swift @@ -10,10 +10,10 @@ import Foundation import Domain import Presentation -protocol AddContentSelectViewModelFactory: SearchContentsUseCaseFactory, ContentsUseCaseFactory { +protocol AddContentSelectViewModelFactory: SearchContentsUseCaseFactory, FetchPopularContentsUseCaseFactory { func makeAddContentSelectViewModel() -> AddContentSelectViewModel func makeAddContentSelectViewModel( - contentsUseCase: ContentsUseCase, + fetchPopularContentsUseCase: FetchPopularContentsUseCase, searchContentsUseCase: SearchContentsUseCase ) -> AddContentSelectViewModel } @@ -22,17 +22,17 @@ extension AddContentSelectViewModelFactory { func makeAddContentSelectViewModel() -> AddContentSelectViewModel { return makeAddContentSelectViewModel( - contentsUseCase: makeContentsUseCase(), + fetchPopularContentsUseCase: makeFetchPopularContentsUseCase(), searchContentsUseCase: makeSearchContentsUseCase() ) } func makeAddContentSelectViewModel( - contentsUseCase: ContentsUseCase, + fetchPopularContentsUseCase: FetchPopularContentsUseCase, searchContentsUseCase: SearchContentsUseCase ) -> AddContentSelectViewModel { return DefaultAddContentSelectViewModel( - contentsUseCase: contentsUseCase, + fetchPopularContentsUseCase: fetchPopularContentsUseCase, searchContentsUseCase: searchContentsUseCase ) } diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionDetailViewModelFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionDetailViewModelFactory.swift index 9f8e18d6..51beb499 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionDetailViewModelFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionDetailViewModelFactory.swift @@ -10,11 +10,12 @@ import Foundation import Domain import Presentation -protocol CollectionDetailViewModelFactory: CollectionDetailUseCaseFactory, FetchBookmarkedUserUseCaseFactory { +protocol CollectionDetailViewModelFactory: FetchCollectionDetailUseCaseFactory, FetchCollectionBookmarkUsersUseCaseFactory { func makeCollectionDetailViewModel(collectionId: Int64) -> CollectionDetailViewModel func makeCollectionDetailViewModel( collectionId: Int64, - collectionDetailUseCase: CollectionDetailUseCase + fetchCollectionDetailUseCase: FetchCollectionDetailUseCase, + fetchCollectionBookmarkUsersUseCase: FetchCollectionBookmarkUsersUseCase ) -> CollectionDetailViewModel } @@ -22,17 +23,19 @@ extension CollectionDetailViewModelFactory { func makeCollectionDetailViewModel(collectionId: Int64) -> CollectionDetailViewModel { return makeCollectionDetailViewModel( collectionId: collectionId, - collectionDetailUseCase: makeCollectionDetailUseCase() + fetchCollectionDetailUseCase: makeFetchCollectionDetailUseCase(), + fetchCollectionBookmarkUsersUseCase: makeFetchCollectionBookmarkUsersUseCase() ) } func makeCollectionDetailViewModel( collectionId: Int64, - collectionDetailUseCase: CollectionDetailUseCase + fetchCollectionDetailUseCase: FetchCollectionDetailUseCase, + fetchCollectionBookmarkUsersUseCase: FetchCollectionBookmarkUsersUseCase ) -> CollectionDetailViewModel { return CollectionDetailViewModel( collectionId: collectionId, - collectionDetailUseCase: collectionDetailUseCase, - fetchBookmarkedUserUseCase: makeFetchBookmarkedUserUseCase() + fetchCollectionDetailUseCase: fetchCollectionDetailUseCase, + fetchCollectionBookmarkUsersUseCase: fetchCollectionBookmarkUsersUseCase ) } } diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionFolderListViewModelFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionFolderListViewModelFactory.swift index e51f8564..cf6fc1e9 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionFolderListViewModelFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionFolderListViewModelFactory.swift @@ -10,16 +10,16 @@ import Foundation import Domain import Presentation -protocol CollectionFolderListViewModelFactory: FetchWatchingCollectionsUseCaseFactory { +protocol CollectionFolderListViewModelFactory: FetchRecentViewedCollectionsUseCaseFactory { func makeCollectionFolderListViewModel() -> CollectionFolderListViewModel - func makeCollectionFolderListViewModel(fetchWatchingCollectionsUseCase: FetchWatchingCollectionsUseCase) -> CollectionFolderListViewModel + func makeCollectionFolderListViewModel(fetchRecentViewedCollectionsUseCase: FetchRecentViewedCollectionsUseCase) -> CollectionFolderListViewModel } extension CollectionFolderListViewModelFactory { func makeCollectionFolderListViewModel() -> CollectionFolderListViewModel { - return makeCollectionFolderListViewModel(fetchWatchingCollectionsUseCase: makeFetchWatchingCollectionsUseCase()) + return makeCollectionFolderListViewModel(fetchRecentViewedCollectionsUseCase: makeFetchRecentViewedCollectionsUseCase()) } - func makeCollectionFolderListViewModel(fetchWatchingCollectionsUseCase: FetchWatchingCollectionsUseCase) -> CollectionFolderListViewModel { - return CollectionFolderListViewModel(fetchWatchingCollectionsUseCase: fetchWatchingCollectionsUseCase) + func makeCollectionFolderListViewModel(fetchRecentViewedCollectionsUseCase: FetchRecentViewedCollectionsUseCase) -> CollectionFolderListViewModel { + return CollectionFolderListViewModel(fetchRecentViewedCollectionsUseCase: fetchRecentViewedCollectionsUseCase) } } diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/ExploreViewModelFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/ExploreViewModelFactory.swift index d208d7ce..6565c1c8 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewModel/ExploreViewModelFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/ExploreViewModelFactory.swift @@ -1,5 +1,5 @@ // -// File.swift +// ExploreViewModelFactory.swift // FLINT // // Created by 김호성 on 2026.01.22. @@ -10,16 +10,16 @@ import Foundation import Domain import Presentation -protocol ExploreViewModelFactory: ExploreUseCaseFactory { +protocol ExploreViewModelFactory: FetchExploreCollectionsUseCaseFactory { func makeExploreViewModel() -> ExploreViewModel - func makeExploreViewModel(exploreUseCase: ExploreUseCase) -> ExploreViewModel + func makeExploreViewModel(fetchExploreCollectionsUseCase: FetchExploreCollectionsUseCase) -> ExploreViewModel } extension ExploreViewModelFactory { func makeExploreViewModel() -> ExploreViewModel { - return makeExploreViewModel(exploreUseCase: makeExploreUseCase()) + return makeExploreViewModel(fetchExploreCollectionsUseCase: makeFetchExploreCollectionsUseCase()) } - func makeExploreViewModel(exploreUseCase: ExploreUseCase) -> ExploreViewModel { - return DefaultExploreViewModel(exploreUseCase: exploreUseCase) + func makeExploreViewModel(fetchExploreCollectionsUseCase: FetchExploreCollectionsUseCase) -> ExploreViewModel { + return DefaultExploreViewModel(fetchExploreCollectionsUseCase: fetchExploreCollectionsUseCase) } } diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/HomeViewModelFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/HomeViewModelFactory.swift index 3425cfcf..a34c5053 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewModel/HomeViewModelFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/HomeViewModelFactory.swift @@ -10,33 +10,40 @@ import Foundation import Domain import Presentation -protocol HomeViewModelFactory: HomeUseCaseFactory, UserProfileUseCaseFactory, FetchWatchingCollectionsUseCaseFactory { +protocol HomeViewModelFactory: FetchRecommendedCollectionsUseCaseFactory, FetchBookmarkedContentsUseCaseFactory, FetchProfileUseCaseFactory, FetchRecentViewedCollectionsUseCaseFactory { func makeHomeViewModel() -> HomeViewModel func makeHomeViewModel( - homeUseCase: HomeUseCase, - userProfileUseCase: UserProfileUseCase, - fetchWatchingCollectionsUseCase: FetchWatchingCollectionsUseCase + fetchRecommendedCollectionsUseCase: FetchRecommendedCollectionsUseCase, + fetchBookmarkedContentsUseCase: FetchBookmarkedContentsUseCase, + fetchProfileUseCase: FetchProfileUseCase, + fetchRecentViewedCollectionsUseCase: FetchRecentViewedCollectionsUseCase, + initialUserName: String ) -> HomeViewModel } extension HomeViewModelFactory { func makeHomeViewModel() -> HomeViewModel { return makeHomeViewModel( - homeUseCase: makeHomeUseCase(), - userProfileUseCase: makeUserProfileUseCase(), - fetchWatchingCollectionsUseCase: makeFetchWatchingCollectionsUseCase() + fetchRecommendedCollectionsUseCase: makeFetchRecommendedCollectionsUseCase(), + fetchBookmarkedContentsUseCase: makeFetchBookmarkedContentsUseCase(), + fetchProfileUseCase: makeFetchProfileUseCase(), + fetchRecentViewedCollectionsUseCase: makeFetchRecentViewedCollectionsUseCase(), + initialUserName: "얀비" ) } func makeHomeViewModel( - homeUseCase: HomeUseCase, - userProfileUseCase: UserProfileUseCase, - fetchWatchingCollectionsUseCase: FetchWatchingCollectionsUseCase + fetchRecommendedCollectionsUseCase: FetchRecommendedCollectionsUseCase, + fetchBookmarkedContentsUseCase: FetchBookmarkedContentsUseCase, + fetchProfileUseCase: FetchProfileUseCase, + fetchRecentViewedCollectionsUseCase: FetchRecentViewedCollectionsUseCase, + initialUserName: String ) -> HomeViewModel { return HomeViewModel( - homeUseCase: homeUseCase, - userProfileUseCase: userProfileUseCase, - fetchWatchingCollectionsUseCase: fetchWatchingCollectionsUseCase, + fetchRecommendedCollectionsUseCase: fetchRecommendedCollectionsUseCase, + fetchBookmarkedContentsUseCase: fetchBookmarkedContentsUseCase, + fetchProfileUseCase: fetchProfileUseCase, + fetchRecentViewedCollectionsUseCase: fetchRecentViewedCollectionsUseCase, initialUserName: "얀비" ) } diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/OnboardingViewModelFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/OnboardingViewModelFactory.swift index 4ad37040..53afcad9 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewModel/OnboardingViewModelFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/OnboardingViewModelFactory.swift @@ -10,21 +10,21 @@ import Foundation import Domain import Presentation -protocol OnboardingViewModelFactory: NicknameUseCaseFactory, SearchContentsUseCaseFactory, ContentsUseCaseFactory, SignupUseCaseFactory { +protocol OnboardingViewModelFactory: CheckNicknameUseCaseFactory, SearchContentsUseCaseFactory, FetchPopularContentsUseCaseFactory, SignupUseCaseFactory { func makeOnboardingViewModel() -> OnboardingViewModel - func makeOnboardingViewModel(nicknameUseCase: NicknameUseCase, contentsUseCase: ContentsUseCase, searchContentsUseCase: SearchContentsUseCase, signupUseCase: SignupUseCase) -> OnboardingViewModel + func makeOnboardingViewModel(checkNicknameUseCase: CheckNicknameUseCase, fetchPopularContentsUseCase: FetchPopularContentsUseCase, searchContentsUseCase: SearchContentsUseCase, signupUseCase: SignupUseCase) -> OnboardingViewModel } extension OnboardingViewModelFactory { func makeOnboardingViewModel() -> OnboardingViewModel { return makeOnboardingViewModel( - nicknameUseCase: makeNicknameUseCase(), - contentsUseCase: makeContentsUseCase(), + checkNicknameUseCase: makeCheckNicknameUseCase(), + fetchPopularContentsUseCase: makeFetchPopularContentsUseCase(), searchContentsUseCase: makeSearchContentsUseCase(), signupUseCase: makeSignupUseCase() ) } - func makeOnboardingViewModel(nicknameUseCase: NicknameUseCase, contentsUseCase: ContentsUseCase, searchContentsUseCase: SearchContentsUseCase, signupUseCase: SignupUseCase) -> OnboardingViewModel { - return DefaultOnboardingViewModel(nicknameUseCase: nicknameUseCase, contentsUseCase: contentsUseCase, searchContentsUseCase: searchContentsUseCase, signupUseCase: signupUseCase) + func makeOnboardingViewModel(checkNicknameUseCase: CheckNicknameUseCase, fetchPopularContentsUseCase: FetchPopularContentsUseCase, searchContentsUseCase: SearchContentsUseCase, signupUseCase: SignupUseCase) -> OnboardingViewModel { + return DefaultOnboardingViewModel(checkNicknameUseCase: checkNicknameUseCase, fetchPopularContentsUseCase: fetchPopularContentsUseCase, searchContentsUseCase: searchContentsUseCase, signupUseCase: signupUseCase) } } diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/ProfileViewModelFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/ProfileViewModelFactory.swift index 94bdd973..e20a2073 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewModel/ProfileViewModelFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/ProfileViewModelFactory.swift @@ -10,24 +10,44 @@ import Foundation import Domain import Presentation -protocol ProfileViewModelFactory: UserProfileUseCaseFactory { - func makeProfileViewModel() -> ProfileViewModel +protocol ProfileViewModelFactory: FetchProfileUseCaseFactory, FetchKeywordsUseCaseFactory, FetchCreatedCollectionsUseCaseFactory, FetchBookmarkedCollectionsUseCaseFactory, FetchBookmarkedContentsUseCaseFactory { + func makeProfileViewModel(target: UserTarget) -> ProfileViewModel func makeProfileViewModel( - target: ProfileViewModel.Target - ) -> ProfileViewModel + target: UserTarget, + fetchProfileUseCase: FetchProfileUseCase, + fetchKeywordsUseCase: FetchKeywordsUseCase, + fetchCreatedCollectionsUseCase: FetchCreatedCollectionsUseCase, + fetchBookmarkedCollectionsUseCase: FetchBookmarkedCollectionsUseCase, + fetchBookmarkedContentsUseCase: FetchBookmarkedContentsUseCase + ) -> ProfileViewModel } extension ProfileViewModelFactory { - func makeProfileViewModel() -> ProfileViewModel { - return makeProfileViewModel(target: .me) + func makeProfileViewModel(target: UserTarget) -> ProfileViewModel { + return makeProfileViewModel( + target: target, + fetchProfileUseCase: makeFetchProfileUseCase(), + fetchKeywordsUseCase: makeFetchKeywordsUseCase(), + fetchCreatedCollectionsUseCase: makeFetchCreatedCollectionsUseCase(), + fetchBookmarkedCollectionsUseCase: makeFetchBookmarkedCollectionsUseCase(), + fetchBookmarkedContentsUseCase: makeFetchBookmarkedContentsUseCase() + ) } - func makeProfileViewModel( - target: ProfileViewModel.Target + target: UserTarget, + fetchProfileUseCase: FetchProfileUseCase, + fetchKeywordsUseCase: FetchKeywordsUseCase, + fetchCreatedCollectionsUseCase: FetchCreatedCollectionsUseCase, + fetchBookmarkedCollectionsUseCase: FetchBookmarkedCollectionsUseCase, + fetchBookmarkedContentsUseCase: FetchBookmarkedContentsUseCase ) -> ProfileViewModel { return ProfileViewModel( target: target, - userProfileUseCase: makeUserProfileUseCase() + fetchProfileUseCase: fetchProfileUseCase, + fetchKeywordsUseCase: fetchKeywordsUseCase, + fetchCreatedCollectionsUseCase: fetchCreatedCollectionsUseCase, + fetchBookmarkedCollectionsUseCase: fetchBookmarkedCollectionsUseCase, + fetchBookmarkedContentsUseCase: fetchBookmarkedContentsUseCase ) } } diff --git a/FLINT/Presentation/Sources/View/Component/MoreNoMoreCollection/MoreNoMoreCollectionItemCell.swift b/FLINT/Presentation/Sources/View/Component/MoreNoMoreCollection/MoreNoMoreCollectionItemCell.swift index 2cd927de..2fe268d5 100644 --- a/FLINT/Presentation/Sources/View/Component/MoreNoMoreCollection/MoreNoMoreCollectionItemCell.swift +++ b/FLINT/Presentation/Sources/View/Component/MoreNoMoreCollection/MoreNoMoreCollectionItemCell.swift @@ -110,10 +110,10 @@ public final class MoreNoMoreCollectionItemCell: BaseCollectionViewCell { userNameLabel.attributedText = nil } - public func configure(entity: CollectionEntity) { + public func configure(entity: CollectionInfoEntity) { // 썸네일 - if let url = URL(string: entity.thumbnailUrl) { + if let url = entity.imageUrl { posterImageView.kf.setImage( with: url, placeholder: UIImage(resource: .imgBackgroundGradiantMiddle) @@ -123,7 +123,7 @@ public final class MoreNoMoreCollectionItemCell: BaseCollectionViewCell { } // 프로필 이미지 - if let url = URL(string: entity.profileImageUrl) { + if let url = entity.profileImageUrl { profileImageView.kf.setImage( with: url, placeholder: UIImage(resource: .imgProfileGray) @@ -141,7 +141,7 @@ public final class MoreNoMoreCollectionItemCell: BaseCollectionViewCell { userNameLabel.attributedText = .pretendard( .caption1_r_12, - text: entity.nickname, + text: entity.userName, color: .flintGray200 ) } diff --git a/FLINT/Presentation/Sources/View/Component/MoreNoMoreCollection/MoreNoMoreCollectionTableViewCell.swift b/FLINT/Presentation/Sources/View/Component/MoreNoMoreCollection/MoreNoMoreCollectionTableViewCell.swift index f0588dd4..7be44e0f 100644 --- a/FLINT/Presentation/Sources/View/Component/MoreNoMoreCollection/MoreNoMoreCollectionTableViewCell.swift +++ b/FLINT/Presentation/Sources/View/Component/MoreNoMoreCollection/MoreNoMoreCollectionTableViewCell.swift @@ -14,8 +14,8 @@ import Entity public final class MoreNoMoreCollectionTableViewCell: BaseTableViewCell { - public var onSelectItem: ((CollectionEntity) -> Void)? - private var items: [CollectionEntity] = [] + public var onSelectItem: ((CollectionInfoEntity) -> Void)? + private var items: [CollectionInfoEntity] = [] // MARK: - UI @@ -62,7 +62,7 @@ public final class MoreNoMoreCollectionTableViewCell: BaseTableViewCell { // MARK: - Public - public func configure(items: [CollectionEntity]) { + public func configure(items: [CollectionInfoEntity]) { self.items = items collectionView.reloadData() } diff --git a/FLINT/Presentation/Sources/View/Component/PreferenceKeyword/KeywordColor+.swift b/FLINT/Presentation/Sources/View/Component/PreferenceKeyword/KeywordColor+.swift new file mode 100644 index 00000000..1a012418 --- /dev/null +++ b/FLINT/Presentation/Sources/View/Component/PreferenceKeyword/KeywordColor+.swift @@ -0,0 +1,22 @@ +// +// KeywordColor+.swift +// FLINT +// +// Created by 진소은 on 1/18/26. +// + +import UIKit + +import Domain + +extension KeywordColor { + public var tagBackgroundImage: UIImage { + switch self { + case .pink: return UIImage(resource: .imgTagPink) + case .green: return UIImage(resource: .imgTagGreen) + case .orange: return UIImage(resource: .imgTagOrange) + case .yellow: return UIImage(resource: .imgTagYellow) + case .blue: return UIImage(resource: .imgTagBlue) + } + } +} diff --git a/FLINT/Presentation/Sources/View/Component/PreferenceKeyword/KeywordColor.swift b/FLINT/Presentation/Sources/View/Component/PreferenceKeyword/KeywordColor.swift deleted file mode 100644 index fed07294..00000000 --- a/FLINT/Presentation/Sources/View/Component/PreferenceKeyword/KeywordColor.swift +++ /dev/null @@ -1,45 +0,0 @@ -// -// KeywordColor.swift -// FLINT -// -// Created by 진소은 on 1/18/26. -// - -import Foundation -import UIKit - -public enum KeywordColor: String, Decodable { - case pink = "PINK" - case green = "GREEN" - case orange = "ORANGE" - case yellow = "YELLOW" - case blue = "BLUE" -} - -public struct KeywordDTO: Decodable { - public let color: KeywordColor - public let rank: Int - public let name: String - public let percentage: Int - public let imageUrl: String - - public init(color: KeywordColor, rank: Int, name: String, percentage: Int, imageUrl: String) { - self.color = color - self.rank = rank - self.name = name - self.percentage = percentage - self.imageUrl = imageUrl - } -} - -extension KeywordColor { - public var tagBackgroundImage: UIImage { - switch self { - case .pink: return UIImage(resource: .imgTagPink) - case .green: return UIImage(resource: .imgTagGreen) - case .orange: return UIImage(resource: .imgTagOrange) - case .yellow: return UIImage(resource: .imgTagYellow) - case .blue: return UIImage(resource: .imgTagBlue) - } - } -} diff --git a/FLINT/Presentation/Sources/View/Component/PreferenceKeyword/PreferenceChip.swift b/FLINT/Presentation/Sources/View/Component/PreferenceKeyword/PreferenceChip.swift index 4cd44f1a..c1fc4ba9 100644 --- a/FLINT/Presentation/Sources/View/Component/PreferenceKeyword/PreferenceChip.swift +++ b/FLINT/Presentation/Sources/View/Component/PreferenceKeyword/PreferenceChip.swift @@ -7,9 +7,11 @@ import UIKit +import Kingfisher import SnapKit import Then -import Kingfisher + +import Domain public final class PreferenceChip: BaseView { @@ -64,12 +66,12 @@ public final class PreferenceChip: BaseView { // MARK: - Public - public func configure(dto: KeywordDTO) { - style = PreferenceChipStyle.from(rank: dto.rank, color: dto.color) + public func configure(keyword: KeywordEntity) { + style = PreferenceChipStyle.from(rank: keyword.rank, color: keyword.color) - keywordLabel.attributedText = .pretendard(.head2_m_20, text: dto.name, color: .white) + keywordLabel.attributedText = .pretendard(.head2_m_20, text: keyword.name, color: .white) - applyResizableBackground(style.backgroundImage(for: dto.color)) + applyResizableBackground(style.backgroundImage(for: keyword.color)) contentStackView.spacing = style.spacing iconImageView.isHidden = (style.iconSize == 0) @@ -78,15 +80,11 @@ public final class PreferenceChip: BaseView { iconImageView.kf.cancelDownloadTask() iconImageView.image = nil } else { - if let url = URL(string: dto.imageUrl) { - iconImageView.kf.setImage( - with: url, - placeholder: nil, - options: [.transition(.fade(0.15)), .cacheOriginalImage] - ) - } else { - iconImageView.image = nil - } + iconImageView.kf.setImage( + with: keyword.imageUrl, + placeholder: nil, + options: [.transition(.fade(0.15)), .cacheOriginalImage] + ) } invalidateIntrinsicContentSize() diff --git a/FLINT/Presentation/Sources/View/Component/PreferenceKeyword/PreferenceChipStyle.swift b/FLINT/Presentation/Sources/View/Component/PreferenceKeyword/PreferenceChipStyle.swift index 02f341c4..4b4937f3 100644 --- a/FLINT/Presentation/Sources/View/Component/PreferenceKeyword/PreferenceChipStyle.swift +++ b/FLINT/Presentation/Sources/View/Component/PreferenceKeyword/PreferenceChipStyle.swift @@ -8,6 +8,8 @@ import Foundation import UIKit +import Domain + public enum PreferenceChipStyle { case colored(KeywordColor) case gray diff --git a/FLINT/Presentation/Sources/View/Component/PreferenceKeyword/PreferenceExampleView.swift b/FLINT/Presentation/Sources/View/Component/PreferenceKeyword/PreferenceExampleView.swift index 1e6aac4b..b422dbee 100644 --- a/FLINT/Presentation/Sources/View/Component/PreferenceKeyword/PreferenceExampleView.swift +++ b/FLINT/Presentation/Sources/View/Component/PreferenceKeyword/PreferenceExampleView.swift @@ -11,6 +11,8 @@ import Kingfisher import SnapKit import Then +import Domain + public final class PreferenceExampleView: BaseView { private let rankedView = PreferenceRankedChipView() @@ -26,13 +28,13 @@ public final class PreferenceExampleView: BaseView { $0.center.equalToSuperview() } - let dummyData: [KeywordDTO] = [ - .init(color: .blue, rank: 1, name: "영화", percentage: 0, imageUrl: "https://picsum.photos/seed/1/80"), - .init(color: .pink, rank: 2, name: "SF", percentage: 0, imageUrl: "https://picsum.photos/seed/2/80"), - .init(color: .green, rank: 3, name: "로맨스", percentage: 0, imageUrl: "https://picsum.photos/seed/3/80"), - .init(color: .orange, rank: 4, name: "공포", percentage: 0, imageUrl: "https://picsum.photos/seed/4/80"), - .init(color: .yellow, rank: 5, name: "액션", percentage: 0, imageUrl: "https://picsum.photos/seed/5/80"), - .init(color: .pink, rank: 6, name: "성장", percentage: 0, imageUrl: "https://picsum.photos/seed/6/80"), + let dummyData: [KeywordEntity] = [ + .init(color: .blue, rank: 1, name: "영화", percentage: 0, imageUrl: URL(string: "https://picsum.photos/seed/1/80")), + .init(color: .pink, rank: 2, name: "SF", percentage: 0, imageUrl: URL(string: "https://picsum.photos/seed/2/80")), + .init(color: .green, rank: 3, name: "로맨스", percentage: 0, imageUrl: URL(string: "https://picsum.photos/seed/3/80")), + .init(color: .orange, rank: 4, name: "공포", percentage: 0, imageUrl: URL(string: "https://picsum.photos/seed/4/80")), + .init(color: .yellow, rank: 5, name: "액션", percentage: 0, imageUrl: URL(string: "https://picsum.photos/seed/5/80")), + .init(color: .pink, rank: 6, name: "성장", percentage: 0, imageUrl: URL(string: "https://picsum.photos/seed/6/80")), ] rankedView.configure(keywords: dummyData) diff --git a/FLINT/Presentation/Sources/View/Component/PreferenceKeyword/PreferenceRankedChipView.swift b/FLINT/Presentation/Sources/View/Component/PreferenceKeyword/PreferenceRankedChipView.swift index f068bf28..5f670937 100644 --- a/FLINT/Presentation/Sources/View/Component/PreferenceKeyword/PreferenceRankedChipView.swift +++ b/FLINT/Presentation/Sources/View/Component/PreferenceKeyword/PreferenceRankedChipView.swift @@ -10,6 +10,8 @@ import UIKit import SnapKit import Then +import Domain + public final class PreferenceRankedChipView: BaseView { private let vStack = UIStackView().then { @@ -29,7 +31,7 @@ public final class PreferenceRankedChipView: BaseView { } } - public func configure(keywords: [KeywordDTO]) { + public func configure(keywords: [KeywordEntity]) { let byRank = Dictionary(uniqueKeysWithValues: keywords.map { ($0.rank, $0) }) let sumA = [1, 2, 4].compactMap { byRank[$0]?.name.count }.reduce(0, +) @@ -70,7 +72,7 @@ public final class PreferenceRankedChipView: BaseView { rankRow.forEach { r in guard let dto = byRank[r] else { return } let chip = PreferenceChip() - chip.configure(dto: dto) + chip.configure(keyword: dto) rowStack.addArrangedSubview(chip) } diff --git a/FLINT/Presentation/Sources/View/Scene/Profile/PreferenceRankedChipTableViewCell.swift b/FLINT/Presentation/Sources/View/Scene/Profile/PreferenceRankedChipTableViewCell.swift index a76b97ff..5ad51ee3 100644 --- a/FLINT/Presentation/Sources/View/Scene/Profile/PreferenceRankedChipTableViewCell.swift +++ b/FLINT/Presentation/Sources/View/Scene/Profile/PreferenceRankedChipTableViewCell.swift @@ -44,16 +44,7 @@ public final class PreferenceRankedChipTableViewCell: BaseTableViewCell { // public func configure(keywords: [KeywordDTO]) { // chipView.configure(keywords: keywords) // } - public func configure(entities: [KeywordEntity]) { - let keywords: [KeywordDTO] = entities.map { entity in - KeywordDTO( - color: KeywordColor(rawValue: entity.color) ?? .pink, // ⚠️ entity.color가 String이라고 가정 - rank: entity.rank, - name: entity.name, - percentage: entity.percentage, - imageUrl: entity.imageUrl - ) - } + public func configure(keywords: [KeywordEntity]) { chipView.configure(keywords: keywords) } } diff --git a/FLINT/Presentation/Sources/View/Scene/Profile/ProfileHeaderTableViewCell.swift b/FLINT/Presentation/Sources/View/Scene/Profile/ProfileHeaderTableViewCell.swift index 7a2deae3..db4fee91 100644 --- a/FLINT/Presentation/Sources/View/Scene/Profile/ProfileHeaderTableViewCell.swift +++ b/FLINT/Presentation/Sources/View/Scene/Profile/ProfileHeaderTableViewCell.swift @@ -88,14 +88,14 @@ public final class ProfileHeaderTableViewCell: BaseTableViewCell { public func configure( nickname: String = "", - profileImageUrl: String? = nil, + profileImageUrl: URL? = nil, isFliner: Bool = false ) { nameLabel.attributedText = .pretendard(.display2_m_28, text: nickname) verificationBadge.isHidden = !isFliner let placeholder = UIImage(resource: .imgProfileGray) - guard let urlString = profileImageUrl, let url = URL(string: urlString) else { + guard let url = profileImageUrl else { profileImageView.image = placeholder return } diff --git a/FLINT/Presentation/Sources/ViewController/Scene/CollectionDetail/CollectionDetailViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/CollectionDetail/CollectionDetailViewController.swift index 96dc4b99..535f0559 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/CollectionDetail/CollectionDetailViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/CollectionDetail/CollectionDetailViewController.swift @@ -119,7 +119,7 @@ public final class CollectionDetailViewController: BaseViewController { public let exploreViewModel: ExploreViewModel + private var mainCollectionViewDataSource: UICollectionViewDiffableDataSource? + // MARK: - Component private let gradientBackgroundView = FixedGradientView().then { @@ -49,10 +51,7 @@ public final class ExploreViewController: BaseViewController { super.viewDidLoad() setNavigationBar(.init(left: .logo)) - rootView.mainCollectionView.register(ExploreCollectionViewCell.self) - rootView.mainCollectionView.register(ExploreEmptyCollectionViewCell.self) - rootView.mainCollectionView.delegate = self - rootView.mainCollectionView.dataSource = self + setupMainCollectionView() } // MARK: - Setup @@ -60,7 +59,8 @@ public final class ExploreViewController: BaseViewController { public override func bind() { exploreViewModel.collections.sink { [weak self] exploreInfoEntity in Log.d(exploreInfoEntity) - self?.rootView.mainCollectionView.reloadData() + guard let self else { return } + mainCollectionViewDataSource?.apply(makeSnapshot(exploreInfoEntities: exploreViewModel.collections.value), animatingDifferences: false) } .store(in: &cancellables) } @@ -78,6 +78,57 @@ public final class ExploreViewController: BaseViewController { } } +extension ExploreViewController { + private enum MainCollectionViewSection: Int { + case main + case empty + } + + private enum MainCollectionViewItem: Equatable, Hashable, Sendable { + case collection(ExploreInfoEntity) + case empty + } + + private func setupMainCollectionView() { + rootView.mainCollectionView.register(ExploreCollectionViewCell.self) + rootView.mainCollectionView.register(ExploreEmptyCollectionViewCell.self) + rootView.mainCollectionView.delegate = self + rootView.mainCollectionView.dataSource = mainCollectionViewDataSource + + mainCollectionViewDataSource = UICollectionViewDiffableDataSource(collectionView: rootView.mainCollectionView, cellProvider: { collectionView, indexPath, itemIdentifier in + switch itemIdentifier { + case let .collection(collection): + guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: ExploreCollectionViewCell.reuseIdentifier, for: indexPath) as? ExploreCollectionViewCell else { + return UICollectionViewCell() + } + cell.collectionImageView.kf.setImage(with: collection.imageUrl) + cell.collectionTitleLabel.attributedText = .pretendard(.display2_m_28, text: collection.title) + cell.collectionDescriptionLabel.attributedText = .pretendard(.body1_r_16, text: collection.description) + cell.collectionDetailButton.addAction(UIAction(handler: { [weak self] _ in + guard let id = Int64(collection.id) else { return } + guard let vc = self?.viewControllerFactory?.makeCollectionDetailViewController(collectionId: id) else { return } + self?.navigationController?.pushViewController(vc, animated: true) + }), for: .touchUpInside) + return cell + case .empty: + guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: ExploreEmptyCollectionViewCell.reuseIdentifier, for: indexPath) as? ExploreEmptyCollectionViewCell else { + return UICollectionViewCell() + } + return cell + } + }) + mainCollectionViewDataSource?.apply(makeSnapshot(exploreInfoEntities: exploreViewModel.collections.value), animatingDifferences: false) + } + + private func makeSnapshot(exploreInfoEntities: [ExploreInfoEntity]) -> NSDiffableDataSourceSnapshot { + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections([.main, .empty]) + snapshot.appendItems(exploreInfoEntities.map({ MainCollectionViewItem.collection($0) }), toSection: .main) + snapshot.appendItems([MainCollectionViewItem.empty], toSection: .empty) + return snapshot + } +} + // MARK: - UICollectionViewDataSource extension ExploreViewController: UICollectionViewDataSource { diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Home/CollectionFolder/CollectionFolderListViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Home/CollectionFolder/CollectionFolderListViewController.swift index 5e81cbf3..fd1e8552 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Home/CollectionFolder/CollectionFolderListViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Home/CollectionFolder/CollectionFolderListViewController.swift @@ -109,10 +109,10 @@ extension CollectionFolderListViewController: UICollectionViewDataSource { let entity = viewModel.items[indexPath.item] - let firstURL = URL(string: entity.imageList.first ?? entity.thumbnailUrl) + let firstURL = URL(string: entity.imageList.first ?? "") ?? entity.thumbnailUrl let secondString = entity.imageList.count > 1 ? entity.imageList[1] : nil let secondURL = secondString.flatMap(URL.init(string:)) - let profileURL = URL(string: entity.profileImageUrl) + let profileURL = entity.profileImageUrl cell.configure( .init( diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Home/HomeViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Home/HomeViewController.swift index 3bf556bd..50f2388a 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Home/HomeViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Home/HomeViewController.swift @@ -26,8 +26,9 @@ public final class HomeViewController: BaseViewController { self.viewControllerFactory = viewControllerFactory } - @available(*, unavailable) - required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } // MARK: - Lifecycle diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Login/LoginViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Login/LoginViewController.swift index 849cf5b0..72bb41ff 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Login/LoginViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Login/LoginViewController.swift @@ -41,7 +41,6 @@ public final class LoginViewController: BaseViewController { public override func bind() { loginViewModel.socialVerifyResultEntity.sink { [weak self] socialVerifyResultEntity in Log.d(socialVerifyResultEntity) - guard let socialVerifyResultEntity else { return } if !socialVerifyResultEntity.isRegistered { self?.register() } else { diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/FilmSelect/FilmSelectViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/FilmSelect/FilmSelectViewController.swift index 0b367595..578c8c10 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/FilmSelect/FilmSelectViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/FilmSelect/FilmSelectViewController.swift @@ -64,13 +64,13 @@ public final class FilmSelectViewController: BaseViewController setNavigationBar(.init(left: .back, backgroundStyle: .solid(DesignSystem.Color.background))) hideKeyboardWhenTappedAround(activeOnAction: false) - onboardingViewModel.fetchContents() + onboardingViewModel.fetchPopularContents() rootView.searchTextField.searchAction = { [weak self] keyword in self?.onboardingViewModel.searchContents(keyword ?? "") } rootView.searchTextField.clearAction = { [weak self] in - self?.onboardingViewModel.fetchContents() + self?.onboardingViewModel.fetchPopularContents() } rootView.progressLabel.attributedText = .pretendard(.caption1_m_12, text: "\(onboardingViewModel.selectedContents.value.count)/\(onboardingViewModel.filmSelectQuestions.count)") diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Profile/ProfileViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Profile/ProfileViewController.swift index 0450f37d..971b81f8 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Profile/ProfileViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Profile/ProfileViewController.swift @@ -17,13 +17,13 @@ import ViewModel public protocol ProfileViewControllerFactory { func makeProfileViewController() -> ProfileViewController - func makeProfileViewController(target: ProfileViewModel.Target) -> ProfileViewController + func makeProfileViewController(target: UserTarget) -> ProfileViewController } public final class ProfileViewController: BaseViewController { - private let profileViewModel: ProfileViewModel + public init( profileViewModel: ProfileViewModel, viewControllerFactory: ViewControllerFactory, @@ -32,10 +32,12 @@ public final class ProfileViewController: BaseViewController { super.init(nibName: nil, bundle: nil) self.viewControllerFactory = viewControllerFactory } - - @available(*, unavailable) - required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + required init?(coder: NSCoder) { + fatalError( + "init(coder:) has not been implemented" + ) + } public override func viewDidLoad() { super.viewDidLoad() @@ -160,7 +162,7 @@ extension ProfileViewController: UITableViewDataSource { for: indexPath ) as! PreferenceRankedChipTableViewCell cell.selectionStyle = .none - cell.configure(entities: keywords) + cell.configure(keywords: keywords) return cell case let .titleHeader(style, title, subtitle): diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Splash/SplashViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Splash/SplashViewController.swift index c3b974b3..d47f6743 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Splash/SplashViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Splash/SplashViewController.swift @@ -5,9 +5,8 @@ // Created by 진소은 on 1/22/26. // - -import UIKit import Combine +import UIKit import View import ViewModel diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/CollectionDetail/CollectionDetailViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/CollectionDetail/CollectionDetailViewModel.swift index 684f5d20..73d10feb 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/CollectionDetail/CollectionDetailViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/CollectionDetail/CollectionDetailViewModel.swift @@ -9,7 +9,6 @@ import Combine import Foundation import Domain -import Entity public final class CollectionDetailViewModel { @@ -51,8 +50,8 @@ public final class CollectionDetailViewModel { // MARK: - Dependency private let collectionId: Int64 - private let collectionDetailUseCase: CollectionDetailUseCase - private let fetchBookmarkedUserUseCase: FetchBookmarkedUserUseCase + private let fetchCollectionDetailUseCase: FetchCollectionDetailUseCase + private let fetchCollectionBookmarkUsersUseCase: FetchCollectionBookmarkUsersUseCase // MARK: - Private @@ -63,12 +62,12 @@ public final class CollectionDetailViewModel { public init( collectionId: Int64, - collectionDetailUseCase: CollectionDetailUseCase, - fetchBookmarkedUserUseCase: FetchBookmarkedUserUseCase + fetchCollectionDetailUseCase: FetchCollectionDetailUseCase, + fetchCollectionBookmarkUsersUseCase: FetchCollectionBookmarkUsersUseCase ) { self.collectionId = collectionId - self.collectionDetailUseCase = collectionDetailUseCase - self.fetchBookmarkedUserUseCase = fetchBookmarkedUserUseCase + self.fetchCollectionDetailUseCase = fetchCollectionDetailUseCase + self.fetchCollectionBookmarkUsersUseCase = fetchCollectionBookmarkUsersUseCase } // MARK: - Transform @@ -96,7 +95,7 @@ public final class CollectionDetailViewModel { private func fetch() { stateSubject.send(.loading) - collectionDetailUseCase.fetchCollectionDetail(collectionId: collectionId) + fetchCollectionDetailUseCase.fetchCollectionDetail(collectionId: collectionId) .sink( receiveCompletion: { [weak self] completion in guard let self else { return } @@ -109,7 +108,7 @@ public final class CollectionDetailViewModel { self.stateSubject.send(.loaded(detail: detail, bookmarkedUsers: nil)) - self.fetchBookmarkedUserUseCase.execute(collectionId: self.collectionId) + self.fetchCollectionBookmarkUsersUseCase.fetchCollectionBookmarkUsers(collectionId: self.collectionId) .sink( receiveCompletion: { _ in }, receiveValue: { [weak self] users in diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/CreateCollection/AddContentSelectViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/CreateCollection/AddContentSelectViewModel.swift index 1b18d5c4..42ad43c9 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/CreateCollection/AddContentSelectViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/CreateCollection/AddContentSelectViewModel.swift @@ -26,7 +26,7 @@ public final class DefaultAddContentSelectViewModel: AddContentSelectViewModel { // MARK: - Dependency - private let contentsUseCase: ContentsUseCase + private let fetchPopularContentsUseCase: FetchPopularContentsUseCase private let searchContentsUseCase: SearchContentsUseCase // MARK: - Output @@ -42,10 +42,10 @@ public final class DefaultAddContentSelectViewModel: AddContentSelectViewModel { // MARK: - Init public init( - contentsUseCase: ContentsUseCase, + fetchPopularContentsUseCase: FetchPopularContentsUseCase, searchContentsUseCase: SearchContentsUseCase ) { - self.contentsUseCase = contentsUseCase + self.fetchPopularContentsUseCase = fetchPopularContentsUseCase self.searchContentsUseCase = searchContentsUseCase bind() } @@ -59,7 +59,7 @@ public final class DefaultAddContentSelectViewModel: AddContentSelectViewModel { public func fetchContents() { isSearching.send(false) - contentsUseCase.fetchContents() + fetchPopularContentsUseCase.fetchPopularContents() .manageThread() .sinkHandledCompletion { [weak self] contents in self?.results.send(contents) @@ -89,7 +89,7 @@ public extension DefaultAddContentSelectViewModel { isSearching.send(true) - searchContentsUseCase.searchContents(keyword) + searchContentsUseCase.searchContents(keyword: keyword) .manageThread() .sinkHandledCompletion { [weak self] contents in self?.results.send(contents) diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/CreateCollection/CreateCollectionView/CreateCollectionViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/CreateCollection/CreateCollectionView/CreateCollectionViewModel.swift index cb2b2900..a7475e40 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/CreateCollection/CreateCollectionView/CreateCollectionViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/CreateCollection/CreateCollectionView/CreateCollectionViewModel.swift @@ -73,9 +73,9 @@ public final class DefaultCreateCollectionViewModel: CreateCollectionViewModel { guard isDoneEnabled.value else { return } guard let entity = createEntity else { return } - createCollectionUseCase.createCollection(entity) + createCollectionUseCase.createCollection(collectionInfo: entity) .manageThread() - .map { Result.success(()) } + .map { _ in Result.success(()) } .catch { Just(Result.failure($0)) } .sinkHandledCompletion { [weak self] result in switch result { diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/Explore/ExploreViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/Explore/ExploreViewModel.swift index 1914ae00..6b2f6a46 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/Explore/ExploreViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/Explore/ExploreViewModel.swift @@ -1,5 +1,5 @@ // -// File.swift +// ExploreViewModel.swift // Presentation // // Created by 김호성 on 2026.01.22. @@ -17,23 +17,23 @@ public protocol ExploreViewModelInput { public protocol ExploreViewModelOutput { var index: CurrentValueSubject { get } var collections: CurrentValueSubject<[ExploreInfoEntity], Never> { get } - var cursor: UInt? { get set } + var cursor: Int64? { get set } } public typealias ExploreViewModel = ExploreViewModelInput & ExploreViewModelOutput public final class DefaultExploreViewModel: ExploreViewModel { - private let exploreUseCase: ExploreUseCase + private let fetchExploreCollectionsUseCase: FetchExploreCollectionsUseCase public var index: CurrentValueSubject = .init(0) public var collections: CurrentValueSubject<[ExploreInfoEntity], Never> = .init([]) - public var cursor: UInt? + public var cursor: Int64? private var cancellables: Set = Set() - public init(exploreUseCase: ExploreUseCase) { - self.exploreUseCase = exploreUseCase + public init(fetchExploreCollectionsUseCase: FetchExploreCollectionsUseCase) { + self.fetchExploreCollectionsUseCase = fetchExploreCollectionsUseCase bind() fetchCollections() } @@ -53,7 +53,7 @@ public final class DefaultExploreViewModel: ExploreViewModel { } private func fetchCollections() { - exploreUseCase.fetchExplore(cursor: cursor) + fetchExploreCollectionsUseCase.fetchExploreCollections(cursor: cursor) .manageThread() .sinkHandledCompletion { [weak self] collectionPagingEntity in guard let self else { return } diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/Home/CollectionFolderListViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/Home/CollectionFolderListViewModel.swift index e743612c..187931af 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/Home/CollectionFolderListViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/Home/CollectionFolderListViewModel.swift @@ -17,15 +17,15 @@ public final class CollectionFolderListViewModel { @Published public private(set) var items: [CollectionEntity] = [] // MARK: - Dependency - private let fetchWatchingCollectionsUseCase: FetchWatchingCollectionsUseCase + private let fetchRecentViewedCollectionsUseCase: FetchRecentViewedCollectionsUseCase private var cancellables = Set() - public init(fetchWatchingCollectionsUseCase: FetchWatchingCollectionsUseCase) { - self.fetchWatchingCollectionsUseCase = fetchWatchingCollectionsUseCase + public init(fetchRecentViewedCollectionsUseCase: FetchRecentViewedCollectionsUseCase) { + self.fetchRecentViewedCollectionsUseCase = fetchRecentViewedCollectionsUseCase } public func load() { - fetchWatchingCollectionsUseCase.fetchWatchingCollections() + fetchRecentViewedCollectionsUseCase.fetchWatchingCollections() .receive(on: DispatchQueue.main) .sink { completion in if case let .failure(error) = completion { diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/Home/HomeViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/Home/HomeViewModel.swift index 8030ac35..8b7b59d2 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/Home/HomeViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/Home/HomeViewModel.swift @@ -5,21 +5,12 @@ // Created by 소은 on 2026.01.23. // -// -// HomeViewModel.swift -// Presentation -// -// Created by 소은 on 2026.01.23. -// - -import Foundation import Combine +import Foundation import Domain -import Entity public final class HomeViewModel { - // MARK: - Section / Row @@ -35,7 +26,7 @@ public final class HomeViewModel { public enum Row { case greeting(userName: String) case header(style: TitleHeaderStyle, title: String, subtitle: String) - case fliner(items: [CollectionEntity]) + case fliner(items: [CollectionInfoEntity]) case recentSavedContents(items: [ContentInfoEntity]) case ctaButton(title: String) } @@ -46,29 +37,32 @@ public final class HomeViewModel { // MARK: - Dependencies - private let homeUseCase: HomeUseCase - private let userProfileUseCase: UserProfileUseCase - private let fetchWatchingCollectionsUseCase: FetchWatchingCollectionsUseCase + private let fetchRecommendedCollectionsUseCase: FetchRecommendedCollectionsUseCase + private let fetchBookmarkedContentsUseCase: FetchBookmarkedContentsUseCase + private let fetchProfileUseCase: FetchProfileUseCase + private let fetchRecentViewedCollectionsUseCase: FetchRecentViewedCollectionsUseCase private var cancellables = Set() // MARK: - State private var userName: String - private var flinerCollections: [CollectionEntity] = [] + private var flinerCollections: [CollectionInfoEntity] = [] private var recentSavedContents: [ContentInfoEntity] = [] private var watchingCollections: [CollectionEntity] = [] // MARK: - Init public init( - homeUseCase: HomeUseCase, - userProfileUseCase: UserProfileUseCase, - fetchWatchingCollectionsUseCase: FetchWatchingCollectionsUseCase, + fetchRecommendedCollectionsUseCase: FetchRecommendedCollectionsUseCase, + fetchBookmarkedContentsUseCase: FetchBookmarkedContentsUseCase, + fetchProfileUseCase: FetchProfileUseCase, + fetchRecentViewedCollectionsUseCase: FetchRecentViewedCollectionsUseCase, initialUserName: String = "얀비" ) { - self.homeUseCase = homeUseCase - self.userProfileUseCase = userProfileUseCase - self.fetchWatchingCollectionsUseCase = fetchWatchingCollectionsUseCase + self.fetchRecommendedCollectionsUseCase = fetchRecommendedCollectionsUseCase + self.fetchBookmarkedContentsUseCase = fetchBookmarkedContentsUseCase + self.fetchProfileUseCase = fetchProfileUseCase + self.fetchRecentViewedCollectionsUseCase = fetchRecentViewedCollectionsUseCase self.userName = initialUserName self.sections = makeSections() } @@ -77,8 +71,8 @@ public final class HomeViewModel { public func load() { - userProfileUseCase.fetchUserProfile(userId: 1) - .receive(on: DispatchQueue.main) + fetchProfileUseCase.fetchProfile(for: .user(id: 1)) + .manageThread() .sink { completion in if case let .failure(error) = completion { print(" fetchUserProfile failed:", error) @@ -91,8 +85,8 @@ public final class HomeViewModel { .store(in: &cancellables) // 1) Fliner 추천 - homeUseCase.fetchRecommendedCollections() - .receive(on: DispatchQueue.main) + fetchRecommendedCollectionsUseCase.fetchRecommendedCollections() + .manageThread() .sink { completion in if case let .failure(error) = completion { print("fetchRecommendedCollections failed:", error) @@ -100,29 +94,15 @@ public final class HomeViewModel { } receiveValue: { [weak self] items in guard let self else { return } - self.flinerCollections = items.map { info in - CollectionEntity( - id: info.id ?? "", - thumbnailUrl: info.imageUrlString, - title: info.title, - description: "", - imageList: [], - bookmarkCount: 0, - isBookmarked: false, - userId: "", - nickname: info.userName, - profileImageUrl: info.profileImageUrlString - ) - - } + self.flinerCollections = items self.sections = self.makeSections() } .store(in: &cancellables) // 2) 최근 저장한 콘텐츠 - userProfileUseCase.fetchMyBookmarkedContents() - .receive(on: DispatchQueue.main) + fetchBookmarkedContentsUseCase.fetchBookmarkedContents(for: .me) + .manageThread() .sink { completion in if case let .failure(error) = completion { print("fetchMyBookmarkedContents failed:", error) @@ -134,8 +114,8 @@ public final class HomeViewModel { } .store(in: &cancellables) - fetchWatchingCollectionsUseCase.fetchWatchingCollections() - .receive(on: DispatchQueue.main) + fetchRecentViewedCollectionsUseCase.fetchWatchingCollections() + .manageThread() .sink { completion in if case let .failure(error) = completion { print("fetchWatchingCollections failed:", error) @@ -146,8 +126,6 @@ public final class HomeViewModel { self.sections = self.makeSections() } .store(in: &cancellables) - - } // MARK: - Builder @@ -210,7 +188,9 @@ public final class HomeViewModel { title: "눈여겨보고 있는 컬렉션", subtitle: "\(userName)님이 최근 살펴본 컬렉션이에요" ), - .fliner(items: watchingCollections) + .fliner(items: watchingCollections.map({ collectionEntity in + return CollectionInfoEntity(id: collectionEntity.id, imageUrl: collectionEntity.thumbnailUrl, profileImageUrl: collectionEntity.profileImageUrl, title: collectionEntity.title, userName: collectionEntity.nickname) + })) ] } diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/Login/LoginViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/Login/LoginViewModel.swift index 14c663b3..25a047e7 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/Login/LoginViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/Login/LoginViewModel.swift @@ -18,7 +18,7 @@ public protocol LoginViewModelInput { } public protocol LoginViewModelOutput { - var socialVerifyResultEntity: CurrentValueSubject { get set } + var socialVerifyResultEntity: PassthroughSubject { get } } public typealias LoginViewModel = LoginViewModelInput & LoginViewModelOutput @@ -27,7 +27,7 @@ public final class DefaultLoginViewModel: LoginViewModel { private let socialVerifyUseCase: SocialVerifyUseCase - public var socialVerifyResultEntity: CurrentValueSubject = .init(nil) + public var socialVerifyResultEntity: PassthroughSubject = .init() private var cancellables: Set = Set() diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/Onboarding/OnboardingViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/Onboarding/OnboardingViewModel.swift index 3537f0f0..983d3ca9 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/Onboarding/OnboardingViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/Onboarding/OnboardingViewModel.swift @@ -1,5 +1,5 @@ // -// File.swift +// OnboardingViewModel.swift // Presentation // // Created by 김호성 on 2026.01.20. diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/Profile/ProfileViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/Profile/ProfileViewModel.swift index d5abb388..981ea57e 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/Profile/ProfileViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/Profile/ProfileViewModel.swift @@ -5,27 +5,34 @@ // Created by 진소은 on 1/22/26. // -import Foundation import Combine +import Foundation import Domain -import Entity +//public protocol ProfileViewModelInput { +// +//} + +//public protocol ProfileViewModelOutput { +// var userProfileEntity: CurrentValueSubject { get set } +//} + +//public typealias ProfileViewModel = ProfileViewModelInput & ProfileViewModelOutput + +//public final class DefaultProfileViewModel: ProfileViewModel { public final class ProfileViewModel { +// public var userProfileEntity: CurrentValueSubject - public enum Target: Equatable { - case me - case user(userId: String) - } - private let target: Target + private let target: UserTarget public enum Row { - case profileHeader(nickname: String, profileImageUrl: String, isFliner: Bool) + case profileHeader(nickname: String, profileImageUrl: URL?, isFliner: Bool) case titleHeader(style: TitleHeaderStyle, title: String, subtitle: String) case preferenceChips(keywords: [KeywordEntity]) - case myCollections(items: [CollectionEntity]) - case savedCollections(items: [CollectionEntity]) + case myCollections(items: [CollectionInfoEntity]) + case savedCollections(items: [CollectionInfoEntity]) case savedContents(items: [ContentInfoEntity]) } @@ -38,183 +45,116 @@ public final class ProfileViewModel { @Published public private(set) var rows: [Row] = [] // MARK: - Dependencies - private let userProfileUseCase: UserProfileUseCase + private let fetchProfileUseCase: FetchProfileUseCase + private let fetchKeywordsUseCase: FetchKeywordsUseCase + private let fetchCreatedCollectionsUseCase: FetchCreatedCollectionsUseCase + private let fetchBookmarkedCollectionsUseCase: FetchBookmarkedCollectionsUseCase + private let fetchBookmarkedContentsUseCase: FetchBookmarkedContentsUseCase private var cancellables = Set() // MARK: - State private var nickname: String private var isFliner: Bool - private var profileImageUrl: String? + private var profileImageUrl: URL? private var keywords: [KeywordEntity] = [] - private var myCollections: [CollectionEntity] = [] - private var savedCollections: [CollectionEntity] = [] + private var myCollections: [CollectionInfoEntity] = [] + private var savedCollections: [CollectionInfoEntity] = [] private var savedContents: [ContentInfoEntity] = [] public init( - target: Target = .me, - userProfileUseCase: UserProfileUseCase, + target: UserTarget, + fetchProfileUseCase: FetchProfileUseCase, + fetchKeywordsUseCase: FetchKeywordsUseCase, + fetchCreatedCollectionsUseCase: FetchCreatedCollectionsUseCase, + fetchBookmarkedCollectionsUseCase: FetchBookmarkedCollectionsUseCase, + fetchBookmarkedContentsUseCase: FetchBookmarkedContentsUseCase, initialNickname: String = "플링", initialIsFliner: Bool = true ) { self.target = target - self.userProfileUseCase = userProfileUseCase + self.fetchProfileUseCase = fetchProfileUseCase + self.fetchKeywordsUseCase = fetchKeywordsUseCase + self.fetchCreatedCollectionsUseCase = fetchCreatedCollectionsUseCase + self.fetchBookmarkedCollectionsUseCase = fetchBookmarkedCollectionsUseCase + self.fetchBookmarkedContentsUseCase = fetchBookmarkedContentsUseCase self.nickname = initialNickname self.isFliner = initialIsFliner - self.profileImageUrl = "" self.rows = makeRows() } // MARK: - Input public func load() { - switch target { - case .me: - userProfileUseCase.fetchMyProfile() - .receive(on: DispatchQueue.main) - .sink { completion in - if case let .failure(error) = completion { - print("❌ fetchProfile failed:", error) - } - } receiveValue: { [weak self] profile in - guard let self else { return } - self.nickname = profile.nickname - self.isFliner = profile.isFliner - self.profileImageUrl = profile.profileImageUrl - self.rows = self.makeRows() - } - .store(in: &cancellables) - userProfileUseCase.fetchMyKeywords() - .receive(on: DispatchQueue.main) - .sink { completion in - if case let .failure(error) = completion { - print("❌ fetchKeywords failed:", error) - } - } receiveValue: { [weak self] keywords in - guard let self else { return } - self.keywords = keywords - self.rows = self.makeRows() - } - .store(in: &cancellables) - - userProfileUseCase.fetchMyCollections() - .receive(on: DispatchQueue.main) - .sink { completion in - if case let .failure(error) = completion { - print("❌ fetchMyCollections failed:", error) - } - } receiveValue: { [weak self] items in - guard let self else { return } - self.myCollections = items - self.rows = self.makeRows() - } - .store(in: &cancellables) - - userProfileUseCase.fetchMyBookmarkedCollections() - .receive(on: DispatchQueue.main) - .sink { completion in - if case let .failure(error) = completion { - print("❌ fetchSavedCollections failed:", error) - } - } receiveValue: { [weak self] items in - print("asdf", items.count) - guard let self else { return } - self.savedCollections = items - self.rows = self.makeRows() - } - .store(in: &cancellables) - - userProfileUseCase.fetchMyBookmarkedContents() - .receive(on: DispatchQueue.main) - .sink { completion in - if case let .failure(error) = completion { - print("❌ fetchSavedContents failed:", error) - } - } receiveValue: { [weak self] items in - guard let self else { return } - self.savedContents = items - self.rows = self.makeRows() + fetchProfileUseCase.fetchProfile(for: target) + .manageThread() + .sinkHandledCompletion(receiveValue: { [weak self] userProfileEntity in + guard let self else { return } + nickname = userProfileEntity.nickname + isFliner = userProfileEntity.role == .fliner + profileImageUrl = userProfileEntity.profileImageUrl + rows = makeRows() + }) + .store(in: &cancellables) + + fetchKeywordsUseCase.fetchKeywords(for: target) + .manageThread() + .sink { completion in + if case let .failure(error) = completion { + print("❌ fetchKeywords failed:", error) } - .store(in: &cancellables) - - - - case .user(let userIdString): - guard let userId = Int64(userIdString) else { - print("❌ invalid userId:", userIdString) - return + } receiveValue: { [weak self] keywords in + guard let self else { return } + self.keywords = keywords + self.rows = self.makeRows() } - userProfileUseCase.fetchUserProfile(userId: userId) - .receive(on: DispatchQueue.main) - .sink { completion in - if case let .failure(error) = completion { - print("❌ fetchProfile failed:", error) - } - } receiveValue: { [weak self] profile in - guard let self else { return } - self.nickname = profile.nickname - self.isFliner = profile.isFliner - self.profileImageUrl = profile.profileImageUrl - self.rows = self.makeRows() - } - .store(in: &cancellables) - userProfileUseCase.fetchUserKeywords(userId: Int64(userId)) - .receive(on: DispatchQueue.main) - .sink { completion in - if case let .failure(error) = completion { - print("❌ fetchKeywords failed:", error) - } - } receiveValue: { [weak self] keywords in - guard let self else { return } - self.keywords = keywords - self.rows = self.makeRows() - } - .store(in: &cancellables) - - userProfileUseCase.fetchUserCollections(userId: userId) - .receive(on: DispatchQueue.main) - .sink { completion in - if case let .failure(error) = completion { - print("❌ fetchMyCollections failed:", error) - } - } receiveValue: { [weak self] items in - guard let self else { return } - self.myCollections = items - self.rows = self.makeRows() + .store(in: &cancellables) + + fetchCreatedCollectionsUseCase.fetchCreatedCollections(for: target) + .manageThread() + .sink { completion in + if case let .failure(error) = completion { + print("❌ fetchMyCollections failed:", error) } - .store(in: &cancellables) - - userProfileUseCase.fetchBookmarkedCollections(userId: userId) - .receive(on: DispatchQueue.main) - .sink { completion in - if case let .failure(error) = completion { - print("❌ fetchSavedCollections failed:", error) - } - } receiveValue: { [weak self] items in - print("asdf", items.count) - guard let self else { return } - self.savedCollections = items - self.rows = self.makeRows() + } receiveValue: { [weak self] items in + guard let self else { return } + self.myCollections = items.map({ collectionEntity in + return CollectionInfoEntity(id: collectionEntity.id, imageUrl: collectionEntity.thumbnailUrl, profileImageUrl: collectionEntity.profileImageUrl, title: collectionEntity.title, userName: collectionEntity.nickname) + }) + self.rows = self.makeRows() + } + .store(in: &cancellables) + + fetchBookmarkedCollectionsUseCase.fetchBookmarkedCollections(for: target) + .manageThread() + .sink { completion in + if case let .failure(error) = completion { + print("❌ fetchSavedCollections failed:", error) } - .store(in: &cancellables) - - userProfileUseCase.fetchBookmarkedContents(userId: userId) - .receive(on: DispatchQueue.main) - .sink { completion in - if case let .failure(error) = completion { - print("❌ fetchSavedContents failed:", error) - } - } receiveValue: { [weak self] items in - guard let self else { return } - self.savedContents = items - self.rows = self.makeRows() + } receiveValue: { [weak self] items in + print("asdf", items.count) + guard let self else { return } + self.savedCollections = items.map({ collectionEntity in + return CollectionInfoEntity(id: collectionEntity.id, imageUrl: collectionEntity.thumbnailUrl, profileImageUrl: collectionEntity.profileImageUrl, title: collectionEntity.title, userName: collectionEntity.nickname) + }) + self.rows = self.makeRows() + } + .store(in: &cancellables) + + fetchBookmarkedContentsUseCase.fetchBookmarkedContents(for: target) + .manageThread() + .sink { completion in + if case let .failure(error) = completion { + print("❌ fetchSavedContents failed:", error) } - .store(in: &cancellables) - } + } receiveValue: { [weak self] items in + guard let self else { return } + self.savedContents = items + self.rows = self.makeRows() + } + .store(in: &cancellables) } - // - // MARK: - Row builder private func makeRows() -> [Row] { var result: [Row] = [] @@ -223,7 +163,7 @@ public final class ProfileViewModel { result.append( .profileHeader( nickname: nickname, - profileImageUrl: profileImageUrl ?? "", + profileImageUrl: profileImageUrl, isFliner: isFliner ) ) diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/Splash/SplashViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/Splash/SplashViewModel.swift deleted file mode 100644 index 3492ccd7..00000000 --- a/FLINT/Presentation/Sources/ViewModel/Scene/Splash/SplashViewModel.swift +++ /dev/null @@ -1,50 +0,0 @@ -// -// SplashViewModel.swift -// Presentation -// -// Created by 진소은 on 1/22/26. -// - - -import Combine - -public final class SplashViewModel: BaseViewModelType { - - public struct Input { - public let viewDidAppear: AnyPublisher - public let lottieFinished: AnyPublisher - - public init( - viewDidAppear: AnyPublisher, - lottieFinished: AnyPublisher - ) { - self.viewDidAppear = viewDidAppear - self.lottieFinished = lottieFinished - } - } - - public struct Output { - /// SplashViewController가 이 이벤트 받으면 rootView.play() 호출 - public let playLottie: AnyPublisher - - /// SplashViewController / Coordinator가 이 이벤트 받으면 Login으로 전환 - public let routeToLogin: AnyPublisher - } - - public init() {} - - public func transform(input: Input) -> Output { - let playLottie = input.viewDidAppear - .prefix(1) - .eraseToAnyPublisher() - - let routeToLogin = input.lottieFinished - .prefix(1) - .eraseToAnyPublisher() - - return Output( - playLottie: playLottie, - routeToLogin: routeToLogin - ) - } -} From 1a089af0790bab282c9f818c4ae7c4fcad9f1e2d Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Tue, 10 Feb 2026 23:23:46 +0900 Subject: [PATCH 36/45] =?UTF-8?q?[feat]=20=ED=83=90=EC=83=89=20=ED=83=AD?= =?UTF-8?q?=20=EA=B8=B0=EB=8A=A5=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 로딩 중에 컬렉션 끝 도달 시 empty cell 보이던 버그 수정 * 컬렉션 1회 요청 시 받아오는 컬렉션 수 3 -> 5 조정 --- .../DTO/Collection/PagedCollectionsDTO.swift | 4 +- .../Collection/CollectionPagingEntity.swift | 4 +- .../Entity/Collection/ExploreInfoEntity.swift | 8 +- .../FetchExploreCollectionsUseCase.swift | 2 +- .../Cell/ExploreEmptyCollectionViewCell.swift | 12 ++- .../Scene/Explore/ExploreViewController.swift | 78 ++++++++----------- .../Scene/Explore/ExploreViewModel.swift | 12 +-- 7 files changed, 57 insertions(+), 63 deletions(-) diff --git a/FLINT/Data/Sources/DTO/Collection/PagedCollectionsDTO.swift b/FLINT/Data/Sources/DTO/Collection/PagedCollectionsDTO.swift index 43862bb5..3736a3f2 100644 --- a/FLINT/Data/Sources/DTO/Collection/PagedCollectionsDTO.swift +++ b/FLINT/Data/Sources/DTO/Collection/PagedCollectionsDTO.swift @@ -36,7 +36,7 @@ extension PagedCollectionsDTO { get throws { return try CollectionPagingEntity( collections: data?.map({ try $0.entity }) ?? [], - cursor: unwrap(Int64(meta?.nextCursor ?? "")) + cursor: Int64(meta?.nextCursor ?? "") ) } } @@ -46,7 +46,7 @@ extension PagedCollectionsDTO.CollectionDTO { public var entity: ExploreInfoEntity { get throws { return try ExploreInfoEntity( - id: unwrap(collectionId), + collectionId: unwrap(Int64(collectionId ?? "")), imageUrl: URL(string: imageUrl ?? ""), title: contentTitle ?? "", description: contentDescription ?? "" diff --git a/FLINT/Domain/Sources/Entity/Collection/CollectionPagingEntity.swift b/FLINT/Domain/Sources/Entity/Collection/CollectionPagingEntity.swift index 39da1752..7f542604 100644 --- a/FLINT/Domain/Sources/Entity/Collection/CollectionPagingEntity.swift +++ b/FLINT/Domain/Sources/Entity/Collection/CollectionPagingEntity.swift @@ -9,9 +9,9 @@ import Foundation public struct CollectionPagingEntity { public let collections: [ExploreInfoEntity] - public let cursor: Int64 + public let cursor: Int64? - public init(collections: [ExploreInfoEntity], cursor: Int64) { + public init(collections: [ExploreInfoEntity], cursor: Int64?) { self.collections = collections self.cursor = cursor } diff --git a/FLINT/Domain/Sources/Entity/Collection/ExploreInfoEntity.swift b/FLINT/Domain/Sources/Entity/Collection/ExploreInfoEntity.swift index 9bde9209..548685d5 100644 --- a/FLINT/Domain/Sources/Entity/Collection/ExploreInfoEntity.swift +++ b/FLINT/Domain/Sources/Entity/Collection/ExploreInfoEntity.swift @@ -7,14 +7,16 @@ import Foundation -public struct ExploreInfoEntity: Equatable, Hashable, Sendable { +public struct ExploreInfoEntity: Hashable, Sendable { public let id: String + public let collectionId: Int64 public let imageUrl: URL? public let title: String public let description: String - public init(id: String, imageUrl: URL?, title: String, description: String) { - self.id = id + public init(collectionId: Int64, imageUrl: URL?, title: String, description: String) { + id = UUID().uuidString + self.collectionId = collectionId self.imageUrl = imageUrl self.title = title self.description = description diff --git a/FLINT/Domain/Sources/UseCase/Collection/FetchExploreCollectionsUseCase.swift b/FLINT/Domain/Sources/UseCase/Collection/FetchExploreCollectionsUseCase.swift index f6b76178..129fe4eb 100644 --- a/FLINT/Domain/Sources/UseCase/Collection/FetchExploreCollectionsUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Collection/FetchExploreCollectionsUseCase.swift @@ -24,6 +24,6 @@ public final class DefaultFetchExploreCollectionsUseCase: FetchExploreCollection } public func fetchExploreCollections(cursor: Int64?) -> AnyPublisher { - collectionRepository.fetchCollections(cursor: cursor, size: 3) + collectionRepository.fetchCollections(cursor: cursor, size: 5) } } diff --git a/FLINT/Presentation/Sources/View/Scene/Explore/Cell/ExploreEmptyCollectionViewCell.swift b/FLINT/Presentation/Sources/View/Scene/Explore/Cell/ExploreEmptyCollectionViewCell.swift index 43f30624..a5809dd0 100644 --- a/FLINT/Presentation/Sources/View/Scene/Explore/Cell/ExploreEmptyCollectionViewCell.swift +++ b/FLINT/Presentation/Sources/View/Scene/Explore/Cell/ExploreEmptyCollectionViewCell.swift @@ -14,7 +14,7 @@ public final class ExploreEmptyCollectionViewCell: BaseCollectionViewCell { // MARK: - Component - public let collectionDetailButton = FlintButton(style: .able, title: "컬렉션 만들러 가기") + public let createCollectionButton = FlintButton(style: .able, title: "컬렉션 만들러 가기") public let wrapperView = UIView() @@ -64,7 +64,7 @@ public final class ExploreEmptyCollectionViewCell: BaseCollectionViewCell { public override func setHierarchy() { contentView.addSubviews( - collectionDetailButton, + createCollectionButton, wrapperView, ) wrapperView.addSubview(mainStackView) @@ -79,18 +79,22 @@ public final class ExploreEmptyCollectionViewCell: BaseCollectionViewCell { } public override func setLayout() { - collectionDetailButton.snp.makeConstraints { + createCollectionButton.snp.makeConstraints { $0.bottom.equalToSuperview().inset(32) $0.horizontalEdges.equalToSuperview().inset(16) $0.height.equalTo(48) } wrapperView.snp.makeConstraints { $0.top.horizontalEdges.equalToSuperview() - $0.bottom.equalTo(collectionDetailButton.snp.top) + $0.bottom.equalTo(createCollectionButton.snp.top) } mainStackView.snp.makeConstraints { $0.horizontalEdges.equalToSuperview().inset(16) $0.centerY.equalToSuperview() } } + + public override func prepare() { + createCollectionButton.removeTarget(nil, action: nil, for: .allEvents) + } } diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Explore/ExploreViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Explore/ExploreViewController.swift index 063655af..5e3d4190 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Explore/ExploreViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Explore/ExploreViewController.swift @@ -57,12 +57,17 @@ public final class ExploreViewController: BaseViewController { // MARK: - Setup public override func bind() { - exploreViewModel.collections.sink { [weak self] exploreInfoEntity in - Log.d(exploreInfoEntity) + exploreViewModel.collections.sink { [weak self] exploreInfoEntities in guard let self else { return } - mainCollectionViewDataSource?.apply(makeSnapshot(exploreInfoEntities: exploreViewModel.collections.value), animatingDifferences: false) + mainCollectionViewDataSource?.apply(makeSnapshot(exploreInfoEntities: exploreInfoEntities, isCollectionsExhausted: exploreViewModel.cursor.value == nil), animatingDifferences: false) } .store(in: &cancellables) + + exploreViewModel.cursor.sink(receiveValue: { [weak self] cursor in + guard let self else { return } + mainCollectionViewDataSource?.apply(makeSnapshot(exploreInfoEntities: exploreViewModel.collections.value, isCollectionsExhausted: cursor == nil), animatingDifferences: false) + }) + .store(in: &cancellables) } public override func setBaseHierarchy() { @@ -78,13 +83,15 @@ public final class ExploreViewController: BaseViewController { } } +// MARK: - MainCollectionView + extension ExploreViewController { private enum MainCollectionViewSection: Int { case main case empty } - private enum MainCollectionViewItem: Equatable, Hashable, Sendable { + private enum MainCollectionViewItem: Hashable, Sendable { case collection(ExploreInfoEntity) case empty } @@ -95,7 +102,9 @@ extension ExploreViewController { rootView.mainCollectionView.delegate = self rootView.mainCollectionView.dataSource = mainCollectionViewDataSource - mainCollectionViewDataSource = UICollectionViewDiffableDataSource(collectionView: rootView.mainCollectionView, cellProvider: { collectionView, indexPath, itemIdentifier in + mainCollectionViewDataSource = UICollectionViewDiffableDataSource(collectionView: rootView.mainCollectionView, cellProvider: { [weak self] collectionView, indexPath, itemIdentifier in + guard let self else { return UICollectionViewCell() } + switch itemIdentifier { case let .collection(collection): guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: ExploreCollectionViewCell.reuseIdentifier, for: indexPath) as? ExploreCollectionViewCell else { @@ -105,63 +114,44 @@ extension ExploreViewController { cell.collectionTitleLabel.attributedText = .pretendard(.display2_m_28, text: collection.title) cell.collectionDescriptionLabel.attributedText = .pretendard(.body1_r_16, text: collection.description) cell.collectionDetailButton.addAction(UIAction(handler: { [weak self] _ in - guard let id = Int64(collection.id) else { return } - guard let vc = self?.viewControllerFactory?.makeCollectionDetailViewController(collectionId: id) else { return } - self?.navigationController?.pushViewController(vc, animated: true) + self?.pushCollectionDetailViewController(collectionId: collection.collectionId) }), for: .touchUpInside) return cell + case .empty: guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: ExploreEmptyCollectionViewCell.reuseIdentifier, for: indexPath) as? ExploreEmptyCollectionViewCell else { return UICollectionViewCell() } + cell.createCollectionButton.addAction(UIAction(handler: pushCreateCollectionViewController(_:)), for: .touchUpInside) return cell } }) - mainCollectionViewDataSource?.apply(makeSnapshot(exploreInfoEntities: exploreViewModel.collections.value), animatingDifferences: false) + mainCollectionViewDataSource?.apply(makeSnapshot(exploreInfoEntities: exploreViewModel.collections.value, isCollectionsExhausted: exploreViewModel.cursor.value == nil), animatingDifferences: false) } - private func makeSnapshot(exploreInfoEntities: [ExploreInfoEntity]) -> NSDiffableDataSourceSnapshot { + private func makeSnapshot(exploreInfoEntities: [ExploreInfoEntity], isCollectionsExhausted: Bool) -> NSDiffableDataSourceSnapshot { var snapshot = NSDiffableDataSourceSnapshot() - snapshot.appendSections([.main, .empty]) + snapshot.appendSections([.main]) snapshot.appendItems(exploreInfoEntities.map({ MainCollectionViewItem.collection($0) }), toSection: .main) - snapshot.appendItems([MainCollectionViewItem.empty], toSection: .empty) + + if isCollectionsExhausted { + snapshot.appendSections([.empty]) + snapshot.appendItems([MainCollectionViewItem.empty], toSection: .empty) + } return snapshot } -} - -// MARK: - UICollectionViewDataSource - -extension ExploreViewController: UICollectionViewDataSource { - public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - return exploreViewModel.collections.value.count + 1 + + private func pushCollectionDetailViewController(collectionId: Int64) { + guard let vc = viewControllerFactory?.makeCollectionDetailViewController(collectionId: collectionId) else { return } + navigationController?.pushViewController(vc, animated: true) } - public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - if indexPath.item == exploreViewModel.collections.value.count { - guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: ExploreEmptyCollectionViewCell.reuseIdentifier, for: indexPath) as? ExploreEmptyCollectionViewCell else { - return UICollectionViewCell() - } - return cell - } - guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: ExploreCollectionViewCell.reuseIdentifier, for: indexPath) as? ExploreCollectionViewCell else { - return UICollectionViewCell() - } - let collection = exploreViewModel.collections.value[indexPath.item] - cell.collectionImageView.kf.setImage(with: collection.imageUrl) - cell.collectionTitleLabel.attributedText = .pretendard(.display2_m_28, text: collection.title) - cell.collectionDescriptionLabel.attributedText = .pretendard(.body1_r_16, text: collection.description) - cell.collectionDetailButton.addAction(UIAction(handler: { [weak self] _ in - guard let id = Int64(collection.id) else { return } - guard let vc = self?.viewControllerFactory?.makeCollectionDetailViewController(collectionId: id) else { return } - self?.navigationController?.pushViewController(vc, animated: true) - - }), for: .touchUpInside) - return cell + private func pushCreateCollectionViewController(_ action: UIAction) { + guard let vc = viewControllerFactory?.makeCreateCollectionViewController() else { return } + navigationController?.pushViewController(vc, animated: true) } } -// MARK: - UICollectionViewDelegateFlowLayout - extension ExploreViewController: UICollectionViewDelegateFlowLayout { public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { return collectionView.bounds.size @@ -172,8 +162,6 @@ extension ExploreViewController: UICollectionViewDelegateFlowLayout { } } -// MARK: - UIScrollViewDelegate - extension ExploreViewController: UIScrollViewDelegate { public func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { guard let collectionView = scrollView as? UICollectionView else { return } @@ -181,7 +169,7 @@ extension ExploreViewController: UIScrollViewDelegate { exploreViewModel.indexUpdated(indexPath.item) UIView.animate(withDuration: 0.25, animations: { [weak self] in guard let self else { return } - if indexPath.item == exploreViewModel.collections.value.count { + if indexPath.section == MainCollectionViewSection.empty.rawValue { setNavigationBar(.init(left: .logo, backgroundStyle: .clear)) } else { setNavigationBar(.init(left: .logo)) diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/Explore/ExploreViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/Explore/ExploreViewModel.swift index 6b2f6a46..6c39b736 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/Explore/ExploreViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/Explore/ExploreViewModel.swift @@ -17,7 +17,7 @@ public protocol ExploreViewModelInput { public protocol ExploreViewModelOutput { var index: CurrentValueSubject { get } var collections: CurrentValueSubject<[ExploreInfoEntity], Never> { get } - var cursor: Int64? { get set } + var cursor: CurrentValueSubject { get set } } public typealias ExploreViewModel = ExploreViewModelInput & ExploreViewModelOutput @@ -28,7 +28,7 @@ public final class DefaultExploreViewModel: ExploreViewModel { public var index: CurrentValueSubject = .init(0) public var collections: CurrentValueSubject<[ExploreInfoEntity], Never> = .init([]) - public var cursor: Int64? + public var cursor: CurrentValueSubject = .init(nil) private var cancellables: Set = Set() @@ -44,8 +44,8 @@ public final class DefaultExploreViewModel: ExploreViewModel { private func bind() { index.sink { [weak self] index in - guard let self else { return } - if index > collections.value.count - 3 { + guard let self, let _ = cursor.value else { return } + if index > collections.value.count - 5 { fetchCollections() } } @@ -53,12 +53,12 @@ public final class DefaultExploreViewModel: ExploreViewModel { } private func fetchCollections() { - fetchExploreCollectionsUseCase.fetchExploreCollections(cursor: cursor) + fetchExploreCollectionsUseCase.fetchExploreCollections(cursor: cursor.value) .manageThread() .sinkHandledCompletion { [weak self] collectionPagingEntity in guard let self else { return } collections.value.append(contentsOf: collectionPagingEntity.collections) - cursor = collectionPagingEntity.cursor + cursor.send(collectionPagingEntity.cursor) } .store(in: &cancellables) } From daac5433bfb76ffe3d084e7dc02b55baa5991a81 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Tue, 10 Feb 2026 23:24:41 +0900 Subject: [PATCH 37/45] =?UTF-8?q?[refactor]=20DIContainer=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FLINT/FLINT/Application/AppDelegate.swift | 11 ++-- FLINT/FLINT/Application/SceneDelegate.swift | 18 +++--- FLINT/FLINT/Dependency/DIContainer.swift | 59 ++++--------------- .../Component/ProfileImageSettingView.swift | 1 + 4 files changed, 27 insertions(+), 62 deletions(-) diff --git a/FLINT/FLINT/Application/AppDelegate.swift b/FLINT/FLINT/Application/AppDelegate.swift index 884ab483..c5272215 100644 --- a/FLINT/FLINT/Application/AppDelegate.swift +++ b/FLINT/FLINT/Application/AppDelegate.swift @@ -17,28 +17,25 @@ import Presentation @main class AppDelegate: UIResponder, UIApplicationDelegate { - + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. UIFont.registerPretendardFonts() KakaoSDK.initSDK(appKey: NetworkConfig.kakaoAppKey) return true } - + // MARK: UISceneSession Lifecycle - + func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { // Called when a new scene session is being created. // Use this method to select a configuration to create the new scene with. return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) } - + func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { // Called when the user discards a scene session. // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. // Use this method to release any resources that were specific to the discarded scenes, as they will not return. } - - } - diff --git a/FLINT/FLINT/Application/SceneDelegate.swift b/FLINT/FLINT/Application/SceneDelegate.swift index cf36522b..2f7505b7 100644 --- a/FLINT/FLINT/Application/SceneDelegate.swift +++ b/FLINT/FLINT/Application/SceneDelegate.swift @@ -13,17 +13,17 @@ import Presentation import Domain class SceneDelegate: UIResponder, UIWindowSceneDelegate { - + var window: UIWindow? let diContainer: DIContainer = DIContainer() - + func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { guard let windowScene = (scene as? UIWindowScene) else { return } window = UIWindow(windowScene: windowScene) -// let viewController = diContainer.makeSplashViewController() - let viewController = diContainer.makeTabBarViewController() + let viewController = diContainer.makeSplashViewController() +// let viewController = diContainer.makeTabBarViewController() let navigationController = UINavigationController(rootViewController: viewController).configured({ $0.navigationBar.isHidden = true }) @@ -37,27 +37,28 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { // Release any resources associated with this scene that can be re-created the next time the scene connects. // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). } - + func sceneDidBecomeActive(_ scene: UIScene) { // Called when the scene has moved from an inactive state to an active state. // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. } - + func sceneWillResignActive(_ scene: UIScene) { // Called when the scene will move from an active state to an inactive state. // This may occur due to temporary interruptions (ex. an incoming phone call). } - + func sceneWillEnterForeground(_ scene: UIScene) { // Called as the scene transitions from the background to the foreground. // Use this method to undo the changes made on entering the background. } - + func sceneDidEnterBackground(_ scene: UIScene) { // Called as the scene transitions from the foreground to the background. // Use this method to save data, release shared resources, and store enough scene-specific state information // to restore the scene back to its current state. } + func scene(_ scene: UIScene, openURLContexts URLContexts: Set) { if let url = URLContexts.first?.url { Log.d(url) @@ -67,4 +68,3 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { } } } - diff --git a/FLINT/FLINT/Dependency/DIContainer.swift b/FLINT/FLINT/Dependency/DIContainer.swift index bdc057c9..f2319ae4 100644 --- a/FLINT/FLINT/Dependency/DIContainer.swift +++ b/FLINT/FLINT/Dependency/DIContainer.swift @@ -33,56 +33,23 @@ final class DIContainer: DependencyFactory { // MARK: - Root Dependency -// lazy var tokenStorage: TokenStorage = DefaultTokenStorage() - lazy var tokenStorage: TokenStorage = TestTokenStorage() - private lazy var authInterceptor: AuthInterceptor = AuthInterceptor(tokenStorage: tokenStorage) private lazy var networkLoggerPlugin: NetworkLoggerPlugin = NetworkLoggerPlugin() - lazy var contentAPIProvider = MoyaProvider( - session: Session(interceptor: authInterceptor), - plugins: [ - networkLoggerPlugin - ] - ) - lazy var userAPIProvider = MoyaProvider( - session: Session(interceptor: authInterceptor), - plugins: [ - networkLoggerPlugin - ] - ) - lazy var collectionAPIProvider = MoyaProvider( - session: Session(interceptor: authInterceptor), - plugins: [ - networkLoggerPlugin - ] - ) - lazy var searchAPIProvider = MoyaProvider( - session: Session(interceptor: authInterceptor), - plugins: [ - networkLoggerPlugin - ] - ) - lazy var bookmarkAPIProvider = MoyaProvider( - session: Session(interceptor: authInterceptor), - plugins: [ - networkLoggerPlugin - ] - ) - - lazy var authAPIProvider = MoyaProvider( - session: Session(interceptor: authInterceptor), - plugins: [ - networkLoggerPlugin - ] - ) + private lazy var session: Session = Session(interceptor: authInterceptor) + private lazy var plugins: [PluginType] = [] +// private lazy var plugins: [PluginType] = [networkLoggerPlugin] + + lazy var authAPIProvider = MoyaProvider(session: session, plugins: plugins) + lazy var bookmarkAPIProvider = MoyaProvider(session: session, plugins: plugins) + lazy var collectionAPIProvider = MoyaProvider(session: session, plugins: plugins) + lazy var contentAPIProvider = MoyaProvider(session: session, plugins: plugins) + lazy var homeAPIProvider = MoyaProvider(session: session, plugins: plugins) + lazy var searchAPIProvider = MoyaProvider(session: session, plugins: plugins) + lazy var userAPIProvider = MoyaProvider(session: session, plugins: plugins) - lazy var homeAPIProvider = MoyaProvider( - session: Session(interceptor: authInterceptor), - plugins: [ - networkLoggerPlugin - ] - ) + lazy var tokenStorage: TokenStorage = DefaultTokenStorage() +// lazy var tokenStorage: TokenStorage = TestTokenStorage() // MARK: - Init diff --git a/FLINT/Presentation/Sources/View/Component/ProfileImageSettingView.swift b/FLINT/Presentation/Sources/View/Component/ProfileImageSettingView.swift index 04ecbb16..898704ee 100644 --- a/FLINT/Presentation/Sources/View/Component/ProfileImageSettingView.swift +++ b/FLINT/Presentation/Sources/View/Component/ProfileImageSettingView.swift @@ -23,6 +23,7 @@ public final class ProfileImageSettingView: BaseView { public let settingButton = UIButton().then { $0.setImage(.icProfileChange, for: .normal) + // TODO: - Profile Image 설정 기능 구현 시 제거할 것!!!! $0.isHidden = true } From f1a3a7659431fee4adc2f3d02d03c8c3497907c0 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Tue, 10 Feb 2026 23:39:13 +0900 Subject: [PATCH 38/45] =?UTF-8?q?[refactor]=20CollectionView=20dequeueReus?= =?UTF-8?q?ableCell=20=ED=95=A8=EC=88=98=20=EA=B0=84=EC=86=8C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extension/UICollectionView+.swift | 19 +++++++++++++++++++ .../Scene/Explore/ExploreViewController.swift | 8 ++------ 2 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 FLINT/Presentation/Sources/ViewController/Extension/UICollectionView+.swift diff --git a/FLINT/Presentation/Sources/ViewController/Extension/UICollectionView+.swift b/FLINT/Presentation/Sources/ViewController/Extension/UICollectionView+.swift new file mode 100644 index 00000000..de4505e1 --- /dev/null +++ b/FLINT/Presentation/Sources/ViewController/Extension/UICollectionView+.swift @@ -0,0 +1,19 @@ +// +// UICollectionView+.swift +// Presentation +// +// Created by 김호성 on 2026.02.10. +// + +import UIKit + +import View + +extension UICollectionView { + public func dequeueReusableCell(_ cellType: T.Type, for indexPath: IndexPath) -> T { + guard let cell: T = dequeueReusableCell(withReuseIdentifier: cellType.reuseIdentifier, for: indexPath) as? T else { + fatalError("Failed to dequeue reusable cell of type \(cellType) with reuseIdentifier \(cellType.reuseIdentifier).") + } + return cell + } +} diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Explore/ExploreViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Explore/ExploreViewController.swift index 5e3d4190..10c475e9 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Explore/ExploreViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Explore/ExploreViewController.swift @@ -107,9 +107,7 @@ extension ExploreViewController { switch itemIdentifier { case let .collection(collection): - guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: ExploreCollectionViewCell.reuseIdentifier, for: indexPath) as? ExploreCollectionViewCell else { - return UICollectionViewCell() - } + let cell = collectionView.dequeueReusableCell(ExploreCollectionViewCell.self, for: indexPath) cell.collectionImageView.kf.setImage(with: collection.imageUrl) cell.collectionTitleLabel.attributedText = .pretendard(.display2_m_28, text: collection.title) cell.collectionDescriptionLabel.attributedText = .pretendard(.body1_r_16, text: collection.description) @@ -119,9 +117,7 @@ extension ExploreViewController { return cell case .empty: - guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: ExploreEmptyCollectionViewCell.reuseIdentifier, for: indexPath) as? ExploreEmptyCollectionViewCell else { - return UICollectionViewCell() - } + let cell = collectionView.dequeueReusableCell(ExploreEmptyCollectionViewCell.self, for: indexPath) cell.createCollectionButton.addAction(UIAction(handler: pushCreateCollectionViewController(_:)), for: .touchUpInside) return cell } From 9e06b093db562656e302cbdd2f505e9c44c1c787 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Fri, 13 Feb 2026 14:40:57 +0900 Subject: [PATCH 39/45] =?UTF-8?q?[refactor]=20CollectionInfoEntity=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0=20&=20=EC=A4=91=EB=B3=B5=EB=90=98=EB=8A=94?= =?UTF-8?q?=20DTO=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DTO/Collection/CollectionDTO.swift | 23 +++---- .../DTO/Collection/CollectionDetailDTO.swift | 4 +- ...lectionsDTO.swift => CollectionsDTO.swift} | 8 +-- .../HomeRecommendedCollectionsDTO.swift | 22 ------- .../RecentViewedCollectionsDTO.swift | 22 ------- .../Service/CollectionService.swift | 6 +- .../Networking/Service/HomeService.swift | 6 +- .../Networking/Service/UserService.swift | 24 +++---- .../RepositoryImpl/HomeRepositoryImpl.swift | 3 +- .../Domain/Util/Extension/Collection+.swift | 15 +++++ .../Collection/CollectionDetailEntity.swift | 63 ++++++++++--------- .../Entity/Collection/CollectionEntity.swift | 23 ++----- .../Collection/CollectionInfoEntity.swift | 24 ------- .../Sources/Repository/HomeRepository.swift | 2 +- .../FetchRecommendedCollectionsUseCase.swift | 4 +- .../MoreNoMoreCollectionItemCell.swift | 8 +-- .../MoreNoMoreCollectionTableViewCell.swift | 6 +- .../CollectionDetailFilmTableViewCell.swift | 2 +- .../CollectionFolderListViewController.swift | 8 +-- .../Home/CollectionFolderListViewModel.swift | 6 +- .../ViewModel/Scene/Home/HomeViewModel.swift | 8 +-- .../Scene/Profile/ProfileViewModel.swift | 16 ++--- 22 files changed, 110 insertions(+), 193 deletions(-) rename FLINT/Data/Sources/DTO/Collection/{UserCollectionsDTO.swift => CollectionsDTO.swift} (64%) delete mode 100644 FLINT/Data/Sources/DTO/Collection/HomeRecommendedCollectionsDTO.swift delete mode 100644 FLINT/Data/Sources/DTO/Collection/RecentViewedCollectionsDTO.swift create mode 100644 FLINT/Domain/Sources/Domain/Util/Extension/Collection+.swift delete mode 100644 FLINT/Domain/Sources/Entity/Collection/CollectionInfoEntity.swift rename FLINT/Presentation/Sources/ViewController/Scene/{Home => }/CollectionFolder/CollectionFolderListViewController.swift (97%) diff --git a/FLINT/Data/Sources/DTO/Collection/CollectionDTO.swift b/FLINT/Data/Sources/DTO/Collection/CollectionDTO.swift index 3b1167ae..19214e6c 100644 --- a/FLINT/Data/Sources/DTO/Collection/CollectionDTO.swift +++ b/FLINT/Data/Sources/DTO/Collection/CollectionDTO.swift @@ -30,24 +30,15 @@ extension CollectionDTO { thumbnailUrl: URL(string: thumbnailUrl ?? ""), title: title ?? "", description: description ?? "", - imageList: imageList ?? [], + imageList: imageList?.compactMap({ URL(string: $0) }) ?? [], bookmarkCount: bookmarkCount ?? 0, isBookmarked: isBookmarked ?? false, - userId: unwrap(userId), - nickname: nickname ?? "", - profileImageUrl: URL(string: profileImageUrl ?? "") - ) - } - } - - public var collectionInfoEntity: CollectionInfoEntity { - get throws { - return try CollectionInfoEntity( - id: unwrap(id), - imageUrl: URL(string: thumbnailUrl ?? ""), - profileImageUrl: URL(string: profileImageUrl ?? ""), - title: title ?? "", - userName: nickname ?? "" + user: UserProfileEntity( + id: unwrap(userId), + nickname: nickname ?? "", + profileImageUrl: URL(string: profileImageUrl ?? ""), + role: .unknown + ) ) } } diff --git a/FLINT/Data/Sources/DTO/Collection/CollectionDetailDTO.swift b/FLINT/Data/Sources/DTO/Collection/CollectionDetailDTO.swift index 818a477d..921adc06 100644 --- a/FLINT/Data/Sources/DTO/Collection/CollectionDetailDTO.swift +++ b/FLINT/Data/Sources/DTO/Collection/CollectionDetailDTO.swift @@ -72,9 +72,9 @@ extension CollectionDetailDTO.AuthorDTO { } extension CollectionDetailDTO.ContentDTO { - public var entity: CollectionContentEntity { + public var entity: CollectionDetailEntity.CollectionContentEntity { get throws { - return try CollectionContentEntity( + return try CollectionDetailEntity.CollectionContentEntity( id: unwrap(id), title: title ?? "", imageUrl: URL(string: imageUrl ?? ""), diff --git a/FLINT/Data/Sources/DTO/Collection/UserCollectionsDTO.swift b/FLINT/Data/Sources/DTO/Collection/CollectionsDTO.swift similarity index 64% rename from FLINT/Data/Sources/DTO/Collection/UserCollectionsDTO.swift rename to FLINT/Data/Sources/DTO/Collection/CollectionsDTO.swift index 681ca501..6c12fb6b 100644 --- a/FLINT/Data/Sources/DTO/Collection/UserCollectionsDTO.swift +++ b/FLINT/Data/Sources/DTO/Collection/CollectionsDTO.swift @@ -1,19 +1,19 @@ // -// UserCollectionsDTO.swift +// HomeRecommendedCollectionsDTO.swift // Data // -// Created by 진소은 on 1/23/26. +// Created by 소은 on 1/20/26. // import Foundation import Entity -public struct UserCollectionsDTO: Codable { +public struct CollectionsDTO: Codable { public let collections: [CollectionDTO]? } -extension UserCollectionsDTO { +extension CollectionsDTO { public var entities: [CollectionEntity] { get throws { return try collections?.map { try $0.collectionEntity } ?? [] diff --git a/FLINT/Data/Sources/DTO/Collection/HomeRecommendedCollectionsDTO.swift b/FLINT/Data/Sources/DTO/Collection/HomeRecommendedCollectionsDTO.swift deleted file mode 100644 index c5e9b592..00000000 --- a/FLINT/Data/Sources/DTO/Collection/HomeRecommendedCollectionsDTO.swift +++ /dev/null @@ -1,22 +0,0 @@ -// -// HomeRecommendedCollectionsDTO.swift -// Data -// -// Created by 소은 on 1/20/26. -// - -import Foundation - -import Entity - -public struct HomeRecommendedCollectionsDTO: Codable { - public let collections: [CollectionDTO]? -} - -extension HomeRecommendedCollectionsDTO { - public var entities: [CollectionInfoEntity] { - get throws { - return try collections?.map { try $0.collectionInfoEntity } ?? [] - } - } -} diff --git a/FLINT/Data/Sources/DTO/Collection/RecentViewedCollectionsDTO.swift b/FLINT/Data/Sources/DTO/Collection/RecentViewedCollectionsDTO.swift deleted file mode 100644 index 68d09729..00000000 --- a/FLINT/Data/Sources/DTO/Collection/RecentViewedCollectionsDTO.swift +++ /dev/null @@ -1,22 +0,0 @@ -// -// RecentViewedCollectionsDTO.swift -// Data -// -// Created by 소은 on 1/24/26. -// - -import Foundation - -import Entity - -public struct RecentViewedCollectionsDTO: Codable { - public let collections: [CollectionDTO]? -} - -extension RecentViewedCollectionsDTO { - public var entities: [CollectionEntity] { - get throws { - return try collections?.compactMap { try $0.collectionEntity } ?? [] - } - } -} diff --git a/FLINT/Data/Sources/Networking/Service/CollectionService.swift b/FLINT/Data/Sources/Networking/Service/CollectionService.swift index 2fddf0a6..70f01c2f 100644 --- a/FLINT/Data/Sources/Networking/Service/CollectionService.swift +++ b/FLINT/Data/Sources/Networking/Service/CollectionService.swift @@ -19,7 +19,7 @@ public protocol CollectionService { func fetchCollections(cursor: Int64?, size: Int32) -> AnyPublisher func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher func fetchCollectionDetail(collectionId: Int64) -> AnyPublisher - func fetchRecentViewedCollections() -> AnyPublisher + func fetchRecentViewedCollections() -> AnyPublisher } public final class DefaultCollectionService: CollectionService { @@ -45,8 +45,8 @@ public final class DefaultCollectionService: CollectionService { .mapBaseResponseData(CollectionDetailDTO.self) } - public func fetchRecentViewedCollections() -> AnyPublisher { + public func fetchRecentViewedCollections() -> AnyPublisher { return collectionAPIProvider.requestPublisher(.fetchRecentViewedCollections) - .mapBaseResponseData(RecentViewedCollectionsDTO.self) + .mapBaseResponseData(CollectionsDTO.self) } } diff --git a/FLINT/Data/Sources/Networking/Service/HomeService.swift b/FLINT/Data/Sources/Networking/Service/HomeService.swift index 39bc275b..24f99f38 100644 --- a/FLINT/Data/Sources/Networking/Service/HomeService.swift +++ b/FLINT/Data/Sources/Networking/Service/HomeService.swift @@ -14,7 +14,7 @@ import Moya import DTO public protocol HomeService { - func fetchRecommendedCollections() -> AnyPublisher + func fetchRecommendedCollections() -> AnyPublisher } public final class DefaultHomeService: HomeService { @@ -25,9 +25,9 @@ public final class DefaultHomeService: HomeService { self.homeAPIProvider = homeAPIProvider } - public func fetchRecommendedCollections() -> AnyPublisher { + public func fetchRecommendedCollections() -> AnyPublisher { return homeAPIProvider.requestPublisher(.fetchRecommendedCollections) - .mapBaseResponseData(HomeRecommendedCollectionsDTO.self) + .mapBaseResponseData(CollectionsDTO.self) } } diff --git a/FLINT/Data/Sources/Networking/Service/UserService.swift b/FLINT/Data/Sources/Networking/Service/UserService.swift index c2685026..9ee9639d 100644 --- a/FLINT/Data/Sources/Networking/Service/UserService.swift +++ b/FLINT/Data/Sources/Networking/Service/UserService.swift @@ -15,14 +15,14 @@ import DTO public protocol UserService { func fetchUserProfile(userId: Int64) -> AnyPublisher - func fetchUserBookmarkedCollections(userId: Int64) -> AnyPublisher + func fetchUserBookmarkedCollections(userId: Int64) -> AnyPublisher func fetchUserBookmarkedContents(userId: Int64) -> AnyPublisher - func fetchUserCreatedCollections(userId: Int64) -> AnyPublisher + func fetchUserCreatedCollections(userId: Int64) -> AnyPublisher func fetchUserKeywords(userId: Int64) -> AnyPublisher func fetchMyProfile() -> AnyPublisher - func fetchMyBookmarkedCollections() -> AnyPublisher - func fetchMyCreatedCollections() -> AnyPublisher + func fetchMyBookmarkedCollections() -> AnyPublisher + func fetchMyCreatedCollections() -> AnyPublisher func fetchMyKeywords() -> AnyPublisher func recalculateMyKeywords() -> AnyPublisher @@ -42,9 +42,9 @@ public final class DefaultUserService: UserService { .mapBaseResponseData(UserProfileDTO.self) } - public func fetchUserBookmarkedCollections(userId: Int64) -> AnyPublisher { + public func fetchUserBookmarkedCollections(userId: Int64) -> AnyPublisher { return userAPIProvider.requestPublisher(.fetchUserBookmarkedCollections(userId: userId)) - .mapBaseResponseData(UserCollectionsDTO.self) + .mapBaseResponseData(CollectionsDTO.self) } public func fetchUserBookmarkedContents(userId: Int64) -> AnyPublisher { @@ -57,9 +57,9 @@ public final class DefaultUserService: UserService { .mapBaseResponseData(KeywordsDTO.self) } - public func fetchUserCreatedCollections(userId: Int64) -> AnyPublisher { + public func fetchUserCreatedCollections(userId: Int64) -> AnyPublisher { return userAPIProvider.requestPublisher(.fetchUserCreatedCollections(userId: userId)) - .mapBaseResponseData(UserCollectionsDTO.self) + .mapBaseResponseData(CollectionsDTO.self) } public func fetchMyProfile() -> AnyPublisher { @@ -67,14 +67,14 @@ public final class DefaultUserService: UserService { .mapBaseResponseData(UserProfileDTO.self) } - public func fetchMyBookmarkedCollections() -> AnyPublisher { + public func fetchMyBookmarkedCollections() -> AnyPublisher { return userAPIProvider.requestPublisher(.fetchMyBookmarkedCollections) - .mapBaseResponseData(UserCollectionsDTO.self) + .mapBaseResponseData(CollectionsDTO.self) } - public func fetchMyCreatedCollections() -> AnyPublisher { + public func fetchMyCreatedCollections() -> AnyPublisher { return userAPIProvider.requestPublisher(.fetchMyCreatedCollections) - .mapBaseResponseData(UserCollectionsDTO.self) + .mapBaseResponseData(CollectionsDTO.self) } public func fetchMyKeywords() -> AnyPublisher { diff --git a/FLINT/Data/Sources/RepositoryImpl/HomeRepositoryImpl.swift b/FLINT/Data/Sources/RepositoryImpl/HomeRepositoryImpl.swift index c9c821a3..9681cbf5 100644 --- a/FLINT/Data/Sources/RepositoryImpl/HomeRepositoryImpl.swift +++ b/FLINT/Data/Sources/RepositoryImpl/HomeRepositoryImpl.swift @@ -21,10 +21,9 @@ public final class DefaultHomeRepository: HomeRepository { self.homeService = homeService } - public func fetchRecommendedCollections() -> AnyPublisher<[CollectionInfoEntity], Error> { + public func fetchRecommendedCollections() -> AnyPublisher<[CollectionEntity], Error> { return homeService.fetchRecommendedCollections() .tryMap { try $0.entities } .eraseToAnyPublisher() } } - diff --git a/FLINT/Domain/Sources/Domain/Util/Extension/Collection+.swift b/FLINT/Domain/Sources/Domain/Util/Extension/Collection+.swift new file mode 100644 index 00000000..bc7ce0e5 --- /dev/null +++ b/FLINT/Domain/Sources/Domain/Util/Extension/Collection+.swift @@ -0,0 +1,15 @@ +// +// Collection+.swift +// Domain +// +// Created by 김호성 on 2026.02.13. +// + + +import Foundation + +extension Collection { + public subscript(safe index: Index) -> Element? { + return indices.contains(index) ? self[index] : nil + } +} diff --git a/FLINT/Domain/Sources/Entity/Collection/CollectionDetailEntity.swift b/FLINT/Domain/Sources/Entity/Collection/CollectionDetailEntity.swift index 563b3856..8c36c26c 100644 --- a/FLINT/Domain/Sources/Entity/Collection/CollectionDetailEntity.swift +++ b/FLINT/Domain/Sources/Entity/Collection/CollectionDetailEntity.swift @@ -38,36 +38,39 @@ public struct CollectionDetailEntity: Equatable { } } -public struct CollectionContentEntity: Equatable { - public let id: String - public let title: String - public let imageUrl: URL? - public let director: String - public let isBookmarked: Bool - public let bookmarkCount: Int - public let isSpoiler: Bool - public let reason: String - public let year: Int +extension CollectionDetailEntity { + public struct CollectionContentEntity: Equatable { + public let id: String + public let title: String + public let imageUrl: URL? + public let director: String + public let isBookmarked: Bool + public let bookmarkCount: Int + public let isSpoiler: Bool + public let reason: String + public let year: Int - public init( - id: String, - title: String, - imageUrl: URL?, - director: String, - isBookmarked: Bool, - bookmarkCount: Int, - isSpoiler: Bool, - reason: String, - year: Int - ) { - self.id = id - self.title = title - self.imageUrl = imageUrl - self.director = director - self.isBookmarked = isBookmarked - self.bookmarkCount = bookmarkCount - self.isSpoiler = isSpoiler - self.reason = reason - self.year = year + public init( + id: String, + title: String, + imageUrl: URL?, + director: String, + isBookmarked: Bool, + bookmarkCount: Int, + isSpoiler: Bool, + reason: String, + year: Int + ) { + self.id = id + self.title = title + self.imageUrl = imageUrl + self.director = director + self.isBookmarked = isBookmarked + self.bookmarkCount = bookmarkCount + self.isSpoiler = isSpoiler + self.reason = reason + self.year = year + } } + } diff --git a/FLINT/Domain/Sources/Entity/Collection/CollectionEntity.swift b/FLINT/Domain/Sources/Entity/Collection/CollectionEntity.swift index c6b0a1c5..5098b424 100644 --- a/FLINT/Domain/Sources/Entity/Collection/CollectionEntity.swift +++ b/FLINT/Domain/Sources/Entity/Collection/CollectionEntity.swift @@ -12,25 +12,12 @@ public struct CollectionEntity: Equatable { public let thumbnailUrl: URL? public let title: String public let description: String - public let imageList: [String] + public let imageList: [URL] public let bookmarkCount: Int public let isBookmarked: Bool - public let userId: String - public let nickname: String - public let profileImageUrl: URL? + public let user: UserProfileEntity - public init( - id: String, - thumbnailUrl: URL?, - title: String, - description: String, - imageList: [String], - bookmarkCount: Int, - isBookmarked: Bool, - userId: String, - nickname: String, - profileImageUrl: URL? - ) { + public init(id: String, thumbnailUrl: URL?, title: String, description: String, imageList: [URL], bookmarkCount: Int, isBookmarked: Bool, user: UserProfileEntity) { self.id = id self.thumbnailUrl = thumbnailUrl self.title = title @@ -38,8 +25,6 @@ public struct CollectionEntity: Equatable { self.imageList = imageList self.bookmarkCount = bookmarkCount self.isBookmarked = isBookmarked - self.userId = userId - self.nickname = nickname - self.profileImageUrl = profileImageUrl + self.user = user } } diff --git a/FLINT/Domain/Sources/Entity/Collection/CollectionInfoEntity.swift b/FLINT/Domain/Sources/Entity/Collection/CollectionInfoEntity.swift deleted file mode 100644 index 07f6c846..00000000 --- a/FLINT/Domain/Sources/Entity/Collection/CollectionInfoEntity.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// CollectionInfoEntity.swift -// Domain -// -// Created by 소은 on 1/22/26. -// - -import Foundation - -public struct CollectionInfoEntity { - public let id: String - public let imageUrl: URL? - public let profileImageUrl: URL? - public let title: String - public let userName: String - - public init(id: String, imageUrl: URL?, profileImageUrl: URL?, title: String, userName: String) { - self.id = id - self.imageUrl = imageUrl - self.profileImageUrl = profileImageUrl - self.title = title - self.userName = userName - } -} diff --git a/FLINT/Domain/Sources/Repository/HomeRepository.swift b/FLINT/Domain/Sources/Repository/HomeRepository.swift index a4c70c7b..c366fc9a 100644 --- a/FLINT/Domain/Sources/Repository/HomeRepository.swift +++ b/FLINT/Domain/Sources/Repository/HomeRepository.swift @@ -11,5 +11,5 @@ import Foundation import Entity public protocol HomeRepository { - func fetchRecommendedCollections() -> AnyPublisher<[CollectionInfoEntity], Error> + func fetchRecommendedCollections() -> AnyPublisher<[CollectionEntity], Error> } diff --git a/FLINT/Domain/Sources/UseCase/Collection/FetchRecommendedCollectionsUseCase.swift b/FLINT/Domain/Sources/UseCase/Collection/FetchRecommendedCollectionsUseCase.swift index 0172748c..76e8ac9d 100644 --- a/FLINT/Domain/Sources/UseCase/Collection/FetchRecommendedCollectionsUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Collection/FetchRecommendedCollectionsUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol FetchRecommendedCollectionsUseCase { - func fetchRecommendedCollections() -> AnyPublisher<[CollectionInfoEntity], Error> + func fetchRecommendedCollections() -> AnyPublisher<[CollectionEntity], Error> } public final class DefaultFetchRecommendedCollectionsUseCase: FetchRecommendedCollectionsUseCase { @@ -23,7 +23,7 @@ public final class DefaultFetchRecommendedCollectionsUseCase: FetchRecommendedCo self.homeRepository = homeRepository } - public func fetchRecommendedCollections() -> AnyPublisher<[CollectionInfoEntity], Error> { + public func fetchRecommendedCollections() -> AnyPublisher<[CollectionEntity], Error> { return homeRepository.fetchRecommendedCollections() } } diff --git a/FLINT/Presentation/Sources/View/Component/MoreNoMoreCollection/MoreNoMoreCollectionItemCell.swift b/FLINT/Presentation/Sources/View/Component/MoreNoMoreCollection/MoreNoMoreCollectionItemCell.swift index 2fe268d5..6c886eb3 100644 --- a/FLINT/Presentation/Sources/View/Component/MoreNoMoreCollection/MoreNoMoreCollectionItemCell.swift +++ b/FLINT/Presentation/Sources/View/Component/MoreNoMoreCollection/MoreNoMoreCollectionItemCell.swift @@ -110,10 +110,10 @@ public final class MoreNoMoreCollectionItemCell: BaseCollectionViewCell { userNameLabel.attributedText = nil } - public func configure(entity: CollectionInfoEntity) { + public func configure(entity: CollectionEntity) { // 썸네일 - if let url = entity.imageUrl { + if let url = entity.thumbnailUrl { posterImageView.kf.setImage( with: url, placeholder: UIImage(resource: .imgBackgroundGradiantMiddle) @@ -123,7 +123,7 @@ public final class MoreNoMoreCollectionItemCell: BaseCollectionViewCell { } // 프로필 이미지 - if let url = entity.profileImageUrl { + if let url = entity.user.profileImageUrl { profileImageView.kf.setImage( with: url, placeholder: UIImage(resource: .imgProfileGray) @@ -141,7 +141,7 @@ public final class MoreNoMoreCollectionItemCell: BaseCollectionViewCell { userNameLabel.attributedText = .pretendard( .caption1_r_12, - text: entity.userName, + text: entity.user.nickname, color: .flintGray200 ) } diff --git a/FLINT/Presentation/Sources/View/Component/MoreNoMoreCollection/MoreNoMoreCollectionTableViewCell.swift b/FLINT/Presentation/Sources/View/Component/MoreNoMoreCollection/MoreNoMoreCollectionTableViewCell.swift index 7be44e0f..f0588dd4 100644 --- a/FLINT/Presentation/Sources/View/Component/MoreNoMoreCollection/MoreNoMoreCollectionTableViewCell.swift +++ b/FLINT/Presentation/Sources/View/Component/MoreNoMoreCollection/MoreNoMoreCollectionTableViewCell.swift @@ -14,8 +14,8 @@ import Entity public final class MoreNoMoreCollectionTableViewCell: BaseTableViewCell { - public var onSelectItem: ((CollectionInfoEntity) -> Void)? - private var items: [CollectionInfoEntity] = [] + public var onSelectItem: ((CollectionEntity) -> Void)? + private var items: [CollectionEntity] = [] // MARK: - UI @@ -62,7 +62,7 @@ public final class MoreNoMoreCollectionTableViewCell: BaseTableViewCell { // MARK: - Public - public func configure(items: [CollectionInfoEntity]) { + public func configure(items: [CollectionEntity]) { self.items = items collectionView.reloadData() } diff --git a/FLINT/Presentation/Sources/View/Scene/CollectionDetail/CollectionDetailFilmTableViewCell.swift b/FLINT/Presentation/Sources/View/Scene/CollectionDetail/CollectionDetailFilmTableViewCell.swift index 8cacdef7..0de866f3 100644 --- a/FLINT/Presentation/Sources/View/Scene/CollectionDetail/CollectionDetailFilmTableViewCell.swift +++ b/FLINT/Presentation/Sources/View/Scene/CollectionDetail/CollectionDetailFilmTableViewCell.swift @@ -280,7 +280,7 @@ extension UIButton { public extension CollectionDetailFilmTableViewCell { - func configure(item: CollectionContentEntity) { + func configure(item: CollectionDetailEntity.CollectionContentEntity) { // 이미지 if let url = item.imageUrl { poster.kf.setImage(with: url) diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Home/CollectionFolder/CollectionFolderListViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/CollectionFolder/CollectionFolderListViewController.swift similarity index 97% rename from FLINT/Presentation/Sources/ViewController/Scene/Home/CollectionFolder/CollectionFolderListViewController.swift rename to FLINT/Presentation/Sources/ViewController/Scene/CollectionFolder/CollectionFolderListViewController.swift index fd1e8552..020038e3 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Home/CollectionFolder/CollectionFolderListViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/CollectionFolder/CollectionFolderListViewController.swift @@ -109,17 +109,17 @@ extension CollectionFolderListViewController: UICollectionViewDataSource { let entity = viewModel.items[indexPath.item] - let firstURL = URL(string: entity.imageList.first ?? "") ?? entity.thumbnailUrl + let firstURL = entity.imageList.first ?? entity.thumbnailUrl let secondString = entity.imageList.count > 1 ? entity.imageList[1] : nil - let secondURL = secondString.flatMap(URL.init(string:)) - let profileURL = entity.profileImageUrl + let secondURL = entity.imageList[safe: 1] + let profileURL = entity.user.profileImageUrl cell.configure( .init( firstPosterURL: firstURL, secondPosterURL: secondURL, profileImageURL: profileURL, - name: entity.nickname, + name: entity.user.nickname, title: entity.title, description: entity.description, isBookmarked: entity.isBookmarked, diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/Home/CollectionFolderListViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/Home/CollectionFolderListViewModel.swift index 187931af..e1530f43 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/Home/CollectionFolderListViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/Home/CollectionFolderListViewModel.swift @@ -50,10 +50,8 @@ public final class CollectionFolderListViewModel { description: old.description, imageList: old.imageList, bookmarkCount: old.bookmarkCount, - isBookmarked: isBookmarked, - userId: old.userId, - nickname: old.nickname, - profileImageUrl: old.profileImageUrl + isBookmarked: isBookmarked, + user: old.user ) } diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/Home/HomeViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/Home/HomeViewModel.swift index 8b7b59d2..3999c721 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/Home/HomeViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/Home/HomeViewModel.swift @@ -26,7 +26,7 @@ public final class HomeViewModel { public enum Row { case greeting(userName: String) case header(style: TitleHeaderStyle, title: String, subtitle: String) - case fliner(items: [CollectionInfoEntity]) + case fliner(items: [CollectionEntity]) case recentSavedContents(items: [ContentInfoEntity]) case ctaButton(title: String) } @@ -46,7 +46,7 @@ public final class HomeViewModel { // MARK: - State private var userName: String - private var flinerCollections: [CollectionInfoEntity] = [] + private var flinerCollections: [CollectionEntity] = [] private var recentSavedContents: [ContentInfoEntity] = [] private var watchingCollections: [CollectionEntity] = [] @@ -188,9 +188,7 @@ public final class HomeViewModel { title: "눈여겨보고 있는 컬렉션", subtitle: "\(userName)님이 최근 살펴본 컬렉션이에요" ), - .fliner(items: watchingCollections.map({ collectionEntity in - return CollectionInfoEntity(id: collectionEntity.id, imageUrl: collectionEntity.thumbnailUrl, profileImageUrl: collectionEntity.profileImageUrl, title: collectionEntity.title, userName: collectionEntity.nickname) - })) + .fliner(items: watchingCollections) ] } diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/Profile/ProfileViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/Profile/ProfileViewModel.swift index 981ea57e..32fc755d 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/Profile/ProfileViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/Profile/ProfileViewModel.swift @@ -31,8 +31,8 @@ public final class ProfileViewModel { case profileHeader(nickname: String, profileImageUrl: URL?, isFliner: Bool) case titleHeader(style: TitleHeaderStyle, title: String, subtitle: String) case preferenceChips(keywords: [KeywordEntity]) - case myCollections(items: [CollectionInfoEntity]) - case savedCollections(items: [CollectionInfoEntity]) + case myCollections(items: [CollectionEntity]) + case savedCollections(items: [CollectionEntity]) case savedContents(items: [ContentInfoEntity]) } @@ -58,8 +58,8 @@ public final class ProfileViewModel { private var profileImageUrl: URL? private var keywords: [KeywordEntity] = [] - private var myCollections: [CollectionInfoEntity] = [] - private var savedCollections: [CollectionInfoEntity] = [] + private var myCollections: [CollectionEntity] = [] + private var savedCollections: [CollectionEntity] = [] private var savedContents: [ContentInfoEntity] = [] public init( @@ -118,9 +118,7 @@ public final class ProfileViewModel { } } receiveValue: { [weak self] items in guard let self else { return } - self.myCollections = items.map({ collectionEntity in - return CollectionInfoEntity(id: collectionEntity.id, imageUrl: collectionEntity.thumbnailUrl, profileImageUrl: collectionEntity.profileImageUrl, title: collectionEntity.title, userName: collectionEntity.nickname) - }) + self.myCollections = items self.rows = self.makeRows() } .store(in: &cancellables) @@ -134,9 +132,7 @@ public final class ProfileViewModel { } receiveValue: { [weak self] items in print("asdf", items.count) guard let self else { return } - self.savedCollections = items.map({ collectionEntity in - return CollectionInfoEntity(id: collectionEntity.id, imageUrl: collectionEntity.thumbnailUrl, profileImageUrl: collectionEntity.profileImageUrl, title: collectionEntity.title, userName: collectionEntity.nickname) - }) + self.savedCollections = items self.rows = self.makeRows() } .store(in: &cancellables) From ab2806c4426fa7c18475aed4fa69321b509e0632 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Sat, 14 Feb 2026 15:51:45 +0900 Subject: [PATCH 40/45] =?UTF-8?q?[refactor]=20Onboarding=20Content=20Selec?= =?UTF-8?q?t=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/Content/ContentInfoEntity.swift | 1 + .../FilmSelectViewControllerFactory+.swift | 8 +- ...> SelectedContentCollectionViewCell.swift} | 4 +- .../AddContentSelectView.swift | 2 +- ...OnboardingContentCollectionViewCell.swift} | 5 +- ...lectView.swift => ContentSelectView.swift} | 20 ++-- .../Nickname/NicknameView.swift | 0 .../Dependency/ViewControllerFactory.swift | 2 +- .../AddContentSelectViewController.swift | 4 +- ...wift => ContentSelectViewController.swift} | 104 +++++++++--------- .../Nickname/NicknameViewController.swift | 4 +- .../Onboarding/OnboardingViewModel.swift | 8 +- 12 files changed, 81 insertions(+), 81 deletions(-) rename FLINT/Presentation/Sources/View/Component/Cell/{FilmPreviewCollectionViewCell.swift => SelectedContentCollectionViewCell.swift} (89%) rename FLINT/Presentation/Sources/View/Scene/Onboarding/FilmSelect/Cell/{OnboardingFilmCollectionViewCell.swift => OnboardingContentCollectionViewCell.swift} (93%) rename FLINT/Presentation/Sources/View/Scene/Onboarding/FilmSelect/{FilmSelectView.swift => ContentSelectView.swift} (93%) rename FLINT/Presentation/Sources/View/Scene/{ => Onboarding}/Nickname/NicknameView.swift (100%) rename FLINT/Presentation/Sources/ViewController/Scene/Onboarding/FilmSelect/{FilmSelectViewController.swift => ContentSelectViewController.swift} (66%) diff --git a/FLINT/Domain/Sources/Entity/Content/ContentInfoEntity.swift b/FLINT/Domain/Sources/Entity/Content/ContentInfoEntity.swift index dfc6e4cb..edfb4473 100644 --- a/FLINT/Domain/Sources/Entity/Content/ContentInfoEntity.swift +++ b/FLINT/Domain/Sources/Entity/Content/ContentInfoEntity.swift @@ -29,6 +29,7 @@ public struct ContentInfoEntity: Equatable { } } +// TODO: - OTT Entity 통일하기 public struct OttSimpleEntity: Equatable { public let ottName: String public let logoUrl: String diff --git a/FLINT/FLINT/Dependency/Factory/ViewController/FilmSelectViewControllerFactory+.swift b/FLINT/FLINT/Dependency/Factory/ViewController/FilmSelectViewControllerFactory+.swift index 2fa43ae6..80357d44 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewController/FilmSelectViewControllerFactory+.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewController/FilmSelectViewControllerFactory+.swift @@ -1,5 +1,5 @@ // -// FilmSelectViewControllerFactory+.swift +// ContentSelectViewControllerFactory+.swift // FLINT // // Created by 김호성 on 2026.01.30. @@ -9,8 +9,8 @@ import Foundation import Presentation -extension FilmSelectViewControllerFactory where Self: ViewControllerFactory { - func makeFilmSelectViewController(onboardingViewModel: OnboardingViewModel) -> FilmSelectViewController { - return FilmSelectViewController(onboardingViewModel: onboardingViewModel, viewControllerFactory: self) +extension ContentSelectViewControllerFactory where Self: ViewControllerFactory { + func makeContentSelectViewController(onboardingViewModel: OnboardingViewModel) -> ContentSelectViewController { + return ContentSelectViewController(onboardingViewModel: onboardingViewModel, viewControllerFactory: self) } } diff --git a/FLINT/Presentation/Sources/View/Component/Cell/FilmPreviewCollectionViewCell.swift b/FLINT/Presentation/Sources/View/Component/Cell/SelectedContentCollectionViewCell.swift similarity index 89% rename from FLINT/Presentation/Sources/View/Component/Cell/FilmPreviewCollectionViewCell.swift rename to FLINT/Presentation/Sources/View/Component/Cell/SelectedContentCollectionViewCell.swift index 6b67b519..df4cf160 100644 --- a/FLINT/Presentation/Sources/View/Component/Cell/FilmPreviewCollectionViewCell.swift +++ b/FLINT/Presentation/Sources/View/Component/Cell/SelectedContentCollectionViewCell.swift @@ -1,5 +1,5 @@ // -// FilmPreviewCollectionViewCell.swift +// SelectedContentCollectionViewCell.swift // FLINT // // Created by 김호성 on 2026.01.10. @@ -10,7 +10,7 @@ import UIKit import SnapKit import Then -public final class FilmPreviewCollectionViewCell: BaseCollectionViewCell { +public final class SelectedContentCollectionViewCell: BaseCollectionViewCell { // MARK: - Component diff --git a/FLINT/Presentation/Sources/View/Scene/CreateCollection/CollectionSearchVIew/AddContentSelectView.swift b/FLINT/Presentation/Sources/View/Scene/CreateCollection/CollectionSearchVIew/AddContentSelectView.swift index 3b3db8cb..069fe37e 100644 --- a/FLINT/Presentation/Sources/View/Scene/CreateCollection/CollectionSearchVIew/AddContentSelectView.swift +++ b/FLINT/Presentation/Sources/View/Scene/CreateCollection/CollectionSearchVIew/AddContentSelectView.swift @@ -33,7 +33,7 @@ public final class AddContentSelectView: BaseView { $0.showsHorizontalScrollIndicator = false $0.showsVerticalScrollIndicator = false $0.contentInset = .init(top: 0, left: 16, bottom: 0, right: 16) - $0.register(FilmPreviewCollectionViewCell.self) + $0.register(SelectedContentCollectionViewCell.self) $0.clipsToBounds = true } diff --git a/FLINT/Presentation/Sources/View/Scene/Onboarding/FilmSelect/Cell/OnboardingFilmCollectionViewCell.swift b/FLINT/Presentation/Sources/View/Scene/Onboarding/FilmSelect/Cell/OnboardingContentCollectionViewCell.swift similarity index 93% rename from FLINT/Presentation/Sources/View/Scene/Onboarding/FilmSelect/Cell/OnboardingFilmCollectionViewCell.swift rename to FLINT/Presentation/Sources/View/Scene/Onboarding/FilmSelect/Cell/OnboardingContentCollectionViewCell.swift index 7b7b823e..5b6ee265 100644 --- a/FLINT/Presentation/Sources/View/Scene/Onboarding/FilmSelect/Cell/OnboardingFilmCollectionViewCell.swift +++ b/FLINT/Presentation/Sources/View/Scene/Onboarding/FilmSelect/Cell/OnboardingContentCollectionViewCell.swift @@ -1,5 +1,5 @@ // -// OnboardingFilmCollectionViewCell.swift +// OnboardingContentCollectionViewCell.swift // FLINT // // Created by 김호성 on 2026.01.17. @@ -10,13 +10,14 @@ import UIKit import SnapKit import Then -public final class OnboardingFilmCollectionViewCell: BaseCollectionViewCell { +public final class OnboardingContentCollectionViewCell: BaseCollectionViewCell { // MARK: - Component public let imageView = UIImageView().then { $0.backgroundColor = .flintGray100 $0.contentMode = .scaleAspectFill + $0.clipsToBounds = true } public let titleLabel = UILabel().then { diff --git a/FLINT/Presentation/Sources/View/Scene/Onboarding/FilmSelect/FilmSelectView.swift b/FLINT/Presentation/Sources/View/Scene/Onboarding/FilmSelect/ContentSelectView.swift similarity index 93% rename from FLINT/Presentation/Sources/View/Scene/Onboarding/FilmSelect/FilmSelectView.swift rename to FLINT/Presentation/Sources/View/Scene/Onboarding/FilmSelect/ContentSelectView.swift index 6422842b..859e46b1 100644 --- a/FLINT/Presentation/Sources/View/Scene/Onboarding/FilmSelect/FilmSelectView.swift +++ b/FLINT/Presentation/Sources/View/Scene/Onboarding/FilmSelect/ContentSelectView.swift @@ -1,5 +1,5 @@ // -// FilmSelectView.swift +// ContentSelectView.swift // FLINT // // Created by 김호성 on 2026.01.14. @@ -10,7 +10,7 @@ import UIKit import SnapKit import Then -public final class FilmSelectView: BaseView { +public final class ContentSelectView: BaseView { // MARK: - Component @@ -55,7 +55,7 @@ public final class FilmSelectView: BaseView { $0.alignment = .fill $0.distribution = .fill } - public let filmPreviewCollectionView = UICollectionView( + public let selectedContentCollectionView = UICollectionView( frame: .zero, collectionViewLayout: UICollectionViewFlowLayout().then { $0.itemSize = CGSize(width: 92, height: 92) @@ -66,14 +66,14 @@ public final class FilmSelectView: BaseView { ).then { $0.isHidden = true $0.layer.applyShadow(alpha: 0.25, blur: 12, y: 12) - $0.register(FilmPreviewCollectionViewCell.self) + $0.register(SelectedContentCollectionViewCell.self) $0.backgroundColor = .flintBackground $0.showsHorizontalScrollIndicator = false $0.showsVerticalScrollIndicator = false $0.contentInset = .init(top: 0, left: 16, bottom: 16, right: 16) } - public let filmCollectionView: UICollectionView = { + public let contentCollectionView: UICollectionView = { let uselessHeight: CGFloat = 230 let item = NSCollectionLayoutItem( layoutSize: NSCollectionLayoutSize( @@ -102,7 +102,7 @@ public final class FilmSelectView: BaseView { collectionView.backgroundColor = .flintBackground collectionView.showsHorizontalScrollIndicator = false collectionView.showsVerticalScrollIndicator = false - collectionView.register(OnboardingFilmCollectionViewCell.self) + collectionView.register(OnboardingContentCollectionViewCell.self) return collectionView }() @@ -158,8 +158,8 @@ public final class FilmSelectView: BaseView { emptyView ) collectionViewStackView.addArrangedSubviews( - filmPreviewCollectionView, - filmCollectionView, + selectedContentCollectionView, + contentCollectionView, ) progressInfoView.addSubviews(progressView, progressLabel) foldableView.addSubview(titleLabel) @@ -220,7 +220,7 @@ public final class FilmSelectView: BaseView { $0.top.equalTo(searchView.snp.bottom) $0.horizontalEdges.equalToSuperview() } - filmPreviewCollectionView.snp.makeConstraints { + selectedContentCollectionView.snp.makeConstraints { $0.height.equalTo(108) } nextButton.snp.makeConstraints { @@ -230,7 +230,7 @@ public final class FilmSelectView: BaseView { $0.bottom.equalTo(safeAreaLayoutGuide) } emptyView.snp.makeConstraints { - $0.edges.equalTo(filmCollectionView) + $0.edges.equalTo(contentCollectionView) } emptyStackView.snp.makeConstraints { $0.center.equalToSuperview() diff --git a/FLINT/Presentation/Sources/View/Scene/Nickname/NicknameView.swift b/FLINT/Presentation/Sources/View/Scene/Onboarding/Nickname/NicknameView.swift similarity index 100% rename from FLINT/Presentation/Sources/View/Scene/Nickname/NicknameView.swift rename to FLINT/Presentation/Sources/View/Scene/Onboarding/Nickname/NicknameView.swift diff --git a/FLINT/Presentation/Sources/ViewController/Dependency/ViewControllerFactory.swift b/FLINT/Presentation/Sources/ViewController/Dependency/ViewControllerFactory.swift index 7d2d346a..93999744 100644 --- a/FLINT/Presentation/Sources/ViewController/Dependency/ViewControllerFactory.swift +++ b/FLINT/Presentation/Sources/ViewController/Dependency/ViewControllerFactory.swift @@ -19,7 +19,7 @@ public typealias ViewControllerFactory = // MARK: - Onboarding NicknameViewControllerFactory & - FilmSelectViewControllerFactory & + ContentSelectViewControllerFactory & OttSelectViewControllerFactory & OnboardingDoneViewControllerFactory & diff --git a/FLINT/Presentation/Sources/ViewController/Scene/CreateCollection/CollectionSearchVIew/AddContentSelectViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/CreateCollection/CollectionSearchVIew/AddContentSelectViewController.swift index 3250e0ff..b52e29ba 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/CreateCollection/CollectionSearchVIew/AddContentSelectViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/CreateCollection/CollectionSearchVIew/AddContentSelectViewController.swift @@ -366,9 +366,9 @@ extension AddContentSelectViewController: UICollectionViewDataSource { ) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell( - withReuseIdentifier: FilmPreviewCollectionViewCell.reuseIdentifier, + withReuseIdentifier: SelectedContentCollectionViewCell.reuseIdentifier, for: indexPath - ) as! FilmPreviewCollectionViewCell + ) as! SelectedContentCollectionViewCell let vm = selectedViewModels[indexPath.item] diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/FilmSelect/FilmSelectViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/FilmSelect/ContentSelectViewController.swift similarity index 66% rename from FLINT/Presentation/Sources/ViewController/Scene/Onboarding/FilmSelect/FilmSelectViewController.swift rename to FLINT/Presentation/Sources/ViewController/Scene/Onboarding/FilmSelect/ContentSelectViewController.swift index 578c8c10..9a0a2a27 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/FilmSelect/FilmSelectViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/FilmSelect/ContentSelectViewController.swift @@ -1,5 +1,5 @@ // -// FilmSelectViewController.swift +// ContentSelectViewController.swift // FLINT // // Created by 김호성 on 2026.01.14. @@ -14,13 +14,13 @@ import Domain import View import ViewModel -public protocol FilmSelectViewControllerFactory { - func makeFilmSelectViewController(onboardingViewModel: OnboardingViewModel) -> FilmSelectViewController +public protocol ContentSelectViewControllerFactory { + func makeContentSelectViewController(onboardingViewModel: OnboardingViewModel) -> ContentSelectViewController } // TODO: - shadow -public final class FilmSelectViewController: BaseViewController { +public final class ContentSelectViewController: BaseViewController { // MARK: - Enum @@ -73,19 +73,19 @@ public final class FilmSelectViewController: BaseViewController self?.onboardingViewModel.fetchPopularContents() } - rootView.progressLabel.attributedText = .pretendard(.caption1_m_12, text: "\(onboardingViewModel.selectedContents.value.count)/\(onboardingViewModel.filmSelectQuestions.count)") - rootView.progressView.progress = Float(onboardingViewModel.selectedContents.value.count) / Float(onboardingViewModel.filmSelectQuestions.count) + rootView.progressLabel.attributedText = .pretendard(.caption1_m_12, text: "\(onboardingViewModel.selectedContents.value.count)/\(onboardingViewModel.contentSelectQuestions.count)") + rootView.progressView.progress = Float(onboardingViewModel.selectedContents.value.count) / Float(onboardingViewModel.contentSelectQuestions.count) rootView.titleLabel.attributedText = .pretendard(.display2_m_28, text: "\(onboardingViewModel.nickname.value) 님이 좋아하는 작품 7개를 골라주세요", lineBreakMode: .byWordWrapping, lineBreakStrategy: .hangulWordPriority) - rootView.subtitleLabel.attributedText = .pretendard(.body2_r_14, text: onboardingViewModel.filmSelectQuestions[onboardingViewModel.selectedContents.value.count]) - rootView.filmPreviewCollectionView.dataSource = self - rootView.filmCollectionView.dataSource = self - rootView.filmCollectionView.delegate = self + rootView.subtitleLabel.attributedText = .pretendard(.body2_r_14, text: onboardingViewModel.contentSelectQuestions[onboardingViewModel.selectedContents.value.count]) + rootView.selectedContentCollectionView.dataSource = self + rootView.contentCollectionView.dataSource = self + rootView.contentCollectionView.delegate = self rootView.searchTextField.delegate = self rootView.layoutIfNeeded() - rootView.filmCollectionView.contentOffset.y = -rootView.filmCollectionView.contentInset.top + rootView.contentCollectionView.contentOffset.y = -rootView.contentCollectionView.contentInset.top - rootView.filmCollectionView.panGestureRecognizer.addTarget(self, action: #selector(filmCollectionViewPanGesture)) + rootView.contentCollectionView.panGestureRecognizer.addTarget(self, action: #selector(contentCollectionViewPanGesture)) rootView.nextButton.addAction(UIAction(handler: pushOttSelectViewController(_:)), for: .touchUpInside) } @@ -98,33 +98,31 @@ public final class FilmSelectViewController: BaseViewController onboardingViewModel.contents.sink { [weak self] contents in self?.rootView.emptyView.isHidden = !contents.isEmpty - self?.rootView.filmCollectionView.reloadData() + self?.rootView.contentCollectionView.reloadData() } .store(in: &cancellables) onboardingViewModel.selectedContents.sink { [weak self] selectedContents in guard let self else { return } UIView.animate(withDuration: 0.2, animations: { - self.rootView.filmPreviewCollectionView.isHidden = selectedContents.isEmpty + self.rootView.selectedContentCollectionView.isHidden = selectedContents.isEmpty }) - self.rootView.filmPreviewCollectionView.reloadData() - self.rootView.filmCollectionView.reloadData() - rootView.progressLabel.attributedText = .pretendard(.caption1_m_12, text: "\(selectedContents.count)/\(onboardingViewModel.filmSelectQuestions.count)") - rootView.progressView.progress = Float(selectedContents.count) / Float(onboardingViewModel.filmSelectQuestions.count) - rootView.subtitleLabel.attributedText = .pretendard(.body2_r_14, text: onboardingViewModel.filmSelectQuestions[min(selectedContents.count, onboardingViewModel.filmSelectQuestions.count-1)]) + self.rootView.selectedContentCollectionView.reloadData() + self.rootView.contentCollectionView.reloadData() + rootView.progressLabel.attributedText = .pretendard(.caption1_m_12, text: "\(selectedContents.count)/\(onboardingViewModel.contentSelectQuestions.count)") + rootView.progressView.progress = Float(selectedContents.count) / Float(onboardingViewModel.contentSelectQuestions.count) + rootView.subtitleLabel.attributedText = .pretendard(.body2_r_14, text: onboardingViewModel.contentSelectQuestions[min(selectedContents.count, onboardingViewModel.contentSelectQuestions.count-1)]) rootView.nextButton.isEnabled = selectedContents.count == 7 } .store(in: &cancellables) } - @objc public func filmCollectionViewPanGesture(_ sender: UIPanGestureRecognizer) { + @objc public func contentCollectionViewPanGesture(_ sender: UIPanGestureRecognizer) { // Adjust the accumulated scroll translation // so that the foldableView responds immediately when the scroll direction changes - let translationY = sender.translation(in: rootView.filmCollectionView).y - let velocityY = sender.velocity(in: rootView.filmCollectionView).y - - Log.d(translationY) + let translationY = sender.translation(in: rootView.contentCollectionView).y + let velocityY = sender.velocity(in: rootView.contentCollectionView).y let unclampedOffset = translationY - offsetCorrection @@ -142,7 +140,7 @@ public final class FilmSelectViewController: BaseViewController let passedFoldableViewYOffset = foldableViewYOffset foldableViewYOffset = translationY - offsetCorrection rootView.updateFoldableViewYOffset(foldableViewYOffset) - rootView.filmCollectionView.contentOffset.y += foldableViewYOffset - passedFoldableViewYOffset + rootView.contentCollectionView.contentOffset.y += foldableViewYOffset - passedFoldableViewYOffset rootView.foldableView.alpha = 1 + foldableViewYOffset / rootView.foldableView.bounds.height // Magnetic snapping effect when the gesture ends @@ -176,43 +174,42 @@ public final class FilmSelectViewController: BaseViewController // MARK: - UICollectionView DataSource & Delegate -extension FilmSelectViewController: UICollectionViewDataSource { +extension ContentSelectViewController: UICollectionViewDataSource { public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - if collectionView === rootView.filmPreviewCollectionView { - return filmPreviewCollectionView(collectionView, numberOfItemsInSection: section) - } else if collectionView === rootView.filmCollectionView { - return filmCollectionView(collectionView, numberOfItemsInSection: section) + if collectionView === rootView.selectedContentCollectionView { + return selectedContentCollectionView(collectionView, numberOfItemsInSection: section) + } else if collectionView === rootView.contentCollectionView { + return contentCollectionView(collectionView, numberOfItemsInSection: section) } return 0 } public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - if collectionView === rootView.filmPreviewCollectionView { - return filmPreviewCollectionView(collectionView, cellForItemAt: indexPath) - } else if collectionView === rootView.filmCollectionView { - return filmCollectionView(collectionView, cellForItemAt: indexPath) + if collectionView === rootView.selectedContentCollectionView { + return selectedContentCollectionView(collectionView, cellForItemAt: indexPath) + } else if collectionView === rootView.contentCollectionView { + return contentCollectionView(collectionView, cellForItemAt: indexPath) } return UICollectionViewCell() } } -extension FilmSelectViewController: UICollectionViewDelegate { +extension ContentSelectViewController: UICollectionViewDelegate { public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - filmCollectionView(collectionView, didSelectItemAt: indexPath) + contentCollectionView(collectionView, didSelectItemAt: indexPath) } } -// MARK: - FilmPreviewCollectionView DataSource +// MARK: - SelectedContentCollectionView DataSource -extension FilmSelectViewController { - public func filmPreviewCollectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { +extension ContentSelectViewController { + public func selectedContentCollectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return onboardingViewModel.selectedContents.value.count } - public func filmPreviewCollectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FilmPreviewCollectionViewCell.reuseIdentifier, for: indexPath) as? FilmPreviewCollectionViewCell else { - return UICollectionViewCell() - } + public func selectedContentCollectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + let cell = collectionView.dequeueReusableCell(SelectedContentCollectionViewCell.self, for: indexPath) + let content = onboardingViewModel.selectedContents.value[indexPath.item] cell.imageView.kf.setImage(with: content.posterUrl) @@ -223,17 +220,16 @@ extension FilmSelectViewController { } } -// MARK: - FilmCollectionView DataSource & Delegate +// MARK: - ContentCollectionView DataSource & Delegate -extension FilmSelectViewController { - public func filmCollectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { +extension ContentSelectViewController { + public func contentCollectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return onboardingViewModel.contents.value.count } - public func filmCollectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: OnboardingFilmCollectionViewCell.reuseIdentifier, for: indexPath) as? OnboardingFilmCollectionViewCell else { - return UICollectionViewCell() - } + public func contentCollectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + let cell = collectionView.dequeueReusableCell(OnboardingContentCollectionViewCell.self, for: indexPath) + let content = onboardingViewModel.contents.value[indexPath.item] cell.overlayView.isHidden = !onboardingViewModel.selectedContents.value.contains(where: { @@ -247,8 +243,8 @@ extension FilmSelectViewController { } } -extension FilmSelectViewController { - public func filmCollectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { +extension ContentSelectViewController { + public func contentCollectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { guard onboardingViewModel.selectedContents.value.count <= 6 else { return } @@ -256,7 +252,9 @@ extension FilmSelectViewController { } } -extension FilmSelectViewController: UITextFieldDelegate { +// MARK: - SearchTextField Delegate + +extension ContentSelectViewController: UITextFieldDelegate { public func textFieldShouldReturn(_ textField: UITextField) -> Bool { textField.resignFirstResponder() guard let text = textField.text else { return true } diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/Nickname/NicknameViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/Nickname/NicknameViewController.swift index 41509f94..8bedc519 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/Nickname/NicknameViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/Nickname/NicknameViewController.swift @@ -165,8 +165,8 @@ public final class NicknameViewController: BaseViewController { private func nextButtonTapped(_ action: UIAction) { rootView.successToast.close(animated: false) rootView.failureToast.close(animated: false) - guard let filmSelectViewController = viewControllerFactory?.makeFilmSelectViewController(onboardingViewModel: onboardingViewModel) else { return } - navigationController?.pushViewController(filmSelectViewController, animated: true) + guard let contentSelectViewController = viewControllerFactory?.makeContentSelectViewController(onboardingViewModel: onboardingViewModel) else { return } + navigationController?.pushViewController(contentSelectViewController, animated: true) } } diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/Onboarding/OnboardingViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/Onboarding/OnboardingViewModel.swift index 983d3ca9..ef1a07f8 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/Onboarding/OnboardingViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/Onboarding/OnboardingViewModel.swift @@ -14,7 +14,7 @@ public protocol OnboardingViewModelInput { // nickname func checkNickname(_ nickname: String) - // film select + // content select func fetchPopularContents() func searchContents(_ keyword: String) func clickContent(_ content: ContentEntity) @@ -32,8 +32,8 @@ public protocol OnboardingViewModelOutput { var nickname: CurrentValueSubject { get } var nicknameValidState: CurrentValueSubject { get } - // film select - var filmSelectQuestions: [String] { get set } + // content select + var contentSelectQuestions: [String] { get set } var contents: CurrentValueSubject<[ContentEntity], Never> { get set } var selectedContents: CurrentValueSubject<[ContentEntity], Never> { get set } @@ -54,7 +54,7 @@ public final class DefaultOnboardingViewModel: OnboardingViewModel { public var nickname: CurrentValueSubject = .init("") public var nicknameValidState: CurrentValueSubject = .init(nil) - public var filmSelectQuestions: [String] = [ + public var contentSelectQuestions: [String] = [ "이번 달, 가장 재미있었던 작품은 무엇인가요?", "여러번 정주행 했던 작품은 무엇인가요?", "좋아하는 인물이 등장하는 작품은 무엇인가요?", From 76e6751539e7b3cf3b8842f736e796e0b4a33898 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Sun, 15 Feb 2026 15:58:34 +0900 Subject: [PATCH 41/45] [refactor] tableview dequereusablecell --- FLINT/Domain/Sources/Entity/Content/Ott.swift | 2 +- .../OnboardingContentCollectionViewCell.swift | 12 ++++ .../OnboardingOttCollectionViewCell.swift | 12 ++++ .../Extension/UITableView+.swift | 19 ++++++ .../Scene/Home/HomeViewController.swift | 44 ++++--------- .../ContentSelectViewController.swift | 14 ++-- .../OttSelect/OttSelectViewController.swift | 12 +--- .../Scene/Profile/ProfileViewController.swift | 64 ++++--------------- 8 files changed, 80 insertions(+), 99 deletions(-) create mode 100644 FLINT/Presentation/Sources/ViewController/Extension/UITableView+.swift rename FLINT/Presentation/Sources/ViewController/Scene/Onboarding/{FilmSelect => ContentSelect}/ContentSelectViewController.swift (95%) diff --git a/FLINT/Domain/Sources/Entity/Content/Ott.swift b/FLINT/Domain/Sources/Entity/Content/Ott.swift index a2e7f242..1888acc0 100644 --- a/FLINT/Domain/Sources/Entity/Content/Ott.swift +++ b/FLINT/Domain/Sources/Entity/Content/Ott.swift @@ -1,6 +1,6 @@ // // Ott.swift -// Presentation +// Domain // // Created by 김호성 on 2026.01.23. // diff --git a/FLINT/Presentation/Sources/View/Scene/Onboarding/FilmSelect/Cell/OnboardingContentCollectionViewCell.swift b/FLINT/Presentation/Sources/View/Scene/Onboarding/FilmSelect/Cell/OnboardingContentCollectionViewCell.swift index 5b6ee265..38e4b5c4 100644 --- a/FLINT/Presentation/Sources/View/Scene/Onboarding/FilmSelect/Cell/OnboardingContentCollectionViewCell.swift +++ b/FLINT/Presentation/Sources/View/Scene/Onboarding/FilmSelect/Cell/OnboardingContentCollectionViewCell.swift @@ -10,6 +10,8 @@ import UIKit import SnapKit import Then +import Domain + public final class OnboardingContentCollectionViewCell: BaseCollectionViewCell { // MARK: - Component @@ -96,4 +98,14 @@ public final class OnboardingContentCollectionViewCell: BaseCollectionViewCell { $0.horizontalEdges.equalToSuperview().inset(32) } } + + // MARK: - Public Function + + public func configure(content: ContentEntity, isSelected: Bool) { + overlayView.isHidden = !isSelected + titleLabel.attributedText = .pretendard(.body1_r_16, text: content.title) + directorLabel.attributedText = .pretendard(.caption1_r_12, text: content.author) + yearLabel.attributedText = .pretendard(.caption1_r_12, text: "\(content.year)") + imageView.kf.setImage(with: content.posterUrl) + } } diff --git a/FLINT/Presentation/Sources/View/Scene/Onboarding/OttSelect/Cell/OnboardingOttCollectionViewCell.swift b/FLINT/Presentation/Sources/View/Scene/Onboarding/OttSelect/Cell/OnboardingOttCollectionViewCell.swift index adaec7a4..77932938 100644 --- a/FLINT/Presentation/Sources/View/Scene/Onboarding/OttSelect/Cell/OnboardingOttCollectionViewCell.swift +++ b/FLINT/Presentation/Sources/View/Scene/Onboarding/OttSelect/Cell/OnboardingOttCollectionViewCell.swift @@ -10,6 +10,8 @@ import UIKit import SnapKit import Then +import Domain + public final class OnboardingOttCollectionViewCell: BaseCollectionViewCell { // MARK: - Component @@ -75,4 +77,14 @@ public final class OnboardingOttCollectionViewCell: BaseCollectionViewCell { $0.horizontalEdges.equalToSuperview().inset(32) } } + + // MARK: - Public Function + + public func configure(ott: Ott, isSelected: Bool) { + overlayView.isHidden = !isSelected + titleLabel.textColor = isSelected ? DesignSystem.Color.gray300 : DesignSystem.Color.white + + imageView.image = ott.logo + titleLabel.attributedText = .pretendard(.body1_m_16, text: ott.korTitle, alignment: .center) + } } diff --git a/FLINT/Presentation/Sources/ViewController/Extension/UITableView+.swift b/FLINT/Presentation/Sources/ViewController/Extension/UITableView+.swift new file mode 100644 index 00000000..8d74370b --- /dev/null +++ b/FLINT/Presentation/Sources/ViewController/Extension/UITableView+.swift @@ -0,0 +1,19 @@ +// +// UITableView+.swift +// Presentation +// +// Created by 김호성 on 2026.02.14. +// + +import UIKit + +import View + +extension UITableView { + public func dequeueReusableCell(_ cellType: T.Type, for indexPath: IndexPath) -> T { + guard let cell: T = dequeueReusableCell(withIdentifier: cellType.reuseIdentifier, for: indexPath) as? T else { + fatalError("Failed to dequeue reusable cell of type \(cellType) with reuseIdentifier \(cellType.reuseIdentifier).") + } + return cell + } +} diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Home/HomeViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Home/HomeViewController.swift index 50f2388a..c9c83c6f 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Home/HomeViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Home/HomeViewController.swift @@ -7,11 +7,11 @@ import UIKit +import Domain + import View import ViewModel -import Domain - public protocol HomeViewControllerFactory { func makeHomeViewController() -> HomeViewController } @@ -141,18 +141,12 @@ extension HomeViewController: UITableViewDataSource { switch row { case .greeting(let userName): - let cell = tableView.dequeueReusableCell( - withIdentifier: HomeGreetingTableViewCell.reuseIdentifier, - for: indexPath - ) as! HomeGreetingTableViewCell + let cell = tableView.dequeueReusableCell(HomeGreetingTableViewCell.self, for: indexPath) cell.configure(userName: userName) return cell case .header(let style, let title, let subtitle): - let cell = tableView.dequeueReusableCell( - withIdentifier: TitleHeaderTableViewCell.reuseIdentifier, - for: indexPath - ) as! TitleHeaderTableViewCell + let cell = tableView.dequeueReusableCell(TitleHeaderTableViewCell.self, for: indexPath) cell.configure(style: map(style), title: title, subtitle: subtitle) @@ -175,35 +169,25 @@ extension HomeViewController: UITableViewDataSource { return cell case .fliner(let items): - let cell = tableView.dequeueReusableCell( - withIdentifier: MoreNoMoreCollectionTableViewCell.reuseIdentifier, - for: indexPath - ) as! MoreNoMoreCollectionTableViewCell + let cell = tableView.dequeueReusableCell(MoreNoMoreCollectionTableViewCell.self, for: indexPath) cell.configure(items: items) cell.onSelectItem = { [weak self] entity in - guard let self else { return } - - guard let collectionId = Int64(entity.id) else { - print("invalid collectionId:", entity.id) - return - } - - let factory = self.viewControllerFactory - ?? (self.parent as? TabBarViewController)?.viewControllerFactory - guard let factory else { return } + guard let self else { return } - let vc = factory.makeCollectionDetailViewController(collectionId: collectionId) - self.navigationController?.pushViewController(vc, animated: true) + guard let collectionId = Int64(entity.id) else { + print("invalid collectionId:", entity.id) + return } + guard let vc = viewControllerFactory?.makeCollectionDetailViewController(collectionId: collectionId) else { return } + self.navigationController?.pushViewController(vc, animated: true) + } + return cell case .ctaButton(let title): - let cell = tableView.dequeueReusableCell( - withIdentifier: HomeCTAButtonTableViewCell.reuseIdentifier, - for: indexPath - ) as! HomeCTAButtonTableViewCell + let cell = tableView.dequeueReusableCell(HomeCTAButtonTableViewCell.self, for: indexPath) cell.configure(title: title) diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/FilmSelect/ContentSelectViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/ContentSelect/ContentSelectViewController.swift similarity index 95% rename from FLINT/Presentation/Sources/ViewController/Scene/Onboarding/FilmSelect/ContentSelectViewController.swift rename to FLINT/Presentation/Sources/ViewController/Scene/Onboarding/ContentSelect/ContentSelectViewController.swift index 9a0a2a27..0f8a1e17 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/FilmSelect/ContentSelectViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/ContentSelect/ContentSelectViewController.swift @@ -149,15 +149,15 @@ public final class ContentSelectViewController: BaseViewController UICollectionViewCell { - guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: OnboardingOttCollectionViewCell.reuseIdentifier, for: indexPath) as? OnboardingOttCollectionViewCell else { - return UICollectionViewCell() - } + let cell = collectionView.dequeueReusableCell(OnboardingOttCollectionViewCell.self, for: indexPath) + guard let ott = Ott(rawValue: indexPath.item) else { return cell } - let isSelectedOtt = onboardingViewModel.selectedOtt.value.contains(where: { $0 == ott }) + cell.configure(ott: ott, isSelected: isSelectedOtt) - cell.overlayView.isHidden = !isSelectedOtt - cell.titleLabel.textColor = isSelectedOtt ? DesignSystem.Color.gray300 : DesignSystem.Color.white - - cell.imageView.image = ott.logo - cell.titleLabel.attributedText = .pretendard(.body1_m_16, text: ott.korTitle, alignment: .center) return cell } } diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Profile/ProfileViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Profile/ProfileViewController.swift index 971b81f8..5a2f963c 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Profile/ProfileViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Profile/ProfileViewController.swift @@ -5,13 +5,14 @@ // Created by 진소은 on 1/19/26. // -import UIKit import Combine +import UIKit import SnapKit import Then import Domain + import View import ViewModel @@ -34,9 +35,7 @@ public final class ProfileViewController: BaseViewController { } required init?(coder: NSCoder) { - fatalError( - "init(coder:) has not been implemented" - ) + fatalError("init(coder:) has not been implemented") } public override func viewDidLoad() { @@ -58,26 +57,11 @@ public final class ProfileViewController: BaseViewController { tableView.dataSource = self tableView.delegate = self - tableView.register( - ProfileHeaderTableViewCell.self, - forCellReuseIdentifier: ProfileHeaderTableViewCell.reuseIdentifier - ) - tableView.register( - PreferenceRankedChipTableViewCell.self, - forCellReuseIdentifier: PreferenceRankedChipTableViewCell.reuseIdentifier - ) - tableView.register( - TitleHeaderTableViewCell.self, - forCellReuseIdentifier: TitleHeaderTableViewCell.reuseIdentifier - ) - tableView.register( - MoreNoMoreCollectionTableViewCell.self, - forCellReuseIdentifier: MoreNoMoreCollectionTableViewCell.reuseIdentifier - ) - tableView.register( - RecentSavedContentTableViewCell.self, - forCellReuseIdentifier: RecentSavedContentTableViewCell.reuseIdentifier - ) + tableView.register(ProfileHeaderTableViewCell.self) + tableView.register(PreferenceRankedChipTableViewCell.self) + tableView.register(TitleHeaderTableViewCell.self) + tableView.register(MoreNoMoreCollectionTableViewCell.self) + tableView.register(RecentSavedContentTableViewCell.self) } public override func bind() { @@ -148,63 +132,43 @@ extension ProfileViewController: UITableViewDataSource { switch row { case let .profileHeader(nickname, profileImageUrl, isFliner): - let cell = tableView.dequeueReusableCell( - withIdentifier: ProfileHeaderTableViewCell.reuseIdentifier, - for: indexPath - ) as! ProfileHeaderTableViewCell + let cell = tableView.dequeueReusableCell(ProfileHeaderTableViewCell.self, for: indexPath) cell.selectionStyle = .none cell.configure(nickname: nickname, profileImageUrl: profileImageUrl, isFliner: isFliner) return cell case let .preferenceChips(keywords): - let cell = tableView.dequeueReusableCell( - withIdentifier: PreferenceRankedChipTableViewCell.reuseIdentifier, - for: indexPath - ) as! PreferenceRankedChipTableViewCell + let cell = tableView.dequeueReusableCell(PreferenceRankedChipTableViewCell.self, for: indexPath) cell.selectionStyle = .none cell.configure(keywords: keywords) return cell case let .titleHeader(style, title, subtitle): - let cell = tableView.dequeueReusableCell( - withIdentifier: TitleHeaderTableViewCell.reuseIdentifier, - for: indexPath - ) as! TitleHeaderTableViewCell + let cell = tableView.dequeueReusableCell(TitleHeaderTableViewCell.self, for: indexPath) cell.selectionStyle = .none cell.configure(style: map(style), title: title, subtitle: subtitle) return cell case let .myCollections(items): - let cell = tableView.dequeueReusableCell( - withIdentifier: MoreNoMoreCollectionTableViewCell.reuseIdentifier, - for: indexPath - ) as! MoreNoMoreCollectionTableViewCell + let cell = tableView.dequeueReusableCell(MoreNoMoreCollectionTableViewCell.self, for: indexPath) cell.selectionStyle = .none - cell.configure(items: items) - cell.onSelectItem = { entity in print("컬렉션 선택:", entity.id) } return cell case let .savedCollections(items): - let cell = tableView.dequeueReusableCell( - withIdentifier: MoreNoMoreCollectionTableViewCell.reuseIdentifier, - for: indexPath - ) as! MoreNoMoreCollectionTableViewCell + let cell = tableView.dequeueReusableCell(MoreNoMoreCollectionTableViewCell.self, for: indexPath) cell.selectionStyle = .none - cell.configure(items: items) - cell.onSelectItem = { entity in print("저장 컬렉션 선택:", entity.id) } return cell case let .savedContents(items): - let cell = tableView.dequeueReusableCell(withIdentifier: RecentSavedContentTableViewCell.reuseIdentifier, - for: indexPath) as! RecentSavedContentTableViewCell + let cell = tableView.dequeueReusableCell(RecentSavedContentTableViewCell.self, for: indexPath) cell.selectionStyle = .none cell.configure(items: items) cell.onTapItem = { [weak self] content in From 5f55dd4d594f36d7a63096292dfb7dd99df689c7 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Sun, 15 Feb 2026 23:10:53 +0900 Subject: [PATCH 42/45] =?UTF-8?q?[comment]=20sticky=20header=20=EC=A3=BC?= =?UTF-8?q?=EC=84=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContentSelect/ContentSelectViewController.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/ContentSelect/ContentSelectViewController.swift b/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/ContentSelect/ContentSelectViewController.swift index 0f8a1e17..4e6122e0 100644 --- a/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/ContentSelect/ContentSelectViewController.swift +++ b/FLINT/Presentation/Sources/ViewController/Scene/Onboarding/ContentSelect/ContentSelectViewController.swift @@ -128,13 +128,13 @@ public final class ContentSelectViewController: BaseViewController= 0 { - // When topBarView is visible - // topBarViewOffsetY = translationY - offsetCorrection = 0 + // When foldableView is visible + // foldableViewYOffset = translationY - offsetCorrection = 0 offsetCorrection = translationY } if unclampedOffset <= -rootView.foldableView.bounds.height { - // When topBarView is hidden - // topBarViewOffsetY = translationY - offsetCorrection = -rootView.foldableView.bounds.height + // When foldableView is hidden + // foldableViewYOffset = translationY - offsetCorrection = -rootView.foldableView.bounds.height offsetCorrection = translationY + rootView.foldableView.bounds.height } let passedFoldableViewYOffset = foldableViewYOffset From d3fe3e3f2ffd7f47b01442dddcdb0dd1c63463e1 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Tue, 17 Feb 2026 17:55:35 +0900 Subject: [PATCH 43/45] [refactor] UseCase callAsFunction --- FLINT/Domain/Sources/UseCase/Auth/SignupUseCase.swift | 4 ++-- .../Sources/UseCase/Auth/SocialVerifyUseCase.swift | 4 ++-- .../Domain/Sources/UseCase/Auth/WithDrawUseCase.swift | 4 ++-- .../UseCase/Collection/CreateCollectionUseCase.swift | 4 ++-- .../Collection/FetchBookmarkedCollectionsUseCase.swift | 4 ++-- .../FetchCollectionBookmarkUsersUseCase.swift | 4 ++-- .../Collection/FetchCollectionDetailUseCase.swift | 4 ++-- .../Collection/FetchCreatedCollectionsUseCase.swift | 4 ++-- .../Collection/FetchExploreCollectionsUseCase.swift | 6 +++--- .../FetchRecentViewedCollectionsUseCase.swift | 4 ++-- .../FetchRecommendedCollectionsUseCase.swift | 4 ++-- .../Collection/ToggleCollectionBookmarkUseCase.swift | 4 ++-- .../Content/FetchBookmarkedContentsUseCase.swift | 4 ++-- .../Content/FetchOTTPlatformsForContentUseCase.swift | 4 ++-- .../UseCase/Content/FetchPopularContentsUseCase.swift | 4 ++-- .../UseCase/Content/SearchContentsUseCase.swift | 4 ++-- .../UseCase/Content/ToggleContentBookmarkUseCase.swift | 4 ++-- .../Sources/UseCase/Profile/CheckNicknameUseCase.swift | 4 ++-- .../Sources/UseCase/Profile/FetchKeywordsUseCase.swift | 4 ++-- .../Sources/UseCase/Profile/FetchProfileUseCase.swift | 4 ++-- .../CollectionDetail/CollectionDetailViewModel.swift | 4 ++-- .../CreateCollection/AddContentSelectViewModel.swift | 4 ++-- .../CreateCollectionViewModel.swift | 2 +- .../ViewModel/Scene/Explore/ExploreViewModel.swift | 2 +- .../Scene/Home/CollectionFolderListViewModel.swift | 2 +- .../Sources/ViewModel/Scene/Home/HomeViewModel.swift | 8 ++++---- .../Sources/ViewModel/Scene/Login/LoginViewModel.swift | 2 +- .../Scene/Onboarding/OnboardingViewModel.swift | 8 ++++---- .../ViewModel/Scene/Profile/ProfileViewModel.swift | 10 +++++----- 29 files changed, 62 insertions(+), 62 deletions(-) diff --git a/FLINT/Domain/Sources/UseCase/Auth/SignupUseCase.swift b/FLINT/Domain/Sources/UseCase/Auth/SignupUseCase.swift index 56ecdfa8..fde53cf3 100644 --- a/FLINT/Domain/Sources/UseCase/Auth/SignupUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Auth/SignupUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol SignupUseCase { - func signup(userInfo: SignupInfoEntity) -> AnyPublisher + func callAsFunction(userInfo: SignupInfoEntity) -> AnyPublisher } public final class DefaultSignupUseCase: SignupUseCase { @@ -23,7 +23,7 @@ public final class DefaultSignupUseCase: SignupUseCase { self.authRepository = authRepository } - public func signup(userInfo: SignupInfoEntity) -> AnyPublisher { + public func callAsFunction(userInfo: SignupInfoEntity) -> AnyPublisher { return authRepository.signup(userInfo: userInfo) } } diff --git a/FLINT/Domain/Sources/UseCase/Auth/SocialVerifyUseCase.swift b/FLINT/Domain/Sources/UseCase/Auth/SocialVerifyUseCase.swift index 55ab581b..13c2e313 100644 --- a/FLINT/Domain/Sources/UseCase/Auth/SocialVerifyUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Auth/SocialVerifyUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol SocialVerifyUseCase { - func socialVerify(socialAuthCredential: SocialVerifyEntity) -> AnyPublisher + func callAsFunction(socialAuthCredential: SocialVerifyEntity) -> AnyPublisher } public final class DefaultSocialVerifyUseCase: SocialVerifyUseCase { @@ -23,7 +23,7 @@ public final class DefaultSocialVerifyUseCase: SocialVerifyUseCase { self.authRepository = authRepository } - public func socialVerify(socialAuthCredential: SocialVerifyEntity) -> AnyPublisher { + public func callAsFunction(socialAuthCredential: SocialVerifyEntity) -> AnyPublisher { return authRepository.socialVerify(socialAuthCredential: socialAuthCredential) } } diff --git a/FLINT/Domain/Sources/UseCase/Auth/WithDrawUseCase.swift b/FLINT/Domain/Sources/UseCase/Auth/WithDrawUseCase.swift index e4ecda74..afe2fdec 100644 --- a/FLINT/Domain/Sources/UseCase/Auth/WithDrawUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Auth/WithDrawUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol WithDrawUseCase { - func withDraw() -> AnyPublisher + func callAsFunction() -> AnyPublisher } public final class DefaultWithDrawUseCase: WithDrawUseCase { @@ -23,7 +23,7 @@ public final class DefaultWithDrawUseCase: WithDrawUseCase { self.authRepository = authRepository } - public func withDraw() -> AnyPublisher { + public func callAsFunction() -> AnyPublisher { return authRepository.withDraw() } } diff --git a/FLINT/Domain/Sources/UseCase/Collection/CreateCollectionUseCase.swift b/FLINT/Domain/Sources/UseCase/Collection/CreateCollectionUseCase.swift index 568bd5c0..0e5c8626 100644 --- a/FLINT/Domain/Sources/UseCase/Collection/CreateCollectionUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Collection/CreateCollectionUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol CreateCollectionUseCase { - func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher + func callAsFunction(collectionInfo: CreateCollectionEntity) -> AnyPublisher } public class DefaultCreateCollectionUseCase: CreateCollectionUseCase { @@ -23,7 +23,7 @@ public class DefaultCreateCollectionUseCase: CreateCollectionUseCase { self.collectionRepository = collectionRepository } - public func createCollection(collectionInfo: CreateCollectionEntity) -> AnyPublisher { + public func callAsFunction(collectionInfo: CreateCollectionEntity) -> AnyPublisher { return collectionRepository.createCollection(collectionInfo: collectionInfo) } } diff --git a/FLINT/Domain/Sources/UseCase/Collection/FetchBookmarkedCollectionsUseCase.swift b/FLINT/Domain/Sources/UseCase/Collection/FetchBookmarkedCollectionsUseCase.swift index a0ca5440..3d74aea4 100644 --- a/FLINT/Domain/Sources/UseCase/Collection/FetchBookmarkedCollectionsUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Collection/FetchBookmarkedCollectionsUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol FetchBookmarkedCollectionsUseCase { - func fetchBookmarkedCollections(for target: UserTarget) -> AnyPublisher<[CollectionEntity], Error> + func callAsFunction(for target: UserTarget) -> AnyPublisher<[CollectionEntity], Error> } public final class DefaultFetchBookmarkedCollectionsUseCase: FetchBookmarkedCollectionsUseCase { @@ -23,7 +23,7 @@ public final class DefaultFetchBookmarkedCollectionsUseCase: FetchBookmarkedColl self.userRepository = userRepository } - public func fetchBookmarkedCollections(for target: UserTarget) -> AnyPublisher<[CollectionEntity], Error> { + public func callAsFunction(for target: UserTarget) -> AnyPublisher<[CollectionEntity], Error> { switch target { case .me: return userRepository.fetchMyBookmarkedCollections() diff --git a/FLINT/Domain/Sources/UseCase/Collection/FetchCollectionBookmarkUsersUseCase.swift b/FLINT/Domain/Sources/UseCase/Collection/FetchCollectionBookmarkUsersUseCase.swift index d0303093..a7e553b8 100644 --- a/FLINT/Domain/Sources/UseCase/Collection/FetchCollectionBookmarkUsersUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Collection/FetchCollectionBookmarkUsersUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol FetchCollectionBookmarkUsersUseCase { - func fetchCollectionBookmarkUsers(collectionId: Int64) -> AnyPublisher + func callAsFunction(collectionId: Int64) -> AnyPublisher } public final class DefaultFetchCollectionBookmarkUsersUseCase: FetchCollectionBookmarkUsersUseCase { @@ -23,7 +23,7 @@ public final class DefaultFetchCollectionBookmarkUsersUseCase: FetchCollectionBo self.bookmarkRepository = bookmarkRepository } - public func fetchCollectionBookmarkUsers(collectionId: Int64) -> AnyPublisher { + public func callAsFunction(collectionId: Int64) -> AnyPublisher { return bookmarkRepository.fetchCollectionBookmarkUsers(collectionId: collectionId) } } diff --git a/FLINT/Domain/Sources/UseCase/Collection/FetchCollectionDetailUseCase.swift b/FLINT/Domain/Sources/UseCase/Collection/FetchCollectionDetailUseCase.swift index 4f92556a..56f1ac3f 100644 --- a/FLINT/Domain/Sources/UseCase/Collection/FetchCollectionDetailUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Collection/FetchCollectionDetailUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol FetchCollectionDetailUseCase { - func fetchCollectionDetail(collectionId: Int64) -> AnyPublisher + func callAsFunction(collectionId: Int64) -> AnyPublisher } public class DefaultFetchCollectionDetailUseCase: FetchCollectionDetailUseCase { @@ -23,7 +23,7 @@ public class DefaultFetchCollectionDetailUseCase: FetchCollectionDetailUseCase { self.collectionRepository = collectionRepository } - public func fetchCollectionDetail(collectionId: Int64) -> AnyPublisher { + public func callAsFunction(collectionId: Int64) -> AnyPublisher { return collectionRepository.fetchCollectionDetail(collectionId: collectionId) } } diff --git a/FLINT/Domain/Sources/UseCase/Collection/FetchCreatedCollectionsUseCase.swift b/FLINT/Domain/Sources/UseCase/Collection/FetchCreatedCollectionsUseCase.swift index 73d90640..492567ec 100644 --- a/FLINT/Domain/Sources/UseCase/Collection/FetchCreatedCollectionsUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Collection/FetchCreatedCollectionsUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol FetchCreatedCollectionsUseCase { - func fetchCreatedCollections(for target: UserTarget) -> AnyPublisher<[CollectionEntity], Error> + func callAsFunction(for target: UserTarget) -> AnyPublisher<[CollectionEntity], Error> } public final class DefaultFetchCreatedCollectionsUseCase: FetchCreatedCollectionsUseCase { @@ -23,7 +23,7 @@ public final class DefaultFetchCreatedCollectionsUseCase: FetchCreatedCollection self.userRepository = userRepository } - public func fetchCreatedCollections(for target: UserTarget) -> AnyPublisher<[CollectionEntity], Error> { + public func callAsFunction(for target: UserTarget) -> AnyPublisher<[CollectionEntity], Error> { switch target { case .me: return userRepository.fetchMyCreatedCollections() diff --git a/FLINT/Domain/Sources/UseCase/Collection/FetchExploreCollectionsUseCase.swift b/FLINT/Domain/Sources/UseCase/Collection/FetchExploreCollectionsUseCase.swift index 129fe4eb..3b5520a6 100644 --- a/FLINT/Domain/Sources/UseCase/Collection/FetchExploreCollectionsUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Collection/FetchExploreCollectionsUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol FetchExploreCollectionsUseCase { - func fetchExploreCollections(cursor: Int64?) -> AnyPublisher + func callAsFunction(cursor: Int64?) -> AnyPublisher } public final class DefaultFetchExploreCollectionsUseCase: FetchExploreCollectionsUseCase { @@ -23,7 +23,7 @@ public final class DefaultFetchExploreCollectionsUseCase: FetchExploreCollection self.collectionRepository = collectionRepository } - public func fetchExploreCollections(cursor: Int64?) -> AnyPublisher { - collectionRepository.fetchCollections(cursor: cursor, size: 5) + public func callAsFunction(cursor: Int64?) -> AnyPublisher { + return collectionRepository.fetchCollections(cursor: cursor, size: 5) } } diff --git a/FLINT/Domain/Sources/UseCase/Collection/FetchRecentViewedCollectionsUseCase.swift b/FLINT/Domain/Sources/UseCase/Collection/FetchRecentViewedCollectionsUseCase.swift index 446f4dda..0c7d6b2e 100644 --- a/FLINT/Domain/Sources/UseCase/Collection/FetchRecentViewedCollectionsUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Collection/FetchRecentViewedCollectionsUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol FetchRecentViewedCollectionsUseCase { - func fetchWatchingCollections() -> AnyPublisher<[CollectionEntity], Error> + func callAsFunction() -> AnyPublisher<[CollectionEntity], Error> } public final class DefaultFetchRecentViewedCollectionsUseCase: FetchRecentViewedCollectionsUseCase { @@ -23,7 +23,7 @@ public final class DefaultFetchRecentViewedCollectionsUseCase: FetchRecentViewed self.collectionRepository = collectionRepository } - public func fetchWatchingCollections() -> AnyPublisher<[CollectionEntity], Error> { + public func callAsFunction() -> AnyPublisher<[CollectionEntity], Error> { return collectionRepository.fetchRecentViewedCollections() } } diff --git a/FLINT/Domain/Sources/UseCase/Collection/FetchRecommendedCollectionsUseCase.swift b/FLINT/Domain/Sources/UseCase/Collection/FetchRecommendedCollectionsUseCase.swift index 76e8ac9d..0b618676 100644 --- a/FLINT/Domain/Sources/UseCase/Collection/FetchRecommendedCollectionsUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Collection/FetchRecommendedCollectionsUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol FetchRecommendedCollectionsUseCase { - func fetchRecommendedCollections() -> AnyPublisher<[CollectionEntity], Error> + func callAsFunction() -> AnyPublisher<[CollectionEntity], Error> } public final class DefaultFetchRecommendedCollectionsUseCase: FetchRecommendedCollectionsUseCase { @@ -23,7 +23,7 @@ public final class DefaultFetchRecommendedCollectionsUseCase: FetchRecommendedCo self.homeRepository = homeRepository } - public func fetchRecommendedCollections() -> AnyPublisher<[CollectionEntity], Error> { + public func callAsFunction() -> AnyPublisher<[CollectionEntity], Error> { return homeRepository.fetchRecommendedCollections() } } diff --git a/FLINT/Domain/Sources/UseCase/Collection/ToggleCollectionBookmarkUseCase.swift b/FLINT/Domain/Sources/UseCase/Collection/ToggleCollectionBookmarkUseCase.swift index c1b1b21b..39849310 100644 --- a/FLINT/Domain/Sources/UseCase/Collection/ToggleCollectionBookmarkUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Collection/ToggleCollectionBookmarkUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol ToggleCollectionBookmarkUseCase { - func toggleCollectionBookmark(collectionId: Int64) -> AnyPublisher + func callAsFunction(collectionId: Int64) -> AnyPublisher } public class DefaultToggleCollectionBookmarkUseCase: ToggleCollectionBookmarkUseCase { @@ -23,7 +23,7 @@ public class DefaultToggleCollectionBookmarkUseCase: ToggleCollectionBookmarkUse self.bookmarkRepository = bookmarkRepository } - public func toggleCollectionBookmark(collectionId: Int64) -> AnyPublisher { + public func callAsFunction(collectionId: Int64) -> AnyPublisher { return bookmarkRepository.toggleCollectionBookmark(collectionId: collectionId) } } diff --git a/FLINT/Domain/Sources/UseCase/Content/FetchBookmarkedContentsUseCase.swift b/FLINT/Domain/Sources/UseCase/Content/FetchBookmarkedContentsUseCase.swift index ca7183eb..d64ce0fe 100644 --- a/FLINT/Domain/Sources/UseCase/Content/FetchBookmarkedContentsUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Content/FetchBookmarkedContentsUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol FetchBookmarkedContentsUseCase { - func fetchBookmarkedContents(for target: UserTarget) -> AnyPublisher<[ContentInfoEntity], Error> + func callAsFunction(for target: UserTarget) -> AnyPublisher<[ContentInfoEntity], Error> } public final class DefaultFetchBookmarkedContentsUseCase: FetchBookmarkedContentsUseCase { @@ -25,7 +25,7 @@ public final class DefaultFetchBookmarkedContentsUseCase: FetchBookmarkedContent self.userRepository = userRepository } - public func fetchBookmarkedContents(for target: UserTarget) -> AnyPublisher<[ContentInfoEntity], Error> { + public func callAsFunction(for target: UserTarget) -> AnyPublisher<[ContentInfoEntity], Error> { switch target { case .me: return contentRepository.fetchMyBookmarkedContents() diff --git a/FLINT/Domain/Sources/UseCase/Content/FetchOTTPlatformsForContentUseCase.swift b/FLINT/Domain/Sources/UseCase/Content/FetchOTTPlatformsForContentUseCase.swift index a7e0cc28..a704bb6b 100644 --- a/FLINT/Domain/Sources/UseCase/Content/FetchOTTPlatformsForContentUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Content/FetchOTTPlatformsForContentUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol FetchOTTPlatformsForContentUseCase { - func fetchOTTPlatformsForContent(contentId: Int64) -> AnyPublisher<[OTTPlatformEntity], Error> + func callAsFunction(contentId: Int64) -> AnyPublisher<[OTTPlatformEntity], Error> } public class DefaultFetchOTTPlatformsForContentUseCase: FetchOTTPlatformsForContentUseCase { @@ -23,7 +23,7 @@ public class DefaultFetchOTTPlatformsForContentUseCase: FetchOTTPlatformsForCont self.contentRepository = contentRepository } - public func fetchOTTPlatformsForContent(contentId: Int64) -> AnyPublisher<[OTTPlatformEntity], Error> { + public func callAsFunction(contentId: Int64) -> AnyPublisher<[OTTPlatformEntity], Error> { return contentRepository.fetchOTTPlatformsForContent(contentId: contentId) } } diff --git a/FLINT/Domain/Sources/UseCase/Content/FetchPopularContentsUseCase.swift b/FLINT/Domain/Sources/UseCase/Content/FetchPopularContentsUseCase.swift index 6acad23a..4a385556 100644 --- a/FLINT/Domain/Sources/UseCase/Content/FetchPopularContentsUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Content/FetchPopularContentsUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol FetchPopularContentsUseCase { - func fetchPopularContents() -> AnyPublisher<[ContentEntity], Error> + func callAsFunction() -> AnyPublisher<[ContentEntity], Error> } public class DefaultFetchPopularContentsUseCase: FetchPopularContentsUseCase { @@ -23,7 +23,7 @@ public class DefaultFetchPopularContentsUseCase: FetchPopularContentsUseCase { self.searchRepository = searchRepository } - public func fetchPopularContents() -> AnyPublisher<[ContentEntity], Error> { + public func callAsFunction() -> AnyPublisher<[ContentEntity], Error> { return searchRepository.searchContents(keyword: nil) } } diff --git a/FLINT/Domain/Sources/UseCase/Content/SearchContentsUseCase.swift b/FLINT/Domain/Sources/UseCase/Content/SearchContentsUseCase.swift index d8e3d59b..3ace5fe8 100644 --- a/FLINT/Domain/Sources/UseCase/Content/SearchContentsUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Content/SearchContentsUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol SearchContentsUseCase: AnyObject { - func searchContents(keyword: String) -> AnyPublisher<[ContentEntity], Error> + func callAsFunction(keyword: String) -> AnyPublisher<[ContentEntity], Error> } public class DefaultSearchContentsUseCase: SearchContentsUseCase { @@ -23,7 +23,7 @@ public class DefaultSearchContentsUseCase: SearchContentsUseCase { self.searchRepository = searchRepository } - public func searchContents(keyword: String) -> AnyPublisher<[ContentEntity], Error> { + public func callAsFunction(keyword: String) -> AnyPublisher<[ContentEntity], Error> { return searchRepository.searchContents(keyword: keyword) } } diff --git a/FLINT/Domain/Sources/UseCase/Content/ToggleContentBookmarkUseCase.swift b/FLINT/Domain/Sources/UseCase/Content/ToggleContentBookmarkUseCase.swift index 3592133c..cf8b3964 100644 --- a/FLINT/Domain/Sources/UseCase/Content/ToggleContentBookmarkUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Content/ToggleContentBookmarkUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol ToggleContentBookmarkUseCase { - func toggleContentBookmark(contentId: Int64) -> AnyPublisher + func callAsFunction(contentId: Int64) -> AnyPublisher } public class DefaultToggleContentBookmarkUseCase: ToggleContentBookmarkUseCase { @@ -23,7 +23,7 @@ public class DefaultToggleContentBookmarkUseCase: ToggleContentBookmarkUseCase { self.bookmarkRepository = bookmarkRepository } - public func toggleContentBookmark(contentId: Int64) -> AnyPublisher { + public func callAsFunction(contentId: Int64) -> AnyPublisher { return bookmarkRepository.toggleContentBookmark(contentId: contentId) } } diff --git a/FLINT/Domain/Sources/UseCase/Profile/CheckNicknameUseCase.swift b/FLINT/Domain/Sources/UseCase/Profile/CheckNicknameUseCase.swift index 0511a1ed..86183df1 100644 --- a/FLINT/Domain/Sources/UseCase/Profile/CheckNicknameUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Profile/CheckNicknameUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol CheckNicknameUseCase { - func checkNickname(_ nickname: String) -> AnyPublisher + func callAsFunction(_ nickname: String) -> AnyPublisher } public final class DefaultCheckNicknameUseCase: CheckNicknameUseCase { @@ -23,7 +23,7 @@ public final class DefaultCheckNicknameUseCase: CheckNicknameUseCase { self.userRepository = userRepository } - public func checkNickname(_ nickname: String) -> AnyPublisher { + public func callAsFunction(_ nickname: String) -> AnyPublisher { return userRepository.checkNickname(nickname) } } diff --git a/FLINT/Domain/Sources/UseCase/Profile/FetchKeywordsUseCase.swift b/FLINT/Domain/Sources/UseCase/Profile/FetchKeywordsUseCase.swift index 0573f9d9..9bfa5b73 100644 --- a/FLINT/Domain/Sources/UseCase/Profile/FetchKeywordsUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Profile/FetchKeywordsUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol FetchKeywordsUseCase { - func fetchKeywords(for target: UserTarget) -> AnyPublisher<[KeywordEntity], Error> + func callAsFunction(for target: UserTarget) -> AnyPublisher<[KeywordEntity], Error> } public final class DefaultFetchKeywordsUseCase: FetchKeywordsUseCase { @@ -23,7 +23,7 @@ public final class DefaultFetchKeywordsUseCase: FetchKeywordsUseCase { self.userRepository = userRepository } - public func fetchKeywords(for target: UserTarget) -> AnyPublisher<[KeywordEntity], Error> { + public func callAsFunction(for target: UserTarget) -> AnyPublisher<[KeywordEntity], Error> { switch target { case .me: return userRepository.fetchMyKeywords() diff --git a/FLINT/Domain/Sources/UseCase/Profile/FetchProfileUseCase.swift b/FLINT/Domain/Sources/UseCase/Profile/FetchProfileUseCase.swift index 619341ff..d65f1cb2 100644 --- a/FLINT/Domain/Sources/UseCase/Profile/FetchProfileUseCase.swift +++ b/FLINT/Domain/Sources/UseCase/Profile/FetchProfileUseCase.swift @@ -12,7 +12,7 @@ import Entity import Repository public protocol FetchProfileUseCase { - func fetchProfile(for target: UserTarget) -> AnyPublisher + func callAsFunction(for target: UserTarget) -> AnyPublisher } public final class DefaultFetchProfileUseCase: FetchProfileUseCase { @@ -23,7 +23,7 @@ public final class DefaultFetchProfileUseCase: FetchProfileUseCase { self.userRepository = userRepository } - public func fetchProfile(for target: UserTarget) -> AnyPublisher { + public func callAsFunction(for target: UserTarget) -> AnyPublisher { switch target { case .me: return userRepository.fetchMyProfile() diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/CollectionDetail/CollectionDetailViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/CollectionDetail/CollectionDetailViewModel.swift index 73d10feb..fcd2833c 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/CollectionDetail/CollectionDetailViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/CollectionDetail/CollectionDetailViewModel.swift @@ -95,7 +95,7 @@ public final class CollectionDetailViewModel { private func fetch() { stateSubject.send(.loading) - fetchCollectionDetailUseCase.fetchCollectionDetail(collectionId: collectionId) + fetchCollectionDetailUseCase(collectionId: collectionId) .sink( receiveCompletion: { [weak self] completion in guard let self else { return } @@ -108,7 +108,7 @@ public final class CollectionDetailViewModel { self.stateSubject.send(.loaded(detail: detail, bookmarkedUsers: nil)) - self.fetchCollectionBookmarkUsersUseCase.fetchCollectionBookmarkUsers(collectionId: self.collectionId) + self.fetchCollectionBookmarkUsersUseCase(collectionId: self.collectionId) .sink( receiveCompletion: { _ in }, receiveValue: { [weak self] users in diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/CreateCollection/AddContentSelectViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/CreateCollection/AddContentSelectViewModel.swift index 42ad43c9..e4229af7 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/CreateCollection/AddContentSelectViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/CreateCollection/AddContentSelectViewModel.swift @@ -59,7 +59,7 @@ public final class DefaultAddContentSelectViewModel: AddContentSelectViewModel { public func fetchContents() { isSearching.send(false) - fetchPopularContentsUseCase.fetchPopularContents() + fetchPopularContentsUseCase() .manageThread() .sinkHandledCompletion { [weak self] contents in self?.results.send(contents) @@ -89,7 +89,7 @@ public extension DefaultAddContentSelectViewModel { isSearching.send(true) - searchContentsUseCase.searchContents(keyword: keyword) + searchContentsUseCase(keyword: keyword) .manageThread() .sinkHandledCompletion { [weak self] contents in self?.results.send(contents) diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/CreateCollection/CreateCollectionView/CreateCollectionViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/CreateCollection/CreateCollectionView/CreateCollectionViewModel.swift index a7475e40..e1d5307a 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/CreateCollection/CreateCollectionView/CreateCollectionViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/CreateCollection/CreateCollectionView/CreateCollectionViewModel.swift @@ -73,7 +73,7 @@ public final class DefaultCreateCollectionViewModel: CreateCollectionViewModel { guard isDoneEnabled.value else { return } guard let entity = createEntity else { return } - createCollectionUseCase.createCollection(collectionInfo: entity) + createCollectionUseCase(collectionInfo: entity) .manageThread() .map { _ in Result.success(()) } .catch { Just(Result.failure($0)) } diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/Explore/ExploreViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/Explore/ExploreViewModel.swift index 6c39b736..cc1499be 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/Explore/ExploreViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/Explore/ExploreViewModel.swift @@ -53,7 +53,7 @@ public final class DefaultExploreViewModel: ExploreViewModel { } private func fetchCollections() { - fetchExploreCollectionsUseCase.fetchExploreCollections(cursor: cursor.value) + fetchExploreCollectionsUseCase(cursor: cursor.value) .manageThread() .sinkHandledCompletion { [weak self] collectionPagingEntity in guard let self else { return } diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/Home/CollectionFolderListViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/Home/CollectionFolderListViewModel.swift index e1530f43..3ec69eeb 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/Home/CollectionFolderListViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/Home/CollectionFolderListViewModel.swift @@ -25,7 +25,7 @@ public final class CollectionFolderListViewModel { } public func load() { - fetchRecentViewedCollectionsUseCase.fetchWatchingCollections() + fetchRecentViewedCollectionsUseCase() .receive(on: DispatchQueue.main) .sink { completion in if case let .failure(error) = completion { diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/Home/HomeViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/Home/HomeViewModel.swift index 3999c721..a4bb455e 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/Home/HomeViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/Home/HomeViewModel.swift @@ -71,7 +71,7 @@ public final class HomeViewModel { public func load() { - fetchProfileUseCase.fetchProfile(for: .user(id: 1)) + fetchProfileUseCase(for: .user(id: 1)) .manageThread() .sink { completion in if case let .failure(error) = completion { @@ -85,7 +85,7 @@ public final class HomeViewModel { .store(in: &cancellables) // 1) Fliner 추천 - fetchRecommendedCollectionsUseCase.fetchRecommendedCollections() + fetchRecommendedCollectionsUseCase() .manageThread() .sink { completion in if case let .failure(error) = completion { @@ -101,7 +101,7 @@ public final class HomeViewModel { .store(in: &cancellables) // 2) 최근 저장한 콘텐츠 - fetchBookmarkedContentsUseCase.fetchBookmarkedContents(for: .me) + fetchBookmarkedContentsUseCase(for: .me) .manageThread() .sink { completion in if case let .failure(error) = completion { @@ -114,7 +114,7 @@ public final class HomeViewModel { } .store(in: &cancellables) - fetchRecentViewedCollectionsUseCase.fetchWatchingCollections() + fetchRecentViewedCollectionsUseCase() .manageThread() .sink { completion in if case let .failure(error) = completion { diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/Login/LoginViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/Login/LoginViewModel.swift index 25a047e7..f53f7cb0 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/Login/LoginViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/Login/LoginViewModel.swift @@ -46,7 +46,7 @@ public final class DefaultLoginViewModel: LoginViewModel { return } if let accessToken = oauthToken?.accessToken { - socialVerifyUseCase.socialVerify( + socialVerifyUseCase( socialAuthCredential: SocialVerifyEntity( provider: .kakao, accessToken: accessToken diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/Onboarding/OnboardingViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/Onboarding/OnboardingViewModel.swift index ef1a07f8..a7f83055 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/Onboarding/OnboardingViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/Onboarding/OnboardingViewModel.swift @@ -88,7 +88,7 @@ public final class DefaultOnboardingViewModel: OnboardingViewModel { nicknameValidState.send(.invalid) return } - checkNicknameUseCase.checkNickname(nickname) + checkNicknameUseCase(nickname) .manageThread() .sinkHandledCompletion(receiveValue: { [weak self] isValidNickname in self?.nicknameValidState.send(isValidNickname ? .valid : .duplicate) @@ -100,7 +100,7 @@ public final class DefaultOnboardingViewModel: OnboardingViewModel { } public func fetchPopularContents() { - fetchPopularContentsUseCase.fetchPopularContents() + fetchPopularContentsUseCase() .manageThread() .sinkHandledCompletion { [weak self] contents in self?.contents.send(contents) @@ -109,7 +109,7 @@ public final class DefaultOnboardingViewModel: OnboardingViewModel { } public func searchContents(_ keyword: String) { - searchContentsUseCase.searchContents(keyword: keyword) + searchContentsUseCase(keyword: keyword) .manageThread() .sinkHandledCompletion { [weak self] contents in self?.contents.send(contents) @@ -140,7 +140,7 @@ public final class DefaultOnboardingViewModel: OnboardingViewModel { } public func signup() { - signupUseCase.signup( + signupUseCase( userInfo: SignupInfoEntity( nickname: nickname.value, favoriteContentIds: selectedContents.value.compactMap({ content in diff --git a/FLINT/Presentation/Sources/ViewModel/Scene/Profile/ProfileViewModel.swift b/FLINT/Presentation/Sources/ViewModel/Scene/Profile/ProfileViewModel.swift index 32fc755d..c30ee27d 100644 --- a/FLINT/Presentation/Sources/ViewModel/Scene/Profile/ProfileViewModel.swift +++ b/FLINT/Presentation/Sources/ViewModel/Scene/Profile/ProfileViewModel.swift @@ -86,7 +86,7 @@ public final class ProfileViewModel { // MARK: - Input public func load() { - fetchProfileUseCase.fetchProfile(for: target) + fetchProfileUseCase(for: target) .manageThread() .sinkHandledCompletion(receiveValue: { [weak self] userProfileEntity in guard let self else { return } @@ -97,7 +97,7 @@ public final class ProfileViewModel { }) .store(in: &cancellables) - fetchKeywordsUseCase.fetchKeywords(for: target) + fetchKeywordsUseCase(for: target) .manageThread() .sink { completion in if case let .failure(error) = completion { @@ -110,7 +110,7 @@ public final class ProfileViewModel { } .store(in: &cancellables) - fetchCreatedCollectionsUseCase.fetchCreatedCollections(for: target) + fetchCreatedCollectionsUseCase(for: target) .manageThread() .sink { completion in if case let .failure(error) = completion { @@ -123,7 +123,7 @@ public final class ProfileViewModel { } .store(in: &cancellables) - fetchBookmarkedCollectionsUseCase.fetchBookmarkedCollections(for: target) + fetchBookmarkedCollectionsUseCase(for: target) .manageThread() .sink { completion in if case let .failure(error) = completion { @@ -137,7 +137,7 @@ public final class ProfileViewModel { } .store(in: &cancellables) - fetchBookmarkedContentsUseCase.fetchBookmarkedContents(for: target) + fetchBookmarkedContentsUseCase(for: target) .manageThread() .sink { completion in if case let .failure(error) = completion { From 44f02450a18603cb85334177dff6fc11b2aad676 Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Tue, 17 Feb 2026 17:56:47 +0900 Subject: [PATCH 44/45] =?UTF-8?q?[refactor]=20OTT=20Entity=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EC=9E=91=EC=97=85=20=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/Content}/CircleOTTPlatform.swift | 13 +---------- .../Sources/Entity/Content}/OTTPlatform.swift | 13 +---------- .../BottomSheet/BaseBottomSheetView.swift | 2 ++ .../OTTPlatformList/OTTBottomSheetView.swift | 2 ++ .../OTTPlatformList/OTTListView.swift | 2 ++ .../OTTPlatformList/OTTPlatform+.swift | 23 +++++++++++++++++++ .../OTTPlatformList/OTTPlatformRowView.swift | 2 ++ .../CircleOTTPlatform+.swift | 23 +++++++++++++++++++ .../RecentSaved/RecentSavedContentItem.swift | 2 ++ 9 files changed, 58 insertions(+), 24 deletions(-) rename FLINT/{Presentation/Sources/View/Component/OTTLogoStripeView => Domain/Sources/Entity/Content}/CircleOTTPlatform.swift (72%) rename FLINT/{Presentation/Sources/View/Component/BottomSheet/OTTPlatformList => Domain/Sources/Entity/Content}/OTTPlatform.swift (86%) create mode 100644 FLINT/Presentation/Sources/View/Component/BottomSheet/OTTPlatformList/OTTPlatform+.swift create mode 100644 FLINT/Presentation/Sources/View/Component/OTTLogoStripeView/CircleOTTPlatform+.swift diff --git a/FLINT/Presentation/Sources/View/Component/OTTLogoStripeView/CircleOTTPlatform.swift b/FLINT/Domain/Sources/Entity/Content/CircleOTTPlatform.swift similarity index 72% rename from FLINT/Presentation/Sources/View/Component/OTTLogoStripeView/CircleOTTPlatform.swift rename to FLINT/Domain/Sources/Entity/Content/CircleOTTPlatform.swift index c220b4d8..bb7246d8 100644 --- a/FLINT/Presentation/Sources/View/Component/OTTLogoStripeView/CircleOTTPlatform.swift +++ b/FLINT/Domain/Sources/Entity/Content/CircleOTTPlatform.swift @@ -1,6 +1,6 @@ // // CircleOTTPlatform.swift -// FLINT +// Domain // // Created by 소은 on 1/13/26. // @@ -18,17 +18,6 @@ public enum CircleOTTPlatform: CaseIterable, Hashable, Sendable { public static let order: [CircleOTTPlatform] = [ .netflix, .tving, .coupangPlay, .wavve, .disneyPlus, .watcha ] - - public var smallLogoImage: UIImage? { - switch self { - case .netflix: return UIImage.imgSmallNetflix1 - case .tving: return UIImage.imgSmallTving1 - case .coupangPlay: return UIImage.imgSmallCoupang1 - case .wavve: return UIImage.imgSmallWavve1 - case .disneyPlus: return UIImage.imgSmallDisney1 - case .watcha: return UIImage.imgSmallWatcha1 - } - } } extension Sequence where Element == CircleOTTPlatform { diff --git a/FLINT/Presentation/Sources/View/Component/BottomSheet/OTTPlatformList/OTTPlatform.swift b/FLINT/Domain/Sources/Entity/Content/OTTPlatform.swift similarity index 86% rename from FLINT/Presentation/Sources/View/Component/BottomSheet/OTTPlatformList/OTTPlatform.swift rename to FLINT/Domain/Sources/Entity/Content/OTTPlatform.swift index c0faf607..48654b41 100644 --- a/FLINT/Presentation/Sources/View/Component/BottomSheet/OTTPlatformList/OTTPlatform.swift +++ b/FLINT/Domain/Sources/Entity/Content/OTTPlatform.swift @@ -1,6 +1,6 @@ // // OTTPlatform.swift -// FLINT +// Domain // // Created by 소은 on 1/12/26. // @@ -27,17 +27,6 @@ public enum OTTPlatform: String, CaseIterable, Hashable { } } - public var icon: UIImage? { - switch self { - case .netflix: return UIImage.imgSmallNetflix1 - case .tving: return UIImage.imgSmallTving1 - case .wavve: return UIImage.imgSmallWavve1 - case .coupangPlay: return UIImage.imgSmallCoupang1 - case .watcha: return UIImage.imgSmallWatcha1 - case .disneyPlus: return UIImage.imgSmallDisney1 - } - } - // MARK: - URL //TODO: 서버 연동 시 서버 값으로 대체 diff --git a/FLINT/Presentation/Sources/View/Component/BottomSheet/BaseBottomSheetView.swift b/FLINT/Presentation/Sources/View/Component/BottomSheet/BaseBottomSheetView.swift index 611954c6..fcc52f2b 100644 --- a/FLINT/Presentation/Sources/View/Component/BottomSheet/BaseBottomSheetView.swift +++ b/FLINT/Presentation/Sources/View/Component/BottomSheet/BaseBottomSheetView.swift @@ -10,6 +10,8 @@ import UIKit import SnapKit import Then +import Domain + public enum BottomSheetContent { case ott(platforms: [OTTPlatform]) case savedUsers(users: [SavedUserRowItem]) diff --git a/FLINT/Presentation/Sources/View/Component/BottomSheet/OTTPlatformList/OTTBottomSheetView.swift b/FLINT/Presentation/Sources/View/Component/BottomSheet/OTTPlatformList/OTTBottomSheetView.swift index 9b71edb5..efdf6d6f 100644 --- a/FLINT/Presentation/Sources/View/Component/BottomSheet/OTTPlatformList/OTTBottomSheetView.swift +++ b/FLINT/Presentation/Sources/View/Component/BottomSheet/OTTPlatformList/OTTBottomSheetView.swift @@ -10,6 +10,8 @@ import UIKit import SnapKit import Then +import Domain + public final class OTTBottomSheetView: BaseView { // MARK: - Public Event diff --git a/FLINT/Presentation/Sources/View/Component/BottomSheet/OTTPlatformList/OTTListView.swift b/FLINT/Presentation/Sources/View/Component/BottomSheet/OTTPlatformList/OTTListView.swift index df4a393e..38a18162 100644 --- a/FLINT/Presentation/Sources/View/Component/BottomSheet/OTTPlatformList/OTTListView.swift +++ b/FLINT/Presentation/Sources/View/Component/BottomSheet/OTTPlatformList/OTTListView.swift @@ -10,6 +10,8 @@ import UIKit import SnapKit import Then +import Domain + public final class OTTListView: BaseView { public static let rowHeight: CGFloat = 48 diff --git a/FLINT/Presentation/Sources/View/Component/BottomSheet/OTTPlatformList/OTTPlatform+.swift b/FLINT/Presentation/Sources/View/Component/BottomSheet/OTTPlatformList/OTTPlatform+.swift new file mode 100644 index 00000000..4918cfe1 --- /dev/null +++ b/FLINT/Presentation/Sources/View/Component/BottomSheet/OTTPlatformList/OTTPlatform+.swift @@ -0,0 +1,23 @@ +// +// OTTPlatform+.swift +// Domain +// +// Created by 소은 on 1/12/26. +// + +import UIKit + +import Domain + +extension OTTPlatform { + public var icon: UIImage? { + switch self { + case .netflix: return UIImage.imgSmallNetflix1 + case .tving: return UIImage.imgSmallTving1 + case .wavve: return UIImage.imgSmallWavve1 + case .coupangPlay: return UIImage.imgSmallCoupang1 + case .watcha: return UIImage.imgSmallWatcha1 + case .disneyPlus: return UIImage.imgSmallDisney1 + } + } +} diff --git a/FLINT/Presentation/Sources/View/Component/BottomSheet/OTTPlatformList/OTTPlatformRowView.swift b/FLINT/Presentation/Sources/View/Component/BottomSheet/OTTPlatformList/OTTPlatformRowView.swift index 4f6f18f8..a1c20ff4 100644 --- a/FLINT/Presentation/Sources/View/Component/BottomSheet/OTTPlatformList/OTTPlatformRowView.swift +++ b/FLINT/Presentation/Sources/View/Component/BottomSheet/OTTPlatformList/OTTPlatformRowView.swift @@ -10,6 +10,8 @@ import UIKit import SnapKit import Then +import Domain + public final class OTTPlatformRowView: BaseView { // MARK: - Public Event diff --git a/FLINT/Presentation/Sources/View/Component/OTTLogoStripeView/CircleOTTPlatform+.swift b/FLINT/Presentation/Sources/View/Component/OTTLogoStripeView/CircleOTTPlatform+.swift new file mode 100644 index 00000000..93f8ca24 --- /dev/null +++ b/FLINT/Presentation/Sources/View/Component/OTTLogoStripeView/CircleOTTPlatform+.swift @@ -0,0 +1,23 @@ +// +// CircleOTTPlatform+.swift +// Domain +// +// Created by 소은 on 1/13/26. +// + +import UIKit + +import Domain + +extension CircleOTTPlatform { + public var smallLogoImage: UIImage? { + switch self { + case .netflix: return UIImage.imgSmallNetflix1 + case .tving: return UIImage.imgSmallTving1 + case .coupangPlay: return UIImage.imgSmallCoupang1 + case .wavve: return UIImage.imgSmallWavve1 + case .disneyPlus: return UIImage.imgSmallDisney1 + case .watcha: return UIImage.imgSmallWatcha1 + } + } +} diff --git a/FLINT/Presentation/Sources/View/Component/RecentSaved/RecentSavedContentItem.swift b/FLINT/Presentation/Sources/View/Component/RecentSaved/RecentSavedContentItem.swift index ff4b0f89..6602715b 100644 --- a/FLINT/Presentation/Sources/View/Component/RecentSaved/RecentSavedContentItem.swift +++ b/FLINT/Presentation/Sources/View/Component/RecentSaved/RecentSavedContentItem.swift @@ -7,6 +7,8 @@ import Foundation +import Domain + public struct RecentSavedContentItem: Hashable { public let id: UUID = UUID() public let posterImageName: String From b8a9509fe19eef955d0f2e891a301df159100a7a Mon Sep 17 00:00:00 2001 From: "Hosung.Kim" Date: Wed, 18 Feb 2026 01:29:24 +0900 Subject: [PATCH 45/45] =?UTF-8?q?[refactor]=20Factory=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repository/AuthRepositoryFactory.swift | 6 +--- .../BookmarkRepositoryFactory.swift | 6 +--- .../CollectionRepositoryFactory.swift | 6 +--- .../Repository/ContentRepositoryFactory.swift | 6 +--- .../Repository/HomeRepositoryFactory.swift | 6 +--- .../Repository/SearchRepositoryFactory.swift | 6 +--- .../Repository/UserRepositoryFactory.swift | 6 +--- .../Factory/Service/AuthServiceFactory.swift | 8 +---- .../Service/BookmarkServiceFactory.swift | 8 +---- .../Service/CollectionServiceFactory.swift | 8 +---- .../Service/ContentServiceFactory.swift | 8 +---- .../Factory/Service/HomeServiceFactory.swift | 8 +---- .../Service/SearchServiceFactory.swift | 8 +---- .../Factory/Service/UserServiceFactory.swift | 8 +---- .../UseCase/Auth/SignupUseCaseFactory.swift | 6 +--- .../Auth/SocialVerifyUseCaseFactory.swift | 8 ++--- .../UseCase/Auth/WithDrawUseCaseFactory.swift | 6 +--- .../CreateCollectionUseCaseFactory.swift | 6 +--- ...hBookmarkedCollectionsUseCaseFactory.swift | 6 +--- ...ollectionBookmarkUsersUseCaseFactory.swift | 6 +--- .../FetchCollectionDetailUseCaseFactory.swift | 6 +--- ...etchCreatedCollectionsUseCaseFactory.swift | 6 +--- ...etchExploreCollectionsUseCaseFactory.swift | 6 +--- ...ecentViewedCollectionsUseCaseFactory.swift | 6 +--- ...RecommendedCollectionsUseCaseFactory.swift | 6 +--- ...ggleCollectionBookmarkUseCaseFactory.swift | 6 +--- ...etchBookmarkedContentsUseCaseFactory.swift | 6 +--- ...OTTPlatformsForContentUseCaseFactory.swift | 6 +--- .../FetchPopularContentsUseCaseFactory.swift | 6 +--- .../SearchContentsUseCaseFactory.swift | 8 ++--- .../ToggleContentBookmarkUseCaseFactory.swift | 6 +--- .../Profile/CheckNicknameUseCaseFactory.swift | 6 +--- .../Profile/FetchKeywordsUseCaseFactory.swift | 6 +--- .../Profile/FetchProfileUseCaseFactory.swift | 6 +--- .../AddContentSelectViewModelFactory.swift | 21 +----------- .../CollectionDetailViewModelFactory.swift | 25 ++------------ ...CollectionFolderListViewModelFactory.swift | 7 +--- .../CreateCollectionViewModelFactory.swift | 7 +--- .../ViewModel/ExploreViewModelFactory.swift | 7 +--- .../ViewModel/HomeViewModelFactory.swift | 32 +---------------- .../ViewModel/LoginViewModelFactory.swift | 7 +--- .../OnboardingViewModelFactory.swift | 12 +------ .../ViewModel/ProfileViewModelFactory.swift | 34 +------------------ 43 files changed, 46 insertions(+), 328 deletions(-) diff --git a/FLINT/FLINT/Dependency/Factory/Repository/AuthRepositoryFactory.swift b/FLINT/FLINT/Dependency/Factory/Repository/AuthRepositoryFactory.swift index 097f4e9c..2af43404 100644 --- a/FLINT/FLINT/Dependency/Factory/Repository/AuthRepositoryFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Repository/AuthRepositoryFactory.swift @@ -12,14 +12,10 @@ import Domain protocol AuthRepositoryFactory: AuthServiceFactory { func makeAuthRepository() -> AuthRepository - func makeAuthRepository(authService: AuthService) -> AuthRepository } extension AuthRepositoryFactory { func makeAuthRepository() -> AuthRepository { - return makeAuthRepository(authService: makeAuthService()) - } - func makeAuthRepository(authService: AuthService) -> AuthRepository { - return DefaultAuthRepository(authService: authService) + return DefaultAuthRepository(authService: makeAuthService()) } } diff --git a/FLINT/FLINT/Dependency/Factory/Repository/BookmarkRepositoryFactory.swift b/FLINT/FLINT/Dependency/Factory/Repository/BookmarkRepositoryFactory.swift index e17dd987..9c17af2a 100644 --- a/FLINT/FLINT/Dependency/Factory/Repository/BookmarkRepositoryFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Repository/BookmarkRepositoryFactory.swift @@ -12,14 +12,10 @@ import Domain protocol BookmarkRepositoryFactory: BookmarkServiceFactory { func makeBookmarkRepository() -> BookmarkRepository - func makeBookmarkRepository(bookmarkService: BookmarkService) -> BookmarkRepository } extension BookmarkRepositoryFactory { func makeBookmarkRepository() -> BookmarkRepository { - return makeBookmarkRepository(bookmarkService: makeBookmarkService()) - } - func makeBookmarkRepository(bookmarkService: BookmarkService) -> BookmarkRepository { - return DefaultBookmarkRepository(bookmarkService: bookmarkService) + return DefaultBookmarkRepository(bookmarkService: makeBookmarkService()) } } diff --git a/FLINT/FLINT/Dependency/Factory/Repository/CollectionRepositoryFactory.swift b/FLINT/FLINT/Dependency/Factory/Repository/CollectionRepositoryFactory.swift index 4238c2a8..1ca678cf 100644 --- a/FLINT/FLINT/Dependency/Factory/Repository/CollectionRepositoryFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Repository/CollectionRepositoryFactory.swift @@ -12,14 +12,10 @@ import Domain protocol CollectionRepositoryFactory: CollectionServiceFactory { func makeCollectionRepository() -> CollectionRepository - func makeCollectionRepository(collectionService: CollectionService) -> CollectionRepository } extension CollectionRepositoryFactory { func makeCollectionRepository() -> CollectionRepository { - return makeCollectionRepository(collectionService: makeCollectionService()) - } - func makeCollectionRepository(collectionService: CollectionService) -> CollectionRepository { - return DefaultCollectionRepository(collectionService: collectionService) + return DefaultCollectionRepository(collectionService: makeCollectionService()) } } diff --git a/FLINT/FLINT/Dependency/Factory/Repository/ContentRepositoryFactory.swift b/FLINT/FLINT/Dependency/Factory/Repository/ContentRepositoryFactory.swift index 5c494686..a81c55c1 100644 --- a/FLINT/FLINT/Dependency/Factory/Repository/ContentRepositoryFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Repository/ContentRepositoryFactory.swift @@ -12,14 +12,10 @@ import Domain protocol ContentRepositoryFactory: ContentServiceFactory { func makeContentRepository() -> ContentRepository - func makeContentRepository(contentService: ContentService) -> ContentRepository } extension ContentRepositoryFactory { func makeContentRepository() -> ContentRepository { - return makeContentRepository(contentService: makeContentService()) - } - func makeContentRepository(contentService: ContentService) -> ContentRepository { - return DefaultContentRepository(contentService: contentService) + return DefaultContentRepository(contentService: makeContentService()) } } diff --git a/FLINT/FLINT/Dependency/Factory/Repository/HomeRepositoryFactory.swift b/FLINT/FLINT/Dependency/Factory/Repository/HomeRepositoryFactory.swift index 50e03173..a606abde 100644 --- a/FLINT/FLINT/Dependency/Factory/Repository/HomeRepositoryFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Repository/HomeRepositoryFactory.swift @@ -12,14 +12,10 @@ import Domain protocol HomeRepositoryFactory: HomeServiceFactory { func makeHomeRepository() -> HomeRepository - func makeHomeRepository(homeService: HomeService) -> HomeRepository } extension HomeRepositoryFactory { func makeHomeRepository() -> HomeRepository { - return makeHomeRepository(homeService: makeHomeService()) - } - func makeHomeRepository(homeService: HomeService) -> HomeRepository { - return DefaultHomeRepository(homeService: homeService) + return DefaultHomeRepository(homeService: makeHomeService()) } } diff --git a/FLINT/FLINT/Dependency/Factory/Repository/SearchRepositoryFactory.swift b/FLINT/FLINT/Dependency/Factory/Repository/SearchRepositoryFactory.swift index 750d24da..55d53023 100644 --- a/FLINT/FLINT/Dependency/Factory/Repository/SearchRepositoryFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Repository/SearchRepositoryFactory.swift @@ -12,14 +12,10 @@ import Domain protocol SearchRepositoryFactory: SearchServiceFactory { func makeSearchRepository() -> SearchRepository - func makeSearchRepository(searchService: SearchService) -> SearchRepository } extension SearchRepositoryFactory { func makeSearchRepository() -> SearchRepository { - return makeSearchRepository(searchService: makeSearchService()) - } - func makeSearchRepository(searchService: SearchService) -> SearchRepository { - return DefaultSearchRepository(searchService: searchService) + return DefaultSearchRepository(searchService: makeSearchService()) } } diff --git a/FLINT/FLINT/Dependency/Factory/Repository/UserRepositoryFactory.swift b/FLINT/FLINT/Dependency/Factory/Repository/UserRepositoryFactory.swift index db0c9e42..8419c9eb 100644 --- a/FLINT/FLINT/Dependency/Factory/Repository/UserRepositoryFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Repository/UserRepositoryFactory.swift @@ -12,14 +12,10 @@ import Domain protocol UserRepositoryFactory: UserServiceFactory { func makeUserRepository() -> UserRepository - func makeUserRepository(userService: UserService) -> UserRepository } extension UserRepositoryFactory { func makeUserRepository() -> UserRepository { - return makeUserRepository(userService: makeUserService()) - } - func makeUserRepository(userService: UserService) -> UserRepository { - return DefaultUserRepository(userService: userService) + return DefaultUserRepository(userService: makeUserService()) } } diff --git a/FLINT/FLINT/Dependency/Factory/Service/AuthServiceFactory.swift b/FLINT/FLINT/Dependency/Factory/Service/AuthServiceFactory.swift index 928ea206..01b69ad3 100644 --- a/FLINT/FLINT/Dependency/Factory/Service/AuthServiceFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Service/AuthServiceFactory.swift @@ -7,20 +7,14 @@ import Foundation -import Moya - import Data protocol AuthServiceFactory: AuthAPIProviderFactory, TokenStorageFactory { func makeAuthService() -> AuthService - func makeAuthService(tokenStorage: TokenStorage, authAPIProvider: MoyaProvider) -> AuthService } extension AuthServiceFactory { func makeAuthService() -> AuthService { - return makeAuthService(tokenStorage: makeTokenStorage(), authAPIProvider: makeAuthAPIProvider()) - } - func makeAuthService(tokenStorage: TokenStorage, authAPIProvider: MoyaProvider) -> AuthService { - return DefaultAuthService(tokenStorage: tokenStorage, authAPIProvider: authAPIProvider) + return DefaultAuthService(tokenStorage: makeTokenStorage(), authAPIProvider: makeAuthAPIProvider()) } } diff --git a/FLINT/FLINT/Dependency/Factory/Service/BookmarkServiceFactory.swift b/FLINT/FLINT/Dependency/Factory/Service/BookmarkServiceFactory.swift index 0b724d86..cef278dc 100644 --- a/FLINT/FLINT/Dependency/Factory/Service/BookmarkServiceFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Service/BookmarkServiceFactory.swift @@ -7,20 +7,14 @@ import Foundation -import Moya - import Data protocol BookmarkServiceFactory: BookmarkAPIProviderFactory { func makeBookmarkService() -> BookmarkService - func makeBookmarkService(bookmarkAPIProvider: MoyaProvider) -> BookmarkService } extension BookmarkServiceFactory { func makeBookmarkService() -> BookmarkService { - return makeBookmarkService(bookmarkAPIProvider: makeBookmarkAPIProvider()) - } - func makeBookmarkService(bookmarkAPIProvider: MoyaProvider) -> BookmarkService { - return DefaultBookmarkService(bookmarkAPIProvider: bookmarkAPIProvider) + return DefaultBookmarkService(bookmarkAPIProvider: makeBookmarkAPIProvider()) } } diff --git a/FLINT/FLINT/Dependency/Factory/Service/CollectionServiceFactory.swift b/FLINT/FLINT/Dependency/Factory/Service/CollectionServiceFactory.swift index b231ed7b..2ae0ad7b 100644 --- a/FLINT/FLINT/Dependency/Factory/Service/CollectionServiceFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Service/CollectionServiceFactory.swift @@ -7,20 +7,14 @@ import Foundation -import Moya - import Data protocol CollectionServiceFactory: CollectionAPIProviderFactory { func makeCollectionService() -> CollectionService - func makeCollectionService(collectionAPIProvider: MoyaProvider) -> CollectionService } extension CollectionServiceFactory { func makeCollectionService() -> CollectionService { - return makeCollectionService(collectionAPIProvider: makeCollectionAPIProvider()) - } - func makeCollectionService(collectionAPIProvider: MoyaProvider) -> CollectionService { - return DefaultCollectionService(collectionAPIProvider: collectionAPIProvider) + return DefaultCollectionService(collectionAPIProvider: makeCollectionAPIProvider()) } } diff --git a/FLINT/FLINT/Dependency/Factory/Service/ContentServiceFactory.swift b/FLINT/FLINT/Dependency/Factory/Service/ContentServiceFactory.swift index 150d256e..c2dfd6a4 100644 --- a/FLINT/FLINT/Dependency/Factory/Service/ContentServiceFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Service/ContentServiceFactory.swift @@ -7,20 +7,14 @@ import Foundation -import Moya - import Data protocol ContentServiceFactory: ContentAPIProviderFactory { func makeContentService() -> ContentService - func makeContentService(contentAPIProvider: MoyaProvider) -> ContentService } extension ContentServiceFactory { func makeContentService() -> ContentService { - return makeContentService(contentAPIProvider: makeContentAPIProvider()) - } - func makeContentService(contentAPIProvider: MoyaProvider) -> ContentService { - return DefaultContentService(contentAPIProvider: contentAPIProvider) + return DefaultContentService(contentAPIProvider: makeContentAPIProvider()) } } diff --git a/FLINT/FLINT/Dependency/Factory/Service/HomeServiceFactory.swift b/FLINT/FLINT/Dependency/Factory/Service/HomeServiceFactory.swift index 76801699..5ed6dc72 100644 --- a/FLINT/FLINT/Dependency/Factory/Service/HomeServiceFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Service/HomeServiceFactory.swift @@ -7,20 +7,14 @@ import Foundation -import Moya - import Data protocol HomeServiceFactory: HomeAPIProviderFactory { func makeHomeService() -> HomeService - func makeHomeService(homeAPIProvider: MoyaProvider) -> HomeService } extension HomeServiceFactory { func makeHomeService() -> HomeService { - return makeHomeService(homeAPIProvider: makeHomeAPIProvider()) - } - func makeHomeService(homeAPIProvider: MoyaProvider) -> HomeService { - return DefaultHomeService(homeAPIProvider: homeAPIProvider) + return DefaultHomeService(homeAPIProvider: makeHomeAPIProvider()) } } diff --git a/FLINT/FLINT/Dependency/Factory/Service/SearchServiceFactory.swift b/FLINT/FLINT/Dependency/Factory/Service/SearchServiceFactory.swift index 897c7e28..68571195 100644 --- a/FLINT/FLINT/Dependency/Factory/Service/SearchServiceFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Service/SearchServiceFactory.swift @@ -7,20 +7,14 @@ import Foundation -import Moya - import Data protocol SearchServiceFactory: SearchAPIProviderFactory { func makeSearchService() -> SearchService - func makeSearchService(searchAPIProvider: MoyaProvider) -> SearchService } extension SearchServiceFactory { func makeSearchService() -> SearchService { - return makeSearchService(searchAPIProvider: makeSearchAPIProvider()) - } - func makeSearchService(searchAPIProvider: MoyaProvider) -> SearchService { - return DefaultSearchService(searchAPIProvider: searchAPIProvider) + return DefaultSearchService(searchAPIProvider: makeSearchAPIProvider()) } } diff --git a/FLINT/FLINT/Dependency/Factory/Service/UserServiceFactory.swift b/FLINT/FLINT/Dependency/Factory/Service/UserServiceFactory.swift index b22147c4..24970990 100644 --- a/FLINT/FLINT/Dependency/Factory/Service/UserServiceFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/Service/UserServiceFactory.swift @@ -7,20 +7,14 @@ import Foundation -import Moya - import Data protocol UserServiceFactory: UserAPIProviderFactory { func makeUserService() -> UserService - func makeUserService(userAPIProvider: MoyaProvider) -> UserService } extension UserServiceFactory { func makeUserService() -> UserService { - return makeUserService(userAPIProvider: makeUserAPIProvider()) - } - func makeUserService(userAPIProvider: MoyaProvider) -> UserService { - return DefaultUserService(userAPIProvider: userAPIProvider) + return DefaultUserService(userAPIProvider: makeUserAPIProvider()) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Auth/SignupUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Auth/SignupUseCaseFactory.swift index d7a9941d..67b7fac6 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Auth/SignupUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Auth/SignupUseCaseFactory.swift @@ -11,14 +11,10 @@ import Domain protocol SignupUseCaseFactory: AuthRepositoryFactory { func makeSignupUseCase() -> SignupUseCase - func makeSignupUseCase(authRepository: AuthRepository) -> SignupUseCase } extension SignupUseCaseFactory { func makeSignupUseCase() -> SignupUseCase { - return makeSignupUseCase(authRepository: makeAuthRepository()) - } - func makeSignupUseCase(authRepository: AuthRepository) -> SignupUseCase { - return DefaultSignupUseCase(authRepository: authRepository) + return DefaultSignupUseCase(authRepository: makeAuthRepository()) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Auth/SocialVerifyUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Auth/SocialVerifyUseCaseFactory.swift index cead480b..2fba9102 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Auth/SocialVerifyUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Auth/SocialVerifyUseCaseFactory.swift @@ -11,14 +11,10 @@ import Domain protocol SocialVerifyUseCaseFactory: AuthRepositoryFactory { func makeSocialVerifyUseCase() -> SocialVerifyUseCase - func makeSocialVerifyUseCase(authRepository: AuthRepository) -> SocialVerifyUseCase } -extension SignupUseCaseFactory { +extension SocialVerifyUseCaseFactory { func makeSocialVerifyUseCase() -> SocialVerifyUseCase { - return makeSocialVerifyUseCase(authRepository: makeAuthRepository()) - } - func makeSocialVerifyUseCase(authRepository: AuthRepository) -> SocialVerifyUseCase { - return DefaultSocialVerifyUseCase(authRepository: authRepository) + return DefaultSocialVerifyUseCase(authRepository: makeAuthRepository()) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Auth/WithDrawUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Auth/WithDrawUseCaseFactory.swift index 7fb0adbb..28c225ff 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Auth/WithDrawUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Auth/WithDrawUseCaseFactory.swift @@ -11,14 +11,10 @@ import Domain protocol WithDrawUseCaseFactory: AuthRepositoryFactory { func makeWithDrawUseCase() -> WithDrawUseCase - func makeWithDrawUseCase(authRepository: AuthRepository) -> WithDrawUseCase } extension WithDrawUseCaseFactory { func makeWithDrawUseCase() -> WithDrawUseCase { - return makeWithDrawUseCase(authRepository: makeAuthRepository()) - } - func makeWithDrawUseCase(authRepository: AuthRepository) -> WithDrawUseCase { - return DefaultWithDrawUseCase(authRepository: authRepository) + return DefaultWithDrawUseCase(authRepository: makeAuthRepository()) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/CreateCollectionUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/CreateCollectionUseCaseFactory.swift index 2b78012c..51e2c3d3 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/CreateCollectionUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/CreateCollectionUseCaseFactory.swift @@ -11,14 +11,10 @@ import Domain protocol CreateCollectionUseCaseFactory: CollectionRepositoryFactory { func makeCreateCollectionUseCase() -> CreateCollectionUseCase - func makeCreateCollectionUseCase(collectionRepository: CollectionRepository) -> CreateCollectionUseCase } extension CreateCollectionUseCaseFactory { func makeCreateCollectionUseCase() -> CreateCollectionUseCase { - return makeCreateCollectionUseCase(collectionRepository: makeCollectionRepository()) - } - func makeCreateCollectionUseCase(collectionRepository: CollectionRepository) -> CreateCollectionUseCase { - return DefaultCreateCollectionUseCase(collectionRepository: collectionRepository) + return DefaultCreateCollectionUseCase(collectionRepository: makeCollectionRepository()) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchBookmarkedCollectionsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchBookmarkedCollectionsUseCaseFactory.swift index 06ce9ccd..ddb9ac18 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchBookmarkedCollectionsUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchBookmarkedCollectionsUseCaseFactory.swift @@ -11,14 +11,10 @@ import Domain protocol FetchBookmarkedCollectionsUseCaseFactory: UserRepositoryFactory { func makeFetchBookmarkedCollectionsUseCase() -> FetchBookmarkedCollectionsUseCase - func makeFetchBookmarkedCollectionsUseCase(userRepository: UserRepository) -> FetchBookmarkedCollectionsUseCase } extension FetchBookmarkedCollectionsUseCaseFactory { func makeFetchBookmarkedCollectionsUseCase() -> FetchBookmarkedCollectionsUseCase { - return makeFetchBookmarkedCollectionsUseCase(userRepository: makeUserRepository()) - } - func makeFetchBookmarkedCollectionsUseCase(userRepository: UserRepository) -> FetchBookmarkedCollectionsUseCase { - return DefaultFetchBookmarkedCollectionsUseCase(userRepository: userRepository) + return DefaultFetchBookmarkedCollectionsUseCase(userRepository: makeUserRepository()) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionBookmarkUsersUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionBookmarkUsersUseCaseFactory.swift index 9442a4f5..413c64e1 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionBookmarkUsersUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionBookmarkUsersUseCaseFactory.swift @@ -11,14 +11,10 @@ import Domain protocol FetchCollectionBookmarkUsersUseCaseFactory: BookmarkRepositoryFactory { func makeFetchCollectionBookmarkUsersUseCase() -> FetchCollectionBookmarkUsersUseCase - func makeFetchCollectionBookmarkUsersUseCase(bookmarkRepository: BookmarkRepository) -> FetchCollectionBookmarkUsersUseCase } extension FetchCollectionBookmarkUsersUseCaseFactory { func makeFetchCollectionBookmarkUsersUseCase() -> FetchCollectionBookmarkUsersUseCase { - return makeFetchCollectionBookmarkUsersUseCase(bookmarkRepository: makeBookmarkRepository()) - } - func makeFetchCollectionBookmarkUsersUseCase(bookmarkRepository: BookmarkRepository) -> FetchCollectionBookmarkUsersUseCase { - return DefaultFetchCollectionBookmarkUsersUseCase(bookmarkRepository: bookmarkRepository) + return DefaultFetchCollectionBookmarkUsersUseCase(bookmarkRepository: makeBookmarkRepository()) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionDetailUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionDetailUseCaseFactory.swift index f6a91b93..a5fb5886 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionDetailUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCollectionDetailUseCaseFactory.swift @@ -11,14 +11,10 @@ import Domain protocol FetchCollectionDetailUseCaseFactory: CollectionRepositoryFactory { func makeFetchCollectionDetailUseCase() -> FetchCollectionDetailUseCase - func makeFetchCollectionDetailUseCase(collectionRepository: CollectionRepository) -> FetchCollectionDetailUseCase } extension FetchCollectionDetailUseCaseFactory { func makeFetchCollectionDetailUseCase() -> FetchCollectionDetailUseCase { - return makeFetchCollectionDetailUseCase(collectionRepository: makeCollectionRepository()) - } - func makeFetchCollectionDetailUseCase(collectionRepository: CollectionRepository) -> FetchCollectionDetailUseCase { - return DefaultFetchCollectionDetailUseCase(collectionRepository: collectionRepository) + return DefaultFetchCollectionDetailUseCase(collectionRepository: makeCollectionRepository()) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCreatedCollectionsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCreatedCollectionsUseCaseFactory.swift index 6ce01768..f0e2fa50 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCreatedCollectionsUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchCreatedCollectionsUseCaseFactory.swift @@ -11,14 +11,10 @@ import Domain protocol FetchCreatedCollectionsUseCaseFactory: UserRepositoryFactory { func makeFetchCreatedCollectionsUseCase() -> FetchCreatedCollectionsUseCase - func makeFetchCreatedCollectionsUseCase(userRepository: UserRepository) -> FetchCreatedCollectionsUseCase } extension FetchKeywordsUseCaseFactory { func makeFetchCreatedCollectionsUseCase() -> FetchCreatedCollectionsUseCase { - return makeFetchCreatedCollectionsUseCase(userRepository: makeUserRepository()) - } - func makeFetchCreatedCollectionsUseCase(userRepository: UserRepository) -> FetchCreatedCollectionsUseCase { - return DefaultFetchCreatedCollectionsUseCase(userRepository: userRepository) + return DefaultFetchCreatedCollectionsUseCase(userRepository: makeUserRepository()) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchExploreCollectionsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchExploreCollectionsUseCaseFactory.swift index c886186e..23d7c2d9 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchExploreCollectionsUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchExploreCollectionsUseCaseFactory.swift @@ -11,14 +11,10 @@ import Domain protocol FetchExploreCollectionsUseCaseFactory: CollectionRepositoryFactory { func makeFetchExploreCollectionsUseCase() -> FetchExploreCollectionsUseCase - func makeFetchExploreCollectionsUseCase(collectionRepository: CollectionRepository) -> FetchExploreCollectionsUseCase } extension FetchExploreCollectionsUseCaseFactory { func makeFetchExploreCollectionsUseCase() -> FetchExploreCollectionsUseCase { - return makeFetchExploreCollectionsUseCase(collectionRepository: makeCollectionRepository()) - } - func makeFetchExploreCollectionsUseCase(collectionRepository: CollectionRepository) -> FetchExploreCollectionsUseCase { - return DefaultFetchExploreCollectionsUseCase(collectionRepository: collectionRepository) + return DefaultFetchExploreCollectionsUseCase(collectionRepository: makeCollectionRepository()) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchRecentViewedCollectionsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchRecentViewedCollectionsUseCaseFactory.swift index 2e17afaa..1be52cde 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchRecentViewedCollectionsUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchRecentViewedCollectionsUseCaseFactory.swift @@ -11,14 +11,10 @@ import Domain protocol FetchRecentViewedCollectionsUseCaseFactory: CollectionRepositoryFactory { func makeFetchRecentViewedCollectionsUseCase() -> FetchRecentViewedCollectionsUseCase - func makeFetchRecentViewedCollectionsUseCase(collectionRepository: CollectionRepository) -> FetchRecentViewedCollectionsUseCase } extension FetchRecentViewedCollectionsUseCaseFactory { func makeFetchRecentViewedCollectionsUseCase() -> FetchRecentViewedCollectionsUseCase { - return makeFetchRecentViewedCollectionsUseCase(collectionRepository: makeCollectionRepository()) - } - func makeFetchRecentViewedCollectionsUseCase(collectionRepository: CollectionRepository) -> FetchRecentViewedCollectionsUseCase { - return DefaultFetchRecentViewedCollectionsUseCase(collectionRepository: collectionRepository) + return DefaultFetchRecentViewedCollectionsUseCase(collectionRepository: makeCollectionRepository()) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchRecommendedCollectionsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchRecommendedCollectionsUseCaseFactory.swift index 16575e6b..dd630f28 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchRecommendedCollectionsUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/FetchRecommendedCollectionsUseCaseFactory.swift @@ -11,14 +11,10 @@ import Domain protocol FetchRecommendedCollectionsUseCaseFactory: HomeRepositoryFactory { func makeFetchRecommendedCollectionsUseCase() -> FetchRecommendedCollectionsUseCase - func makeFetchRecommendedCollectionsUseCase(homeRepository: HomeRepository) -> FetchRecommendedCollectionsUseCase } extension FetchRecommendedCollectionsUseCaseFactory { func makeFetchRecommendedCollectionsUseCase() -> FetchRecommendedCollectionsUseCase { - return makeFetchRecommendedCollectionsUseCase(homeRepository: makeHomeRepository()) - } - func makeFetchRecommendedCollectionsUseCase(homeRepository: HomeRepository) -> FetchRecommendedCollectionsUseCase { - return DefaultFetchRecommendedCollectionsUseCase(homeRepository: homeRepository) + return DefaultFetchRecommendedCollectionsUseCase(homeRepository: makeHomeRepository()) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/ToggleCollectionBookmarkUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/ToggleCollectionBookmarkUseCaseFactory.swift index 961bfab3..4a391340 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Collection/ToggleCollectionBookmarkUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Collection/ToggleCollectionBookmarkUseCaseFactory.swift @@ -11,14 +11,10 @@ import Domain protocol ToggleCollectionBookmarkUseCaseFactory: BookmarkRepositoryFactory { func makeToggleCollectionBookmarkUseCase() -> ToggleCollectionBookmarkUseCase - func makeToggleCollectionBookmarkUseCase(bookmarkRepository: BookmarkRepository) -> ToggleCollectionBookmarkUseCase } extension ToggleCollectionBookmarkUseCaseFactory { func makeToggleCollectionBookmarkUseCase() -> ToggleCollectionBookmarkUseCase { - return makeToggleCollectionBookmarkUseCase(bookmarkRepository: makeBookmarkRepository()) - } - func makeToggleCollectionBookmarkUseCase(bookmarkRepository: BookmarkRepository) -> ToggleCollectionBookmarkUseCase { - return DefaultToggleCollectionBookmarkUseCase(bookmarkRepository: bookmarkRepository) + return DefaultToggleCollectionBookmarkUseCase(bookmarkRepository: makeBookmarkRepository()) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchBookmarkedContentsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchBookmarkedContentsUseCaseFactory.swift index 471808bd..a4557744 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchBookmarkedContentsUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchBookmarkedContentsUseCaseFactory.swift @@ -11,14 +11,10 @@ import Domain protocol FetchBookmarkedContentsUseCaseFactory: ContentRepositoryFactory, UserRepositoryFactory { func makeFetchBookmarkedContentsUseCase() -> FetchBookmarkedContentsUseCase - func makeFetchBookmarkedContentsUseCase(contentRepository: ContentRepository, userRepository: UserRepository) -> FetchBookmarkedContentsUseCase } extension FetchBookmarkedContentsUseCaseFactory { func makeFetchBookmarkedContentsUseCase() -> FetchBookmarkedContentsUseCase { - return makeFetchBookmarkedContentsUseCase(contentRepository: makeContentRepository(), userRepository: makeUserRepository()) - } - func makeFetchBookmarkedContentsUseCase(contentRepository: ContentRepository, userRepository: UserRepository) -> FetchBookmarkedContentsUseCase { - return DefaultFetchBookmarkedContentsUseCase(contentRepository: contentRepository, userRepository: userRepository) + return DefaultFetchBookmarkedContentsUseCase(contentRepository: makeContentRepository(), userRepository: makeUserRepository()) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchOTTPlatformsForContentUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchOTTPlatformsForContentUseCaseFactory.swift index 745b8bf4..485ed69a 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchOTTPlatformsForContentUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchOTTPlatformsForContentUseCaseFactory.swift @@ -11,14 +11,10 @@ import Domain protocol FetchOTTPlatformsForContentUseCaseFactory: ContentRepositoryFactory { func makeFetchOTTPlatformsForContentUseCase() -> FetchOTTPlatformsForContentUseCase - func makeFetchOTTPlatformsForContentUseCase(contentRepository: ContentRepository) -> FetchOTTPlatformsForContentUseCase } extension FetchOTTPlatformsForContentUseCaseFactory { func makeFetchOTTPlatformsForContentUseCase() -> FetchOTTPlatformsForContentUseCase { - return makeFetchOTTPlatformsForContentUseCase(contentRepository: makeContentRepository()) - } - func makeFetchOTTPlatformsForContentUseCase(contentRepository: ContentRepository) -> FetchOTTPlatformsForContentUseCase { - return DefaultFetchOTTPlatformsForContentUseCase(contentRepository: contentRepository) + return DefaultFetchOTTPlatformsForContentUseCase(contentRepository: makeContentRepository()) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchPopularContentsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchPopularContentsUseCaseFactory.swift index 8412702d..96acb37e 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchPopularContentsUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Content/FetchPopularContentsUseCaseFactory.swift @@ -11,14 +11,10 @@ import Domain protocol FetchPopularContentsUseCaseFactory: SearchRepositoryFactory { func makeFetchPopularContentsUseCase() -> FetchPopularContentsUseCase - func makeFetchPopularContentsUseCase(searchRepository: SearchRepository) -> FetchPopularContentsUseCase } extension FetchPopularContentsUseCaseFactory { func makeFetchPopularContentsUseCase() -> FetchPopularContentsUseCase { - return makeFetchPopularContentsUseCase(searchRepository: makeSearchRepository()) - } - func makeFetchPopularContentsUseCase(searchRepository: SearchRepository) -> FetchPopularContentsUseCase { - return DefaultFetchPopularContentsUseCase(searchRepository: searchRepository) + return DefaultFetchPopularContentsUseCase(searchRepository: makeSearchRepository()) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Content/SearchContentsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Content/SearchContentsUseCaseFactory.swift index 428a920f..ffb925db 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Content/SearchContentsUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Content/SearchContentsUseCaseFactory.swift @@ -1,5 +1,5 @@ // -// ContentsUseCase.swift +// SearchContentsUseCaseFactory.swift // FLINT // // Created by 김호성 on 2026.01.22. @@ -11,14 +11,10 @@ import Domain protocol SearchContentsUseCaseFactory: SearchRepositoryFactory { func makeSearchContentsUseCase() -> SearchContentsUseCase - func makeSearchContentsUseCase(searchRepository: SearchRepository) -> SearchContentsUseCase } extension SearchContentsUseCaseFactory { func makeSearchContentsUseCase() -> SearchContentsUseCase { - return makeSearchContentsUseCase(searchRepository: makeSearchRepository()) - } - func makeSearchContentsUseCase(searchRepository: SearchRepository) -> SearchContentsUseCase { - return DefaultSearchContentsUseCase(searchRepository: searchRepository) + return DefaultSearchContentsUseCase(searchRepository: makeSearchRepository()) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Content/ToggleContentBookmarkUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Content/ToggleContentBookmarkUseCaseFactory.swift index 5526e86b..bd8f8beb 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Content/ToggleContentBookmarkUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Content/ToggleContentBookmarkUseCaseFactory.swift @@ -11,14 +11,10 @@ import Domain protocol ToggleContentBookmarkUseCaseFactory: BookmarkRepositoryFactory { func makeToggleContentBookmarkUseCase() -> ToggleContentBookmarkUseCase - func makeToggleContentBookmarkUseCase(bookmarkRepository: BookmarkRepository) -> ToggleContentBookmarkUseCase } extension ToggleContentBookmarkUseCaseFactory { func makeToggleContentBookmarkUseCase() -> ToggleContentBookmarkUseCase { - return makeToggleContentBookmarkUseCase(bookmarkRepository: makeBookmarkRepository()) - } - func makeToggleContentBookmarkUseCase(bookmarkRepository: BookmarkRepository) -> ToggleContentBookmarkUseCase { - return DefaultToggleContentBookmarkUseCase(bookmarkRepository: bookmarkRepository) + return DefaultToggleContentBookmarkUseCase(bookmarkRepository: makeBookmarkRepository()) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Profile/CheckNicknameUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Profile/CheckNicknameUseCaseFactory.swift index 16e0b2c4..a3e877f5 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Profile/CheckNicknameUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Profile/CheckNicknameUseCaseFactory.swift @@ -11,14 +11,10 @@ import Domain protocol CheckNicknameUseCaseFactory: UserRepositoryFactory { func makeCheckNicknameUseCase() -> CheckNicknameUseCase - func makeCheckNicknameUseCase(userRepository: UserRepository) -> CheckNicknameUseCase } extension CheckNicknameUseCaseFactory { func makeCheckNicknameUseCase() -> CheckNicknameUseCase { - return makeCheckNicknameUseCase(userRepository: makeUserRepository()) - } - func makeCheckNicknameUseCase(userRepository: UserRepository) -> CheckNicknameUseCase { - return DefaultCheckNicknameUseCase(userRepository: userRepository) + return DefaultCheckNicknameUseCase(userRepository: makeUserRepository()) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Profile/FetchKeywordsUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Profile/FetchKeywordsUseCaseFactory.swift index 7a1a728a..4eb81ce1 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Profile/FetchKeywordsUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Profile/FetchKeywordsUseCaseFactory.swift @@ -11,14 +11,10 @@ import Domain protocol FetchKeywordsUseCaseFactory: UserRepositoryFactory { func makeFetchKeywordsUseCase() -> FetchKeywordsUseCase - func makeFetchKeywordsUseCase(userRepository: UserRepository) -> FetchKeywordsUseCase } extension FetchKeywordsUseCaseFactory { func makeFetchKeywordsUseCase() -> FetchKeywordsUseCase { - return makeFetchKeywordsUseCase(userRepository: makeUserRepository()) - } - func makeFetchKeywordsUseCase(userRepository: UserRepository) -> FetchKeywordsUseCase { - return DefaultFetchKeywordsUseCase(userRepository: userRepository) + return DefaultFetchKeywordsUseCase(userRepository: makeUserRepository()) } } diff --git a/FLINT/FLINT/Dependency/Factory/UseCase/Profile/FetchProfileUseCaseFactory.swift b/FLINT/FLINT/Dependency/Factory/UseCase/Profile/FetchProfileUseCaseFactory.swift index f5065b44..acf1fdfa 100644 --- a/FLINT/FLINT/Dependency/Factory/UseCase/Profile/FetchProfileUseCaseFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/UseCase/Profile/FetchProfileUseCaseFactory.swift @@ -11,14 +11,10 @@ import Domain protocol FetchProfileUseCaseFactory: UserRepositoryFactory { func makeFetchProfileUseCase() -> FetchProfileUseCase - func makeFetchProfileUseCase(userRepository: UserRepository) -> FetchProfileUseCase } extension FetchProfileUseCaseFactory { func makeFetchProfileUseCase() -> FetchProfileUseCase { - return makeFetchProfileUseCase(userRepository: makeUserRepository()) - } - func makeFetchProfileUseCase(userRepository: UserRepository) -> FetchProfileUseCase { - return DefaultFetchProfileUseCase(userRepository: userRepository) + return DefaultFetchProfileUseCase(userRepository: makeUserRepository()) } } diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/AddContentSelectViewModelFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/AddContentSelectViewModelFactory.swift index f36f9610..037c94d1 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewModel/AddContentSelectViewModelFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/AddContentSelectViewModelFactory.swift @@ -7,33 +7,14 @@ import Foundation -import Domain import Presentation protocol AddContentSelectViewModelFactory: SearchContentsUseCaseFactory, FetchPopularContentsUseCaseFactory { func makeAddContentSelectViewModel() -> AddContentSelectViewModel - func makeAddContentSelectViewModel( - fetchPopularContentsUseCase: FetchPopularContentsUseCase, - searchContentsUseCase: SearchContentsUseCase - ) -> AddContentSelectViewModel } extension AddContentSelectViewModelFactory { - func makeAddContentSelectViewModel() -> AddContentSelectViewModel { - return makeAddContentSelectViewModel( - fetchPopularContentsUseCase: makeFetchPopularContentsUseCase(), - searchContentsUseCase: makeSearchContentsUseCase() - ) - } - - func makeAddContentSelectViewModel( - fetchPopularContentsUseCase: FetchPopularContentsUseCase, - searchContentsUseCase: SearchContentsUseCase - ) -> AddContentSelectViewModel { - return DefaultAddContentSelectViewModel( - fetchPopularContentsUseCase: fetchPopularContentsUseCase, - searchContentsUseCase: searchContentsUseCase - ) + return DefaultAddContentSelectViewModel(fetchPopularContentsUseCase: makeFetchPopularContentsUseCase(), searchContentsUseCase: makeSearchContentsUseCase()) } } diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionDetailViewModelFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionDetailViewModelFactory.swift index 51beb499..e6a7eaf3 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionDetailViewModelFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionDetailViewModelFactory.swift @@ -1,5 +1,5 @@ // -// CollectionDetailViewModel.swift +// CollectionDetailViewModelFactory.swift // FLINT // // Created by 김호성 on 2026.02.02. @@ -7,35 +7,14 @@ import Foundation -import Domain import Presentation protocol CollectionDetailViewModelFactory: FetchCollectionDetailUseCaseFactory, FetchCollectionBookmarkUsersUseCaseFactory { func makeCollectionDetailViewModel(collectionId: Int64) -> CollectionDetailViewModel - func makeCollectionDetailViewModel( - collectionId: Int64, - fetchCollectionDetailUseCase: FetchCollectionDetailUseCase, - fetchCollectionBookmarkUsersUseCase: FetchCollectionBookmarkUsersUseCase - ) -> CollectionDetailViewModel } extension CollectionDetailViewModelFactory { func makeCollectionDetailViewModel(collectionId: Int64) -> CollectionDetailViewModel { - return makeCollectionDetailViewModel( - collectionId: collectionId, - fetchCollectionDetailUseCase: makeFetchCollectionDetailUseCase(), - fetchCollectionBookmarkUsersUseCase: makeFetchCollectionBookmarkUsersUseCase() - ) - } - func makeCollectionDetailViewModel( - collectionId: Int64, - fetchCollectionDetailUseCase: FetchCollectionDetailUseCase, - fetchCollectionBookmarkUsersUseCase: FetchCollectionBookmarkUsersUseCase - ) -> CollectionDetailViewModel { - return CollectionDetailViewModel( - collectionId: collectionId, - fetchCollectionDetailUseCase: fetchCollectionDetailUseCase, - fetchCollectionBookmarkUsersUseCase: fetchCollectionBookmarkUsersUseCase - ) + return CollectionDetailViewModel(collectionId: collectionId, fetchCollectionDetailUseCase: makeFetchCollectionDetailUseCase(), fetchCollectionBookmarkUsersUseCase: makeFetchCollectionBookmarkUsersUseCase()) } } diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionFolderListViewModelFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionFolderListViewModelFactory.swift index cf6fc1e9..36d3792c 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionFolderListViewModelFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/CollectionFolderListViewModelFactory.swift @@ -7,19 +7,14 @@ import Foundation -import Domain import Presentation protocol CollectionFolderListViewModelFactory: FetchRecentViewedCollectionsUseCaseFactory { func makeCollectionFolderListViewModel() -> CollectionFolderListViewModel - func makeCollectionFolderListViewModel(fetchRecentViewedCollectionsUseCase: FetchRecentViewedCollectionsUseCase) -> CollectionFolderListViewModel } extension CollectionFolderListViewModelFactory { func makeCollectionFolderListViewModel() -> CollectionFolderListViewModel { - return makeCollectionFolderListViewModel(fetchRecentViewedCollectionsUseCase: makeFetchRecentViewedCollectionsUseCase()) - } - func makeCollectionFolderListViewModel(fetchRecentViewedCollectionsUseCase: FetchRecentViewedCollectionsUseCase) -> CollectionFolderListViewModel { - return CollectionFolderListViewModel(fetchRecentViewedCollectionsUseCase: fetchRecentViewedCollectionsUseCase) + return CollectionFolderListViewModel(fetchRecentViewedCollectionsUseCase: makeFetchRecentViewedCollectionsUseCase()) } } diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/CreateCollectionViewModelFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/CreateCollectionViewModelFactory.swift index 18cb24c0..ae523133 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewModel/CreateCollectionViewModelFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/CreateCollectionViewModelFactory.swift @@ -7,19 +7,14 @@ import Foundation -import Domain import Presentation protocol CreateCollectionViewModelFactory: CreateCollectionUseCaseFactory { func makeCreateCollectionViewModel() -> CreateCollectionViewModel - func makeCreateCollectionViewModel(createCollectionUseCase: CreateCollectionUseCase) -> CreateCollectionViewModel } extension CreateCollectionViewModelFactory { func makeCreateCollectionViewModel() -> CreateCollectionViewModel { - return makeCreateCollectionViewModel(createCollectionUseCase: makeCreateCollectionUseCase()) - } - func makeCreateCollectionViewModel(createCollectionUseCase: CreateCollectionUseCase) -> CreateCollectionViewModel { - return DefaultCreateCollectionViewModel(createCollectionUseCase: createCollectionUseCase) + return DefaultCreateCollectionViewModel(createCollectionUseCase: makeCreateCollectionUseCase()) } } diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/ExploreViewModelFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/ExploreViewModelFactory.swift index 6565c1c8..ba7ec64f 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewModel/ExploreViewModelFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/ExploreViewModelFactory.swift @@ -7,19 +7,14 @@ import Foundation -import Domain import Presentation protocol ExploreViewModelFactory: FetchExploreCollectionsUseCaseFactory { func makeExploreViewModel() -> ExploreViewModel - func makeExploreViewModel(fetchExploreCollectionsUseCase: FetchExploreCollectionsUseCase) -> ExploreViewModel } extension ExploreViewModelFactory { func makeExploreViewModel() -> ExploreViewModel { - return makeExploreViewModel(fetchExploreCollectionsUseCase: makeFetchExploreCollectionsUseCase()) - } - func makeExploreViewModel(fetchExploreCollectionsUseCase: FetchExploreCollectionsUseCase) -> ExploreViewModel { - return DefaultExploreViewModel(fetchExploreCollectionsUseCase: fetchExploreCollectionsUseCase) + return DefaultExploreViewModel(fetchExploreCollectionsUseCase: makeFetchExploreCollectionsUseCase()) } } diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/HomeViewModelFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/HomeViewModelFactory.swift index a34c5053..54fee029 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewModel/HomeViewModelFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/HomeViewModelFactory.swift @@ -7,44 +7,14 @@ import Foundation -import Domain import Presentation protocol HomeViewModelFactory: FetchRecommendedCollectionsUseCaseFactory, FetchBookmarkedContentsUseCaseFactory, FetchProfileUseCaseFactory, FetchRecentViewedCollectionsUseCaseFactory { func makeHomeViewModel() -> HomeViewModel - func makeHomeViewModel( - fetchRecommendedCollectionsUseCase: FetchRecommendedCollectionsUseCase, - fetchBookmarkedContentsUseCase: FetchBookmarkedContentsUseCase, - fetchProfileUseCase: FetchProfileUseCase, - fetchRecentViewedCollectionsUseCase: FetchRecentViewedCollectionsUseCase, - initialUserName: String - ) -> HomeViewModel } extension HomeViewModelFactory { func makeHomeViewModel() -> HomeViewModel { - return makeHomeViewModel( - fetchRecommendedCollectionsUseCase: makeFetchRecommendedCollectionsUseCase(), - fetchBookmarkedContentsUseCase: makeFetchBookmarkedContentsUseCase(), - fetchProfileUseCase: makeFetchProfileUseCase(), - fetchRecentViewedCollectionsUseCase: makeFetchRecentViewedCollectionsUseCase(), - initialUserName: "얀비" - ) - } - - func makeHomeViewModel( - fetchRecommendedCollectionsUseCase: FetchRecommendedCollectionsUseCase, - fetchBookmarkedContentsUseCase: FetchBookmarkedContentsUseCase, - fetchProfileUseCase: FetchProfileUseCase, - fetchRecentViewedCollectionsUseCase: FetchRecentViewedCollectionsUseCase, - initialUserName: String - ) -> HomeViewModel { - return HomeViewModel( - fetchRecommendedCollectionsUseCase: fetchRecommendedCollectionsUseCase, - fetchBookmarkedContentsUseCase: fetchBookmarkedContentsUseCase, - fetchProfileUseCase: fetchProfileUseCase, - fetchRecentViewedCollectionsUseCase: fetchRecentViewedCollectionsUseCase, - initialUserName: "얀비" - ) + return HomeViewModel(fetchRecommendedCollectionsUseCase: makeFetchRecommendedCollectionsUseCase(), fetchBookmarkedContentsUseCase: makeFetchBookmarkedContentsUseCase(), fetchProfileUseCase: makeFetchProfileUseCase(), fetchRecentViewedCollectionsUseCase: makeFetchRecentViewedCollectionsUseCase()) } } diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/LoginViewModelFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/LoginViewModelFactory.swift index 65b8bc53..2472b133 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewModel/LoginViewModelFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/LoginViewModelFactory.swift @@ -7,19 +7,14 @@ import Foundation -import Domain import Presentation protocol LoginViewModelFactory: SocialVerifyUseCaseFactory { func makeLoginViewModel() -> LoginViewModel - func makeLoginViewModel(socialVerifyUseCase: SocialVerifyUseCase) -> LoginViewModel } extension LoginViewModelFactory { func makeLoginViewModel() -> LoginViewModel { - return makeLoginViewModel(socialVerifyUseCase: makeSocialVerifyUseCase()) - } - func makeLoginViewModel(socialVerifyUseCase: SocialVerifyUseCase) -> LoginViewModel { - return DefaultLoginViewModel(socialVerifyUseCase: socialVerifyUseCase) + return DefaultLoginViewModel(socialVerifyUseCase: makeSocialVerifyUseCase()) } } diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/OnboardingViewModelFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/OnboardingViewModelFactory.swift index 53afcad9..56d324bf 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewModel/OnboardingViewModelFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/OnboardingViewModelFactory.swift @@ -7,24 +7,14 @@ import Foundation -import Domain import Presentation protocol OnboardingViewModelFactory: CheckNicknameUseCaseFactory, SearchContentsUseCaseFactory, FetchPopularContentsUseCaseFactory, SignupUseCaseFactory { func makeOnboardingViewModel() -> OnboardingViewModel - func makeOnboardingViewModel(checkNicknameUseCase: CheckNicknameUseCase, fetchPopularContentsUseCase: FetchPopularContentsUseCase, searchContentsUseCase: SearchContentsUseCase, signupUseCase: SignupUseCase) -> OnboardingViewModel } extension OnboardingViewModelFactory { func makeOnboardingViewModel() -> OnboardingViewModel { - return makeOnboardingViewModel( - checkNicknameUseCase: makeCheckNicknameUseCase(), - fetchPopularContentsUseCase: makeFetchPopularContentsUseCase(), - searchContentsUseCase: makeSearchContentsUseCase(), - signupUseCase: makeSignupUseCase() - ) - } - func makeOnboardingViewModel(checkNicknameUseCase: CheckNicknameUseCase, fetchPopularContentsUseCase: FetchPopularContentsUseCase, searchContentsUseCase: SearchContentsUseCase, signupUseCase: SignupUseCase) -> OnboardingViewModel { - return DefaultOnboardingViewModel(checkNicknameUseCase: checkNicknameUseCase, fetchPopularContentsUseCase: fetchPopularContentsUseCase, searchContentsUseCase: searchContentsUseCase, signupUseCase: signupUseCase) + return DefaultOnboardingViewModel(checkNicknameUseCase: makeCheckNicknameUseCase(), fetchPopularContentsUseCase: makeFetchPopularContentsUseCase(), searchContentsUseCase: makeSearchContentsUseCase(), signupUseCase: makeSignupUseCase()) } } diff --git a/FLINT/FLINT/Dependency/Factory/ViewModel/ProfileViewModelFactory.swift b/FLINT/FLINT/Dependency/Factory/ViewModel/ProfileViewModelFactory.swift index e20a2073..be70ecac 100644 --- a/FLINT/FLINT/Dependency/Factory/ViewModel/ProfileViewModelFactory.swift +++ b/FLINT/FLINT/Dependency/Factory/ViewModel/ProfileViewModelFactory.swift @@ -12,42 +12,10 @@ import Presentation protocol ProfileViewModelFactory: FetchProfileUseCaseFactory, FetchKeywordsUseCaseFactory, FetchCreatedCollectionsUseCaseFactory, FetchBookmarkedCollectionsUseCaseFactory, FetchBookmarkedContentsUseCaseFactory { func makeProfileViewModel(target: UserTarget) -> ProfileViewModel - func makeProfileViewModel( - target: UserTarget, - fetchProfileUseCase: FetchProfileUseCase, - fetchKeywordsUseCase: FetchKeywordsUseCase, - fetchCreatedCollectionsUseCase: FetchCreatedCollectionsUseCase, - fetchBookmarkedCollectionsUseCase: FetchBookmarkedCollectionsUseCase, - fetchBookmarkedContentsUseCase: FetchBookmarkedContentsUseCase - ) -> ProfileViewModel } extension ProfileViewModelFactory { func makeProfileViewModel(target: UserTarget) -> ProfileViewModel { - return makeProfileViewModel( - target: target, - fetchProfileUseCase: makeFetchProfileUseCase(), - fetchKeywordsUseCase: makeFetchKeywordsUseCase(), - fetchCreatedCollectionsUseCase: makeFetchCreatedCollectionsUseCase(), - fetchBookmarkedCollectionsUseCase: makeFetchBookmarkedCollectionsUseCase(), - fetchBookmarkedContentsUseCase: makeFetchBookmarkedContentsUseCase() - ) - } - func makeProfileViewModel( - target: UserTarget, - fetchProfileUseCase: FetchProfileUseCase, - fetchKeywordsUseCase: FetchKeywordsUseCase, - fetchCreatedCollectionsUseCase: FetchCreatedCollectionsUseCase, - fetchBookmarkedCollectionsUseCase: FetchBookmarkedCollectionsUseCase, - fetchBookmarkedContentsUseCase: FetchBookmarkedContentsUseCase - ) -> ProfileViewModel { - return ProfileViewModel( - target: target, - fetchProfileUseCase: fetchProfileUseCase, - fetchKeywordsUseCase: fetchKeywordsUseCase, - fetchCreatedCollectionsUseCase: fetchCreatedCollectionsUseCase, - fetchBookmarkedCollectionsUseCase: fetchBookmarkedCollectionsUseCase, - fetchBookmarkedContentsUseCase: fetchBookmarkedContentsUseCase - ) + return ProfileViewModel(target: target, fetchProfileUseCase: makeFetchProfileUseCase(), fetchKeywordsUseCase: makeFetchKeywordsUseCase(), fetchCreatedCollectionsUseCase: makeFetchCreatedCollectionsUseCase(), fetchBookmarkedCollectionsUseCase: makeFetchBookmarkedCollectionsUseCase(), fetchBookmarkedContentsUseCase: makeFetchBookmarkedContentsUseCase()) } }