fix: resume interrupted downloads after force-kill

This commit is contained in:
edde746
2026-02-09 09:04:44 +01:00
parent 1fb32f1618
commit 839c274e0d
3 changed files with 32 additions and 1 deletions
+7 -1
View File
@@ -214,7 +214,7 @@ class _MainAppState extends State<MainApp> with WidgetsBindingObserver {
PlexApiCache.initialize(_appDatabase);
_downloadManager = DownloadManagerService(database: _appDatabase, storageService: DownloadStorageService.instance);
_downloadManager.recoverInterruptedDownloads();
_downloadManager.recoveryFuture = _downloadManager.recoverInterruptedDownloads();
_offlineWatchSyncService = OfflineWatchSyncService(database: _appDatabase, serverManager: _serverManager);
@@ -398,6 +398,12 @@ class _SetupScreenState extends State<SetupScreen> {
if (!mounted) return;
if (result.hasConnections) {
// Resume any downloads that were interrupted by app kill
final downloadProvider = context.read<DownloadProvider>();
downloadProvider.ensureInitialized().then((_) {
downloadProvider.resumeQueuedDownloads(result.firstClient!);
});
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => MainScreen(client: result.firstClient!)),