mirror of
https://github.com/aome510/spotify-player.git
synced 2026-04-26 17:35:50 +03:00
[PR #939] [MERGED] refactor: consolidate client requests and move currently_playing_tracks_id to PlayerState #934
Labels
No labels
bug
documentation
enhancement
good first issue
help wanted
pull-request
question
third-party
third-party
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotify-player#934
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/aome510/spotify-player/pull/939
Author: @aome510
Created: 2/23/2026
Status: ✅ Merged
Merged: 2/23/2026
Merged by: @aome510
Base:
master← Head:simplify-context-id📝 Commits (3)
f681effmove currently_playing_tracks_id from UIState to PlayerState98b6f13simplify codes by using single GetContext requestf7fec41fmt📊 Changes
11 files changed (+114 additions, -172 deletions)
View changed files
📝
spotify_player/src/client/handlers.rs(+1 -8)📝
spotify_player/src/client/mod.rs(+43 -80)📝
spotify_player/src/client/request.rs(+0 -7)📝
spotify_player/src/event/mod.rs(+32 -37)📝
spotify_player/src/event/page.rs(+2 -2)📝
spotify_player/src/event/window.rs(+12 -6)📝
spotify_player/src/main.rs(+3 -1)📝
spotify_player/src/state/constant.rs(+8 -8)📝
spotify_player/src/state/player.rs(+10 -2)📝
spotify_player/src/state/ui/mod.rs(+0 -18)📝
spotify_player/src/state/ui/page.rs(+3 -3)📄 Description
Summary
This PR simplifies the client request model by consolidating multiple specialized track-fetching requests into the single existing
GetContextrequest, and movescurrently_playing_tracks_idfromUIStatetoPlayerState.Consolidate
ClientRequestvariantsRemoved
GetUserSavedTracks,GetUserTopTracks,GetUserRecentlyPlayedTracks, andGetRadioTracksrequest variants. All of these are now dispatched asGetContext(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 aradio:prefixed URI).Move
currently_playing_tracks_idtoPlayerStateThe field tracking the active Tracks context (for contexts not represented in Spotify's playback API, e.g. liked/top tracks) was moved from
UIStatetoPlayerState. This makes it accessible toPlayerState::playing_context_id(), which now falls back tocurrently_playing_tracks_idwhen there is no active Spotify context. All event handler functions that modify this field were updated to take&SharedStateinstead of usingUIStateGuard.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.