feat(mobile): Remote thumbnails and images use an on-disk image cache (#7929)

* Fixes remote full / thumbnail provider

* Adds image cache manager to both remote image providers

format

format

Fix typo in equals

remove unused import

renames image loader

* Adds height and width to the image cache for thumbs

format

* Uses a separate remote and thumbnail cache

format

* Fixes key name

* Changes uri to string, fixes comment

* Chunk events are optional and remote thumbnails don't report chunk events

* better exception handling

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
martyfuhry 2024-03-14 16:29:09 -04:00 committed by GitHub
parent 5a589babcb
commit 582cdcab82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 168 additions and 117 deletions

View file

@ -42,7 +42,6 @@ class ImmichImage extends StatelessWidget {
if (asset == null) {
return ImmichRemoteImageProvider(
assetId: assetId!,
isThumbnail: false,
);
}
@ -53,7 +52,6 @@ class ImmichImage extends StatelessWidget {
} else {
return ImmichRemoteImageProvider(
assetId: asset.remoteId!,
isThumbnail: false,
);
}
}

View file

@ -3,7 +3,7 @@ import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:immich_mobile/modules/asset_viewer/image_providers/immich_local_thumbnail_provider.dart';
import 'package:immich_mobile/modules/asset_viewer/image_providers/immich_remote_image_provider.dart';
import 'package:immich_mobile/modules/asset_viewer/image_providers/immich_remote_thumbnail_provider.dart';
import 'package:immich_mobile/shared/models/asset.dart';
import 'package:immich_mobile/shared/ui/hooks/blurhash_hook.dart';
import 'package:immich_mobile/shared/ui/immich_image.dart';
@ -38,9 +38,8 @@ class ImmichThumbnail extends HookWidget {
}
if (asset == null) {
return ImmichRemoteImageProvider(
return ImmichRemoteThumbnailProvider(
assetId: assetId!,
isThumbnail: true,
);
}
@ -51,9 +50,10 @@ class ImmichThumbnail extends HookWidget {
width: thumbnailSize,
);
} else {
return ImmichRemoteImageProvider(
return ImmichRemoteThumbnailProvider(
assetId: asset.remoteId!,
isThumbnail: true,
height: thumbnailSize,
width: thumbnailSize,
);
}
}