From 63f5799631c77180edd5ddddd7311e96d074b27e Mon Sep 17 00:00:00 2001 From: baegteun Date: Wed, 4 Oct 2023 12:17:13 +0900 Subject: [PATCH 1/6] :sparkles: :: [#201] CombineUtility / Publisher + not operator --- .../CombineUtility/Sources/Publisher/Publisher+not.swift | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Projects/Shared/CombineUtility/Sources/Publisher/Publisher+not.swift diff --git a/Projects/Shared/CombineUtility/Sources/Publisher/Publisher+not.swift b/Projects/Shared/CombineUtility/Sources/Publisher/Publisher+not.swift new file mode 100644 index 00000000..f0f57e35 --- /dev/null +++ b/Projects/Shared/CombineUtility/Sources/Publisher/Publisher+not.swift @@ -0,0 +1,7 @@ +import Combine + +public extension Publisher where Output == Bool { + func not() -> Publishers.Map { + self.map { !$0 } + } +} From 2bb6f495d2fae635130b268ecd24f23bf86d492d Mon Sep 17 00:00:00 2001 From: baegteun Date: Wed, 4 Oct 2023 12:19:27 +0900 Subject: [PATCH 2/6] =?UTF-8?q?:zap:=20::=20[#201]=20SelfStudyFeature=20/?= =?UTF-8?q?=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EA=B0=80=EC=A0=B8=EC=98=A4?= =?UTF-8?q?=EB=8A=94=20=EC=8B=9C=EC=A0=90=20viewDidLoad=20->=20viewWillApp?= =?UTF-8?q?ear?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Scene/SelfStudyViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projects/Feature/SelfStudyFeature/Sources/Scene/SelfStudyViewController.swift b/Projects/Feature/SelfStudyFeature/Sources/Scene/SelfStudyViewController.swift index 12c40b31..50f282c1 100644 --- a/Projects/Feature/SelfStudyFeature/Sources/Scene/SelfStudyViewController.swift +++ b/Projects/Feature/SelfStudyFeature/Sources/Scene/SelfStudyViewController.swift @@ -77,7 +77,7 @@ final class SelfStudyViewController: BaseStoredViewController { } override func bindAction() { - viewDidLoadPublisher + viewWillAppearPublisher .merge(with: selfStudyRefreshContorol.controlPublisher(for: .valueChanged).map { _ in }) .map { Store.Action.fetchSelfStudyRank } .sink(receiveValue: store.send(_:)) From c4ed6259233749045c503335e7f5dc669d0a7992 Mon Sep 17 00:00:00 2001 From: baegteun Date: Wed, 4 Oct 2023 12:19:58 +0900 Subject: [PATCH 3/6] =?UTF-8?q?:recycle:=20::=20[#201]=20SelfStudyViewCont?= =?UTF-8?q?roller=20/=20=EB=8D=B0=EC=9D=B4=ED=84=B0=EA=B0=80=20=EC=97=86?= =?UTF-8?q?=EC=9D=84=20=EA=B2=BD=EC=9A=B0=EC=9D=98=20=ED=99=94=EB=A9=B4=20?= =?UTF-8?q?=ED=91=9C=EC=8B=9C=20=EC=BD=94=EB=93=9C=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Scene/SelfStudyViewController.swift | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Projects/Feature/SelfStudyFeature/Sources/Scene/SelfStudyViewController.swift b/Projects/Feature/SelfStudyFeature/Sources/Scene/SelfStudyViewController.swift index 50f282c1..d240daf1 100644 --- a/Projects/Feature/SelfStudyFeature/Sources/Scene/SelfStudyViewController.swift +++ b/Projects/Feature/SelfStudyFeature/Sources/Scene/SelfStudyViewController.swift @@ -103,11 +103,9 @@ final class SelfStudyViewController: BaseStoredViewController { sharedState .map(\.selfStudyRankList) .map(\.isEmpty) + .not() .removeDuplicates() - .sink(with: self, receiveValue: { owner, selfStudyIsEmpty in - owner.selfStudyTableView.isHidden = selfStudyIsEmpty - owner.emptySelfStudyStackView.isHidden = !selfStudyIsEmpty - }) + .assign(to: \.isHidden, on: emptySelfStudyStackView) .store(in: &subscription) sharedState From 6dbab9fd131803a6a39b1514989e2e32b16f8bdf Mon Sep 17 00:00:00 2001 From: baegteun Date: Wed, 4 Oct 2023 12:21:15 +0900 Subject: [PATCH 4/6] =?UTF-8?q?:zap:=20::=20[#201]=20SelfStudyFeature=20/?= =?UTF-8?q?=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EA=B0=80=EC=A0=B8=EC=98=A4?= =?UTF-8?q?=EB=8A=94=20=EC=8B=9C=EC=A0=90=20viewDidLoad=20->=20viewWillApp?= =?UTF-8?q?ear?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MassageFeature/Sources/Scene/MassageStore.swift | 8 ++++---- .../Sources/Scene/MassageViewController.swift | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Projects/Feature/MassageFeature/Sources/Scene/MassageStore.swift b/Projects/Feature/MassageFeature/Sources/Scene/MassageStore.swift index f9c9a56a..0f104f5b 100644 --- a/Projects/Feature/MassageFeature/Sources/Scene/MassageStore.swift +++ b/Projects/Feature/MassageFeature/Sources/Scene/MassageStore.swift @@ -27,7 +27,7 @@ final class MassageStore: BaseStore { } enum Action { - case viewDidLoad + case viewWillAppear case fetchMassageRankList } @@ -40,8 +40,8 @@ final class MassageStore: BaseStore { extension MassageStore { func mutate(state: State, action: Action) -> SideEffect { switch action { - case .viewDidLoad: - return viewDidLoad() + case .viewWillAppear: + return viewWillAppear() case .fetchMassageRankList: return fetchMassageRankList() @@ -66,7 +66,7 @@ extension MassageStore { // MARK: - Mutate private extension MassageStore { - func viewDidLoad() -> SideEffect { + func viewWillAppear() -> SideEffect { return self.fetchMassageRankList() } diff --git a/Projects/Feature/MassageFeature/Sources/Scene/MassageViewController.swift b/Projects/Feature/MassageFeature/Sources/Scene/MassageViewController.swift index 8277090b..696f4d39 100644 --- a/Projects/Feature/MassageFeature/Sources/Scene/MassageViewController.swift +++ b/Projects/Feature/MassageFeature/Sources/Scene/MassageViewController.swift @@ -63,8 +63,8 @@ final class MassageViewController: BaseStoredViewController { } override func bindAction() { - viewDidLoadPublisher - .map { Store.Action.viewDidLoad } + viewWillAppearPublisher + .map { Store.Action.viewWillAppear } .sink(receiveValue: store.send(_:)) .store(in: &subscription) From 9df3586d069b67943b7f67176bbd211265121897 Mon Sep 17 00:00:00 2001 From: baegteun Date: Wed, 4 Oct 2023 12:22:30 +0900 Subject: [PATCH 5/6] =?UTF-8?q?:recycle:=20::=20[#201]=20MassageViewContro?= =?UTF-8?q?ller=20/=20=EB=8D=B0=EC=9D=B4=ED=84=B0=EA=B0=80=20=EC=97=86?= =?UTF-8?q?=EC=9D=84=20=EA=B2=BD=EC=9A=B0=EC=9D=98=20=ED=99=94=EB=A9=B4=20?= =?UTF-8?q?=ED=91=9C=EC=8B=9C=20=EC=BD=94=EB=93=9C=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Scene/MassageViewController.swift | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Projects/Feature/MassageFeature/Sources/Scene/MassageViewController.swift b/Projects/Feature/MassageFeature/Sources/Scene/MassageViewController.swift index 696f4d39..6e3df8b0 100644 --- a/Projects/Feature/MassageFeature/Sources/Scene/MassageViewController.swift +++ b/Projects/Feature/MassageFeature/Sources/Scene/MassageViewController.swift @@ -11,7 +11,6 @@ final class MassageViewController: BaseStoredViewController { private let massageNavigationBarLabel = DotoriNavigationBarLabel(text: L10n.Massage.massageTitle) private let massageTableView = UITableView() .set(\.backgroundColor, .clear) - .set(\.isHidden, true) .set(\.separatorStyle, .none) .set(\.sectionHeaderHeight, 0) .then { @@ -96,11 +95,9 @@ final class MassageViewController: BaseStoredViewController { sharedState .map(\.massageRankList) .map(\.isEmpty) + .not() .removeDuplicates() - .sink(with: self, receiveValue: { owner, massageIsEmpty in - owner.massageTableView.isHidden = massageIsEmpty - owner.emptySelfStudyStackView.isHidden = !massageIsEmpty - }) + .assign(to: \.isHidden, on: emptySelfStudyStackView) .store(in: &subscription) } } From 28c6ebe42d1cc2649a659b554e7ea10ae07c19aa Mon Sep 17 00:00:00 2001 From: baegteun Date: Wed, 4 Oct 2023 12:23:00 +0900 Subject: [PATCH 6/6] =?UTF-8?q?:fire:=20::=20[#201]=20SelfStudyViewControl?= =?UTF-8?q?elr=20/=20TableView=20hidden=20=EC=B2=98=EB=A6=AC=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SelfStudyFeature/Sources/Scene/SelfStudyViewController.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Projects/Feature/SelfStudyFeature/Sources/Scene/SelfStudyViewController.swift b/Projects/Feature/SelfStudyFeature/Sources/Scene/SelfStudyViewController.swift index d240daf1..87b951fa 100644 --- a/Projects/Feature/SelfStudyFeature/Sources/Scene/SelfStudyViewController.swift +++ b/Projects/Feature/SelfStudyFeature/Sources/Scene/SelfStudyViewController.swift @@ -23,7 +23,6 @@ final class SelfStudyViewController: BaseStoredViewController { .set(\.separatorStyle, .none) .set(\.sectionHeaderHeight, 0) .set(\.sectionFooterHeight, 0) - .set(\.isHidden, true) .then { $0.register(cellType: SelfStudyCell.self) }