mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00
fix: selecting an Alternative Track Source removes the current song from the queue #2039
This commit is contained in:
parent
9f2d423cfe
commit
e3285bd4da
@ -247,7 +247,10 @@ class AudioPlayerNotifier extends Notifier<AudioPlayerState> {
|
||||
|
||||
// Tracks related methods
|
||||
|
||||
Future<void> addTracksAtFirst(Iterable<Track> tracks) async {
|
||||
Future<void> addTracksAtFirst(
|
||||
Iterable<Track> tracks, {
|
||||
bool allowDuplicates = false,
|
||||
}) async {
|
||||
if (state.tracks.length == 1) {
|
||||
return addTracks(tracks);
|
||||
}
|
||||
@ -257,7 +260,8 @@ class AudioPlayerNotifier extends Notifier<AudioPlayerState> {
|
||||
for (int i = 0; i < tracks.length; i++) {
|
||||
final track = tracks.elementAt(i);
|
||||
|
||||
if (state.tracks.any((element) => _compareTracks(element, track))) {
|
||||
if (!allowDuplicates &&
|
||||
state.tracks.any((element) => _compareTracks(element, track))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ class ActiveSourcedTrackNotifier extends Notifier<SourcedTrack?> {
|
||||
final playbackNotifier = ref.read(audioPlayerProvider.notifier);
|
||||
final oldActiveIndex = audioPlayer.currentIndex;
|
||||
|
||||
await playbackNotifier.addTracksAtFirst([newTrack]);
|
||||
await playbackNotifier.addTracksAtFirst([newTrack], allowDuplicates: true);
|
||||
await Future.delayed(const Duration(milliseconds: 50));
|
||||
await playbackNotifier.jumpToTrack(newTrack);
|
||||
|
||||
|
@ -2528,10 +2528,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: youtube_explode_dart
|
||||
sha256: "523a01ef948607d3e8fdcdcdcef1ce805c7d26480f609e3b209d1c73520a6c3c"
|
||||
sha256: "6d5f9a0a55d02743e59ca495887432814bddb6b11400b08ee0eeaf69c83d0089"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.1"
|
||||
version: "2.3.5"
|
||||
sdks:
|
||||
dart: ">=3.5.3 <4.0.0"
|
||||
flutter: ">=3.24.0"
|
||||
|
@ -88,7 +88,7 @@ dependencies:
|
||||
version: ^3.0.2
|
||||
visibility_detector: ^0.4.0+2
|
||||
window_manager: ^0.3.9
|
||||
youtube_explode_dart: ^2.3.1
|
||||
youtube_explode_dart: ^2.3.5
|
||||
simple_icons: ^10.1.3
|
||||
jiosaavn: ^0.1.0
|
||||
draggable_scrollbar:
|
||||
|
Loading…
Reference in New Issue
Block a user