From 2db50f563fac667645fc01c8387f96c42edde3ca Mon Sep 17 00:00:00 2001 From: Hamp Date: Tue, 13 Aug 2024 00:17:48 +0900 Subject: [PATCH 1/2] =?UTF-8?q?:zap:=20::=20more=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=ED=81=B4=EB=A6=AD=20=EC=9E=AC=20=ED=81=B4=EB=A6=AD=EC=8B=9C=20?= =?UTF-8?q?=ED=95=98=EB=8B=A8=20=ED=8E=B8=EC=A7=91=EB=B7=B0=20=EB=8B=AB?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Reactors/MyPlaylistDetailReactor.swift | 25 +++++++++++++++++-- .../MyPlaylistDetailViewController.swift | 25 ++++++++++++++----- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/Projects/Features/PlaylistFeature/Sources/Reactors/MyPlaylistDetailReactor.swift b/Projects/Features/PlaylistFeature/Sources/Reactors/MyPlaylistDetailReactor.swift index 353332da0..e181c22c9 100644 --- a/Projects/Features/PlaylistFeature/Sources/Reactors/MyPlaylistDetailReactor.swift +++ b/Projects/Features/PlaylistFeature/Sources/Reactors/MyPlaylistDetailReactor.swift @@ -24,6 +24,7 @@ final class MyPlaylistDetailReactor: Reactor { case removeSongs case changeImageData(PlaylistImageKind) case shareButtonDidTap + case moreButtonDidTap } enum Mutation { @@ -34,6 +35,7 @@ final class MyPlaylistDetailReactor: Reactor { case updateLoadingState(Bool) case updateSelectedCount(Int) case updateImageData(PlaylistImageKind?) + case updateShowEditSheet(Bool) case showToast(String) case showShareLink(String) case postNotification(Notification.Name) @@ -47,6 +49,7 @@ final class MyPlaylistDetailReactor: Reactor { var isLoading: Bool var selectedCount: Int var imageData: PlaylistImageKind? + var showEditSheet: Bool @Pulse var toastMessage: String? @Pulse var shareLink: String? @Pulse var notiName: Notification.Name? @@ -98,11 +101,13 @@ final class MyPlaylistDetailReactor: Reactor { backupPlaylistModels: [], isLoading: true, selectedCount: 0, + showEditSheet: false, notiName: nil ) } func mutate(action: Action) -> Observable { + switch action { case .viewDidLoad: return viewDidLoad() @@ -142,7 +147,9 @@ final class MyPlaylistDetailReactor: Reactor { case let .changeImageData(imageData): return updateImageData(imageData: imageData) case .shareButtonDidTap: - return .just(.showShareLink(deepLinkGenerator.generatePlaylistDeepLink(key: key))) + return updateShareLink() + case .moreButtonDidTap: + return updateShowEditSheet(flag: !self.currentState.showEditSheet) } } @@ -177,6 +184,8 @@ final class MyPlaylistDetailReactor: Reactor { newState.shareLink = link case let .postNotification(notiName): newState.notiName = notiName + case let .updateShowEditSheet(flag): + newState.showEditSheet = flag } return newState @@ -356,7 +365,8 @@ private extension MyPlaylistDetailReactor { return .concat([ .just(.updateEditingState(true)), - .just(.updateBackUpPlaylist(currentPlaylists)) + .just(.updateBackUpPlaylist(currentPlaylists)), + updateShowEditSheet(flag: false), ]) } @@ -468,4 +478,15 @@ private extension MyPlaylistDetailReactor { func postNotification(notiName: Notification.Name) -> Observable { .just(.postNotification(notiName)) } + + func updateShareLink() -> Observable { + return .concat([ + .just(.showShareLink(deepLinkGenerator.generatePlaylistDeepLink(key: key))), + updateShowEditSheet(flag: false) + ]) + } + + func updateShowEditSheet(flag: Bool) -> Observable { + return .just(.updateShowEditSheet(flag)) + } } diff --git a/Projects/Features/PlaylistFeature/Sources/ViewControllers/MyPlaylistDetailViewController.swift b/Projects/Features/PlaylistFeature/Sources/ViewControllers/MyPlaylistDetailViewController.swift index b9c521720..70299f3c3 100644 --- a/Projects/Features/PlaylistFeature/Sources/ViewControllers/MyPlaylistDetailViewController.swift +++ b/Projects/Features/PlaylistFeature/Sources/ViewControllers/MyPlaylistDetailViewController.swift @@ -198,13 +198,13 @@ final class MyPlaylistDetailViewController: BaseReactorViewController Date: Tue, 13 Aug 2024 00:17:53 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=8E=A8=20::=20=EC=BD=94=EB=93=9C=20Fo?= =?UTF-8?q?rmatting=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Reactors/MyPlaylistDetailReactor.swift | 3 +-- .../ViewControllers/MyPlaylistDetailViewController.swift | 8 ++------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Projects/Features/PlaylistFeature/Sources/Reactors/MyPlaylistDetailReactor.swift b/Projects/Features/PlaylistFeature/Sources/Reactors/MyPlaylistDetailReactor.swift index e181c22c9..571ac7995 100644 --- a/Projects/Features/PlaylistFeature/Sources/Reactors/MyPlaylistDetailReactor.swift +++ b/Projects/Features/PlaylistFeature/Sources/Reactors/MyPlaylistDetailReactor.swift @@ -107,7 +107,6 @@ final class MyPlaylistDetailReactor: Reactor { } func mutate(action: Action) -> Observable { - switch action { case .viewDidLoad: return viewDidLoad() @@ -478,7 +477,7 @@ private extension MyPlaylistDetailReactor { func postNotification(notiName: Notification.Name) -> Observable { .just(.postNotification(notiName)) } - + func updateShareLink() -> Observable { return .concat([ .just(.showShareLink(deepLinkGenerator.generatePlaylistDeepLink(key: key))), diff --git a/Projects/Features/PlaylistFeature/Sources/ViewControllers/MyPlaylistDetailViewController.swift b/Projects/Features/PlaylistFeature/Sources/ViewControllers/MyPlaylistDetailViewController.swift index 70299f3c3..dd30b35ce 100644 --- a/Projects/Features/PlaylistFeature/Sources/ViewControllers/MyPlaylistDetailViewController.swift +++ b/Projects/Features/PlaylistFeature/Sources/ViewControllers/MyPlaylistDetailViewController.swift @@ -198,9 +198,7 @@ final class MyPlaylistDetailViewController: BaseReactorViewController