Skip to content

Commit

Permalink
Merge pull request #519 from Shreyassp002/Fix-Overview-Screen
Browse files Browse the repository at this point in the history
Fix: Delete song from BrainzPlayer playlist
  • Loading branch information
07jasjeet authored Jan 4, 2025
2 parents fa86ff8 + bacfa5b commit 99791fc
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -421,17 +421,17 @@ fun PlayerScreen(
Spacer(modifier = Modifier.weight(1f))
Button(
onClick = {
checkedSongs.forEach { song ->
brainzPlayerViewModel.appPreferences.currentPlayable?.songs?.toMutableList()
?.remove(song)
val currentPlayable = brainzPlayerViewModel.appPreferences.currentPlayable
val updatedSongs = currentPlayable?.songs?.toMutableList()?.apply {
removeAll(checkedSongs)
}
brainzPlayerViewModel.appPreferences.currentPlayable?.songs?.let {
updatedSongs?.let {
brainzPlayerViewModel.changePlayable(
it,
PlayableType.ALL_SONGS,
brainzPlayerViewModel.appPreferences.currentPlayable?.id ?: 0,
brainzPlayerViewModel.appPreferences.currentPlayable?.songs?.indexOfFirst { it.mediaID == currentlyPlayingSong.mediaID }
?: 0, brainzPlayerViewModel.songCurrentPosition.value
currentPlayable.id,
it.indexOfFirst { song -> song.mediaID == currentlyPlayingSong.mediaID }.coerceAtLeast(0),
brainzPlayerViewModel.songCurrentPosition.value
)
}
brainzPlayerViewModel.queueChanged(
Expand Down

0 comments on commit 99791fc

Please sign in to comment.