Skip to content

Commit

Permalink
don't require viewId for downloads, move queue restore into postLaunc…
Browse files Browse the repository at this point in the history
…hHook
  • Loading branch information
Chaphasilor committed Nov 6, 2024
1 parent f9a2e4c commit 54488a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions lib/screens/music_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,18 @@ import '../services/jellyfin_api_helper.dart';

void postLaunchHook() async {
final downloadsService = GetIt.instance<DownloadsService>();
final queueService = GetIt.instance<QueueService>();

// make sure playlist info is downloaded for users upgrading from older versions and new installations AFTER logging in and selecting their libraries/views
if (!FinampSettingsHelper.finampSettings.hasDownloadedPlaylistInfo) {
await downloadsService.addDefaultPlaylistInfoDownload();
FinampSettingsHelper.setHasDownloadedPlaylistInfo(true);
}

// Restore queue
unawaited(queueService
.performInitialQueueLoad()
.catchError((x) => GlobalSnackbar.error(x)));
}

class MusicScreen extends ConsumerStatefulWidget {
Expand All @@ -56,7 +62,6 @@ class _MusicScreenState extends ConsumerState<MusicScreen>
final _audioServiceHelper = GetIt.instance<AudioServiceHelper>();
final _finampUserHelper = GetIt.instance<FinampUserHelper>();
final _jellyfinApiHelper = GetIt.instance<JellyfinApiHelper>();
final _queueService = GetIt.instance<QueueService>();

void _stopSearching() {
setState(() {
Expand Down Expand Up @@ -191,9 +196,6 @@ class _MusicScreenState extends ConsumerState<MusicScreen>

@override
Widget build(BuildContext context) {
_queueService
.performInitialQueueLoad()
.catchError((x) => GlobalSnackbar.error(x));
if (_tabController == null) {
_buildTabController();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/services/downloads_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,8 @@ class DownloadsService {
/// it to the anchor as required and then syncing.
Future<void> addDownload({
required DownloadStub stub,
required String viewId,
required DownloadProfile transcodeProfile,
String? viewId,
}) async {
// Comment https://github.com/jmshrv/finamp/issues/134#issuecomment-1563441355
// suggests this does not make a request and always returns failure
Expand Down

0 comments on commit 54488a1

Please sign in to comment.