Show "play next" option when song is already in queue
Addresses #2325 Partially addresses #2088, #1721
Allows users to "Play next" a song which is already present in queue. This is currently not possible and makes the intended use flow quite confusing.
This is a quick fix adhering to the current system, but I believe the whole queue/play next system should be revised as suggested in #2217.
Actually just adding back the option wouldn't work that way. You also have to handle the case differently for tracks already in queue.
In the callback for playNext, for tracks already in queue, audioPlayer.move must be used instead of addTrackAt
Actually just adding back the option wouldn't work that way. You also have to handle the case differently for tracks already in queue. In the callback for
playNext, for tracks already in queue,audioPlayer.movemust be used instead ofaddTrackAt
After taking a quick look at the codebase, I assumed that by "the callback for playNext" you meant the switch case in TrackOptionsAction, but I wasn't sure how to discern whether or not a track was in the queue from there. So I decided to change AudioPlayerNotifier::addTracksAtFirst in a way that instead of filtering out duplicated tracks when allowDuplicates is false, they get moved to the top. I might now have realized a semi-decent way to do it outside of this method so tell me if I need to rewrite this.
I couldn't get flutter to build on windows so I'll try and build this tomorrow on my laptop, provided I can actually get around to downloading the sdk somewhat rapidly. I'll request a new review once I'm confident it doesn't just crash horribly.
Asking a new review as this now builds and seems to work as intended. If I tried to manually update the state as was being done before, I got inconsistencies between the view and the underlying playlist, while by removing it altogether I could get the desired effect, but I couldn't understand if it was being updated in some other place. Is there a reason for this/was it unnecessary?