Slim PlayerViewModel: extract controller sync and playPause#2344
Merged
Conversation
Pass 8a - playPause + remote-queue reconciliation -> PlaybackDispatchStateHolder: - Move playPause (cast pause/resume, remote-queue realignment, local controller resume/fallback paths) plus its hasRemoteQueueItems and remoteQueueMatchesLocalQueue helpers. Every dependency and callback it needs already existed in the dispatch holder. Pass 8b - media-controller sync cluster -> new MediaControllerSyncStateHolder: - Move the decomposed Player.Listener registrations (volume, playback state, media-item/timeline transitions incl. the EOT sleep timer and Telegram offline guard, tracks/metadata/shuffle/repeat), the initial controller-state snapshot, the queue snapshot rebuild with its timeline-signature dedupe, repeat-mode restore/flush, position sync, and the playback audio-metadata (format/bitrate/sample-rate) probing. - The holder owns the listener registry, transition/buffering/probe jobs and the PlaybackAudioMetadata flow; the ViewModel re-exposes playbackAudioMetadata and supplies VM-owned state through one ControllerSyncCallbacks bundle set at init. - ViewModel sheds the field-injected MediaMapper (now a holder ctor dep). - PlayerViewModelTest constructs the real sync holder wired to the same mocks so the repeat-mode restore test keeps covering the moved logic. All public ViewModel signatures preserved as thin delegates; no UI files change. PlayerViewModel: 3,962 -> 3,118 lines. Verified: compileDebugKotlin, PlayerViewModelTest, PlayerViewModelHydrationTest, QueueStateHolderTest, PlaybackStateHolderTest. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pass 8a - playPause + remote-queue reconciliation -> PlaybackDispatchStateHolder:
Pass 8b - media-controller sync cluster -> new MediaControllerSyncStateHolder:
All public ViewModel signatures preserved as thin delegates; no UI files change. PlayerViewModel: 3,962 -> 3,118 lines.
Verified: compileDebugKotlin, PlayerViewModelTest, PlayerViewModelHydrationTest, QueueStateHolderTest, PlaybackStateHolderTest.