refactoring
security update
This commit is contained in:
parent
1747ab0245
commit
78fe9e7b09
39 changed files with 289 additions and 132 deletions
|
@ -1,12 +1,14 @@
|
|||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||
import 'package:mc_gallery/features/core/services/app_lifecycle_service.dart';
|
||||
import 'package:mc_gallery/features/core/services/local_storage_service.dart';
|
||||
import 'package:mc_gallery/features/core/services/logging_service.dart';
|
||||
import 'package:mc_gallery/locator.dart';
|
||||
|
||||
class ImageCacheManagerService with LoggingService {
|
||||
import '/features/core/services/app_lifecycle_service.dart';
|
||||
import '/features/core/services/local_storage_service.dart';
|
||||
import '/features/core/services/logging_service.dart';
|
||||
import '/locator.dart';
|
||||
|
||||
/// Handles maintaining the caching of downloaded images
|
||||
class ImageCacheManagerService {
|
||||
ImageCacheManagerService(
|
||||
{required AppLifecycleService appLifecycleService,
|
||||
required LocalStorageService localStorageService})
|
||||
|
@ -17,6 +19,7 @@ class ImageCacheManagerService with LoggingService {
|
|||
|
||||
final AppLifecycleService _appLifecycleService;
|
||||
final LocalStorageService _localStorageService;
|
||||
final LoggingService _loggingService = LoggingService.locate;
|
||||
final _cacheManager = DefaultCacheManager();
|
||||
|
||||
Future<void> emptyCache() async => await _cacheManager.emptyCache();
|
||||
|
@ -31,7 +34,7 @@ class ImageCacheManagerService with LoggingService {
|
|||
case AppLifecycleState.inactive:
|
||||
case AppLifecycleState.paused:
|
||||
case AppLifecycleState.detached:
|
||||
info('Discarding cached images');
|
||||
_loggingService.info('Discarding cached images');
|
||||
await _cacheManager.emptyCache();
|
||||
_localStorageService.resetFavourites();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue