Slim PlayerViewModel: extract selection actions and playback dispatch…#2340
Merged
Conversation
… core Pass 6 - multi-selection batch actions -> MultiSelectionStateHolder: - Move the songs/albums/genres play/queue/play-next trios, like/unlike, ZIP share, and album/genre song resolution out of the ViewModel. - Deduplicate while moving: the album and genre trios collapse into shared launchAlbumSelectionAction/launchGenreSelectionAction helpers and like/unlike into one updateFavoritesForSelection. Toast strings, ordering, and clearSelection timing preserved verbatim. - Holder gains MusicRepository + @ApplicationContext ctor deps; ViewModel supplies playback/toast collaborators via SelectionActionCallbacks. - Remove dead queueAndPlaySelectedAlbums (zero callers). Pass 7 - playback dispatch core -> new PlaybackDispatchStateHolder: - Move both showAndPlaySong overloads, library/favorites full-queue playback with its job/token staleness machinery, playSongs, playSongsShuffled, internalPlaySongs, queue-segment batching, song hydration, playExternalUri, the shuffle-all tile entry point, loadAndPlaySong, the preparing-song pill state, and addSongToQueue/addSongNextToQueue. - @ViewModelScoped holder injects its 13 @singleton deps directly; ViewModel-owned state (controller, UI state, sheet, toasts, transition job) crosses one PlaybackDispatchCallbacks bundle set at init. - ViewModel ctor: +playbackDispatchStateHolder, -appShortcutManager, -externalMediaStateHolder (both now unused there). - PlayerViewModelTest constructs the real dispatch holder wired to the same mocks so end-to-end playback tests keep covering the moved logic. All public ViewModel signatures are preserved as thin delegates, so no UI files change. PlayerViewModel: 5,061 -> 3,962 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.
… core
Pass 6 - multi-selection batch actions -> MultiSelectionStateHolder:
Pass 7 - playback dispatch core -> new PlaybackDispatchStateHolder:
All public ViewModel signatures are preserved as thin delegates, so no UI files change. PlayerViewModel: 5,061 -> 3,962 lines.
Verified: compileDebugKotlin, PlayerViewModelTest, PlayerViewModelHydrationTest, QueueStateHolderTest, PlaybackStateHolderTest.