Repository navigation
Keep the profile music playing when its strip is clicked again - #125
Merged
macosswift merged 3 commits intoOct 30, 2026
Merged
macosswift merged 3 commits into
macosswift merged 3 commits into
Conversation
Clicking the music strip of a profile always created a new player and started it from the first track, so a track picked from the list was replaced as soon as the strip was clicked again. When the music of the same profile is already playing, only open the track list.
1 task done
Collaborator
|
Issues:
|
Collaborator
|
Issues:
|
… scroll to the playing track
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.
Key change
Clicking the music strip in a profile header while that profile's music is already playing now only opens the track list. The player is not recreated and the playback is not restarted. The first click, when nothing from this profile is playing, behaves as before: it starts the music and opens the list.
A new
activeProfileMusichook inPeerInfoUIHooksreturns the current state and theProfileSavedMusicContextof the player in the navigation header when it plays the music of the same peer, andnilotherwise. The app-side implementation checks the header context object and the shared audio player (getAudioPlayer()), so it does not depend on the header view, which does not exist before the first playback.PeerInfoHeadItem.openProfileMusic()opens the list with that state and context, not with the ones of the profile screen that was just opened. When a profile is closed and opened again while its music keeps playing, the new screen has its ownProfileSavedMusicContext, and tracks that the list loads further, adds, removes or reorders through it would not reach the queue of the running player. The hook returnsnil, and the previous behaviour (a new player) is used, when the running player has no state yet or belongs to another account than the profile screen, so with several accounts the list never edits the music profile of the account that is playing. The hook also returns the track that is playing now, and the list is opened scrolled to it, not to the main track of the profile, which can be out of view in a long list.Reason
openProfileMusic()always created a newAPProfileSavedControllerand calledstart(), which begins with the first track of the profile, and installing the new player stops the previous one. As a result, a track chosen from the list was replaced by the first track as soon as the strip was clicked again, and the list could not be used to pick another track while music was playing.Screenshot/video result (before/after)
The same scenario on both builds: open a profile with two saved tracks, click the strip, pick the second track (No Love) in the list, close the list, click the strip again.
Before
After
Confirmation
Tested on macOS 26.7.1 (25G241), Apple M2, with local Debug builds of master at e537320 (before) and of this branch (after).
Testing limitations:
Only my own profile was tested. The code path is the same for other users' profiles, but I did not open one with music.
Only macOS 26.7.1 was available. No other macOS version and no Intel machine were used.
Multiple accounts (the account check and the other-account fallback) and VoiceOver were not tested.
Closing the profile and opening it again while its music keeps playing, then loading more tracks or reordering them in the list, was not tested in the app. The change only compiles in a build and makes the list use the running player's own context.
I built with the Postbox
assertinOrderedItemListTable.replaceItemsdisabled (-assert-config Release), because a Debug build traps on my account at launch on a duplicate recent inline bot entry. This is unrelated to the change.I confirm that I have tested the affected behavior and verified that it works properly, or verified the content and links for a documentation-only change.