Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mobile): Fixes prefer remote assets in thumbnail provider #7485

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions mobile/lib/shared/ui/immich_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ class ImmichImage extends StatelessWidget {
}
}

// Whether to use the local asset image provider or a remote one
static bool useLocal(Asset asset) =>
!asset.isRemote ||
asset.isLocal && !Store.get(StoreKey.preferRemoteImage, false);

@override
Widget build(BuildContext context) {
if (asset == null) {
Expand Down
5 changes: 2 additions & 3 deletions mobile/lib/shared/ui/immich_thumbnail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:immich_mobile/modules/asset_viewer/image_providers/immich_local_
import 'package:immich_mobile/modules/asset_viewer/image_providers/immich_remote_image_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';
import 'package:immich_mobile/shared/ui/thumbhash_placeholder.dart';
import 'package:octo_image/octo_image.dart';

Expand Down Expand Up @@ -43,7 +44,7 @@ class ImmichThumbnail extends HookWidget {
);
}

if (useLocal(asset)) {
if (ImmichImage.useLocal(asset)) {
return ImmichLocalThumbnailProvider(
asset: asset,
height: thumbnailSize,
Expand All @@ -57,8 +58,6 @@ class ImmichThumbnail extends HookWidget {
}
}

static bool useLocal(Asset asset) => !asset.isRemote || asset.isLocal;

@override
Widget build(BuildContext context) {
Uint8List? blurhash = useBlurHashRef(asset).value;
Expand Down