mirror of
https://github.com/immich-app/immich.git
synced 2024-12-21 01:39:59 +02:00
c5504aae6e
* refactor: migrate album sort option to provider * refactor: use sort order in add to album sheet list * test(mobile): album_sort_options_provider unit tests * refactor: sort shared albums with user selected sort * refactor: use listview to render shared albums * refactor: rename to AlbumSortByOptions * refactor: remove filtering inside sort functions * font size --------- Co-authored-by: shalong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
78 lines
2.5 KiB
Dart
78 lines
2.5 KiB
Dart
import 'package:immich_mobile/shared/models/store.dart';
|
|
|
|
enum AppSettingsEnum<T> {
|
|
loadPreview<bool>(StoreKey.loadPreview, "loadPreview", true),
|
|
loadOriginal<bool>(StoreKey.loadOriginal, "loadOriginal", false),
|
|
themeMode<String>(
|
|
StoreKey.themeMode,
|
|
"themeMode",
|
|
"system",
|
|
), // "light","dark","system"
|
|
tilesPerRow<int>(StoreKey.tilesPerRow, "tilesPerRow", 4),
|
|
dynamicLayout<bool>(StoreKey.dynamicLayout, "dynamicLayout", false),
|
|
groupAssetsBy<int>(StoreKey.groupAssetsBy, "groupBy", 0),
|
|
uploadErrorNotificationGracePeriod<int>(
|
|
StoreKey.uploadErrorNotificationGracePeriod,
|
|
"uploadErrorNotificationGracePeriod",
|
|
2,
|
|
),
|
|
backgroundBackupTotalProgress<bool>(
|
|
StoreKey.backgroundBackupTotalProgress,
|
|
"backgroundBackupTotalProgress",
|
|
true,
|
|
),
|
|
backgroundBackupSingleProgress<bool>(
|
|
StoreKey.backgroundBackupSingleProgress,
|
|
"backgroundBackupSingleProgress",
|
|
false,
|
|
),
|
|
storageIndicator<bool>(StoreKey.storageIndicator, "storageIndicator", true),
|
|
thumbnailCacheSize<int>(
|
|
StoreKey.thumbnailCacheSize,
|
|
"thumbnailCacheSize",
|
|
10000,
|
|
),
|
|
imageCacheSize<int>(StoreKey.imageCacheSize, "imageCacheSize", 350),
|
|
albumThumbnailCacheSize<int>(
|
|
StoreKey.albumThumbnailCacheSize,
|
|
"albumThumbnailCacheSize",
|
|
200,
|
|
),
|
|
selectedAlbumSortOrder<int>(
|
|
StoreKey.selectedAlbumSortOrder,
|
|
"selectedAlbumSortOrder",
|
|
0,
|
|
),
|
|
advancedTroubleshooting<bool>(StoreKey.advancedTroubleshooting, null, false),
|
|
logLevel<int>(StoreKey.logLevel, null, 5), // Level.INFO = 5
|
|
preferRemoteImage<bool>(StoreKey.preferRemoteImage, null, false),
|
|
mapThemeMode<bool>(StoreKey.mapThemeMode, null, false),
|
|
mapShowFavoriteOnly<bool>(StoreKey.mapShowFavoriteOnly, null, false),
|
|
mapIncludeArchived<bool>(StoreKey.mapIncludeArchived, null, false),
|
|
mapRelativeDate<int>(StoreKey.mapRelativeDate, null, 0),
|
|
allowSelfSignedSSLCert<bool>(StoreKey.selfSignedCert, null, false),
|
|
ignoreIcloudAssets<bool>(StoreKey.ignoreIcloudAssets, null, false),
|
|
selectedAlbumSortReverse<bool>(
|
|
StoreKey.selectedAlbumSortReverse,
|
|
null,
|
|
false,
|
|
),
|
|
;
|
|
|
|
const AppSettingsEnum(this.storeKey, this.hiveKey, this.defaultValue);
|
|
|
|
final StoreKey<T> storeKey;
|
|
final String? hiveKey;
|
|
final T defaultValue;
|
|
}
|
|
|
|
class AppSettingsService {
|
|
T getSetting<T>(AppSettingsEnum<T> setting) {
|
|
return Store.get(setting.storeKey, setting.defaultValue);
|
|
}
|
|
|
|
void setSetting<T>(AppSettingsEnum<T> setting, T value) {
|
|
Store.put(setting.storeKey, value);
|
|
}
|
|
}
|