mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
fix(mobile): setting to always display remote assets (#3044)
This commit is contained in:
committed by
GitHub
parent
5869648f19
commit
615893be38
@@ -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(
|
||||
|
||||
@@ -44,7 +44,8 @@ enum AppSettingsEnum<T> {
|
||||
0,
|
||||
),
|
||||
advancedTroubleshooting<bool>(StoreKey.advancedTroubleshooting, null, false),
|
||||
logLevel<int>(StoreKey.logLevel, null, 5) // Level.INFO = 5
|
||||
logLevel<int>(StoreKey.logLevel, null, 5), // Level.INFO = 5
|
||||
preferRemoteImage<bool>(StoreKey.preferRemoteImage, null, false),
|
||||
;
|
||||
|
||||
const AppSettingsEnum(this.storeKey, this.hiveKey, this.defaultValue);
|
||||
|
||||
@@ -16,6 +16,8 @@ class AdvancedSettings extends HookConsumerWidget {
|
||||
final isEnabled =
|
||||
useState(AppSettingsEnum.advancedTroubleshooting.defaultValue);
|
||||
final levelId = useState(AppSettingsEnum.logLevel.defaultValue);
|
||||
final preferRemote =
|
||||
useState(AppSettingsEnum.preferRemoteImage.defaultValue);
|
||||
|
||||
useEffect(
|
||||
() {
|
||||
@@ -23,6 +25,8 @@ class AdvancedSettings extends HookConsumerWidget {
|
||||
AppSettingsEnum.advancedTroubleshooting,
|
||||
);
|
||||
levelId.value = appSettingService.getSetting(AppSettingsEnum.logLevel);
|
||||
preferRemote.value =
|
||||
appSettingService.getSetting(AppSettingsEnum.preferRemoteImage);
|
||||
return null;
|
||||
},
|
||||
[],
|
||||
@@ -77,6 +81,13 @@ class AdvancedSettings extends HookConsumerWidget {
|
||||
activeColor: Theme.of(context).primaryColor,
|
||||
),
|
||||
),
|
||||
SettingsSwitchListTile(
|
||||
appSettingService: appSettingService,
|
||||
valueNotifier: preferRemote,
|
||||
settingsEnum: AppSettingsEnum.preferRemoteImage,
|
||||
title: "advanced_settings_prefer_remote_title".tr(),
|
||||
subtitle: "advanced_settings_prefer_remote_subtitle".tr(),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user