mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +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
|
|
@ -3,14 +3,31 @@ import 'package:openapi/api.dart';
|
|||
|
||||
import '../constants/hive_box.dart';
|
||||
|
||||
String getThumbnailUrl(final AssetResponseDto asset,
|
||||
{ThumbnailFormat type = ThumbnailFormat.WEBP}) {
|
||||
final box = Hive.box(userInfoBox);
|
||||
String getThumbnailUrl(
|
||||
final AssetResponseDto asset, {
|
||||
ThumbnailFormat type = ThumbnailFormat.WEBP,
|
||||
}) {
|
||||
return _getThumbnailUrl(asset.id, type: type);
|
||||
}
|
||||
|
||||
return '${box.get(serverEndpointKey)}/asset/thumbnail/${asset.id}?format=${type.value}';
|
||||
String getAlbumThumbnailUrl(
|
||||
final AlbumResponseDto album, {
|
||||
ThumbnailFormat type = ThumbnailFormat.WEBP,
|
||||
}) {
|
||||
if (album.albumThumbnailAssetId == null) {
|
||||
return '';
|
||||
}
|
||||
return _getThumbnailUrl(album.albumThumbnailAssetId!, type: type);
|
||||
}
|
||||
|
||||
String getImageUrl(final AssetResponseDto asset) {
|
||||
final box = Hive.box(userInfoBox);
|
||||
return '${box.get(serverEndpointKey)}/asset/file?aid=${asset.deviceAssetId}&did=${asset.deviceId}&isThumb=false';
|
||||
}
|
||||
|
||||
String _getThumbnailUrl(final String id,
|
||||
{ThumbnailFormat type = ThumbnailFormat.WEBP}) {
|
||||
final box = Hive.box(userInfoBox);
|
||||
|
||||
return '${box.get(serverEndpointKey)}/asset/thumbnail/${id}?format=${type.value}';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue