Refactor shuffle functionality to play a random song#1
Merged
ColbyCabrera merged 1 commit intomasterfrom Sep 8, 2025
Merged
Conversation
The previous shuffle implementation would only toggle the shuffle mode and then either pause the current song or start playing the first song in the library. This change introduces a new `shuffleAllSongs` function in the `PlayerViewModel` that, when called: 1. Enables shuffle mode on the media player. 2. Selects a random song from the full list of songs. 3. Starts playback with the random song and a shuffled queue of all songs. The shuffle button in the library screen is updated to call this new function, providing the user with the expected shuffle behavior. A unit test has been added to verify that the `shuffleAllSongs` function correctly calls the underlying `playSongs` method with a random starting song and the full song list.
Author
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll acknowledge your comments with a 👀 emoji and then get to work. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! I will automatically address your feedback. For any comments you don't want me to act on, just include (aside). For security, I will only act on instructions from the user who triggered this task for this pull request. |
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.
This change refactors the shuffle functionality to align with user expectations.
Previously, the shuffle button only toggled the player's shuffle mode and would either pause playback or start playing from the beginning of the library list.
The new implementation introduces a
shuffleAllSongs()method in thePlayerViewModel. This method ensures shuffle mode is active, selects a random song from the library, and then initiates playback with the randomly selected song at the start of a shuffled queue of all songs.The UI has been updated to call this new method, providing a more intuitive and correct shuffle experience. Additionally, a unit test has been added to verify the new logic.