feat(sidebar): highlight currently-playing playlist - #441
Open
tsibog wants to merge 2 commits into
Open
Conversation
Track which playlist the current track was played from via sourcePlaylistId on PlayerService. Show NowPlayingIndicator (equalizer bars) on the matching sidebar row instead of the static system image. Closes sozercan#433
Contributor
Author
|
@codex review |
Keeps each row's own icon and drops the animated equalizer, so the sidebar indicates the playing playlist with colour alone and no motion. Renames isPlaying to isNowPlayingSource: the flag means "this is the playing source", not "audio is currently playing". The old name is what made NowPlayingIndicator(isPlaying: true) look correct at the call site, which kept the bars animating while paused.
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.
Description
When a track is playing from a playlist, there's no indication in the sidebar of which playlist is currently playing. This PR tracks the source playlist ID in
PlayerServiceand tints the matching sidebar row's title with the brand accent.The
sourcePlaylistIdis set when playing from a playlist view and cleared when playing from non-playlist sources (radio, mix, individual track, stop).Demo
AI Prompt (Optional)
🤖 AI Prompt Used
AI Tool: Claude
Type of Change
Related Issues
Closes #433
Changes Made
PlayerService.swift: AddedsourcePlaylistId: String?propertyProtocols.swift: AddedsourcePlaylistIdtoPlayerServiceProtocolPlayerService+Queue.swift: SetsourcePlaylistIdinplayQueuewhen called from a playlist contextPlayerService+PlaybackControls.swift: ClearsourcePlaylistIdon stopPlayerService+PlaybackBoundaries.swift: ClearsourcePlaylistIdon playback endPlaylistPlaybackActions.swift: SetsourcePlaylistIdwhen playing from playlistPlaylistDetailView.swift: SetsourcePlaylistIdwhen playing a track from the playlist viewKasetSidebarRow.swift: AddedisNowPlayingSourceparameter; tints the row title with the brand accent when set, keeping the row's own iconSidebar.swift: PassisNowPlayingSourceto pinned item rows by comparingplayerService.sourcePlaylistIdwithitem.contentIdMockPlayerService.swift: AddedsourcePlaylistIdfor protocol conformanceTesting
swift test --skip KasetUITests) — 2956 tests in 232 suitesBuilt and tested locally on macOS 26 (Apple Silicon). Manual verification in a packaged build: the pinned playlist's title tints while it is the playing source, the tint moves when switching playlists, and it clears when playback moves to a non-playlist source.
Two suites fail nondeterministically in local full-suite runs —
FavoritesManagerTestsLegacyMigrationClaimsandSettingsManagerTests(a locale leak:LaunchPage.home.displayNameresolving to"홈"). A different suite fails on each run and both pass in isolation (FavoritesManagerTestsLegacyMigrationClaimswas re-run 3x on its own: 19 tests, all passing each time), so this is pre-existing parallel-execution flakiness in shared global state, unrelated to this change — nothing here touchesFavoritesManagerorSettingsManager.Checklist
swiftlint --strict && swiftformat .— both clean (0/622 files need formatting)Additional Notes
The
sourcePlaylistIdis cleared in all non-playlist play paths to prevent stale highlights.Why a tint rather than an equalizer indicator
An earlier version of this PR replaced the row's icon with the animated
NowPlayingIndicatorused in track rows. That was dropped in favour of tinting the title:The parameter is named
isNowPlayingSourcerather thanisPlayingbecause it means "this is the playing source", not "audio is currently playing". The earlier naming is precisely what madeNowPlayingIndicator(isPlaying: true)look correct at the call site, which left the bars animating even while playback was paused.NowPlayingIndicatorandEqualizerVieware untouched by this PR; playlist track rows continue to use them as before.