Skip to content

Commit

Permalink
fix: view artists crash, closes Malopieds#332
Browse files Browse the repository at this point in the history
  • Loading branch information
z-huang authored and Malopieds committed Aug 21, 2024
1 parent 8356ff2 commit 2f49d60
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions app/src/main/java/com/malopieds/innertune/ui/menu/PlayerMenu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ fun PlayerMenu(

val download by LocalDownloadUtil.current.getDownload(mediaMetadata.id).collectAsState(initial = null)

val artists =
remember(mediaMetadata.artists) {
mediaMetadata.artists.filter { it.id != null }
}

var showChoosePlaylistDialog by rememberSaveable {
mutableStateOf(false)
}
Expand Down Expand Up @@ -194,7 +199,7 @@ fun PlayerMenu(
ListDialog(
onDismiss = { showSelectArtistDialog = false },
) {
items(mediaMetadata.artists) { artist ->
items(artists) { artist ->
Box(
contentAlignment = Alignment.CenterStart,
modifier =
Expand Down Expand Up @@ -323,16 +328,18 @@ fun PlayerMenu(
}
}
}
GridMenuItem(
icon = R.drawable.artist,
title = R.string.view_artist,
) {
if (mediaMetadata.artists.size == 1) {
navController.navigate("artist/${mediaMetadata.artists[0].id}")
playerBottomSheetState.collapseSoft()
onDismiss()
} else {
showSelectArtistDialog = true
if (artists.isNotEmpty()) {
GridMenuItem(
icon = R.drawable.artist,
title = R.string.view_artist,
) {
if (mediaMetadata.artists.size == 1) {
navController.navigate("artist/${mediaMetadata.artists[0].id}")
playerBottomSheetState.collapseSoft()
onDismiss()
} else {
showSelectArtistDialog = true
}
}
}
if (mediaMetadata.album != null) {
Expand Down

0 comments on commit 2f49d60

Please sign in to comment.