Fixes unable to dismiss next up during credits (#899)

## Description
Fixes an issue where the "Next Up" popup continuously pops up when
dismissed if you have "Show next up during credits/outro" enabled.

### Related issues
Fixes #895
Bug introduced by #884

### Testing
Emulator

## Screenshots
N/A

## AI or LLM usage
None
This commit is contained in:
Ray 2026-02-14 16:13:38 -05:00 committed by GitHub
parent 1e810c1157
commit 44eb50910d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -165,7 +165,6 @@ class PlaybackViewModel
val currentPlayback = MutableStateFlow<CurrentPlayback?>(null) val currentPlayback = MutableStateFlow<CurrentPlayback?>(null)
val currentItemPlayback = MutableLiveData<ItemPlayback>() val currentItemPlayback = MutableLiveData<ItemPlayback>()
val currentSegment = MutableStateFlow<MediaSegmentState?>(null) val currentSegment = MutableStateFlow<MediaSegmentState?>(null)
private val autoSkippedSegments = mutableSetOf<UUID>()
val subtitleCues = MutableLiveData<List<Cue>>(listOf()) val subtitleCues = MutableLiveData<List<Cue>>(listOf())
@ -957,7 +956,10 @@ class PlaybackViewModel
} }
} }
// Variables for tracking segment state
private var segmentJob: Job? = null private var segmentJob: Job? = null
private val autoSkippedSegments = mutableSetOf<UUID>()
private val outroShownSegments = mutableSetOf<UUID>()
/** /**
* Cancels listening for segments and clears current segment state * Cancels listening for segments and clears current segment state
@ -965,6 +967,7 @@ class PlaybackViewModel
private fun resetSegmentState() { private fun resetSegmentState() {
segmentJob?.cancel() segmentJob?.cancel()
autoSkippedSegments.clear() autoSkippedSegments.clear()
outroShownSegments.clear()
currentSegment.value = null currentSegment.value = null
} }
@ -1007,7 +1010,8 @@ class PlaybackViewModel
if (currentSegment.type == MediaSegmentType.OUTRO && if (currentSegment.type == MediaSegmentType.OUTRO &&
prefs.showNextUpWhen == ShowNextUpWhen.DURING_CREDITS && prefs.showNextUpWhen == ShowNextUpWhen.DURING_CREDITS &&
playlist != null && playlist.hasNext() playlist != null && playlist.hasNext() &&
outroShownSegments.add(currentSegment.id)
) { ) {
val nextItem = playlist.peek() val nextItem = playlist.peek()
Timber.v("Setting next up during outro to ${nextItem?.id}") Timber.v("Setting next up during outro to ${nextItem?.id}")