From de3a680a3d5a754abec2040300bbf75adaa90f40 Mon Sep 17 00:00:00 2001 From: youn9k Date: Mon, 17 Jun 2024 12:15:04 +0900 Subject: [PATCH 01/15] =?UTF-8?q?=F0=9F=8E=A8=20::=20[#568]=20Faq=20Compon?= =?UTF-8?q?ent=20Interface=20=EC=84=B8=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyInfoFeature/Interface/FaqModel.swift | 18 ++++++++++++++++++ .../MyInfoFeature/Interface/Interface.swift | 8 ++++++++ 2 files changed, 26 insertions(+) create mode 100644 Projects/Features/MyInfoFeature/Interface/FaqModel.swift diff --git a/Projects/Features/MyInfoFeature/Interface/FaqModel.swift b/Projects/Features/MyInfoFeature/Interface/FaqModel.swift new file mode 100644 index 000000000..3f97113bf --- /dev/null +++ b/Projects/Features/MyInfoFeature/Interface/FaqModel.swift @@ -0,0 +1,18 @@ +import Foundation + +public struct FaqModel: Equatable { + public init( + category: String, + question: String, + answer: String, + isOpen: Bool + ) { + self.category = category + self.question = question + self.answer = answer + self.isOpen = isOpen + } + + public let category, question, answer: String + public var isOpen: Bool +} diff --git a/Projects/Features/MyInfoFeature/Interface/Interface.swift b/Projects/Features/MyInfoFeature/Interface/Interface.swift index 49cbef165..a92795407 100644 --- a/Projects/Features/MyInfoFeature/Interface/Interface.swift +++ b/Projects/Features/MyInfoFeature/Interface/Interface.swift @@ -15,3 +15,11 @@ public protocol AppPushSettingFactory { public protocol OpenSourceLicenseFactory { func makeView() -> UIViewController } + +public protocol FaqFactory { + func makeView() -> UIViewController +} + +public protocol FaqContentFactory { + func makeView(dataSource: [FaqModel]) -> UIViewController +} From 9c3302f11d9542e1c4ca1da1dcce068dcf400824 Mon Sep 17 00:00:00 2001 From: youn9k Date: Mon, 17 Jun 2024 12:30:11 +0900 Subject: [PATCH 02/15] =?UTF-8?q?=F0=9F=8E=A8=20::=20[#568]=20=08Faq=20Dom?= =?UTF-8?q?ain=20testing=20=EC=9D=98=EC=A1=B4=EC=84=B1=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Projects/Features/MyInfoFeature/Project.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Projects/Features/MyInfoFeature/Project.swift b/Projects/Features/MyInfoFeature/Project.swift index 83c67f1b3..7ef0240a0 100644 --- a/Projects/Features/MyInfoFeature/Project.swift +++ b/Projects/Features/MyInfoFeature/Project.swift @@ -26,7 +26,8 @@ let project = Project.module( .feature(target: .MyInfoFeature), .feature(target: .MyInfoFeature, type: .interface), .feature(target: .BaseFeature, type: .testing), - .feature(target: .SignInFeature, type: .testing) + .feature(target: .SignInFeature, type: .testing), + .domain(target: .FaqDomain, type: .testing) ]), .tests(module: .feature(.MyInfoFeature), dependencies: [ .feature(target: .MyInfoFeature) From f78b9ab077740fd26f7e60465f725171f5153af9 Mon Sep 17 00:00:00 2001 From: youn9k Date: Mon, 17 Jun 2024 12:36:17 +0900 Subject: [PATCH 03/15] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20::=20[#568]=20Faq=20?= =?UTF-8?q?ViewController=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 도메인 레이어의 Entity를 그대로 사용 -> Model 로 변환하여 사용 --- .../Sources/Components/FaqComponent.swift | 14 +++------- .../Components/FaqContentComponent.swift | 14 +++------- .../FAQ/FaqContentViewController.swift | 8 ------ .../FAQ/FaqViewController.swift | 27 ++++++------------- .../Sources/ViewModels/FaqViewModel.swift | 23 ++++++++-------- .../ViewModels/QnaContentViewModel.swift | 16 +++-------- .../Sources/Views/AnswerTableViewCell.swift | 12 ++------- .../Sources/Views/QuestionTableViewCell.swift | 12 ++------- .../Testing/FaqComponentStub.swift | 18 +++++++++++++ .../Testing/FaqContentComponentStub.swift | 10 +++++++ 10 files changed, 63 insertions(+), 91 deletions(-) create mode 100644 Projects/Features/MyInfoFeature/Testing/FaqComponentStub.swift create mode 100644 Projects/Features/MyInfoFeature/Testing/FaqContentComponentStub.swift diff --git a/Projects/Features/MyInfoFeature/Sources/Components/FaqComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/FaqComponent.swift index 9f56c2811..231ee32e6 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/FaqComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/FaqComponent.swift @@ -1,12 +1,6 @@ -// -// SearchComponent.swift -// SearchFeature -// -// Created by yongbeomkwak on 2023/02/10. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - import FaqDomainInterface +import MyInfoFeatureInterface +import UIKit import Foundation import NeedleFoundation @@ -16,8 +10,8 @@ public protocol FaqDependency: Dependency { var fetchFaqUseCase: any FetchFaqUseCase { get } } -public final class FaqComponent: Component { - public func makeView() -> FaqViewController { +public final class FaqComponent: Component, FaqFactory { + public func makeView() -> UIViewController { return FaqViewController.viewController( viewModel: .init( fetchFaqCategoriesUseCase: dependency.fetchFaqCategoriesUseCase, diff --git a/Projects/Features/MyInfoFeature/Sources/Components/FaqContentComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/FaqContentComponent.swift index 9318bbd4a..18b4b3f96 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/FaqContentComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/FaqContentComponent.swift @@ -1,17 +1,11 @@ -// -// SearchComponent.swift -// SearchFeature -// -// Created by yongbeomkwak on 2023/02/10. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - import FaqDomainInterface +import MyInfoFeatureInterface +import UIKit import Foundation import NeedleFoundation -public final class FaqContentComponent: Component { - public func makeView(dataSource: [FaqEntity]) -> FaqContentViewController { +public final class FaqContentComponent: Component, FaqContentFactory { + public func makeView(dataSource: [FaqModel]) -> UIViewController { return FaqContentViewController.viewController(viewModel: .init(dataSource: dataSource)) } } diff --git a/Projects/Features/MyInfoFeature/Sources/ViewControllers/FAQ/FaqContentViewController.swift b/Projects/Features/MyInfoFeature/Sources/ViewControllers/FAQ/FaqContentViewController.swift index ba4db0eab..2bdd947c5 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewControllers/FAQ/FaqContentViewController.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewControllers/FAQ/FaqContentViewController.swift @@ -1,11 +1,3 @@ -// -// QnaContentViewController.swift -// StorageFeature -// -// Created by yongbeomkwak on 2023/01/29. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - import BaseFeature import RxCocoa import RxRelay diff --git a/Projects/Features/MyInfoFeature/Sources/ViewControllers/FAQ/FaqViewController.swift b/Projects/Features/MyInfoFeature/Sources/ViewControllers/FAQ/FaqViewController.swift index 599b8c6fb..43e89e643 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewControllers/FAQ/FaqViewController.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewControllers/FAQ/FaqViewController.swift @@ -1,11 +1,4 @@ -// -// QnAViewController.swift -// StorageFeature -// -// Created by yongbeomkwak on 2023/01/29. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - +import MyInfoFeatureInterface import DesignSystem import NVActivityIndicatorView import Pageboy @@ -37,7 +30,7 @@ public final class FaqViewController: TabmanViewController, ViewControllerFromSt var disposeBag = DisposeBag() var viewModel: FaqViewModel! - var faqContentComponent: FaqContentComponent! + var faqContentFactory: FaqContentFactory! lazy var input = FaqViewModel.Input() lazy var output = viewModel.transform(from: input) @@ -45,11 +38,11 @@ public final class FaqViewController: TabmanViewController, ViewControllerFromSt public static func viewController( viewModel: FaqViewModel, - faqContentComponent: FaqContentComponent + faqContentFactory: FaqContentFactory ) -> FaqViewController { let viewController = FaqViewController.viewController(storyBoardName: "Faq", bundle: Bundle.module) viewController.viewModel = viewModel - viewController.faqContentComponent = faqContentComponent + viewController.faqContentFactory = faqContentFactory return viewController } } @@ -107,18 +100,14 @@ extension FaqViewController { self?.activityIndicator.stopAnimating() }) .subscribe { [weak self] categories, qna in - guard let self = self else { - return - } - guard let comp = self.faqContentComponent else { - return - } + guard let self = self else { return } + guard let factory = self.faqContentFactory else { return } self.viewControllers = categories.enumerated().map { i, c in if i == 0 { - return comp.makeView(dataSource: qna) + return factory.makeView(dataSource: qna) } else { - return comp.makeView(dataSource: qna.filter { + return factory.makeView(dataSource: qna.filter { $0.category.replacingOccurrences(of: " ", with: "") == c .replacingOccurrences(of: " ", with: "") }) diff --git a/Projects/Features/MyInfoFeature/Sources/ViewModels/FaqViewModel.swift b/Projects/Features/MyInfoFeature/Sources/ViewModels/FaqViewModel.swift index c78c4c5b7..c0cfa7ae7 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewModels/FaqViewModel.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewModels/FaqViewModel.swift @@ -1,16 +1,7 @@ -// -// AfterLoginStorageViewModel.swift -// StorageFeature -// -// Created by yongbeomkwak on 2023/01/26. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - import BaseFeature import FaqDomainInterface +import MyInfoFeatureInterface import Foundation - -// import KeychainModule import RxRelay import RxSwift import Utility @@ -23,7 +14,7 @@ public final class FaqViewModel: ViewModelType { public struct Input {} public struct Output { - let dataSource: BehaviorRelay<([String], [FaqEntity])> = BehaviorRelay(value: ([], [])) + let dataSource: BehaviorRelay<([String], [FaqModel])> = BehaviorRelay(value: ([], [])) } public init( @@ -52,6 +43,16 @@ public final class FaqViewModel: ViewModelType { let zip2 = fetchQnaUseCase.execute() .catchAndReturn([]) + .map { + $0.map { + FaqModel( + category: $0.category, + question: $0.question, + answer: $0.answer, + isOpen: $0.isOpen + ) + } + } .asObservable() Observable.zip(zip1, zip2) diff --git a/Projects/Features/MyInfoFeature/Sources/ViewModels/QnaContentViewModel.swift b/Projects/Features/MyInfoFeature/Sources/ViewModels/QnaContentViewModel.swift index 147f2b65a..0de9f7bcb 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewModels/QnaContentViewModel.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewModels/QnaContentViewModel.swift @@ -1,30 +1,20 @@ -// -// AfterLoginStorageViewModel.swift -// StorageFeature -// -// Created by yongbeomkwak on 2023/01/26. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - import BaseFeature -import FaqDomainInterface +import MyInfoFeatureInterface import Foundation - -// import KeychainModule import RxRelay import RxSwift import Utility public final class QnaContentViewModel: ViewModelType { var disposeBag = DisposeBag() - var dataSource: [FaqEntity] + var dataSource: [FaqModel] public struct Input {} public struct Output {} public init( - dataSource: [FaqEntity] + dataSource: [FaqModel] ) { DEBUG_LOG("✅ \(Self.self) 생성") self.dataSource = dataSource diff --git a/Projects/Features/MyInfoFeature/Sources/Views/AnswerTableViewCell.swift b/Projects/Features/MyInfoFeature/Sources/Views/AnswerTableViewCell.swift index b7686d392..eb693c3f5 100644 --- a/Projects/Features/MyInfoFeature/Sources/Views/AnswerTableViewCell.swift +++ b/Projects/Features/MyInfoFeature/Sources/Views/AnswerTableViewCell.swift @@ -1,13 +1,5 @@ -// -// AnswerTableViewCell.swift -// StorageFeature -// -// Created by yongbeomkwak on 2023/01/30. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - import DesignSystem -import FaqDomainInterface +import MyInfoFeatureInterface import UIKit class AnswerTableViewCell: UITableViewCell { @@ -21,7 +13,7 @@ class AnswerTableViewCell: UITableViewCell { } extension AnswerTableViewCell { - public func update(model: FaqEntity) { + public func update(model: FaqModel) { answerLabel.text = model.answer } } diff --git a/Projects/Features/MyInfoFeature/Sources/Views/QuestionTableViewCell.swift b/Projects/Features/MyInfoFeature/Sources/Views/QuestionTableViewCell.swift index 116445818..bd3c99ab0 100644 --- a/Projects/Features/MyInfoFeature/Sources/Views/QuestionTableViewCell.swift +++ b/Projects/Features/MyInfoFeature/Sources/Views/QuestionTableViewCell.swift @@ -1,13 +1,5 @@ -// -// QuestionTableViewCell.swift -// StorageFeature -// -// Created by yongbeomkwak on 2023/01/30. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - import DesignSystem -import FaqDomainInterface +import MyInfoFeatureInterface import UIKit class QuestionTableViewCell: UITableViewCell { @@ -25,7 +17,7 @@ class QuestionTableViewCell: UITableViewCell { } extension QuestionTableViewCell { - public func update(model: FaqEntity) { + public func update(model: FaqModel) { categoryLabel.text = model.category titleLabel.text = model.question expandImageView.image = model.isOpen ? DesignSystemAsset.Navigation.fold.image : DesignSystemAsset.Navigation diff --git a/Projects/Features/MyInfoFeature/Testing/FaqComponentStub.swift b/Projects/Features/MyInfoFeature/Testing/FaqComponentStub.swift new file mode 100644 index 000000000..caa833a07 --- /dev/null +++ b/Projects/Features/MyInfoFeature/Testing/FaqComponentStub.swift @@ -0,0 +1,18 @@ +import FaqDomainInterface +@testable import FaqDomainTesting +import Foundation +@testable import MyInfoFeature +import MyInfoFeatureInterface +import UIKit + +public final class FaqComponentStub: FaqFactory { + public func makeView() -> UIViewController { + return FaqViewController.viewController( + viewModel: .init( + fetchFaqCategoriesUseCase: FetchFaqCategoriesUseCaseStub(), + fetchQnaUseCase: FetchFaqUseCaseStub() + ), + faqContentFactory: FaqContentComponentStub() + ) + } +} diff --git a/Projects/Features/MyInfoFeature/Testing/FaqContentComponentStub.swift b/Projects/Features/MyInfoFeature/Testing/FaqContentComponentStub.swift new file mode 100644 index 000000000..bb9201282 --- /dev/null +++ b/Projects/Features/MyInfoFeature/Testing/FaqContentComponentStub.swift @@ -0,0 +1,10 @@ +import Foundation +import MyInfoFeatureInterface +@testable import MyInfoFeature +import UIKit + +public final class FaqContentComponentStub: FaqContentFactory { + public func makeView(dataSource: [FaqModel]) -> UIViewController { + return FaqContentViewController.viewController(viewModel: .init(dataSource: dataSource)) + } +} From 9e0da0206713d9a3d662b402eb9801fa3907142c Mon Sep 17 00:00:00 2001 From: youn9k Date: Mon, 17 Jun 2024 12:36:40 +0900 Subject: [PATCH 04/15] =?UTF-8?q?=F0=9F=8E=A8=20::=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?Formatting=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyInfoFeature/Sources/Components/FaqComponent.swift | 4 ++-- .../Sources/Components/FaqContentComponent.swift | 4 ++-- .../Sources/ViewControllers/FAQ/FaqViewController.swift | 2 +- .../MyInfoFeature/Sources/ViewModels/FaqViewModel.swift | 2 +- .../Sources/ViewModels/QnaContentViewModel.swift | 2 +- .../MyInfoFeature/Testing/FaqContentComponentStub.swift | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Projects/Features/MyInfoFeature/Sources/Components/FaqComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/FaqComponent.swift index 231ee32e6..178a234fc 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/FaqComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/FaqComponent.swift @@ -1,8 +1,8 @@ import FaqDomainInterface -import MyInfoFeatureInterface -import UIKit import Foundation +import MyInfoFeatureInterface import NeedleFoundation +import UIKit public protocol FaqDependency: Dependency { var faqContentComponent: FaqContentComponent { get } diff --git a/Projects/Features/MyInfoFeature/Sources/Components/FaqContentComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/FaqContentComponent.swift index 18b4b3f96..1dfc3cb59 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/FaqContentComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/FaqContentComponent.swift @@ -1,8 +1,8 @@ import FaqDomainInterface -import MyInfoFeatureInterface -import UIKit import Foundation +import MyInfoFeatureInterface import NeedleFoundation +import UIKit public final class FaqContentComponent: Component, FaqContentFactory { public func makeView(dataSource: [FaqModel]) -> UIViewController { diff --git a/Projects/Features/MyInfoFeature/Sources/ViewControllers/FAQ/FaqViewController.swift b/Projects/Features/MyInfoFeature/Sources/ViewControllers/FAQ/FaqViewController.swift index 43e89e643..c3d2ad10e 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewControllers/FAQ/FaqViewController.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewControllers/FAQ/FaqViewController.swift @@ -1,5 +1,5 @@ -import MyInfoFeatureInterface import DesignSystem +import MyInfoFeatureInterface import NVActivityIndicatorView import Pageboy import RxSwift diff --git a/Projects/Features/MyInfoFeature/Sources/ViewModels/FaqViewModel.swift b/Projects/Features/MyInfoFeature/Sources/ViewModels/FaqViewModel.swift index c0cfa7ae7..de63db43c 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewModels/FaqViewModel.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewModels/FaqViewModel.swift @@ -1,7 +1,7 @@ import BaseFeature import FaqDomainInterface -import MyInfoFeatureInterface import Foundation +import MyInfoFeatureInterface import RxRelay import RxSwift import Utility diff --git a/Projects/Features/MyInfoFeature/Sources/ViewModels/QnaContentViewModel.swift b/Projects/Features/MyInfoFeature/Sources/ViewModels/QnaContentViewModel.swift index 0de9f7bcb..6afdcc1da 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewModels/QnaContentViewModel.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewModels/QnaContentViewModel.swift @@ -1,6 +1,6 @@ import BaseFeature -import MyInfoFeatureInterface import Foundation +import MyInfoFeatureInterface import RxRelay import RxSwift import Utility diff --git a/Projects/Features/MyInfoFeature/Testing/FaqContentComponentStub.swift b/Projects/Features/MyInfoFeature/Testing/FaqContentComponentStub.swift index bb9201282..04a60d42f 100644 --- a/Projects/Features/MyInfoFeature/Testing/FaqContentComponentStub.swift +++ b/Projects/Features/MyInfoFeature/Testing/FaqContentComponentStub.swift @@ -1,6 +1,6 @@ import Foundation -import MyInfoFeatureInterface @testable import MyInfoFeature +import MyInfoFeatureInterface import UIKit public final class FaqContentComponentStub: FaqContentFactory { From 617b3cd6fd5bf5eaff8f547fe6a09a77a2f298fb Mon Sep 17 00:00:00 2001 From: youn9k Date: Mon, 17 Jun 2024 12:52:41 +0900 Subject: [PATCH 05/15] =?UTF-8?q?=F0=9F=8E=A8=20::=20[#568]=20Factory=20?= =?UTF-8?q?=EC=9D=B8=ED=84=B0=ED=8E=98=EC=9D=B4=EC=8A=A4=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Interface/FetchNoticeModel.swift | 43 +++++++++++++++++++ .../MyInfoFeature/Interface/Interface.swift | 16 +++++++ 2 files changed, 59 insertions(+) create mode 100644 Projects/Features/MyInfoFeature/Interface/FetchNoticeModel.swift diff --git a/Projects/Features/MyInfoFeature/Interface/FetchNoticeModel.swift b/Projects/Features/MyInfoFeature/Interface/FetchNoticeModel.swift new file mode 100644 index 000000000..9d838c4b7 --- /dev/null +++ b/Projects/Features/MyInfoFeature/Interface/FetchNoticeModel.swift @@ -0,0 +1,43 @@ +import Foundation + +public struct FetchNoticeModel { + public init( + id: Int, + category: String, + title: String, + content: String, + thumbnail: FetchNoticeModel.Image, + origins: [FetchNoticeModel.Image], + createdAt: Double + ) { + self.id = id + self.category = category + self.title = title + self.content = content + self.thumbnail = thumbnail + self.origins = origins + self.createdAt = createdAt + } + + public let id: Int + public let category, title: String + public let content: String + public let thumbnail: FetchNoticeModel.Image + public let origins: [FetchNoticeModel.Image] + public let createdAt: Double +} + +public extension FetchNoticeModel { + struct Image { + public init ( + url: String, + link: String + ) { + self.url = url + self.link = link + } + + public let url: String + public let link: String + } +} diff --git a/Projects/Features/MyInfoFeature/Interface/Interface.swift b/Projects/Features/MyInfoFeature/Interface/Interface.swift index a92795407..f94a5648e 100644 --- a/Projects/Features/MyInfoFeature/Interface/Interface.swift +++ b/Projects/Features/MyInfoFeature/Interface/Interface.swift @@ -23,3 +23,19 @@ public protocol FaqFactory { public protocol FaqContentFactory { func makeView(dataSource: [FaqModel]) -> UIViewController } + +public protocol NoticeFactory { + func makeView() -> UIViewController +} + +public protocol NoticeDetailFactory { + func makeView(model: FetchNoticeModel) -> UIViewController +} + +public protocol QuestionFactory { + func makeView() -> UIViewController +} + +public protocol TeamInfoFactory { + func makeView() -> UIViewController +} From fcb7e1113811c4db43b780e7b1d9a33e28f23e8a Mon Sep 17 00:00:00 2001 From: youn9k Date: Mon, 17 Jun 2024 16:56:08 +0900 Subject: [PATCH 06/15] =?UTF-8?q?=F0=9F=8E=A8=20::=20[#568]=20Factory=20?= =?UTF-8?q?=EC=9D=B8=ED=84=B0=ED=8E=98=EC=9D=B4=EC=8A=A4=20=EC=97=B0?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyInfoFeature/Interface/FaqModel.swift | 18 -------- .../Interface/FetchNoticeModel.swift | 43 ------------------- .../MyInfoFeature/Interface/Interface.swift | 6 ++- .../Sources/Components/FaqComponent.swift | 4 +- .../Components/FaqContentComponent.swift | 2 +- .../Sources/Components/NoticeComponent.swift | 18 +++----- .../Components/NoticeDetailComponent.swift | 14 ++---- .../Notice/NoticeDetailViewController.swift | 8 ---- .../Notice/NoticeViewController.swift | 17 +++----- .../Sources/ViewModels/FaqViewModel.swift | 12 +----- .../ViewModels/NoticeDetailViewModel.swift | 8 ---- .../Sources/ViewModels/NoticeViewModel.swift | 9 +--- .../ViewModels/QnaContentViewModel.swift | 6 +-- .../Sources/Views/AnswerTableViewCell.swift | 4 +- .../Views/NoticeDetailHeaderView.swift | 8 ---- .../Sources/Views/NoticeListCell.swift | 8 ---- .../Sources/Views/QuestionTableViewCell.swift | 4 +- 17 files changed, 31 insertions(+), 158 deletions(-) delete mode 100644 Projects/Features/MyInfoFeature/Interface/FaqModel.swift delete mode 100644 Projects/Features/MyInfoFeature/Interface/FetchNoticeModel.swift diff --git a/Projects/Features/MyInfoFeature/Interface/FaqModel.swift b/Projects/Features/MyInfoFeature/Interface/FaqModel.swift deleted file mode 100644 index 3f97113bf..000000000 --- a/Projects/Features/MyInfoFeature/Interface/FaqModel.swift +++ /dev/null @@ -1,18 +0,0 @@ -import Foundation - -public struct FaqModel: Equatable { - public init( - category: String, - question: String, - answer: String, - isOpen: Bool - ) { - self.category = category - self.question = question - self.answer = answer - self.isOpen = isOpen - } - - public let category, question, answer: String - public var isOpen: Bool -} diff --git a/Projects/Features/MyInfoFeature/Interface/FetchNoticeModel.swift b/Projects/Features/MyInfoFeature/Interface/FetchNoticeModel.swift deleted file mode 100644 index 9d838c4b7..000000000 --- a/Projects/Features/MyInfoFeature/Interface/FetchNoticeModel.swift +++ /dev/null @@ -1,43 +0,0 @@ -import Foundation - -public struct FetchNoticeModel { - public init( - id: Int, - category: String, - title: String, - content: String, - thumbnail: FetchNoticeModel.Image, - origins: [FetchNoticeModel.Image], - createdAt: Double - ) { - self.id = id - self.category = category - self.title = title - self.content = content - self.thumbnail = thumbnail - self.origins = origins - self.createdAt = createdAt - } - - public let id: Int - public let category, title: String - public let content: String - public let thumbnail: FetchNoticeModel.Image - public let origins: [FetchNoticeModel.Image] - public let createdAt: Double -} - -public extension FetchNoticeModel { - struct Image { - public init ( - url: String, - link: String - ) { - self.url = url - self.link = link - } - - public let url: String - public let link: String - } -} diff --git a/Projects/Features/MyInfoFeature/Interface/Interface.swift b/Projects/Features/MyInfoFeature/Interface/Interface.swift index f94a5648e..f05f6d4d4 100644 --- a/Projects/Features/MyInfoFeature/Interface/Interface.swift +++ b/Projects/Features/MyInfoFeature/Interface/Interface.swift @@ -1,4 +1,6 @@ import UIKit +import NoticeDomainInterface +import FaqDomainInterface public protocol MyInfoFactory { func makeView() -> UIViewController @@ -21,7 +23,7 @@ public protocol FaqFactory { } public protocol FaqContentFactory { - func makeView(dataSource: [FaqModel]) -> UIViewController + func makeView(dataSource: [FaqEntity]) -> UIViewController } public protocol NoticeFactory { @@ -29,7 +31,7 @@ public protocol NoticeFactory { } public protocol NoticeDetailFactory { - func makeView(model: FetchNoticeModel) -> UIViewController + func makeView(model: FetchNoticeEntity) -> UIViewController } public protocol QuestionFactory { diff --git a/Projects/Features/MyInfoFeature/Sources/Components/FaqComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/FaqComponent.swift index 178a234fc..956200fbd 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/FaqComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/FaqComponent.swift @@ -5,7 +5,7 @@ import NeedleFoundation import UIKit public protocol FaqDependency: Dependency { - var faqContentComponent: FaqContentComponent { get } + var faqContentFactory: FaqContentFactory { get } var fetchFaqCategoriesUseCase: any FetchFaqCategoriesUseCase { get } var fetchFaqUseCase: any FetchFaqUseCase { get } } @@ -17,7 +17,7 @@ public final class FaqComponent: Component, FaqFactory { fetchFaqCategoriesUseCase: dependency.fetchFaqCategoriesUseCase, fetchQnaUseCase: dependency.fetchFaqUseCase ), - faqContentComponent: dependency.faqContentComponent + faqContentFactory: dependency.faqContentFactory ) } } diff --git a/Projects/Features/MyInfoFeature/Sources/Components/FaqContentComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/FaqContentComponent.swift index 1dfc3cb59..71d5ae035 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/FaqContentComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/FaqContentComponent.swift @@ -5,7 +5,7 @@ import NeedleFoundation import UIKit public final class FaqContentComponent: Component, FaqContentFactory { - public func makeView(dataSource: [FaqModel]) -> UIViewController { + public func makeView(dataSource: [FaqEntity]) -> UIViewController { return FaqContentViewController.viewController(viewModel: .init(dataSource: dataSource)) } } diff --git a/Projects/Features/MyInfoFeature/Sources/Components/NoticeComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/NoticeComponent.swift index 60a540d58..e4f6debcb 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/NoticeComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/NoticeComponent.swift @@ -1,27 +1,21 @@ -// -// NoticeComponent.swift -// StorageFeature -// -// Created by KTH on 2023/04/08. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - import Foundation import NeedleFoundation +import MyInfoFeatureInterface import NoticeDomainInterface +import UIKit public protocol NoticeDependency: Dependency { var fetchNoticeUseCase: any FetchNoticeUseCase { get } - var noticeDetailComponent: NoticeDetailComponent { get } + var noticeDetailFactory: NoticeDetailFactory { get } } -public final class NoticeComponent: Component { - public func makeView() -> NoticeViewController { +public final class NoticeComponent: Component, NoticeFactory { + public func makeView() -> UIViewController { return NoticeViewController.viewController( viewModel: .init( fetchNoticeUseCase: dependency.fetchNoticeUseCase ), - noticeDetailComponent: dependency.noticeDetailComponent + noticeDetailFactory: dependency.noticeDetailFactory ) } } diff --git a/Projects/Features/MyInfoFeature/Sources/Components/NoticeDetailComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/NoticeDetailComponent.swift index 54be55b8b..453b95e1f 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/NoticeDetailComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/NoticeDetailComponent.swift @@ -1,19 +1,13 @@ -// -// NoticeDetailComponent.swift -// StorageFeature -// -// Created by KTH on 2023/04/08. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - import Foundation +import MyInfoFeatureInterface import NeedleFoundation import NoticeDomainInterface +import UIKit public protocol NoticeDetailDependency: Dependency {} -public final class NoticeDetailComponent: Component { - public func makeView(model: FetchNoticeEntity) -> NoticeDetailViewController { +public final class NoticeDetailComponent: Component, NoticeDetailFactory { + public func makeView(model: FetchNoticeEntity) -> UIViewController { return NoticeDetailViewController.viewController( viewModel: .init( model: model diff --git a/Projects/Features/MyInfoFeature/Sources/ViewControllers/Notice/NoticeDetailViewController.swift b/Projects/Features/MyInfoFeature/Sources/ViewControllers/Notice/NoticeDetailViewController.swift index 5528c8f57..0fa1d3674 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewControllers/Notice/NoticeDetailViewController.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewControllers/Notice/NoticeDetailViewController.swift @@ -1,11 +1,3 @@ -// -// NoticeDetailViewController.swift -// StorageFeature -// -// Created by KTH on 2023/04/08. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - import BaseFeature import DesignSystem import NoticeDomainInterface diff --git a/Projects/Features/MyInfoFeature/Sources/ViewControllers/Notice/NoticeViewController.swift b/Projects/Features/MyInfoFeature/Sources/ViewControllers/Notice/NoticeViewController.swift index 63b0c8a12..dfb16a626 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewControllers/Notice/NoticeViewController.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewControllers/Notice/NoticeViewController.swift @@ -1,11 +1,4 @@ -// -// NoticeViewController.swift -// StorageFeature -// -// Created by KTH on 2023/04/08. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - +import MyInfoFeatureInterface import BaseFeature import DesignSystem import NVActivityIndicatorView @@ -20,7 +13,7 @@ public final class NoticeViewController: UIViewController, ViewControllerFromSto @IBOutlet weak var backButton: UIButton! @IBOutlet weak var indicator: NVActivityIndicatorView! - private var noticeDetailComponent: NoticeDetailComponent! + private var noticeDetailFactory: NoticeDetailFactory! private var viewModel: NoticeViewModel! private lazy var input = NoticeViewModel.Input() private lazy var output = viewModel.transform(from: input) @@ -35,11 +28,11 @@ public final class NoticeViewController: UIViewController, ViewControllerFromSto public static func viewController( viewModel: NoticeViewModel, - noticeDetailComponent: NoticeDetailComponent + noticeDetailFactory: NoticeDetailFactory ) -> NoticeViewController { let viewController = NoticeViewController.viewController(storyBoardName: "Notice", bundle: Bundle.module) viewController.viewModel = viewModel - viewController.noticeDetailComponent = noticeDetailComponent + viewController.noticeDetailFactory = noticeDetailFactory return viewController } @@ -91,7 +84,7 @@ private extension NoticeViewController { output.goNoticeDetailScene .bind(with: self) { owner, model in - let viewController = owner.noticeDetailComponent.makeView(model: model) + let viewController = owner.noticeDetailFactory.makeView(model: model) viewController.modalPresentationStyle = .overFullScreen owner.present(viewController, animated: true) } diff --git a/Projects/Features/MyInfoFeature/Sources/ViewModels/FaqViewModel.swift b/Projects/Features/MyInfoFeature/Sources/ViewModels/FaqViewModel.swift index de63db43c..2b656c350 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewModels/FaqViewModel.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewModels/FaqViewModel.swift @@ -14,7 +14,7 @@ public final class FaqViewModel: ViewModelType { public struct Input {} public struct Output { - let dataSource: BehaviorRelay<([String], [FaqModel])> = BehaviorRelay(value: ([], [])) + let dataSource: BehaviorRelay<([String], [FaqEntity])> = BehaviorRelay(value: ([], [])) } public init( @@ -43,16 +43,6 @@ public final class FaqViewModel: ViewModelType { let zip2 = fetchQnaUseCase.execute() .catchAndReturn([]) - .map { - $0.map { - FaqModel( - category: $0.category, - question: $0.question, - answer: $0.answer, - isOpen: $0.isOpen - ) - } - } .asObservable() Observable.zip(zip1, zip2) diff --git a/Projects/Features/MyInfoFeature/Sources/ViewModels/NoticeDetailViewModel.swift b/Projects/Features/MyInfoFeature/Sources/ViewModels/NoticeDetailViewModel.swift index b63ea0667..ca91c34c7 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewModels/NoticeDetailViewModel.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewModels/NoticeDetailViewModel.swift @@ -1,11 +1,3 @@ -// -// NoticeDetailViewModel.swift -// StorageFeature -// -// Created by KTH on 2023/04/08. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - import BaseFeature import Foundation import Kingfisher diff --git a/Projects/Features/MyInfoFeature/Sources/ViewModels/NoticeViewModel.swift b/Projects/Features/MyInfoFeature/Sources/ViewModels/NoticeViewModel.swift index 4010e2a34..68bd5a754 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewModels/NoticeViewModel.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewModels/NoticeViewModel.swift @@ -1,13 +1,6 @@ -// -// NoticeViewModel.swift -// StorageFeature -// -// Created by KTH on 2023/04/08. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - import BaseFeature import Foundation +import MyInfoFeatureInterface import NoticeDomainInterface import RxRelay import RxSwift diff --git a/Projects/Features/MyInfoFeature/Sources/ViewModels/QnaContentViewModel.swift b/Projects/Features/MyInfoFeature/Sources/ViewModels/QnaContentViewModel.swift index 6afdcc1da..cae02fd7a 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewModels/QnaContentViewModel.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewModels/QnaContentViewModel.swift @@ -1,20 +1,20 @@ import BaseFeature import Foundation -import MyInfoFeatureInterface +import FaqDomainInterface import RxRelay import RxSwift import Utility public final class QnaContentViewModel: ViewModelType { var disposeBag = DisposeBag() - var dataSource: [FaqModel] + var dataSource: [FaqEntity] public struct Input {} public struct Output {} public init( - dataSource: [FaqModel] + dataSource: [FaqEntity] ) { DEBUG_LOG("✅ \(Self.self) 생성") self.dataSource = dataSource diff --git a/Projects/Features/MyInfoFeature/Sources/Views/AnswerTableViewCell.swift b/Projects/Features/MyInfoFeature/Sources/Views/AnswerTableViewCell.swift index eb693c3f5..20392cb6b 100644 --- a/Projects/Features/MyInfoFeature/Sources/Views/AnswerTableViewCell.swift +++ b/Projects/Features/MyInfoFeature/Sources/Views/AnswerTableViewCell.swift @@ -1,5 +1,5 @@ import DesignSystem -import MyInfoFeatureInterface +import FaqDomainInterface import UIKit class AnswerTableViewCell: UITableViewCell { @@ -13,7 +13,7 @@ class AnswerTableViewCell: UITableViewCell { } extension AnswerTableViewCell { - public func update(model: FaqModel) { + public func update(model: FaqEntity) { answerLabel.text = model.answer } } diff --git a/Projects/Features/MyInfoFeature/Sources/Views/NoticeDetailHeaderView.swift b/Projects/Features/MyInfoFeature/Sources/Views/NoticeDetailHeaderView.swift index 02541f81e..a9fd653d9 100644 --- a/Projects/Features/MyInfoFeature/Sources/Views/NoticeDetailHeaderView.swift +++ b/Projects/Features/MyInfoFeature/Sources/Views/NoticeDetailHeaderView.swift @@ -1,11 +1,3 @@ -// -// NoticeDetailHeaderView.swift -// StorageFeature -// -// Created by KTH on 2023/04/08. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - import DesignSystem import NoticeDomainInterface import UIKit diff --git a/Projects/Features/MyInfoFeature/Sources/Views/NoticeListCell.swift b/Projects/Features/MyInfoFeature/Sources/Views/NoticeListCell.swift index b41ae3c43..c00ba5cee 100644 --- a/Projects/Features/MyInfoFeature/Sources/Views/NoticeListCell.swift +++ b/Projects/Features/MyInfoFeature/Sources/Views/NoticeListCell.swift @@ -1,11 +1,3 @@ -// -// NoticeListCell.swift -// StorageFeature -// -// Created by KTH on 2023/04/08. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - import DesignSystem import NoticeDomainInterface import UIKit diff --git a/Projects/Features/MyInfoFeature/Sources/Views/QuestionTableViewCell.swift b/Projects/Features/MyInfoFeature/Sources/Views/QuestionTableViewCell.swift index bd3c99ab0..ce19cce34 100644 --- a/Projects/Features/MyInfoFeature/Sources/Views/QuestionTableViewCell.swift +++ b/Projects/Features/MyInfoFeature/Sources/Views/QuestionTableViewCell.swift @@ -1,5 +1,5 @@ import DesignSystem -import MyInfoFeatureInterface +import FaqDomainInterface import UIKit class QuestionTableViewCell: UITableViewCell { @@ -17,7 +17,7 @@ class QuestionTableViewCell: UITableViewCell { } extension QuestionTableViewCell { - public func update(model: FaqModel) { + public func update(model: FaqEntity) { categoryLabel.text = model.category titleLabel.text = model.question expandImageView.image = model.isOpen ? DesignSystemAsset.Navigation.fold.image : DesignSystemAsset.Navigation From 0b67e500d51de54a2af99e403c44731bd40a7d9b Mon Sep 17 00:00:00 2001 From: youn9k Date: Mon, 17 Jun 2024 22:26:12 +0900 Subject: [PATCH 07/15] =?UTF-8?q?=F0=9F=8E=A8=20::=20[#568]=20=EC=98=81?= =?UTF-8?q?=ED=96=A5=EB=B0=9B=EB=8A=94=20=EC=BB=B4=ED=8F=AC=EB=84=8C?= =?UTF-8?q?=ED=8A=B8=EB=93=A4=20Factory=20=EC=9E=91=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Application/AppComponent+Base.swift | 4 +-- .../Application/AppComponent+Faq.swift | 5 +-- .../Application/AppComponent+MyInfo.swift | 12 ++++--- .../Application/AppComponent+Notice.swift | 5 +-- .../Sources/Application/AppComponent.swift | 3 -- .../Components/MainTabBarComponent.swift | 13 ++++---- .../MainTabBarViewController.swift | 23 ++++++------- Projects/Features/MyInfoFeature/Project.swift | 5 ++- .../Sources/Components/FaqComponent.swift | 2 +- .../Sources/Components/MyInfoComponent.swift | 16 +++++----- .../Sources/Components/NoticeComponent.swift | 2 +- .../Sources/Components/RequestComponent.swift | 9 +++--- .../Components/ServiceInfoComponent.swift | 5 +-- .../Sources/Components/SettingComponent.swift | 16 +++++----- .../Components/TeamInfoComponent.swift | 2 +- .../MyInfo/MyInfoViewController.swift | 32 +++++++++---------- .../Request/RequestViewController.swift | 17 +++++----- .../ServiceInfoViewController.swift | 9 +++--- 18 files changed, 96 insertions(+), 84 deletions(-) diff --git a/Projects/App/Sources/Application/AppComponent+Base.swift b/Projects/App/Sources/Application/AppComponent+Base.swift index 071df6d4d..2549480bb 100644 --- a/Projects/App/Sources/Application/AppComponent+Base.swift +++ b/Projects/App/Sources/Application/AppComponent+Base.swift @@ -15,11 +15,11 @@ public extension AppComponent { ContainSongsComponent(parent: self) } - var privacyComponent: PrivacyComponent { + var privacyFactory: any PrivacyFactory { PrivacyComponent(parent: self) } - var serviceTermsComponent: ServiceTermsComponent { + var serviceTermsFactory: any ServiceTermFactory { ServiceTermsComponent(parent: self) } } diff --git a/Projects/App/Sources/Application/AppComponent+Faq.swift b/Projects/App/Sources/Application/AppComponent+Faq.swift index 528c80864..206080dc2 100644 --- a/Projects/App/Sources/Application/AppComponent+Faq.swift +++ b/Projects/App/Sources/Application/AppComponent+Faq.swift @@ -10,6 +10,7 @@ import BaseFeature import FaqDomain import FaqDomainInterface import MyInfoFeature +import MyInfoFeatureInterface import SignInFeature // MARK: 변수명 주의 @@ -20,11 +21,11 @@ public extension AppComponent { QuestionComponent(parent: self) } - var faqComponent: FaqComponent { + var faqFactory: any FaqFactory { FaqComponent(parent: self) } - var faqContentComponent: FaqContentComponent { + var faqContentFactory: any FaqContentFactory { FaqContentComponent(parent: self) } diff --git a/Projects/App/Sources/Application/AppComponent+MyInfo.swift b/Projects/App/Sources/Application/AppComponent+MyInfo.swift index 2b43fc08e..83472ba48 100644 --- a/Projects/App/Sources/Application/AppComponent+MyInfo.swift +++ b/Projects/App/Sources/Application/AppComponent+MyInfo.swift @@ -3,19 +3,23 @@ import MyInfoFeature import MyInfoFeatureInterface extension AppComponent { - var myInfoComponent: MyInfoComponent { + var myInfoFactory: any MyInfoFactory { MyInfoComponent(parent: self) } - var settingComponent: SettingComponent { + var settingFactory: any SettingFactory { SettingComponent(parent: self) } - var teamInfoComponent: TeamInfoComponent { + var teamInfoFactory: any TeamInfoFactory { TeamInfoComponent(parent: self) } - var appPushSettingComponent: AppPushSettingComponent { + var appPushSettingFactory: any AppPushSettingFactory { AppPushSettingComponent(parent: self) } + + var openSourceLicenseFactory: any OpenSourceLicenseFactory { + OpenSourceLicenseComponent(parent: self) + } } diff --git a/Projects/App/Sources/Application/AppComponent+Notice.swift b/Projects/App/Sources/Application/AppComponent+Notice.swift index 76fe97ff8..e2606e366 100644 --- a/Projects/App/Sources/Application/AppComponent+Notice.swift +++ b/Projects/App/Sources/Application/AppComponent+Notice.swift @@ -9,6 +9,7 @@ import BaseFeature import MainTabFeature import MyInfoFeature +import MyInfoFeatureInterface import NoticeDomain import NoticeDomainInterface import StorageFeature @@ -18,11 +19,11 @@ public extension AppComponent { NoticePopupComponent(parent: self) } - var noticeComponent: NoticeComponent { + var noticeFactory: any NoticeFactory { NoticeComponent(parent: self) } - var noticeDetailComponent: NoticeDetailComponent { + var noticeDetailFactory: any NoticeDetailFactory { NoticeDetailComponent(parent: self) } diff --git a/Projects/App/Sources/Application/AppComponent.swift b/Projects/App/Sources/Application/AppComponent.swift index e9a11b62a..9f977ac15 100644 --- a/Projects/App/Sources/Application/AppComponent.swift +++ b/Projects/App/Sources/Application/AppComponent.swift @@ -55,9 +55,6 @@ public extension AppComponent { // MARK: - ETC public extension AppComponent { - var openSourceLicenseComponent: OpenSourceLicenseComponent { - OpenSourceLicenseComponent(parent: self) - } var serviceInfoComponent: ServiceInfoComponent { ServiceInfoComponent(parent: self) diff --git a/Projects/Features/MainTabFeature/Sources/Components/MainTabBarComponent.swift b/Projects/Features/MainTabFeature/Sources/Components/MainTabBarComponent.swift index 34af7b684..711230e2c 100644 --- a/Projects/Features/MainTabFeature/Sources/Components/MainTabBarComponent.swift +++ b/Projects/Features/MainTabFeature/Sources/Components/MainTabBarComponent.swift @@ -4,6 +4,7 @@ import ChartFeature import Foundation import HomeFeature import MyInfoFeature +import MyInfoFeatureInterface import NeedleFoundation import NoticeDomainInterface import SearchFeature @@ -18,10 +19,10 @@ public protocol MainTabBarDependency: Dependency { var searchFactory: any SearchFactory { get } var artistComponent: ArtistComponent { get } var storageFactory: any StorageFactory { get } - var myInfoComponent: MyInfoComponent { get } + var myInfoFactory: any MyInfoFactory { get } var noticePopupComponent: NoticePopupComponent { get } - var noticeComponent: NoticeComponent { get } - var noticeDetailComponent: NoticeDetailComponent { get } + var noticeFactory: any NoticeFactory { get } + var noticeDetailFactory: any NoticeDetailFactory { get } } public final class MainTabBarComponent: Component { @@ -35,10 +36,10 @@ public final class MainTabBarComponent: Component { searchFactory: self.dependency.searchFactory, artistComponent: self.dependency.artistComponent, storageFactory: self.dependency.storageFactory, - myInfoComponent: self.dependency.myInfoComponent, + myInfoFactory: self.dependency.myInfoFactory, noticePopupComponent: self.dependency.noticePopupComponent, - noticeComponent: self.dependency.noticeComponent, - noticeDetailComponent: self.dependency.noticeDetailComponent + noticeFactory: self.dependency.noticeFactory, + noticeDetailFactory: self.dependency.noticeDetailFactory ) } } diff --git a/Projects/Features/MainTabFeature/Sources/ViewControllers/MainTabBarViewController.swift b/Projects/Features/MainTabFeature/Sources/ViewControllers/MainTabBarViewController.swift index 598d50a12..bb7871e63 100644 --- a/Projects/Features/MainTabFeature/Sources/ViewControllers/MainTabBarViewController.swift +++ b/Projects/Features/MainTabFeature/Sources/ViewControllers/MainTabBarViewController.swift @@ -4,6 +4,7 @@ import ChartFeature import DesignSystem import HomeFeature import MyInfoFeature +import MyInfoFeatureInterface import NoticeDomainInterface import RxCocoa import RxSwift @@ -26,7 +27,7 @@ public final class MainTabBarViewController: BaseViewController, ViewControllerF searchFactory.makeView().wrapNavigationController, artistComponent.makeView().wrapNavigationController, storageFactory.makeView().wrapNavigationController, - myInfoComponent.makeView().wrapNavigationController + myInfoFactory.makeView().wrapNavigationController ] }() @@ -43,10 +44,10 @@ public final class MainTabBarViewController: BaseViewController, ViewControllerF private var searchFactory: SearchFactory! private var artistComponent: ArtistComponent! private var storageFactory: StorageFactory! - private var myInfoComponent: MyInfoComponent! + private var myInfoFactory: MyInfoFactory! private var noticePopupComponent: NoticePopupComponent! - private var noticeComponent: NoticeComponent! - private var noticeDetailComponent: NoticeDetailComponent! + private var noticeFactory: NoticeFactory! + private var noticeDetailFactory: NoticeDetailFactory! override public func viewDidLoad() { super.viewDidLoad() @@ -72,10 +73,10 @@ public final class MainTabBarViewController: BaseViewController, ViewControllerF searchFactory: SearchFactory, artistComponent: ArtistComponent, storageFactory: StorageFactory, - myInfoComponent: MyInfoComponent, + myInfoFactory: MyInfoFactory, noticePopupComponent: NoticePopupComponent, - noticeComponent: NoticeComponent, - noticeDetailComponent: NoticeDetailComponent + noticeFactory: NoticeFactory, + noticeDetailFactory: NoticeDetailFactory ) -> MainTabBarViewController { let viewController = MainTabBarViewController.viewController(storyBoardName: "Main", bundle: Bundle.module) viewController.viewModel = viewModel @@ -84,10 +85,10 @@ public final class MainTabBarViewController: BaseViewController, ViewControllerF viewController.searchFactory = searchFactory viewController.artistComponent = artistComponent viewController.storageFactory = storageFactory - viewController.myInfoComponent = myInfoComponent + viewController.myInfoFactory = myInfoFactory viewController.noticePopupComponent = noticePopupComponent - viewController.noticeComponent = noticeComponent - viewController.noticeDetailComponent = noticeDetailComponent + viewController.noticeFactory = noticeFactory + viewController.noticeDetailFactory = noticeDetailFactory return viewController } } @@ -148,7 +149,7 @@ extension MainTabBarViewController { extension MainTabBarViewController: NoticePopupViewControllerDelegate { public func noticeTapped(model: FetchNoticeEntity) { if model.thumbnail.link.isEmpty { - let viewController = noticeDetailComponent.makeView(model: model) + let viewController = noticeDetailFactory.makeView(model: model) viewController.modalPresentationStyle = .overFullScreen present(viewController, animated: true) diff --git a/Projects/Features/MyInfoFeature/Project.swift b/Projects/Features/MyInfoFeature/Project.swift index 7ef0240a0..b311edc95 100644 --- a/Projects/Features/MyInfoFeature/Project.swift +++ b/Projects/Features/MyInfoFeature/Project.swift @@ -5,7 +5,10 @@ import ProjectDescriptionHelpers let project = Project.module( name: ModulePaths.Feature.MyInfoFeature.rawValue, targets: [ - .interface(module: .feature(.MyInfoFeature)), + .interface(module: .feature(.MyInfoFeature), dependencies: [ + .domain(target: .NoticeDomain, type: .interface), + .domain(target: .FaqDomain, type: .interface) + ]), .implements( module: .feature(.MyInfoFeature), product: .staticFramework, diff --git a/Projects/Features/MyInfoFeature/Sources/Components/FaqComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/FaqComponent.swift index 956200fbd..5ea67a196 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/FaqComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/FaqComponent.swift @@ -5,7 +5,7 @@ import NeedleFoundation import UIKit public protocol FaqDependency: Dependency { - var faqContentFactory: FaqContentFactory { get } + var faqContentFactory: any FaqContentFactory { get } var fetchFaqCategoriesUseCase: any FetchFaqCategoriesUseCase { get } var fetchFaqUseCase: any FetchFaqUseCase { get } } diff --git a/Projects/Features/MyInfoFeature/Sources/Components/MyInfoComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/MyInfoComponent.swift index 92134f427..5a734d84f 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/MyInfoComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/MyInfoComponent.swift @@ -7,11 +7,11 @@ import UIKit public protocol MyInfoDependency: Dependency { var signInFactory: any SignInFactory { get } var textPopUpFactory: any TextPopUpFactory { get } - var faqComponent: FaqComponent { get } - var noticeComponent: NoticeComponent { get } + var faqFactory: any FaqFactory { get } + var noticeFactory: any NoticeFactory { get } var questionComponent: QuestionComponent { get } - var teamInfoComponent: TeamInfoComponent { get } - var settingComponent: SettingComponent { get } + var teamInfoFactory: any TeamInfoFactory { get } + var settingFactory: any SettingFactory { get } } public final class MyInfoComponent: Component, MyInfoFactory { @@ -20,11 +20,11 @@ public final class MyInfoComponent: Component, MyInfoFactory { reactor: MyInfoReactor(), textPopUpFactory: dependency.textPopUpFactory, signInFactory: dependency.signInFactory, - faqComponent: dependency.faqComponent, - noticeComponent: dependency.noticeComponent, + faqFactory: dependency.faqFactory, + noticeFactory: dependency.noticeFactory, questionComponent: dependency.questionComponent, - teamInfoComponent: dependency.teamInfoComponent, - settingComponent: dependency.settingComponent + teamInfoFactory: dependency.teamInfoFactory, + settingFactory: dependency.settingFactory ) } } diff --git a/Projects/Features/MyInfoFeature/Sources/Components/NoticeComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/NoticeComponent.swift index e4f6debcb..bef824d28 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/NoticeComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/NoticeComponent.swift @@ -6,7 +6,7 @@ import UIKit public protocol NoticeDependency: Dependency { var fetchNoticeUseCase: any FetchNoticeUseCase { get } - var noticeDetailFactory: NoticeDetailFactory { get } + var noticeDetailFactory: any NoticeDetailFactory { get } } public final class NoticeComponent: Component, NoticeFactory { diff --git a/Projects/Features/MyInfoFeature/Sources/Components/RequestComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/RequestComponent.swift index 9b6eed6c2..5b5e6f7dc 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/RequestComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/RequestComponent.swift @@ -4,13 +4,14 @@ import BaseFeatureInterface import Foundation import NeedleFoundation import UserDomainInterface +import MyInfoFeatureInterface public protocol RequestDependency: Dependency { var withdrawUserInfoUseCase: any WithdrawUserInfoUseCase { get } var logoutUseCase: any LogoutUseCase { get } - var faqComponent: FaqComponent { get } + var faqFactory: any FaqFactory { get } var questionComponent: QuestionComponent { get } - var noticeComponent: NoticeComponent { get } + var noticeFactory: any NoticeFactory { get } var serviceInfoComponent: ServiceInfoComponent { get } var textPopUpFactory: any TextPopUpFactory { get } } @@ -22,9 +23,9 @@ public final class RequestComponent: Component { withDrawUserInfoUseCase: dependency.withdrawUserInfoUseCase, logoutUseCase: dependency.logoutUseCase ), - faqComponent: dependency.faqComponent, + faqFactory: dependency.faqFactory, questionComponent: dependency.questionComponent, - noticeComponent: dependency.noticeComponent, + noticeFactory: dependency.noticeFactory, serviceInfoComponent: dependency.serviceInfoComponent, textPopUpFactory: dependency.textPopUpFactory ) diff --git a/Projects/Features/MyInfoFeature/Sources/Components/ServiceInfoComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/ServiceInfoComponent.swift index 38ab4af0b..3fe6fb76e 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/ServiceInfoComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/ServiceInfoComponent.swift @@ -1,9 +1,10 @@ import BaseFeatureInterface import Foundation import NeedleFoundation +import MyInfoFeatureInterface public protocol ServiceInfoDependency: Dependency { - var openSourceLicenseComponent: OpenSourceLicenseComponent { get } + var openSourceLicenseFactory: any OpenSourceLicenseFactory { get } var textPopUpFactory: any TextPopUpFactory { get } } @@ -11,7 +12,7 @@ public final class ServiceInfoComponent: Component { public func makeView() -> ServiceInfoViewController { return ServiceInfoViewController.viewController( viewModel: ServiceInfoViewModel(), - openSourceLicenseComponent: dependency.openSourceLicenseComponent, + openSourceLicenseFactory: dependency.openSourceLicenseFactory, textPopUpFactory: dependency.textPopUpFactory ) } diff --git a/Projects/Features/MyInfoFeature/Sources/Components/SettingComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/SettingComponent.swift index 487c57659..c4d04fcc8 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/SettingComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/SettingComponent.swift @@ -12,10 +12,10 @@ public protocol SettingDependency: Dependency { var logoutUseCase: any LogoutUseCase { get } var textPopUpFactory: any TextPopUpFactory { get } var signInFactory: any SignInFactory { get } - var appPushSettingComponent: AppPushSettingComponent { get } - var serviceTermsComponent: ServiceTermsComponent { get } - var privacyComponent: PrivacyComponent { get } - var openSourceLicenseComponent: OpenSourceLicenseComponent { get } + var appPushSettingFactory: any AppPushSettingFactory { get } + var serviceTermsFactory: any ServiceTermFactory { get } + var privacyFactory: any PrivacyFactory { get } + var openSourceLicenseFactory: any OpenSourceLicenseFactory { get } } public final class SettingComponent: Component, SettingFactory { @@ -27,10 +27,10 @@ public final class SettingComponent: Component, SettingFactor ), textPopUpFactory: dependency.textPopUpFactory, signInFactory: dependency.signInFactory, - appPushSettingFactory: dependency.appPushSettingComponent, - serviceTermsFactory: dependency.serviceTermsComponent, - privacyFactory: dependency.privacyComponent, - openSourceLicenseFactory: dependency.openSourceLicenseComponent + appPushSettingFactory: dependency.appPushSettingFactory, + serviceTermsFactory: dependency.serviceTermsFactory, + privacyFactory: dependency.privacyFactory, + openSourceLicenseFactory: dependency.openSourceLicenseFactory ) } } diff --git a/Projects/Features/MyInfoFeature/Sources/Components/TeamInfoComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/TeamInfoComponent.swift index 4397e4e50..bb1dab2ea 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/TeamInfoComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/TeamInfoComponent.swift @@ -5,7 +5,7 @@ import UIKit public protocol TeamInfoDependency: Dependency {} -public final class TeamInfoComponent: Component { +public final class TeamInfoComponent: Component, TeamInfoFactory { public func makeView() -> UIViewController { return TeamInfoViewController.viewController( reactor: TeamInfoReactor() diff --git a/Projects/Features/MyInfoFeature/Sources/ViewControllers/MyInfo/MyInfoViewController.swift b/Projects/Features/MyInfoFeature/Sources/ViewControllers/MyInfo/MyInfoViewController.swift index 0894296c7..7b76fa076 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewControllers/MyInfo/MyInfoViewController.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewControllers/MyInfo/MyInfoViewController.swift @@ -15,11 +15,11 @@ final class MyInfoViewController: BaseReactorViewController { let myInfoView = MyInfoView() private var textPopUpFactory: TextPopUpFactory! private var signInFactory: SignInFactory! - private var faqComponent: FaqComponent! // 자주 묻는 질문 - private var noticeComponent: NoticeComponent! // 공지사항 + private var faqFactory: FaqFactory! // 자주 묻는 질문 + private var noticeFactory: NoticeFactory! // 공지사항 private var questionComponent: QuestionComponent! // 문의하기 - private var teamInfoComponent: TeamInfoComponent! // 팀 소개 - private var settingComponent: SettingComponent! + private var teamInfoFactory: TeamInfoFactory! // 팀 소개 + private var settingFactory: SettingFactory! override func configureNavigation() { self.navigationController?.setNavigationBarHidden(true, animated: true) @@ -33,20 +33,20 @@ final class MyInfoViewController: BaseReactorViewController { reactor: MyInfoReactor, textPopUpFactory: TextPopUpFactory, signInFactory: SignInFactory, - faqComponent: FaqComponent, - noticeComponent: NoticeComponent, + faqFactory: FaqFactory, + noticeFactory: NoticeFactory, questionComponent: QuestionComponent, - teamInfoComponent: TeamInfoComponent, - settingComponent: SettingComponent + teamInfoFactory: TeamInfoFactory, + settingFactory: SettingFactory ) -> MyInfoViewController { let viewController = MyInfoViewController(reactor: reactor) viewController.textPopUpFactory = textPopUpFactory viewController.signInFactory = signInFactory - viewController.faqComponent = faqComponent - viewController.noticeComponent = noticeComponent + viewController.faqFactory = faqFactory + viewController.noticeFactory = noticeFactory viewController.questionComponent = questionComponent - viewController.teamInfoComponent = teamInfoComponent - viewController.settingComponent = settingComponent + viewController.teamInfoFactory = teamInfoFactory + viewController.settingFactory = settingFactory return viewController } @@ -119,20 +119,20 @@ final class MyInfoViewController: BaseReactorViewController { // owner.showPanModal(content: vc) } case .faq: - let vc = owner.faqComponent.makeView() + let vc = owner.faqFactory.makeView() owner.navigationController?.pushViewController(vc, animated: true) case .noti: - let vc = owner.noticeComponent.makeView() + let vc = owner.noticeFactory.makeView() owner.navigationController?.pushViewController(vc, animated: true) case .mail: let vc = owner.questionComponent.makeView() vc.modalPresentationStyle = .overFullScreen owner.present(vc, animated: true) case .team: - let vc = owner.teamInfoComponent.makeView() + let vc = owner.teamInfoFactory.makeView() owner.navigationController?.pushViewController(vc, animated: true) case .setting: - let vc = owner.settingComponent.makeView() + let vc = owner.settingFactory.makeView() owner.navigationController?.pushViewController(vc, animated: true) } } diff --git a/Projects/Features/MyInfoFeature/Sources/ViewControllers/Request/RequestViewController.swift b/Projects/Features/MyInfoFeature/Sources/ViewControllers/Request/RequestViewController.swift index b496cc049..0a58b590f 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewControllers/Request/RequestViewController.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewControllers/Request/RequestViewController.swift @@ -4,6 +4,7 @@ import DesignSystem import RxSwift import UIKit import Utility +import MyInfoFeatureInterface public final class RequestViewController: UIViewController, ViewControllerFromStoryBoard { @IBOutlet weak var backButton: UIButton! @@ -43,7 +44,7 @@ public final class RequestViewController: UIViewController, ViewControllerFromSt } @IBAction func moveQnaAction(_ sender: UIButton) { - let vc = faqComponent.makeView() + let vc = faqFactory.makeView() self.navigationController?.pushViewController(vc, animated: true) } @@ -54,7 +55,7 @@ public final class RequestViewController: UIViewController, ViewControllerFromSt } @IBAction func movenoticeAction(_ sender: Any) { - let viewController = noticeComponent.makeView() + let viewController = noticeFactory.makeView() self.navigationController?.pushViewController(viewController, animated: true) } @@ -100,9 +101,9 @@ public final class RequestViewController: UIViewController, ViewControllerFromSt lazy var input = RequestViewModel.Input() lazy var output = viewModel.transform(from: input) - var faqComponent: FaqComponent! + var faqFactory: FaqFactory! var questionComponent: QuestionComponent! - var noticeComponent: NoticeComponent! + var noticeFactory: NoticeFactory! var serviceInfoComponent: ServiceInfoComponent! var disposeBag = DisposeBag() @@ -121,17 +122,17 @@ public final class RequestViewController: UIViewController, ViewControllerFromSt public static func viewController( viewModel: RequestViewModel, - faqComponent: FaqComponent, + faqFactory: FaqFactory, questionComponent: QuestionComponent, - noticeComponent: NoticeComponent, + noticeFactory: NoticeFactory, serviceInfoComponent: ServiceInfoComponent, textPopUpFactory: TextPopUpFactory ) -> RequestViewController { let viewController = RequestViewController.viewController(storyBoardName: "Request", bundle: Bundle.module) viewController.viewModel = viewModel - viewController.faqComponent = faqComponent + viewController.faqFactory = faqFactory viewController.questionComponent = questionComponent - viewController.noticeComponent = noticeComponent + viewController.noticeFactory = noticeFactory viewController.serviceInfoComponent = serviceInfoComponent viewController.textPopUpFactory = textPopUpFactory return viewController diff --git a/Projects/Features/MyInfoFeature/Sources/ViewControllers/ServiceInfo/ServiceInfoViewController.swift b/Projects/Features/MyInfoFeature/Sources/ViewControllers/ServiceInfo/ServiceInfoViewController.swift index 988fbd9a3..3ed37203b 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewControllers/ServiceInfo/ServiceInfoViewController.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewControllers/ServiceInfo/ServiceInfoViewController.swift @@ -6,13 +6,14 @@ import RxCocoa import RxSwift import UIKit import Utility +import MyInfoFeatureInterface public class ServiceInfoViewController: UIViewController, ViewControllerFromStoryBoard { @IBOutlet weak var backButton: UIButton! @IBOutlet weak var titleStringLabel: UILabel! @IBOutlet weak var tableView: UITableView! - var openSourceLicenseComponent: OpenSourceLicenseComponent! + var openSourceLicenseFactory: OpenSourceLicenseFactory! var textPopUpFactory: TextPopUpFactory! var viewModel: ServiceInfoViewModel! var disposeBag: DisposeBag = DisposeBag() @@ -29,7 +30,7 @@ public class ServiceInfoViewController: UIViewController, ViewControllerFromStor public static func viewController( viewModel: ServiceInfoViewModel, - openSourceLicenseComponent: OpenSourceLicenseComponent, + openSourceLicenseFactory: OpenSourceLicenseFactory, textPopUpFactory: TextPopUpFactory ) -> ServiceInfoViewController { let viewController = ServiceInfoViewController.viewController( @@ -37,7 +38,7 @@ public class ServiceInfoViewController: UIViewController, ViewControllerFromStor bundle: Bundle.module ) viewController.viewModel = viewModel - viewController.openSourceLicenseComponent = openSourceLicenseComponent + viewController.openSourceLicenseFactory = openSourceLicenseFactory viewController.textPopUpFactory = textPopUpFactory return viewController } @@ -65,7 +66,7 @@ extension ServiceInfoViewController { vc.modalPresentationStyle = .overFullScreen owner.present(vc, animated: true) case .openSourceLicense: - let vc = owner.openSourceLicenseComponent.makeView() + let vc = owner.openSourceLicenseFactory.makeView() owner.navigationController?.pushViewController(vc, animated: true) case .removeCache: owner.viewModel.input.requestCacheSize.onNext(()) From c4f9f2013a19856c007ec373a1d195078d1ff376 Mon Sep 17 00:00:00 2001 From: youn9k Date: Mon, 17 Jun 2024 22:26:59 +0900 Subject: [PATCH 08/15] =?UTF-8?q?=F0=9F=8E=A8=20::=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?Formatting=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Projects/App/Sources/Application/AppComponent+MyInfo.swift | 2 +- Projects/App/Sources/Application/AppComponent.swift | 1 - Projects/Features/MyInfoFeature/Interface/Interface.swift | 4 ++-- .../MyInfoFeature/Sources/Components/NoticeComponent.swift | 2 +- .../MyInfoFeature/Sources/Components/RequestComponent.swift | 2 +- .../Sources/Components/ServiceInfoComponent.swift | 2 +- .../Sources/ViewControllers/Notice/NoticeViewController.swift | 2 +- .../ViewControllers/Request/RequestViewController.swift | 2 +- .../ServiceInfo/ServiceInfoViewController.swift | 2 +- .../Sources/ViewModels/QnaContentViewModel.swift | 2 +- 10 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Projects/App/Sources/Application/AppComponent+MyInfo.swift b/Projects/App/Sources/Application/AppComponent+MyInfo.swift index 83472ba48..0e45097ca 100644 --- a/Projects/App/Sources/Application/AppComponent+MyInfo.swift +++ b/Projects/App/Sources/Application/AppComponent+MyInfo.swift @@ -18,7 +18,7 @@ extension AppComponent { var appPushSettingFactory: any AppPushSettingFactory { AppPushSettingComponent(parent: self) } - + var openSourceLicenseFactory: any OpenSourceLicenseFactory { OpenSourceLicenseComponent(parent: self) } diff --git a/Projects/App/Sources/Application/AppComponent.swift b/Projects/App/Sources/Application/AppComponent.swift index 9f977ac15..0ddc48fdc 100644 --- a/Projects/App/Sources/Application/AppComponent.swift +++ b/Projects/App/Sources/Application/AppComponent.swift @@ -55,7 +55,6 @@ public extension AppComponent { // MARK: - ETC public extension AppComponent { - var serviceInfoComponent: ServiceInfoComponent { ServiceInfoComponent(parent: self) } diff --git a/Projects/Features/MyInfoFeature/Interface/Interface.swift b/Projects/Features/MyInfoFeature/Interface/Interface.swift index f05f6d4d4..fd2f44fa0 100644 --- a/Projects/Features/MyInfoFeature/Interface/Interface.swift +++ b/Projects/Features/MyInfoFeature/Interface/Interface.swift @@ -1,6 +1,6 @@ -import UIKit -import NoticeDomainInterface import FaqDomainInterface +import NoticeDomainInterface +import UIKit public protocol MyInfoFactory { func makeView() -> UIViewController diff --git a/Projects/Features/MyInfoFeature/Sources/Components/NoticeComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/NoticeComponent.swift index bef824d28..cd37cf78b 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/NoticeComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/NoticeComponent.swift @@ -1,6 +1,6 @@ import Foundation -import NeedleFoundation import MyInfoFeatureInterface +import NeedleFoundation import NoticeDomainInterface import UIKit diff --git a/Projects/Features/MyInfoFeature/Sources/Components/RequestComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/RequestComponent.swift index 5b5e6f7dc..9537814fb 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/RequestComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/RequestComponent.swift @@ -2,9 +2,9 @@ import AuthDomainInterface import BaseFeature import BaseFeatureInterface import Foundation +import MyInfoFeatureInterface import NeedleFoundation import UserDomainInterface -import MyInfoFeatureInterface public protocol RequestDependency: Dependency { var withdrawUserInfoUseCase: any WithdrawUserInfoUseCase { get } diff --git a/Projects/Features/MyInfoFeature/Sources/Components/ServiceInfoComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/ServiceInfoComponent.swift index 3fe6fb76e..512ed22ce 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/ServiceInfoComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/ServiceInfoComponent.swift @@ -1,7 +1,7 @@ import BaseFeatureInterface import Foundation -import NeedleFoundation import MyInfoFeatureInterface +import NeedleFoundation public protocol ServiceInfoDependency: Dependency { var openSourceLicenseFactory: any OpenSourceLicenseFactory { get } diff --git a/Projects/Features/MyInfoFeature/Sources/ViewControllers/Notice/NoticeViewController.swift b/Projects/Features/MyInfoFeature/Sources/ViewControllers/Notice/NoticeViewController.swift index dfb16a626..32ec34414 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewControllers/Notice/NoticeViewController.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewControllers/Notice/NoticeViewController.swift @@ -1,6 +1,6 @@ -import MyInfoFeatureInterface import BaseFeature import DesignSystem +import MyInfoFeatureInterface import NVActivityIndicatorView import RxCocoa import RxSwift diff --git a/Projects/Features/MyInfoFeature/Sources/ViewControllers/Request/RequestViewController.swift b/Projects/Features/MyInfoFeature/Sources/ViewControllers/Request/RequestViewController.swift index 0a58b590f..f17f47594 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewControllers/Request/RequestViewController.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewControllers/Request/RequestViewController.swift @@ -1,10 +1,10 @@ import BaseFeature import BaseFeatureInterface import DesignSystem +import MyInfoFeatureInterface import RxSwift import UIKit import Utility -import MyInfoFeatureInterface public final class RequestViewController: UIViewController, ViewControllerFromStoryBoard { @IBOutlet weak var backButton: UIButton! diff --git a/Projects/Features/MyInfoFeature/Sources/ViewControllers/ServiceInfo/ServiceInfoViewController.swift b/Projects/Features/MyInfoFeature/Sources/ViewControllers/ServiceInfo/ServiceInfoViewController.swift index 3ed37203b..690da8fee 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewControllers/ServiceInfo/ServiceInfoViewController.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewControllers/ServiceInfo/ServiceInfoViewController.swift @@ -2,11 +2,11 @@ import BaseFeature import BaseFeatureInterface import DesignSystem import Kingfisher +import MyInfoFeatureInterface import RxCocoa import RxSwift import UIKit import Utility -import MyInfoFeatureInterface public class ServiceInfoViewController: UIViewController, ViewControllerFromStoryBoard { @IBOutlet weak var backButton: UIButton! diff --git a/Projects/Features/MyInfoFeature/Sources/ViewModels/QnaContentViewModel.swift b/Projects/Features/MyInfoFeature/Sources/ViewModels/QnaContentViewModel.swift index cae02fd7a..ef646a4d1 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewModels/QnaContentViewModel.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewModels/QnaContentViewModel.swift @@ -1,6 +1,6 @@ import BaseFeature -import Foundation import FaqDomainInterface +import Foundation import RxRelay import RxSwift import Utility From 48b6bd07e78ff633dba324fb4f18a565e5076003 Mon Sep 17 00:00:00 2001 From: youn9k Date: Mon, 17 Jun 2024 22:42:54 +0900 Subject: [PATCH 09/15] =?UTF-8?q?=F0=9F=8E=A8=20::=20[#568]=20Question=20C?= =?UTF-8?q?omponent=20->=20Factory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Application/AppComponent+Faq.swift | 22 ------------------- .../Application/AppComponent+MyInfo.swift | 12 ++++++++++ .../Sources/Components/MyInfoComponent.swift | 4 ++-- .../Components/QuestionComponent.swift | 6 +++-- .../Sources/Components/RequestComponent.swift | 4 ++-- .../MyInfo/MyInfoViewController.swift | 8 +++---- .../Request/RequestViewController.swift | 8 +++---- 7 files changed, 28 insertions(+), 36 deletions(-) diff --git a/Projects/App/Sources/Application/AppComponent+Faq.swift b/Projects/App/Sources/Application/AppComponent+Faq.swift index 206080dc2..12bb97865 100644 --- a/Projects/App/Sources/Application/AppComponent+Faq.swift +++ b/Projects/App/Sources/Application/AppComponent+Faq.swift @@ -1,34 +1,12 @@ -// -// AppComponent+Search.swift -// WaktaverseMusic -// -// Created by yongbeomkwak on 2023/02/07. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - import BaseFeature import FaqDomain import FaqDomainInterface -import MyInfoFeature -import MyInfoFeatureInterface import SignInFeature // MARK: 변수명 주의 // AppComponent 내 변수 == Dependency 내 변수 이름 같아야함 public extension AppComponent { - var questionComponent: QuestionComponent { - QuestionComponent(parent: self) - } - - var faqFactory: any FaqFactory { - FaqComponent(parent: self) - } - - var faqContentFactory: any FaqContentFactory { - FaqContentComponent(parent: self) - } - var remoteFaqDataSource: any RemoteFaqDataSource { shared { RemoteFaqDataSourceImpl(keychain: keychain) diff --git a/Projects/App/Sources/Application/AppComponent+MyInfo.swift b/Projects/App/Sources/Application/AppComponent+MyInfo.swift index 0e45097ca..f89280f8f 100644 --- a/Projects/App/Sources/Application/AppComponent+MyInfo.swift +++ b/Projects/App/Sources/Application/AppComponent+MyInfo.swift @@ -22,4 +22,16 @@ extension AppComponent { var openSourceLicenseFactory: any OpenSourceLicenseFactory { OpenSourceLicenseComponent(parent: self) } + + var questionFactory: any QuestionFactory { + QuestionComponent(parent: self) + } + + var faqFactory: any FaqFactory { + FaqComponent(parent: self) + } + + var faqContentFactory: any FaqContentFactory { + FaqContentComponent(parent: self) + } } diff --git a/Projects/Features/MyInfoFeature/Sources/Components/MyInfoComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/MyInfoComponent.swift index 5a734d84f..925bc024e 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/MyInfoComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/MyInfoComponent.swift @@ -9,7 +9,7 @@ public protocol MyInfoDependency: Dependency { var textPopUpFactory: any TextPopUpFactory { get } var faqFactory: any FaqFactory { get } var noticeFactory: any NoticeFactory { get } - var questionComponent: QuestionComponent { get } + var questionFactory: any QuestionFactory { get } var teamInfoFactory: any TeamInfoFactory { get } var settingFactory: any SettingFactory { get } } @@ -22,7 +22,7 @@ public final class MyInfoComponent: Component, MyInfoFactory { signInFactory: dependency.signInFactory, faqFactory: dependency.faqFactory, noticeFactory: dependency.noticeFactory, - questionComponent: dependency.questionComponent, + questionFactory: dependency.questionFactory, teamInfoFactory: dependency.teamInfoFactory, settingFactory: dependency.settingFactory ) diff --git a/Projects/Features/MyInfoFeature/Sources/Components/QuestionComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/QuestionComponent.swift index 9ad72c566..8e195fb32 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/QuestionComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/QuestionComponent.swift @@ -1,13 +1,15 @@ import BaseFeatureInterface import Foundation import NeedleFoundation +import MyInfoFeatureInterface +import UIKit public protocol QuestionDependency: Dependency { var textPopUpFactory: any TextPopUpFactory { get } } -public final class QuestionComponent: Component { - public func makeView() -> QuestionViewController { +public final class QuestionComponent: Component, QuestionFactory { + public func makeView() -> UIViewController { return QuestionViewController.viewController( viewModel: .init(), textPopUpFactory: dependency.textPopUpFactory diff --git a/Projects/Features/MyInfoFeature/Sources/Components/RequestComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/RequestComponent.swift index 9537814fb..2a1547421 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/RequestComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/RequestComponent.swift @@ -10,7 +10,7 @@ public protocol RequestDependency: Dependency { var withdrawUserInfoUseCase: any WithdrawUserInfoUseCase { get } var logoutUseCase: any LogoutUseCase { get } var faqFactory: any FaqFactory { get } - var questionComponent: QuestionComponent { get } + var questionFactory: any QuestionFactory { get } var noticeFactory: any NoticeFactory { get } var serviceInfoComponent: ServiceInfoComponent { get } var textPopUpFactory: any TextPopUpFactory { get } @@ -24,7 +24,7 @@ public final class RequestComponent: Component { logoutUseCase: dependency.logoutUseCase ), faqFactory: dependency.faqFactory, - questionComponent: dependency.questionComponent, + questionFactory: dependency.questionFactory, noticeFactory: dependency.noticeFactory, serviceInfoComponent: dependency.serviceInfoComponent, textPopUpFactory: dependency.textPopUpFactory diff --git a/Projects/Features/MyInfoFeature/Sources/ViewControllers/MyInfo/MyInfoViewController.swift b/Projects/Features/MyInfoFeature/Sources/ViewControllers/MyInfo/MyInfoViewController.swift index 7b76fa076..ea2f917ac 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewControllers/MyInfo/MyInfoViewController.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewControllers/MyInfo/MyInfoViewController.swift @@ -17,7 +17,7 @@ final class MyInfoViewController: BaseReactorViewController { private var signInFactory: SignInFactory! private var faqFactory: FaqFactory! // 자주 묻는 질문 private var noticeFactory: NoticeFactory! // 공지사항 - private var questionComponent: QuestionComponent! // 문의하기 + private var questionFactory: QuestionFactory! // 문의하기 private var teamInfoFactory: TeamInfoFactory! // 팀 소개 private var settingFactory: SettingFactory! @@ -35,7 +35,7 @@ final class MyInfoViewController: BaseReactorViewController { signInFactory: SignInFactory, faqFactory: FaqFactory, noticeFactory: NoticeFactory, - questionComponent: QuestionComponent, + questionFactory: QuestionFactory, teamInfoFactory: TeamInfoFactory, settingFactory: SettingFactory ) -> MyInfoViewController { @@ -44,7 +44,7 @@ final class MyInfoViewController: BaseReactorViewController { viewController.signInFactory = signInFactory viewController.faqFactory = faqFactory viewController.noticeFactory = noticeFactory - viewController.questionComponent = questionComponent + viewController.questionFactory = questionFactory viewController.teamInfoFactory = teamInfoFactory viewController.settingFactory = settingFactory return viewController @@ -125,7 +125,7 @@ final class MyInfoViewController: BaseReactorViewController { let vc = owner.noticeFactory.makeView() owner.navigationController?.pushViewController(vc, animated: true) case .mail: - let vc = owner.questionComponent.makeView() + let vc = owner.questionFactory.makeView() vc.modalPresentationStyle = .overFullScreen owner.present(vc, animated: true) case .team: diff --git a/Projects/Features/MyInfoFeature/Sources/ViewControllers/Request/RequestViewController.swift b/Projects/Features/MyInfoFeature/Sources/ViewControllers/Request/RequestViewController.swift index f17f47594..8918680b7 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewControllers/Request/RequestViewController.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewControllers/Request/RequestViewController.swift @@ -49,7 +49,7 @@ public final class RequestViewController: UIViewController, ViewControllerFromSt } @IBAction func moveQuestionAction(_ sender: Any) { - let vc = questionComponent.makeView().wrapNavigationController + let vc = questionFactory.makeView().wrapNavigationController vc.modalPresentationStyle = .overFullScreen self.present(vc, animated: true) } @@ -102,7 +102,7 @@ public final class RequestViewController: UIViewController, ViewControllerFromSt lazy var output = viewModel.transform(from: input) var faqFactory: FaqFactory! - var questionComponent: QuestionComponent! + var questionFactory: QuestionFactory! var noticeFactory: NoticeFactory! var serviceInfoComponent: ServiceInfoComponent! @@ -123,7 +123,7 @@ public final class RequestViewController: UIViewController, ViewControllerFromSt public static func viewController( viewModel: RequestViewModel, faqFactory: FaqFactory, - questionComponent: QuestionComponent, + questionFactory: QuestionFactory, noticeFactory: NoticeFactory, serviceInfoComponent: ServiceInfoComponent, textPopUpFactory: TextPopUpFactory @@ -131,7 +131,7 @@ public final class RequestViewController: UIViewController, ViewControllerFromSt let viewController = RequestViewController.viewController(storyBoardName: "Request", bundle: Bundle.module) viewController.viewModel = viewModel viewController.faqFactory = faqFactory - viewController.questionComponent = questionComponent + viewController.questionFactory = questionFactory viewController.noticeFactory = noticeFactory viewController.serviceInfoComponent = serviceInfoComponent viewController.textPopUpFactory = textPopUpFactory From 9eeb88caf1f846637fbe84cc36c5d8ca1de9f877 Mon Sep 17 00:00:00 2001 From: youn9k Date: Mon, 17 Jun 2024 22:43:00 +0900 Subject: [PATCH 10/15] =?UTF-8?q?=F0=9F=8E=A8=20::=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?Formatting=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Projects/App/Sources/Application/AppComponent+MyInfo.swift | 2 +- .../MyInfoFeature/Sources/Components/QuestionComponent.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Projects/App/Sources/Application/AppComponent+MyInfo.swift b/Projects/App/Sources/Application/AppComponent+MyInfo.swift index f89280f8f..370895ce0 100644 --- a/Projects/App/Sources/Application/AppComponent+MyInfo.swift +++ b/Projects/App/Sources/Application/AppComponent+MyInfo.swift @@ -22,7 +22,7 @@ extension AppComponent { var openSourceLicenseFactory: any OpenSourceLicenseFactory { OpenSourceLicenseComponent(parent: self) } - + var questionFactory: any QuestionFactory { QuestionComponent(parent: self) } diff --git a/Projects/Features/MyInfoFeature/Sources/Components/QuestionComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/QuestionComponent.swift index 8e195fb32..c2e647a24 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/QuestionComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/QuestionComponent.swift @@ -1,7 +1,7 @@ import BaseFeatureInterface import Foundation -import NeedleFoundation import MyInfoFeatureInterface +import NeedleFoundation import UIKit public protocol QuestionDependency: Dependency { From 022d26d16ddc30845163adb51bb54b37b1d1bc6e Mon Sep 17 00:00:00 2001 From: youn9k Date: Mon, 17 Jun 2024 22:46:36 +0900 Subject: [PATCH 11/15] =?UTF-8?q?=F0=9F=8E=A8=20::=20[#568]=20ServiceInfo?= =?UTF-8?q?=20Component=20->=20Factory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../App/Sources/Application/AppComponent+MyInfo.swift | 4 ++++ Projects/App/Sources/Application/AppComponent.swift | 4 ---- Projects/Features/MyInfoFeature/Interface/Interface.swift | 4 ++++ .../Sources/Components/RequestComponent.swift | 4 ++-- .../Sources/Components/ServiceInfoComponent.swift | 6 +++--- .../ViewControllers/Request/RequestViewController.swift | 8 ++++---- 6 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Projects/App/Sources/Application/AppComponent+MyInfo.swift b/Projects/App/Sources/Application/AppComponent+MyInfo.swift index 370895ce0..db7fc786b 100644 --- a/Projects/App/Sources/Application/AppComponent+MyInfo.swift +++ b/Projects/App/Sources/Application/AppComponent+MyInfo.swift @@ -34,4 +34,8 @@ extension AppComponent { var faqContentFactory: any FaqContentFactory { FaqContentComponent(parent: self) } + + var serviceInfoFactory: any ServiceInfoFactory { + ServiceInfoComponent(parent: self) + } } diff --git a/Projects/App/Sources/Application/AppComponent.swift b/Projects/App/Sources/Application/AppComponent.swift index 0ddc48fdc..93f1e7025 100644 --- a/Projects/App/Sources/Application/AppComponent.swift +++ b/Projects/App/Sources/Application/AppComponent.swift @@ -55,10 +55,6 @@ public extension AppComponent { // MARK: - ETC public extension AppComponent { - var serviceInfoComponent: ServiceInfoComponent { - ServiceInfoComponent(parent: self) - } - var permissionComponent: PermissionComponent { PermissionComponent(parent: self) } diff --git a/Projects/Features/MyInfoFeature/Interface/Interface.swift b/Projects/Features/MyInfoFeature/Interface/Interface.swift index fd2f44fa0..14d5bef90 100644 --- a/Projects/Features/MyInfoFeature/Interface/Interface.swift +++ b/Projects/Features/MyInfoFeature/Interface/Interface.swift @@ -41,3 +41,7 @@ public protocol QuestionFactory { public protocol TeamInfoFactory { func makeView() -> UIViewController } + +public protocol ServiceInfoFactory { + func makeView() -> UIViewController +} diff --git a/Projects/Features/MyInfoFeature/Sources/Components/RequestComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/RequestComponent.swift index 2a1547421..dacb2cc12 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/RequestComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/RequestComponent.swift @@ -12,7 +12,7 @@ public protocol RequestDependency: Dependency { var faqFactory: any FaqFactory { get } var questionFactory: any QuestionFactory { get } var noticeFactory: any NoticeFactory { get } - var serviceInfoComponent: ServiceInfoComponent { get } + var serviceInfoFactory: ServiceInfoFactory { get } var textPopUpFactory: any TextPopUpFactory { get } } @@ -26,7 +26,7 @@ public final class RequestComponent: Component { faqFactory: dependency.faqFactory, questionFactory: dependency.questionFactory, noticeFactory: dependency.noticeFactory, - serviceInfoComponent: dependency.serviceInfoComponent, + serviceInfoFactory: dependency.serviceInfoFactory, textPopUpFactory: dependency.textPopUpFactory ) } diff --git a/Projects/Features/MyInfoFeature/Sources/Components/ServiceInfoComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/ServiceInfoComponent.swift index 512ed22ce..fdbf7da72 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/ServiceInfoComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/ServiceInfoComponent.swift @@ -1,15 +1,15 @@ import BaseFeatureInterface -import Foundation import MyInfoFeatureInterface import NeedleFoundation +import UIKit public protocol ServiceInfoDependency: Dependency { var openSourceLicenseFactory: any OpenSourceLicenseFactory { get } var textPopUpFactory: any TextPopUpFactory { get } } -public final class ServiceInfoComponent: Component { - public func makeView() -> ServiceInfoViewController { +public final class ServiceInfoComponent: Component, ServiceInfoFactory { + public func makeView() -> UIViewController { return ServiceInfoViewController.viewController( viewModel: ServiceInfoViewModel(), openSourceLicenseFactory: dependency.openSourceLicenseFactory, diff --git a/Projects/Features/MyInfoFeature/Sources/ViewControllers/Request/RequestViewController.swift b/Projects/Features/MyInfoFeature/Sources/ViewControllers/Request/RequestViewController.swift index 8918680b7..4bff5b3c4 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewControllers/Request/RequestViewController.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewControllers/Request/RequestViewController.swift @@ -104,7 +104,7 @@ public final class RequestViewController: UIViewController, ViewControllerFromSt var faqFactory: FaqFactory! var questionFactory: QuestionFactory! var noticeFactory: NoticeFactory! - var serviceInfoComponent: ServiceInfoComponent! + var serviceInfoFactory: ServiceInfoFactory! var disposeBag = DisposeBag() deinit { DEBUG_LOG("❌ \(Self.self) Deinit") } @@ -125,7 +125,7 @@ public final class RequestViewController: UIViewController, ViewControllerFromSt faqFactory: FaqFactory, questionFactory: QuestionFactory, noticeFactory: NoticeFactory, - serviceInfoComponent: ServiceInfoComponent, + serviceInfoFactory: ServiceInfoFactory, textPopUpFactory: TextPopUpFactory ) -> RequestViewController { let viewController = RequestViewController.viewController(storyBoardName: "Request", bundle: Bundle.module) @@ -133,7 +133,7 @@ public final class RequestViewController: UIViewController, ViewControllerFromSt viewController.faqFactory = faqFactory viewController.questionFactory = questionFactory viewController.noticeFactory = noticeFactory - viewController.serviceInfoComponent = serviceInfoComponent + viewController.serviceInfoFactory = serviceInfoFactory viewController.textPopUpFactory = textPopUpFactory return viewController } @@ -267,7 +267,7 @@ extension RequestViewController { serviceButton.rx.tap .withUnretained(self) .subscribe(onNext: { owner, _ in - let viewController = owner.serviceInfoComponent.makeView() + let viewController = owner.serviceInfoFactory.makeView() owner.navigationController?.pushViewController(viewController, animated: true) }).disposed(by: disposeBag) From dbc2a98cdde126b064d07823be97f5527999a911 Mon Sep 17 00:00:00 2001 From: youn9k Date: Mon, 17 Jun 2024 23:03:38 +0900 Subject: [PATCH 12/15] =?UTF-8?q?=F0=9F=8E=A8=20::=20[#568]=20MyInfoStub?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20=ED=95=84=EC=9A=94=ED=95=9C?= =?UTF-8?q?=20Stub=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Demo/Sources/AppDelegate.swift | 6 ++--- Projects/Features/MyInfoFeature/Project.swift | 3 ++- .../Testing/FaqContentComponentStub.swift | 3 ++- .../Testing/MyInfoComponentStub.swift | 22 +++++++++++++++++++ .../Testing/NoticeComponentStub.swift | 20 +++++++++++++++++ .../Testing/NoticeDetailComponentStub.swift | 15 +++++++++++++ .../Testing/QuestionComponentStub.swift | 14 ++++++++++++ .../Testing/TeamInfoComponentStub.swift | 12 ++++++++++ 8 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 Projects/Features/MyInfoFeature/Testing/MyInfoComponentStub.swift create mode 100644 Projects/Features/MyInfoFeature/Testing/NoticeComponentStub.swift create mode 100644 Projects/Features/MyInfoFeature/Testing/NoticeDetailComponentStub.swift create mode 100644 Projects/Features/MyInfoFeature/Testing/QuestionComponentStub.swift create mode 100644 Projects/Features/MyInfoFeature/Testing/TeamInfoComponentStub.swift diff --git a/Projects/Features/MyInfoFeature/Demo/Sources/AppDelegate.swift b/Projects/Features/MyInfoFeature/Demo/Sources/AppDelegate.swift index 507f07698..3c171422b 100644 --- a/Projects/Features/MyInfoFeature/Demo/Sources/AppDelegate.swift +++ b/Projects/Features/MyInfoFeature/Demo/Sources/AppDelegate.swift @@ -1,5 +1,5 @@ import Inject -@testable import MyInfoFeature +@testable import MyInfoFeatureTesting import UIKit @main @@ -12,9 +12,9 @@ final class AppDelegate: UIResponder, UIApplicationDelegate { ) -> Bool { window = UIWindow(frame: UIScreen.main.bounds) - let reactor = MyInfoReactor() + let vc = MyInfoComponentStub() let viewController = Inject.ViewControllerHost( - UINavigationController(rootViewController: MyInfoViewController(reactor: reactor)) + UINavigationController(rootViewController: vc.makeView()) ) window?.rootViewController = viewController window?.makeKeyAndVisible() diff --git a/Projects/Features/MyInfoFeature/Project.swift b/Projects/Features/MyInfoFeature/Project.swift index b311edc95..ba73a607a 100644 --- a/Projects/Features/MyInfoFeature/Project.swift +++ b/Projects/Features/MyInfoFeature/Project.swift @@ -30,7 +30,8 @@ let project = Project.module( .feature(target: .MyInfoFeature, type: .interface), .feature(target: .BaseFeature, type: .testing), .feature(target: .SignInFeature, type: .testing), - .domain(target: .FaqDomain, type: .testing) + .domain(target: .FaqDomain, type: .testing), + .domain(target: .NoticeDomain, type: .testing) ]), .tests(module: .feature(.MyInfoFeature), dependencies: [ .feature(target: .MyInfoFeature) diff --git a/Projects/Features/MyInfoFeature/Testing/FaqContentComponentStub.swift b/Projects/Features/MyInfoFeature/Testing/FaqContentComponentStub.swift index 04a60d42f..77bc3e02f 100644 --- a/Projects/Features/MyInfoFeature/Testing/FaqContentComponentStub.swift +++ b/Projects/Features/MyInfoFeature/Testing/FaqContentComponentStub.swift @@ -1,10 +1,11 @@ import Foundation +import FaqDomainInterface @testable import MyInfoFeature import MyInfoFeatureInterface import UIKit public final class FaqContentComponentStub: FaqContentFactory { - public func makeView(dataSource: [FaqModel]) -> UIViewController { + public func makeView(dataSource: [FaqEntity]) -> UIViewController { return FaqContentViewController.viewController(viewModel: .init(dataSource: dataSource)) } } diff --git a/Projects/Features/MyInfoFeature/Testing/MyInfoComponentStub.swift b/Projects/Features/MyInfoFeature/Testing/MyInfoComponentStub.swift new file mode 100644 index 000000000..3f8c98b88 --- /dev/null +++ b/Projects/Features/MyInfoFeature/Testing/MyInfoComponentStub.swift @@ -0,0 +1,22 @@ +import BaseFeatureInterface +@testable import SignInFeatureTesting +@testable import BaseFeatureTesting +@testable import MyInfoFeature +import MyInfoFeatureInterface +import SignInFeatureInterface +import UIKit + +public final class MyInfoComponentStub: MyInfoFactory { + public func makeView() -> UIViewController { + return MyInfoViewController.viewController( + reactor: MyInfoReactor(), + textPopUpFactory: TextPopUpComponentStub(), + signInFactory: SignInComponentStub(), + faqFactory: FaqComponentStub(), + noticeFactory: NoticeComponentStub(), + questionFactory: QuestionComponentStub(), + teamInfoFactory: TeamInfoComponentStub(), + settingFactory: SettingComponentStub() + ) + } +} diff --git a/Projects/Features/MyInfoFeature/Testing/NoticeComponentStub.swift b/Projects/Features/MyInfoFeature/Testing/NoticeComponentStub.swift new file mode 100644 index 000000000..62110305b --- /dev/null +++ b/Projects/Features/MyInfoFeature/Testing/NoticeComponentStub.swift @@ -0,0 +1,20 @@ +import Foundation +import MyInfoFeatureInterface +import NoticeDomainInterface +@testable import NoticeDomainTesting +@testable import BaseFeatureTesting +import Foundation +@testable import MyInfoFeature +import UIKit + + +public final class NoticeComponentStub: NoticeFactory { + public func makeView() -> UIViewController { + return NoticeViewController.viewController( + viewModel: .init( + fetchNoticeUseCase: FetchNoticeUseCaseStub() + ), + noticeDetailFactory: NoticeDetailComponentStub() + ) + } +} diff --git a/Projects/Features/MyInfoFeature/Testing/NoticeDetailComponentStub.swift b/Projects/Features/MyInfoFeature/Testing/NoticeDetailComponentStub.swift new file mode 100644 index 000000000..e160d1368 --- /dev/null +++ b/Projects/Features/MyInfoFeature/Testing/NoticeDetailComponentStub.swift @@ -0,0 +1,15 @@ +import Foundation +import MyInfoFeatureInterface +@testable import MyInfoFeature +import NoticeDomainInterface +import UIKit + +public final class NoticeDetailComponentStub: NoticeDetailFactory { + public func makeView(model: FetchNoticeEntity) -> UIViewController { + return NoticeDetailViewController.viewController( + viewModel: .init( + model: model + ) + ) + } +} diff --git a/Projects/Features/MyInfoFeature/Testing/QuestionComponentStub.swift b/Projects/Features/MyInfoFeature/Testing/QuestionComponentStub.swift new file mode 100644 index 000000000..164681bb3 --- /dev/null +++ b/Projects/Features/MyInfoFeature/Testing/QuestionComponentStub.swift @@ -0,0 +1,14 @@ +import BaseFeatureInterface +@testable import BaseFeatureTesting +@testable import MyInfoFeature +import MyInfoFeatureInterface +import UIKit + +public final class QuestionComponentStub: QuestionFactory { + public func makeView() -> UIViewController { + return QuestionViewController.viewController( + viewModel: .init(), + textPopUpFactory: TextPopUpComponentStub() + ) + } +} diff --git a/Projects/Features/MyInfoFeature/Testing/TeamInfoComponentStub.swift b/Projects/Features/MyInfoFeature/Testing/TeamInfoComponentStub.swift new file mode 100644 index 000000000..fc1bd98d3 --- /dev/null +++ b/Projects/Features/MyInfoFeature/Testing/TeamInfoComponentStub.swift @@ -0,0 +1,12 @@ +import BaseFeatureInterface +import MyInfoFeatureInterface +@testable import MyInfoFeature +import UIKit + +public final class TeamInfoComponentStub: TeamInfoFactory { + public func makeView() -> UIViewController { + return TeamInfoViewController.viewController( + reactor: TeamInfoReactor() + ) + } +} From 89fd2ad358e29c7e57e0b50fb9ed226c4b2cd95b Mon Sep 17 00:00:00 2001 From: youn9k Date: Mon, 17 Jun 2024 23:03:42 +0900 Subject: [PATCH 13/15] =?UTF-8?q?=F0=9F=8E=A8=20::=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?Formatting=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Projects/App/Sources/Application/AppComponent+MyInfo.swift | 2 +- .../MyInfoFeature/Testing/FaqContentComponentStub.swift | 2 +- .../MyInfoFeature/Testing/MyInfoComponentStub.swift | 2 +- .../MyInfoFeature/Testing/NoticeComponentStub.swift | 6 ++---- .../MyInfoFeature/Testing/NoticeDetailComponentStub.swift | 2 +- .../MyInfoFeature/Testing/TeamInfoComponentStub.swift | 2 +- 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Projects/App/Sources/Application/AppComponent+MyInfo.swift b/Projects/App/Sources/Application/AppComponent+MyInfo.swift index db7fc786b..8428c7032 100644 --- a/Projects/App/Sources/Application/AppComponent+MyInfo.swift +++ b/Projects/App/Sources/Application/AppComponent+MyInfo.swift @@ -34,7 +34,7 @@ extension AppComponent { var faqContentFactory: any FaqContentFactory { FaqContentComponent(parent: self) } - + var serviceInfoFactory: any ServiceInfoFactory { ServiceInfoComponent(parent: self) } diff --git a/Projects/Features/MyInfoFeature/Testing/FaqContentComponentStub.swift b/Projects/Features/MyInfoFeature/Testing/FaqContentComponentStub.swift index 77bc3e02f..9b1ec61e7 100644 --- a/Projects/Features/MyInfoFeature/Testing/FaqContentComponentStub.swift +++ b/Projects/Features/MyInfoFeature/Testing/FaqContentComponentStub.swift @@ -1,5 +1,5 @@ -import Foundation import FaqDomainInterface +import Foundation @testable import MyInfoFeature import MyInfoFeatureInterface import UIKit diff --git a/Projects/Features/MyInfoFeature/Testing/MyInfoComponentStub.swift b/Projects/Features/MyInfoFeature/Testing/MyInfoComponentStub.swift index 3f8c98b88..c4040a1fe 100644 --- a/Projects/Features/MyInfoFeature/Testing/MyInfoComponentStub.swift +++ b/Projects/Features/MyInfoFeature/Testing/MyInfoComponentStub.swift @@ -1,9 +1,9 @@ import BaseFeatureInterface -@testable import SignInFeatureTesting @testable import BaseFeatureTesting @testable import MyInfoFeature import MyInfoFeatureInterface import SignInFeatureInterface +@testable import SignInFeatureTesting import UIKit public final class MyInfoComponentStub: MyInfoFactory { diff --git a/Projects/Features/MyInfoFeature/Testing/NoticeComponentStub.swift b/Projects/Features/MyInfoFeature/Testing/NoticeComponentStub.swift index 62110305b..7a03ab4ac 100644 --- a/Projects/Features/MyInfoFeature/Testing/NoticeComponentStub.swift +++ b/Projects/Features/MyInfoFeature/Testing/NoticeComponentStub.swift @@ -1,13 +1,11 @@ +@testable import BaseFeatureTesting import Foundation +@testable import MyInfoFeature import MyInfoFeatureInterface import NoticeDomainInterface @testable import NoticeDomainTesting -@testable import BaseFeatureTesting -import Foundation -@testable import MyInfoFeature import UIKit - public final class NoticeComponentStub: NoticeFactory { public func makeView() -> UIViewController { return NoticeViewController.viewController( diff --git a/Projects/Features/MyInfoFeature/Testing/NoticeDetailComponentStub.swift b/Projects/Features/MyInfoFeature/Testing/NoticeDetailComponentStub.swift index e160d1368..a549b6196 100644 --- a/Projects/Features/MyInfoFeature/Testing/NoticeDetailComponentStub.swift +++ b/Projects/Features/MyInfoFeature/Testing/NoticeDetailComponentStub.swift @@ -1,6 +1,6 @@ import Foundation -import MyInfoFeatureInterface @testable import MyInfoFeature +import MyInfoFeatureInterface import NoticeDomainInterface import UIKit diff --git a/Projects/Features/MyInfoFeature/Testing/TeamInfoComponentStub.swift b/Projects/Features/MyInfoFeature/Testing/TeamInfoComponentStub.swift index fc1bd98d3..46a208a44 100644 --- a/Projects/Features/MyInfoFeature/Testing/TeamInfoComponentStub.swift +++ b/Projects/Features/MyInfoFeature/Testing/TeamInfoComponentStub.swift @@ -1,6 +1,6 @@ import BaseFeatureInterface -import MyInfoFeatureInterface @testable import MyInfoFeature +import MyInfoFeatureInterface import UIKit public final class TeamInfoComponentStub: TeamInfoFactory { From 0cf280ca267426f01cb23942a62d00feb605a5a7 Mon Sep 17 00:00:00 2001 From: youn9k Date: Tue, 18 Jun 2024 10:13:00 +0900 Subject: [PATCH 14/15] =?UTF-8?q?=F0=9F=8E=A8=20::=20=08Demo=20=ED=83=80?= =?UTF-8?q?=EA=B2=9F=EC=97=90=EC=84=9C=20=EA=B5=AC=ED=98=84=EC=B2=B4=20?= =?UTF-8?q?=EC=9D=98=EC=A1=B4=EC=84=B1=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Projects/Features/MyInfoFeature/Project.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Projects/Features/MyInfoFeature/Project.swift b/Projects/Features/MyInfoFeature/Project.swift index ba73a607a..e5fc59ed7 100644 --- a/Projects/Features/MyInfoFeature/Project.swift +++ b/Projects/Features/MyInfoFeature/Project.swift @@ -37,7 +37,6 @@ let project = Project.module( .feature(target: .MyInfoFeature) ]), .demo(module: .feature(.MyInfoFeature), dependencies: [ - .feature(target: .MyInfoFeature), .feature(target: .MyInfoFeature, type: .testing) ]) ] From 3ce446955e96188bdd6f658b7b11885d15b72dbd Mon Sep 17 00:00:00 2001 From: youn9k Date: Tue, 18 Jun 2024 12:24:31 +0900 Subject: [PATCH 15/15] =?UTF-8?q?=F0=9F=92=A9=20::=20[#568]=20=EB=B9=A0?= =?UTF-8?q?=EC=A7=84=20=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyInfoFeature/Sources/Components/RequestComponent.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projects/Features/MyInfoFeature/Sources/Components/RequestComponent.swift b/Projects/Features/MyInfoFeature/Sources/Components/RequestComponent.swift index dacb2cc12..a4cddff61 100644 --- a/Projects/Features/MyInfoFeature/Sources/Components/RequestComponent.swift +++ b/Projects/Features/MyInfoFeature/Sources/Components/RequestComponent.swift @@ -12,7 +12,7 @@ public protocol RequestDependency: Dependency { var faqFactory: any FaqFactory { get } var questionFactory: any QuestionFactory { get } var noticeFactory: any NoticeFactory { get } - var serviceInfoFactory: ServiceInfoFactory { get } + var serviceInfoFactory: any ServiceInfoFactory { get } var textPopUpFactory: any TextPopUpFactory { get } }