fix the startup reveal and the first-play hitch for real

The mini player's enter spec was decided from `firstReveal`, which was false at the first
composition (the player is not visible yet) and flipped back to `expandVertically` in the
same frame the visibility changed, so the expand animation always ran. PlaybackState now
carries `restored`, set by restore() and cleared on any user playback, and the mini
player uses it to appear in place for the whole restored session.

The first play after a restart could still pay for a fresh buffer because a stream-quality
reload rebuilds the window, and loadWindow only prepared when autoplay was set. It now
always prepares, so a reload (or the restore) leaves the current track buffered.
This commit is contained in:
austinried
2026-10-04 00:30:00 +00:00
parent 3bcf87b5b4
commit f7a5502240
3 changed files with 35 additions and 12 deletions
@@ -160,6 +160,20 @@ class PlaybackControllerTest {
assertEquals(listOf("play"), handle.operations)
}
@Test
fun restoringMarksTheStateUntilPlaybackStarts() {
seedAlbum(5, sourceId = 1)
runBlocking { queues.replace(listOf(queues.albumEntry(1, "al1"))) }
controller.connect()
await { handle.items.isNotEmpty() }
assertTrue(controller.state.value.restored)
controller.playAlbum(1, "al1", 0)
await { !controller.state.value.restored }
}
@Test
fun nextAdvancesTheCursor() {
seedAlbum(3, sourceId = 1)
@@ -1067,7 +1081,9 @@ class PlaybackControllerTest {
assertEquals(33_000L, handle.positionMs)
assertFalse(handle.playWhenReady)
assertTrue(handle.operations.drop(before).none { it.startsWith("prepare") || it.startsWith("play") })
val reload = handle.operations.drop(before)
assertTrue("a reload must re-prepare, or the next play pays for it", reload.any { it == "prepare" })
assertTrue(reload.none { it == "play" })
}
@Test