Skip to content

Native Android client for Spotify, built with Jetpack Compose

Immersive player: a tap on the title opens the album for an extension's or a download's song too (the song's own album when Spotify's state has none)

kota-zof413f369e174
diff --git a/base/app/src/main/java/com/music/spotui/ui/immersive/player/PlayerBridge.kt b/base/app/src/main/java/com/music/spotui/ui/immersive/player/PlayerBridge.kt
index 4f635adb..50bcadf9 100644
--- a/base/app/src/main/java/com/music/spotui/ui/immersive/player/PlayerBridge.kt
+++ b/base/app/src/main/java/com/music/spotui/ui/immersive/player/PlayerBridge.kt
@@ -212,9 +212,13 @@ fun rememberImmersivePlayer(navController: NavController): ImmersivePlayerBridge
if (on) Toast.makeText(context, context.getString(R.string.immersive_player_added_to_liked), Toast.LENGTH_SHORT).show()
},
openAlbum = {
- val albumId = SongPlayer.nowPlaying.value.albumUri.substringAfterLast(":")
- if (albumId.isNotBlank()) {
- navController.navigate(albumRoute(vm.currentSongAlbum.value, vm.currentSongSinger.value, albumId))
+ // An extension's or a download's song has no album in Spotify's state: the song's own
+ // album, as the options' "Go to album" (a tap on the title did nothing for them).
+ val song = nowPlayingSong(vm)
+ val albumId = SongPlayer.nowPlaying.value.albumUri.substringAfterLast(":").ifBlank { song.albumId }
+ val album = vm.currentSongAlbum.value.ifBlank { song.album }
+ if (albumId.isNotBlank() || album.isNotBlank()) {
+ navController.navigate(albumRoute(album, vm.currentSongSinger.value.ifBlank { song.singer }, albumId))
}
},
openArtist = {