1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-01 08:31:59 +00:00

fix(mobile): Fixes local thumbnail image provider key (#7766)

* Fixes large and small image cache

* Fixes local thumb provider key

format

* format

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
martyfuhry 2024-03-11 23:04:52 -04:00 committed by GitHub
parent de28f83d0d
commit a1130b3e27
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -10,7 +10,8 @@ import 'package:photo_manager/photo_manager.dart';
/// The local image provider for an asset /// The local image provider for an asset
/// Only viable /// Only viable
class ImmichLocalThumbnailProvider extends ImageProvider<Asset> { class ImmichLocalThumbnailProvider
extends ImageProvider<ImmichLocalThumbnailProvider> {
final Asset asset; final Asset asset;
final int height; final int height;
final int width; final int width;
@ -24,15 +25,20 @@ class ImmichLocalThumbnailProvider extends ImageProvider<Asset> {
/// Converts an [ImageProvider]'s settings plus an [ImageConfiguration] to a key /// Converts an [ImageProvider]'s settings plus an [ImageConfiguration] to a key
/// that describes the precise image to load. /// that describes the precise image to load.
@override @override
Future<Asset> obtainKey(ImageConfiguration configuration) { Future<ImmichLocalThumbnailProvider> obtainKey(
return SynchronousFuture(asset); ImageConfiguration configuration,
) {
return SynchronousFuture(this);
} }
@override @override
ImageStreamCompleter loadImage(Asset key, ImageDecoderCallback decode) { ImageStreamCompleter loadImage(
ImmichLocalThumbnailProvider key,
ImageDecoderCallback decode,
) {
final chunkEvents = StreamController<ImageChunkEvent>(); final chunkEvents = StreamController<ImageChunkEvent>();
return MultiImageStreamCompleter( return MultiImageStreamCompleter(
codec: _codec(key, decode, chunkEvents), codec: _codec(key.asset, decode, chunkEvents),
scale: 1.0, scale: 1.0,
chunkEvents: chunkEvents.stream, chunkEvents: chunkEvents.stream,
informationCollector: () sync* { informationCollector: () sync* {