mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-27 03:41:47 +02:00
perf(cache): enforce cover byte budget during foreground use
This commit is contained in:
@@ -251,6 +251,7 @@ class _EagerInitializationState extends ConsumerState<_EagerInitialization>
|
||||
@override
|
||||
void dispose() {
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
CoverCacheManager.stopMaintenance();
|
||||
_localLibraryEnabledSub?.close();
|
||||
_downloadHistoryWarmupTimer?.cancel();
|
||||
_localLibraryWarmupTimer?.cancel();
|
||||
@@ -260,6 +261,7 @@ class _EagerInitializationState extends ConsumerState<_EagerInitialization>
|
||||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
if (state == AppLifecycleState.resumed) {
|
||||
CoverCacheManager.scheduleMaintenance();
|
||||
_maybeAutoScanLocalLibrary();
|
||||
if (ref.exists(localLibraryProvider)) {
|
||||
unawaited(
|
||||
@@ -274,6 +276,7 @@ class _EagerInitializationState extends ConsumerState<_EagerInitialization>
|
||||
.resumePendingDownloadsOnForeground();
|
||||
}
|
||||
} else if (state == AppLifecycleState.paused) {
|
||||
CoverCacheManager.stopMaintenance();
|
||||
// Last reliable moment before the OS may kill the process: make sure
|
||||
// any debounced download-queue persistence reaches disk.
|
||||
if (ref.exists(downloadQueueProvider)) {
|
||||
|
||||
Reference in New Issue
Block a user