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

πŸ”€ :: (#1227) λ…Έλž˜ 상세에 μ§„μž… μ‹œ μ§„μž…μ  ꡬ뢄 없이 λ…Έλž˜ μƒμ„Έμ˜ 데이터λ₯Ό μ‚¬μš©ν•˜λ„λ‘ λ³€κ²½ #1228

Merged
merged 1 commit into from
Aug 25, 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 @@ -219,7 +219,9 @@ extension ArtistMusicContentViewController: ArtistMusicCellDelegate {
.first(where: { $0.songID == id })
else { return }
PlayState.shared.append(item: .init(id: tappedSong.songID, title: tappedSong.title, artist: tappedSong.artist))
songDetailPresenter.present(id: id)
let playlistIDs = PlayState.shared.currentPlaylist
.map(\.id)
songDetailPresenter.present(ids: playlistIDs, selectedID: tappedSong.songID)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ extension ChartContentViewController: ChartContentTableViewCellDelegate {
.first(where: { $0.id == id })
else { return }
PlayState.shared.append(item: .init(id: tappedSong.id, title: tappedSong.title, artist: tappedSong.artist))
songDetailPresenter.present(id: id)
let playlistIDs = PlayState.shared.currentPlaylist
.map(\.id)
songDetailPresenter.present(ids: playlistIDs, selectedID: tappedSong.id)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ final class CreditSongListTabItemReactor: Reactor {
return songDidTap(id: id)
case let .songThumbnailDidTap(id):
return navigateMutation(navigateType: .dismiss(completion: { [songDetailPresenter] in
songDetailPresenter.present(id: id)
let playlistIDs = PlayState.shared.currentPlaylist
.map(\.id)
songDetailPresenter.present(ids: playlistIDs, selectedID: id)
}))
case .randomPlayButtonDidTap:
return randomPlayButtonDidTap()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,9 @@ extension HomeViewController: HomeChartCellDelegate {
func thumbnailDidTap(model: ChartRankingEntity) {
LogManager.analytics(HomeAnalyticsLog.clickMusicItem(location: .homeTop100, id: model.id))
PlayState.shared.append(item: .init(id: model.id, title: model.title, artist: model.artist))
songDetailPresenter.present(id: model.id)
let playlistIDs = PlayState.shared.currentPlaylist
.map(\.id)
songDetailPresenter.present(ids: playlistIDs, selectedID: model.id)
}

func playButtonDidTap(model: ChartRankingEntity) {
Expand All @@ -426,7 +428,9 @@ extension HomeViewController: HomeNewSongCellDelegate {
func thumbnailDidTap(model: NewSongsEntity) {
LogManager.analytics(HomeAnalyticsLog.clickMusicItem(location: .homeRecent, id: model.id))
PlayState.shared.append(item: .init(id: model.id, title: model.title, artist: model.artist))
songDetailPresenter.present(id: model.id)
let playlistIDs = PlayState.shared.currentPlaylist
.map(\.id)
songDetailPresenter.present(ids: playlistIDs, selectedID: model.id)
}

func playButtonDidTap(model: NewSongsEntity) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ extension NewSongsContentViewController: NewSongsCellDelegate {
.first(where: { $0.id == id })
else { return }
PlayState.shared.append(item: .init(id: tappedSong.id, title: tappedSong.title, artist: tappedSong.artist))
songDetailPresenter.present(id: id)
let playlistIDs = PlayState.shared.currentPlaylist
.map(\.id)
songDetailPresenter.present(ids: playlistIDs, selectedID: id)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ private extension MainTabBarViewController {

case "songDetail":
let id = params["id"] as? String ?? ""
songDetailPresenter.present(id: id)
let playlistIDs = PlayState.shared.currentPlaylist
.map(\.id)
songDetailPresenter.present(ids: playlistIDs, selectedID: id)

default:
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ final class MusicDetailViewController: BaseReactorViewController<MusicDetailReac
override func bindState(reactor: MusicDetailReactor) {
let sharedState = reactor.state
.subscribe(on: MainScheduler.asyncInstance)
.share(replay: 2)
.share(replay: 8)
let youtubeURLGenerator = YoutubeURLGenerator()

sharedState.map(\.songIDs)
Expand Down Expand Up @@ -117,16 +117,17 @@ final class MusicDetailViewController: BaseReactorViewController<MusicDetailReac
sharedState
.filter { !$0.songIDs.isEmpty }
.map(\.selectedIndex)
.skip(1)
.distinctUntilChanged()
.bind(onNext: musicDetailView.updateSelectedIndex(index:))
.skip(2)
.take(1)
.bind(onNext: musicDetailView.updateInitialSelectedIndex(index:))
.disposed(by: disposeBag)

sharedState
.filter { !$0.songIDs.isEmpty }
.map(\.selectedIndex)
.take(1)
.bind(onNext: musicDetailView.updateInitialSelectedIndex(index:))
.skip(3)
.distinctUntilChanged()
.bind(onNext: musicDetailView.updateSelectedIndex(index:))
.disposed(by: disposeBag)

sharedState.compactMap(\.navigateType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ final class MyPlaylistDetailViewController: BaseReactorViewController<MyPlaylist
guard let model = owner.dataSource.itemIdentifier(for: indexPath) else { return }

PlayState.shared.append(item: .init(id: model.id, title: model.title, artist: model.artist))
owner.songDetailPresenter.present(id: model.id)
let playlistIDs = PlayState.shared.currentPlaylist
.map(\.id)
owner.songDetailPresenter.present(ids: playlistIDs, selectedID: model.id)
}
.disposed(by: disposeBag)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,9 @@ extension UnknownPlaylistDetailViewController: PlaylistDateTableViewCellDelegate
.first(where: { $0.id == key })
else { return }
PlayState.shared.append(item: .init(id: tappedSong.id, title: tappedSong.title, artist: tappedSong.artist))
songDetailPresenter.present(id: key)
let playlistIDs = PlayState.shared.currentPlaylist
.map(\.id)
songDetailPresenter.present(ids: playlistIDs, selectedID: key)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,9 @@ extension WakmusicPlaylistDetailViewController: PlaylistDateTableViewCellDelegat
.first(where: { $0.id == key })
else { return }
PlayState.shared.append(item: .init(id: tappedSong.id, title: tappedSong.title, artist: tappedSong.artist))
songDetailPresenter.present(id: key)
let playlistIDs = PlayState.shared.currentPlaylist
.map(\.id)
songDetailPresenter.present(ids: playlistIDs, selectedID: key)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,9 @@ extension SongSearchResultViewController: SongResultCellDelegate {
.first(where: { $0.id == key })
else { return }
PlayState.shared.append(item: .init(id: tappedSong.id, title: tappedSong.title, artist: tappedSong.artist))
songDetailPresenter.present(id: key)
let playlistIDs = PlayState.shared.currentPlaylist
.map(\.id)
songDetailPresenter.present(ids: playlistIDs, selectedID: key)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ final class LikeStorageViewController: BaseReactorViewController<LikeStorageReac
LogManager.analytics(StorageAnalyticsLog.clickMyLikeListMusicButton(id: song.songID))

PlayState.shared.append(item: .init(id: song.songID, title: song.title, artist: song.artist))
owner.songDetailPresenter.present(id: song.songID)
let playlistIDs = PlayState.shared.currentPlaylist
.map(\.id)
owner.songDetailPresenter.present(ids: playlistIDs, selectedID: song.songID)
})
.disposed(by: disposeBag)
}
Expand Down
Loading