Compare commits

..

1 Commits

Author SHA1 Message Date
Richard Hajek
9483a7b605
Merge 42e954428b into c709de6bf1 2025-03-10 23:57:38 +06:00
2 changed files with 1 additions and 24 deletions

View File

@ -101,17 +101,11 @@ class PlaylistCreateDialog extends HookConsumerWidget {
} else { } else {
await playlistNotifier.create(payload, onError); await playlistNotifier.create(payload, onError);
} }
if (trackIds.isNotEmpty) {
await playlistNotifier.addTracks(trackIds, onError);
}
} finally { } finally {
isSubmitting.value = false; isSubmitting.value = false;
if (context.mounted && if (context.mounted &&
!ref.read(playlistProvider(playlistId ?? "")).hasError) { !ref.read(playlistProvider(playlistId ?? "")).hasError) {
context.router.maybePop<Playlist>( context.router.maybePop();
await ref.read(playlistProvider(playlistId ?? "").future),
);
} }
} }
} }

View File

@ -98,23 +98,6 @@ class PlaylistNotifier extends FamilyAsyncNotifier<Playlist, String> {
} }
}); });
} }
Future<void> addTracks(List<String> trackIds, [ValueChanged? onError]) async {
try {
if (state.value == null) return;
final spotify = ref.read(spotifyProvider);
await spotify.playlists.addTracks(
trackIds.map((id) => "spotify:track:$id").toList(),
state.value!.id!,
);
} catch (e, stack) {
onError?.call(e);
AppLogger.reportError(e, stack);
rethrow;
}
}
} }
final playlistProvider = final playlistProvider =