mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
Use CachedNetworkImage and separate cache for thumbnails on library page (#509)
* Use CachedNetworkImage and separate cache for thumbnails on library page * Use caching for shared albums as well * Introduce cache service
This commit is contained in:
parent
3125d04f32
commit
8e4c4c34e4
7 changed files with 81 additions and 30 deletions
21
mobile/lib/shared/services/cache.service.dart
Normal file
21
mobile/lib/shared/services/cache.service.dart
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
enum CacheType {
|
||||
albumThumbnail,
|
||||
sharedAlbumThumbnail;
|
||||
}
|
||||
|
||||
final cacheServiceProvider = Provider((_) => CacheService());
|
||||
|
||||
class CacheService {
|
||||
|
||||
BaseCacheManager getCache(CacheType type) {
|
||||
return _getDefaultCache(type.name);
|
||||
}
|
||||
|
||||
BaseCacheManager _getDefaultCache(String cacheName) {
|
||||
return CacheManager(Config(cacheName));
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue