fix(mobile): setting to always display remote assets (#3044)

This commit is contained in:
Fynn Petersen-Frey
2023-07-01 03:47:44 +02:00
committed by GitHub
parent 5869648f19
commit 615893be38
6 changed files with 26 additions and 6 deletions

View File

@@ -131,7 +131,8 @@ class GalleryViewerPage extends HookConsumerWidget {
if (index < totalAssets && index >= 0) {
final asset = loadAsset(index);
if (asset.isLocal) {
if (!asset.isRemote ||
asset.isLocal && !Store.get(StoreKey.preferRemoteImage, false)) {
// Preload the local asset
precacheImage(localImageProvider(asset), context);
} else {
@@ -459,7 +460,8 @@ class GalleryViewerPage extends HookConsumerWidget {
});
ImageProvider imageProvider(Asset asset) {
if (asset.isLocal) {
if (!asset.isRemote ||
asset.isLocal && !Store.get(StoreKey.preferRemoteImage, false)) {
return localImageProvider(asset);
} else {
if (isLoadOriginal.value) {
@@ -518,7 +520,9 @@ class GalleryViewerPage extends HookConsumerWidget {
loadingBuilder: isLoadPreview.value
? (context, event) {
final a = asset();
if (!a.isLocal) {
if (!a.isLocal ||
(a.isRemote &&
Store.get(StoreKey.preferRemoteImage, false))) {
// Use the WEBP Thumbnail as a placeholder for the JPEG thumbnail to achieve
// Three-Stage Loading (WEBP -> JPEG -> Original)
final webPThumbnail = CachedNetworkImage(