Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ”€ :: (#1093) 더보기 λ²„νŠΌμ„ 톡해 ν•˜λ‹¨ λ·° 숨기기 #1094

Merged
merged 2 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ final class MyPlaylistDetailReactor: Reactor {
case removeSongs
case changeImageData(PlaylistImageKind)
case shareButtonDidTap
case moreButtonDidTap
}

enum Mutation {
Expand All @@ -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)
Expand All @@ -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?
Expand Down Expand Up @@ -98,6 +101,7 @@ final class MyPlaylistDetailReactor: Reactor {
backupPlaylistModels: [],
isLoading: true,
selectedCount: 0,
showEditSheet: false,
notiName: nil
)
}
Expand Down Expand Up @@ -142,7 +146,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)
}
}

Expand Down Expand Up @@ -177,6 +183,8 @@ final class MyPlaylistDetailReactor: Reactor {
newState.shareLink = link
case let .postNotification(notiName):
newState.notiName = notiName
case let .updateShowEditSheet(flag):
newState.showEditSheet = flag
}

return newState
Expand Down Expand Up @@ -356,7 +364,8 @@ private extension MyPlaylistDetailReactor {

return .concat([
.just(.updateEditingState(true)),
.just(.updateBackUpPlaylist(currentPlaylists))
.just(.updateBackUpPlaylist(currentPlaylists)),
updateShowEditSheet(flag: false),
])
}

Expand Down Expand Up @@ -468,4 +477,15 @@ private extension MyPlaylistDetailReactor {
func postNotification(notiName: Notification.Name) -> Observable<Mutation> {
.just(.postNotification(notiName))
}

func updateShareLink() -> Observable<Mutation> {
return .concat([
.just(.showShareLink(deepLinkGenerator.generatePlaylistDeepLink(key: key))),
updateShowEditSheet(flag: false)
])
}

func updateShowEditSheet(flag: Bool) -> Observable<Mutation> {
return .just(.updateShowEditSheet(flag))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,8 @@ final class MyPlaylistDetailViewController: BaseReactorViewController<MyPlaylist

moreButton.rx
.tap
.bind(with: self) { owner, _ in
owner.showplaylistEditSheet(in: owner.view)
owner.playlisteditSheetView?.delegate = owner
}
.map { Reactor.Action.moreButtonDidTap }
.bind(to: reactor.action)
.disposed(by: disposeBag)

completeButton.rx
Expand Down Expand Up @@ -376,6 +374,19 @@ final class MyPlaylistDetailViewController: BaseReactorViewController<MyPlaylist
}
}
.disposed(by: disposeBag)

sharedState.map(\.showEditSheet)
.distinctUntilChanged()
.bind(with: self) { owner, flag in

if flag {
owner.showplaylistEditSheet(in: owner.view)
owner.playlisteditSheetView?.delegate = owner
} else {
owner.hideplaylistEditSheet()
}
}
.disposed(by: disposeBag)
}
}

Expand Down Expand Up @@ -597,8 +608,6 @@ extension MyPlaylistDetailViewController: PlaylistEditSheetDelegate {
LogManager.analytics(PlaylistAnalyticsLog.clickPlaylistShareButton)
reactor?.action.onNext(.shareButtonDidTap)
}

self.hideplaylistEditSheet()
}
}

Expand Down
Loading