fix(downloads): inject visibility-aware client resolver

This commit is contained in:
edde746
2026-06-12 14:16:24 +02:00
parent c2fe142293
commit 5e4449247b
11 changed files with 82 additions and 37 deletions
+5 -7
View File
@@ -480,13 +480,11 @@ class _MainAppState extends State<MainApp> with WidgetsBindingObserver {
PlexApiCache.initialize(_appDatabase);
JellyfinApiCache.initialize(_appDatabase);
_downloadManager = DownloadManagerService(database: _appDatabase, storageService: DownloadStorageService.instance);
_downloadManager.setClientResolver((serverId, {clientScopeId}) {
if (clientScopeId != null && clientScopeId.isNotEmpty) {
return _serverManager.getJellyfinClientByCompoundId(clientScopeId) ?? _serverManager.getClient(serverId);
}
return _serverManager.getClient(serverId);
});
_downloadManager = DownloadManagerService(
database: _appDatabase,
storageService: DownloadStorageService.instance,
clientResolver: _serverManager.resolveDownloadClient,
);
_downloadManager.recoveryFuture = _downloadManager.recoverInterruptedDownloads();
_offlineWatchSyncService = OfflineWatchSyncService(database: _appDatabase, serverManager: _serverManager);