diff --git a/Projects/Features/ArtistFeature/Sources/ViewControllers/ArtistMusicContentViewController.swift b/Projects/Features/ArtistFeature/Sources/ViewControllers/ArtistMusicContentViewController.swift index eee9937ba..f3d57ef88 100644 --- a/Projects/Features/ArtistFeature/Sources/ViewControllers/ArtistMusicContentViewController.swift +++ b/Projects/Features/ArtistFeature/Sources/ViewControllers/ArtistMusicContentViewController.swift @@ -268,7 +268,11 @@ extension ArtistMusicContentViewController: SongCartViewDelegate { ) PlayState.shared.loadAndAppendSongsToPlaylist(songs) input.allSongSelected.onNext(false) - WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: "왁타버스 뮤직").play() + if songs.allSatisfy({ $0.title.isContainShortsTagTitle }) { + WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: "왁타버스 뮤직", playPlatform: .youtube).play() + } else { + WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: "왁타버스 뮤직").play() + } default: return } diff --git a/Projects/Features/ChartFeature/Sources/ViewContrillers/ChartContentViewController.swift b/Projects/Features/ChartFeature/Sources/ViewContrillers/ChartContentViewController.swift index bc5fb5b17..a4621acd7 100644 --- a/Projects/Features/ChartFeature/Sources/ViewContrillers/ChartContentViewController.swift +++ b/Projects/Features/ChartFeature/Sources/ViewContrillers/ChartContentViewController.swift @@ -146,7 +146,15 @@ private extension ChartContentViewController { return } PlayState.shared.loadAndAppendSongsToPlaylist(source.songs) - WakmusicYoutubePlayer(ids: source.songs.map { $0.id }, title: source.playlistTitle).play() + if source.songs.allSatisfy({ $0.title.isContainShortsTagTitle }) { + WakmusicYoutubePlayer( + ids: source.songs.map { $0.id }, + title: source.playlistTitle, + playPlatform: .youtube + ).play() + } else { + WakmusicYoutubePlayer(ids: source.songs.map { $0.id }, title: source.playlistTitle).play() + } }) .disposed(by: disposeBag) @@ -303,7 +311,11 @@ extension ChartContentViewController: SongCartViewDelegate { LogManager.analytics( CommonAnalyticsLog.clickPlayButton(location: .chart, type: .multiple) ) - WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: "왁타버스 뮤직").play() + if songs.allSatisfy({ $0.title.isContainShortsTagTitle }) { + WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: "왁타버스 뮤직", playPlatform: .youtube).play() + } else { + WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: "왁타버스 뮤직").play() + } case .remove: return diff --git a/Projects/Features/CreditSongListFeature/Sources/CreditSongListTab/CreditSongListTabItemReactor.swift b/Projects/Features/CreditSongListFeature/Sources/CreditSongListTab/CreditSongListTabItemReactor.swift index c85076696..98a152052 100644 --- a/Projects/Features/CreditSongListFeature/Sources/CreditSongListTab/CreditSongListTabItemReactor.swift +++ b/Projects/Features/CreditSongListFeature/Sources/CreditSongListTab/CreditSongListTabItemReactor.swift @@ -35,7 +35,7 @@ final class CreditSongListTabItemReactor: Reactor { } enum NavigateType { - case playYoutube(ids: [String]) + case playYoutube(ids: [String], playPlatform: WakmusicYoutubePlayer.PlayPlatform) case containSongs(ids: [String]) case textPopup(text: String, completion: () -> Void) case signIn @@ -162,7 +162,12 @@ private extension CreditSongListTabItemReactor { .shuffled() .prefix(50) let songs = Array(randomSongs) - return navigateMutation(navigateType: .playYoutube(ids: songs)) + let playPlatform = if currentState.songs.allSatisfy({ $0.title.isContainShortsTagTitle }) { + WakmusicYoutubePlayer.PlayPlatform.youtube + } else { + WakmusicYoutubePlayer.PlayPlatform.automatic + } + return navigateMutation(navigateType: .playYoutube(ids: songs, playPlatform: playPlatform)) } func allSelectButtonDidTap() -> Observable { @@ -222,7 +227,16 @@ private extension CreditSongListTabItemReactor { )) } - return navigateMutation(navigateType: .playYoutube(ids: containTargetSongIDs)) + let isOnlyShorts = currentState.songs + .filter { currentState.selectedSongs.contains($0.id) } + .allSatisfy { $0.title.isContainShortsTagTitle } + let playPlatform = if isOnlyShorts { + WakmusicYoutubePlayer.PlayPlatform.youtube + } else { + WakmusicYoutubePlayer.PlayPlatform.automatic + } + + return navigateMutation(navigateType: .playYoutube(ids: containTargetSongIDs, playPlatform: playPlatform)) } func reachedBottom() -> Observable { diff --git a/Projects/Features/CreditSongListFeature/Sources/CreditSongListTab/CreditSongListTabItemViewController.swift b/Projects/Features/CreditSongListFeature/Sources/CreditSongListTab/CreditSongListTabItemViewController.swift index 41f890368..37acd281f 100644 --- a/Projects/Features/CreditSongListFeature/Sources/CreditSongListTab/CreditSongListTabItemViewController.swift +++ b/Projects/Features/CreditSongListFeature/Sources/CreditSongListTab/CreditSongListTabItemViewController.swift @@ -155,8 +155,8 @@ final class CreditSongListTabItemViewController: .compactMap { $0 } .bind(with: self) { owner, navigate in switch navigate { - case let .playYoutube(ids): - owner.playYoutube(ids: ids) + case let .playYoutube(ids, playPlatform): + owner.playYoutube(ids: ids, playPlatform: playPlatform) case let .containSongs(ids): owner.presentContainSongs(ids: ids) case let .textPopup(text, completion): @@ -287,10 +287,10 @@ extension CreditSongListTabItemViewController { return dataSource } - private func playYoutube(ids: [String]) { + private func playYoutube(ids: [String], playPlatform: WakmusicYoutubePlayer.PlayPlatform) { let worker = reactor?.workerName ?? "작업자" let title = "\(worker)님과 함께하는 랜뮤" - WakmusicYoutubePlayer(ids: ids, title: title).play() + WakmusicYoutubePlayer(ids: ids, title: title, playPlatform: playPlatform).play() } private func presentContainSongs(ids: [String]) { diff --git a/Projects/Features/HomeFeature/Sources/ViewControllers/NewSongsContentViewController.swift b/Projects/Features/HomeFeature/Sources/ViewControllers/NewSongsContentViewController.swift index e1a44abb9..06f15d263 100644 --- a/Projects/Features/HomeFeature/Sources/ViewControllers/NewSongsContentViewController.swift +++ b/Projects/Features/HomeFeature/Sources/ViewControllers/NewSongsContentViewController.swift @@ -317,7 +317,11 @@ extension NewSongsContentViewController: SongCartViewDelegate { LogManager.analytics( CommonAnalyticsLog.clickPlayButton(location: .recentMusic, type: .multiple) ) - WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: "왁타버스 뮤직").play() + if songs.allSatisfy({ $0.title.isContainShortsTagTitle }) { + WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: "왁타버스 뮤직", playPlatform: .youtube).play() + } else { + WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: "왁타버스 뮤직").play() + } case .remove: return diff --git a/Projects/Features/PlaylistFeature/Sources/ViewControllers/MyPlaylistDetailViewController.swift b/Projects/Features/PlaylistFeature/Sources/ViewControllers/MyPlaylistDetailViewController.swift index 7f82b45c0..33049bb25 100644 --- a/Projects/Features/PlaylistFeature/Sources/ViewControllers/MyPlaylistDetailViewController.swift +++ b/Projects/Features/PlaylistFeature/Sources/ViewControllers/MyPlaylistDetailViewController.swift @@ -566,7 +566,11 @@ extension MyPlaylistDetailViewController: PlayButtonGroupViewDelegate { PlayState.shared.append(contentsOf: songs.map { PlaylistItem(id: $0.id, title: $0.title, artist: $0.artist) }) - WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: title).play() + if songs.allSatisfy({ $0.title.isContainShortsTagTitle }) { + WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: "왁타버스 뮤직", playPlatform: .youtube).play() + } else { + WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: "왁타버스 뮤직").play() + } } } diff --git a/Projects/Features/PlaylistFeature/Sources/ViewControllers/PlaylistViewController+Delegate.swift b/Projects/Features/PlaylistFeature/Sources/ViewControllers/PlaylistViewController+Delegate.swift index 11c548056..87eea374e 100644 --- a/Projects/Features/PlaylistFeature/Sources/ViewControllers/PlaylistViewController+Delegate.swift +++ b/Projects/Features/PlaylistFeature/Sources/ViewControllers/PlaylistViewController+Delegate.swift @@ -85,7 +85,11 @@ extension PlaylistViewController: UITableViewDelegate { .map(\.id) .shuffled() .prefix(50) - WakmusicYoutubePlayer(ids: Array(songIDs), title: "왁타버스 뮤직 재생목록 (랜덤)").play() + if output.playlists.value.allSatisfy({ $0.title.isContainShortsTagTitle }) { + WakmusicYoutubePlayer(ids: Array(songIDs), title: "왁타버스 뮤직 재생목록 (랜덤)", playPlatform: .youtube).play() + } else { + WakmusicYoutubePlayer(ids: Array(songIDs), title: "왁타버스 뮤직 재생목록 (랜덤)").play() + } } return randomPlayButton } diff --git a/Projects/Features/PlaylistFeature/Sources/ViewControllers/UnknownPlaylistDetailViewController.swift b/Projects/Features/PlaylistFeature/Sources/ViewControllers/UnknownPlaylistDetailViewController.swift index bfa815295..bc71b8c9d 100644 --- a/Projects/Features/PlaylistFeature/Sources/ViewControllers/UnknownPlaylistDetailViewController.swift +++ b/Projects/Features/PlaylistFeature/Sources/ViewControllers/UnknownPlaylistDetailViewController.swift @@ -392,7 +392,11 @@ extension UnknownPlaylistDetailViewController: PlayButtonGroupViewDelegate { } PlayState.shared.append(contentsOf: songs.map { PlaylistItem(item: $0) }) - WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: title).play() + if songs.allSatisfy({ $0.title.isContainShortsTagTitle }) { + WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: title, playPlatform: .youtube).play() + } else { + WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: title).play() + } } } @@ -440,7 +444,11 @@ extension UnknownPlaylistDetailViewController: SongCartViewDelegate { LogManager.analytics( CommonAnalyticsLog.clickPlayButton(location: .playlistDetail, type: .multiple) ) - WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: "왁타버스 뮤직").play() + if songs.allSatisfy({ $0.title.isContainShortsTagTitle }) { + WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: "왁타버스 뮤직", playPlatform: .youtube).play() + } else { + WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: "왁타버스 뮤직").play() + } reactor.action.onNext(.deselectAll) case .remove: diff --git a/Projects/Features/PlaylistFeature/Sources/ViewControllers/WakmusicPlaylistDetailViewController.swift b/Projects/Features/PlaylistFeature/Sources/ViewControllers/WakmusicPlaylistDetailViewController.swift index c80e8fe2b..649588138 100644 --- a/Projects/Features/PlaylistFeature/Sources/ViewControllers/WakmusicPlaylistDetailViewController.swift +++ b/Projects/Features/PlaylistFeature/Sources/ViewControllers/WakmusicPlaylistDetailViewController.swift @@ -399,7 +399,11 @@ extension WakmusicPlaylistDetailViewController: SongCartViewDelegate { CommonAnalyticsLog.clickPlayButton(location: .playlistDetail, type: .multiple) ) PlayState.shared.append(contentsOf: songs.map { PlaylistItem(item: $0) }) - WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: "왁타버스 뮤직").play() + if songs.allSatisfy({ $0.title.isContainShortsTagTitle }) { + WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: "왁타버스 뮤직", playPlatform: .youtube).play() + } else { + WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: "왁타버스 뮤직").play() + } reactor.action.onNext(.deselectAll) case .remove: diff --git a/Projects/Features/SearchFeature/Sources/After/ViewControllers/SongSearchResultViewController.swift b/Projects/Features/SearchFeature/Sources/After/ViewControllers/SongSearchResultViewController.swift index 82ac4f12f..1f5ebe891 100644 --- a/Projects/Features/SearchFeature/Sources/After/ViewControllers/SongSearchResultViewController.swift +++ b/Projects/Features/SearchFeature/Sources/After/ViewControllers/SongSearchResultViewController.swift @@ -407,7 +407,11 @@ extension SongSearchResultViewController: SongCartViewDelegate { } PlayState.shared.append(contentsOf: songs.map { PlaylistItem(item: $0) }) - WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: "왁타버스 뮤직").play() + if songs.allSatisfy({ $0.title.isContainShortsTagTitle }) { + WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: "왁타버스 뮤직", playPlatform: .youtube).play() + } else { + WakmusicYoutubePlayer(ids: songs.map { $0.id }, title: "왁타버스 뮤직").play() + } reactor.action.onNext(.deselectAll) case .remove: diff --git a/Projects/Features/SearchFeature/Sources/Before/ViewControllers/BeforeSearchContentViewController.swift b/Projects/Features/SearchFeature/Sources/Before/ViewControllers/BeforeSearchContentViewController.swift index 93a61fa60..c2ed84d16 100644 --- a/Projects/Features/SearchFeature/Sources/Before/ViewControllers/BeforeSearchContentViewController.swift +++ b/Projects/Features/SearchFeature/Sources/Before/ViewControllers/BeforeSearchContentViewController.swift @@ -317,7 +317,7 @@ extension BeforeSearchContentViewController: UICollectionViewDelegate { switch model { case let .youtube(model: model): // 주간 왁뮤 - WakmusicYoutubePlayer(id: model.id).play() + WakmusicYoutubePlayer(id: model.id, playPlatform: .youtube).play() LogManager.analytics(SearchAnalyticsLog.clickLatestWakmuYoutubeVideo) case let .recommend(model: model): let log = CommonAnalyticsLog.clickPlaylistItem(location: .search, key: model.key) diff --git a/Projects/Features/StorageFeature/Sources/Reactors/ListStorageReactor.swift b/Projects/Features/StorageFeature/Sources/Reactors/ListStorageReactor.swift index d5bb457a0..6c4564e88 100644 --- a/Projects/Features/StorageFeature/Sources/Reactors/ListStorageReactor.swift +++ b/Projects/Features/StorageFeature/Sources/Reactors/ListStorageReactor.swift @@ -401,7 +401,11 @@ extension ListStorageReactor { PlayState.shared.appendSongsToPlaylist(appendingPlaylistItems) let ids = appendingPlaylistItems.map { $0.id } .prefix(50) - WakmusicYoutubePlayer(ids: Array(ids), title: "왁타버스 뮤직").play() + if appendingPlaylistItems.allSatisfy({ $0.title.isContainShortsTagTitle }) { + WakmusicYoutubePlayer(ids: Array(ids), title: "왁타버스 뮤직", playPlatform: .youtube).play() + } else { + WakmusicYoutubePlayer(ids: Array(ids), title: "왁타버스 뮤직").play() + } self?.storageCommonService.isEditingState.onNext(false) }) .flatMap { songs -> Observable in