From a1130b3e27201141312af9eff43580342d45690e Mon Sep 17 00:00:00 2001 From: martyfuhry Date: Mon, 11 Mar 2024 23:04:52 -0400 Subject: [PATCH] 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 --- .../immich_local_thumbnail_provider.dart | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/mobile/lib/modules/asset_viewer/image_providers/immich_local_thumbnail_provider.dart b/mobile/lib/modules/asset_viewer/image_providers/immich_local_thumbnail_provider.dart index bb86cfafda..0c97ab01cc 100644 --- a/mobile/lib/modules/asset_viewer/image_providers/immich_local_thumbnail_provider.dart +++ b/mobile/lib/modules/asset_viewer/image_providers/immich_local_thumbnail_provider.dart @@ -10,7 +10,8 @@ import 'package:photo_manager/photo_manager.dart'; /// The local image provider for an asset /// Only viable -class ImmichLocalThumbnailProvider extends ImageProvider { +class ImmichLocalThumbnailProvider + extends ImageProvider { final Asset asset; final int height; final int width; @@ -24,15 +25,20 @@ class ImmichLocalThumbnailProvider extends ImageProvider { /// Converts an [ImageProvider]'s settings plus an [ImageConfiguration] to a key /// that describes the precise image to load. @override - Future obtainKey(ImageConfiguration configuration) { - return SynchronousFuture(asset); + Future obtainKey( + ImageConfiguration configuration, + ) { + return SynchronousFuture(this); } @override - ImageStreamCompleter loadImage(Asset key, ImageDecoderCallback decode) { + ImageStreamCompleter loadImage( + ImmichLocalThumbnailProvider key, + ImageDecoderCallback decode, + ) { final chunkEvents = StreamController(); return MultiImageStreamCompleter( - codec: _codec(key, decode, chunkEvents), + codec: _codec(key.asset, decode, chunkEvents), scale: 1.0, chunkEvents: chunkEvents.stream, informationCollector: () sync* {