Skip to content

refactor: consolidate client requests and move currently_playing_tracks_id to PlayerState#939

Merged
aome510 merged 3 commits intomasterfrom
simplify-context-id
Feb 23, 2026
Merged

refactor: consolidate client requests and move currently_playing_tracks_id to PlayerState#939
aome510 merged 3 commits intomasterfrom
simplify-context-id

Conversation

@aome510
Copy link
Owner

@aome510 aome510 commented Feb 23, 2026

Summary

This PR simplifies the client request model by consolidating multiple specialized track-fetching requests into the single existing GetContext request, and moves currently_playing_tracks_id from UIState to PlayerState.

Consolidate ClientRequest variants

Removed GetUserSavedTracks, GetUserTopTracks, GetUserRecentlyPlayedTracks, and GetRadioTracks request variants. All of these are now dispatched as GetContext(ContextId::Tracks(...)). The handler resolves the appropriate API call by pattern-matching on the tracks URI string (USER_TOP_TRACKS_URI, USER_RECENTLY_PLAYED_TRACKS_URI, USER_LIKED_TRACKS_URI, or a radio: prefixed URI).

Move currently_playing_tracks_id to PlayerState

The field tracking the active Tracks context (for contexts not represented in Spotify's playback API, e.g. liked/top tracks) was moved from UIState to PlayerState. This makes it accessible to PlayerState::playing_context_id(), which now falls back to currently_playing_tracks_id when there is no active Spotify context. All event handler functions that modify this field were updated to take &SharedState instead of using UIStateGuard.

@aome510 aome510 merged commit a67782e into master Feb 23, 2026
5 checks passed
@aome510 aome510 deleted the simplify-context-id branch February 23, 2026 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant