Fix inconsistent playback end behavior issues (#1616)

## Description
The exact behavior of what happens when playback ends based on the
user's settings would change between versions. This PR defines the
behaviors better and includes unit tests to verify future changes won't
break it again.

### Related issues
Fixes #1548
Related to https://github.com/damontecres/Wholphin/pull/1257

### Testing
Emulator & unit tests

## Screenshots
N/A

## AI or LLM usage
None
This commit is contained in:
Damontecres 2026-06-23 17:23:47 -04:00 • committed by GitHub
parent 899e3decc2
commit 552c3b5500
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 124 additions and 9 deletions

View file

@ -1034,14 +1034,26 @@ class PlaybackViewModel
}
is PlaylistItem.Media -> {
if (currentItem is PlaylistItem.Intro) {
Timber.v("Current item is intro, so playing next up immediately")
playNextUp()
} else if (preferences.appPreferences.playbackPreferences.showNextUpWhen != ShowNextUpWhen.NEXT_UP_NEVER) {
Timber.v("Setting next up to ${nextItem.id}")
_state.update { it.copy(nextUp = nextItem.item) }
} else {
controllerViewState.showControls()
val prefs = preferences.appPreferences.playbackPreferences
when {
currentItem is PlaylistItem.Intro -> {
Timber.v("Current item is intro, so playing next up immediately")
playNextUp()
}
prefs.showNextUpWhen == ShowNextUpWhen.NEXT_UP_NEVER && !prefs.autoPlayNext -> {
Timber.v("Never show or auto play next up, returning")
navigationManager.goBack()
}
prefs.showNextUpWhen != ShowNextUpWhen.NEXT_UP_NEVER -> {
Timber.v("Setting next up to ${nextItem.id}")
_state.update { it.copy(nextUp = nextItem.item) }
}
else -> {
controllerViewState.showControls()
}
}
}