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

๐Ÿ”€ :: (#1283) ์‡ผ์ธ ๋กœ๋งŒ ๊ตฌ์„ฑํ•˜์—ฌ ์žฌ์ƒ ์‹œ ํ•ญ์ƒ ์œ ํŠœ๋ธŒ๋กœ๋งŒ ์žฌ์ƒ #1284

Merged
merged 4 commits into from
Sep 2, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<Mutation> {
Expand Down Expand Up @@ -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<Mutation> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
}

Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Mutation> in
Expand Down
Loading