Autoplay the next voice message if it is the next timeline item. (#6089)

This commit is contained in:
Mauro
2026-09-01 18:00:14 +02:00
committed by GitHub
parent b4a36ad465
commit 86bc4d54b6
13 changed files with 463 additions and 16 deletions
@@ -273,6 +273,23 @@ struct AudioPlayerStateTests {
#expect(!audioPlayerState.showProgressIndicator)
}
@Test
mutating func audioPlayerActionsDidFinishPlayingWhenDetachedStraightAway() async throws {
await audioPlayerState.updateState(progress: 0.4)
audioPlayerState.attachAudioPlayer(audioPlayerMock)
let deferred = deferFulfillment(audioPlayerState.$progress) { $0 == 0.0 }
// Detaching before the action has been handled is what happens when the following
// voice message takes the player over as soon as this one reaches its end.
audioPlayerActionsSubject.send(.didFinishPlaying)
audioPlayerState.detachAudioPlayer()
try await deferred.fulfill()
#expect(audioPlayerState.progress == 0.0)
#expect(!audioPlayerState.showProgressIndicator)
}
@Test
func setPlaybackSpeed() {
audioPlayerState.attachAudioPlayer(audioPlayerMock)