2026-05-05 10:45:51 +07:00
|
|
|
import 'package:flutter/material.dart';
|
2026-05-07 22:12:14 +07:00
|
|
|
import 'package:immich_mobile/constants/colors.dart';
|
2026-05-07 23:27:06 +07:00
|
|
|
import 'package:immich_mobile/constants/enums.dart';
|
2026-05-05 10:45:51 +07:00
|
|
|
import 'package:immich_mobile/domain/models/log.model.dart';
|
2026-05-13 02:53:25 +07:00
|
|
|
import 'package:immich_mobile/domain/models/timeline.model.dart';
|
2026-07-22 01:53:50 +05:30
|
|
|
import 'package:immich_mobile/domain/models/value_codec.dart';
|
2026-05-18 23:28:59 +05:30
|
|
|
import 'package:immich_mobile/providers/album/album_sort_by_options.provider.dart';
|
2026-06-30 13:53:13 -05:00
|
|
|
import 'package:immich_mobile/utils/semver.dart';
|
2026-05-05 10:45:51 +07:00
|
|
|
|
2026-06-12 04:35:50 +05:30
|
|
|
enum SettingsKey<T> {
|
2026-05-07 22:12:14 +07:00
|
|
|
// Theme
|
2026-07-22 01:53:50 +05:30
|
|
|
themePrimaryColor<ImmichColorPreset>(codec: EnumCodec(ImmichColorPreset.values)),
|
|
|
|
|
themeMode<ThemeMode>(codec: EnumCodec(ThemeMode.values)),
|
2026-05-28 01:19:25 +05:30
|
|
|
themeDynamic<bool>(),
|
|
|
|
|
themeColorfulInterface<bool>(),
|
2026-05-07 22:12:14 +07:00
|
|
|
|
2026-05-13 04:50:35 +07:00
|
|
|
// Image
|
2026-05-28 01:19:25 +05:30
|
|
|
imagePreferRemote<bool>(),
|
|
|
|
|
imageLoadOriginal<bool>(),
|
2026-05-13 04:50:35 +07:00
|
|
|
|
2026-05-13 21:36:19 +07:00
|
|
|
// Viewer
|
2026-05-28 01:19:25 +05:30
|
|
|
viewerLoopVideo<bool>(),
|
|
|
|
|
viewerLoadOriginalVideo<bool>(),
|
|
|
|
|
viewerAutoPlayVideo<bool>(),
|
|
|
|
|
viewerTapToNavigate<bool>(),
|
2026-05-13 21:36:19 +07:00
|
|
|
|
2026-05-18 21:52:42 +05:30
|
|
|
// Network
|
2026-05-29 03:12:59 +05:30
|
|
|
networkAutoEndpointSwitching<bool>(),
|
2026-07-22 01:53:50 +05:30
|
|
|
networkExternalEndpointList<List<String>>(codec: ListCodec(PrimitiveCodec.string)),
|
|
|
|
|
networkCustomHeaders<Map<String, String>>(codec: MapCodec(PrimitiveCodec.string, PrimitiveCodec.string)),
|
2026-06-12 04:35:50 +05:30
|
|
|
networkPreferredWifiName<String?>(),
|
|
|
|
|
networkLocalEndpoint<String?>(),
|
2026-05-18 21:52:42 +05:30
|
|
|
|
2026-05-18 23:28:59 +05:30
|
|
|
// Album
|
2026-07-22 01:53:50 +05:30
|
|
|
albumSortMode<AlbumSortMode>(codec: EnumCodec(AlbumSortMode.values)),
|
2026-05-28 01:19:25 +05:30
|
|
|
albumIsReverse<bool>(),
|
|
|
|
|
albumIsGrid<bool>(),
|
2026-05-18 23:28:59 +05:30
|
|
|
|
2026-05-19 00:40:10 +05:30
|
|
|
// Backup
|
2026-05-28 01:19:25 +05:30
|
|
|
backupEnabled<bool>(),
|
|
|
|
|
backupUseCellularForVideos<bool>(),
|
|
|
|
|
backupUseCellularForPhotos<bool>(),
|
|
|
|
|
backupRequireCharging<bool>(),
|
|
|
|
|
backupTriggerDelay<int>(),
|
|
|
|
|
backupSyncAlbums<bool>(),
|
2026-05-19 00:40:10 +05:30
|
|
|
|
2026-05-13 02:53:25 +07:00
|
|
|
// Timeline
|
2026-05-28 01:19:25 +05:30
|
|
|
timelineTilesPerRow<int>(),
|
2026-07-22 01:53:50 +05:30
|
|
|
timelineGroupAssetsBy<GroupAssetsBy>(codec: EnumCodec(GroupAssetsBy.values)),
|
2026-05-28 01:19:25 +05:30
|
|
|
timelineStorageIndicator<bool>(),
|
2026-05-13 02:53:25 +07:00
|
|
|
|
2026-05-07 22:12:14 +07:00
|
|
|
// Log
|
2026-07-22 01:53:50 +05:30
|
|
|
logLevel<LogLevel>(codec: EnumCodec(LogLevel.values)),
|
2026-05-07 23:27:06 +07:00
|
|
|
|
2026-05-12 10:43:52 +07:00
|
|
|
// Map
|
2026-05-28 01:19:25 +05:30
|
|
|
mapShowFavoriteOnly<bool>(),
|
|
|
|
|
mapRelativeDate<int>(),
|
2026-07-23 17:18:15 +02:00
|
|
|
mapCustomFrom<DateTime?>(),
|
|
|
|
|
mapCustomTo<DateTime?>(),
|
2026-05-28 01:19:25 +05:30
|
|
|
mapIncludeArchived<bool>(),
|
2026-07-22 01:53:50 +05:30
|
|
|
mapThemeMode<ThemeMode>(codec: EnumCodec(ThemeMode.values)),
|
2026-05-28 01:19:25 +05:30
|
|
|
mapWithPartners<bool>(),
|
2026-05-12 10:43:52 +07:00
|
|
|
|
2026-05-07 23:27:06 +07:00
|
|
|
// Cleanup
|
2026-05-28 01:19:25 +05:30
|
|
|
cleanupKeepFavorites<bool>(),
|
2026-07-22 01:53:50 +05:30
|
|
|
cleanupKeepMediaType<AssetKeepType>(codec: EnumCodec(AssetKeepType.values)),
|
|
|
|
|
cleanupKeepAlbumIds<List<String>>(codec: ListCodec(PrimitiveCodec.string)),
|
2026-05-28 01:19:25 +05:30
|
|
|
cleanupCutoffDaysAgo<int>(),
|
|
|
|
|
cleanupDefaultsInitialized<bool>(),
|
2026-05-15 16:12:04 -07:00
|
|
|
|
2026-06-10 09:26:09 -05:00
|
|
|
// Share
|
2026-07-22 01:53:50 +05:30
|
|
|
shareFileType<ShareAssetType>(codec: EnumCodec(ShareAssetType.values)),
|
2026-06-10 09:26:09 -05:00
|
|
|
|
2026-05-15 16:12:04 -07:00
|
|
|
// Slideshow
|
2026-05-28 01:19:25 +05:30
|
|
|
slideshowRepeat<bool>(),
|
|
|
|
|
slideshowDuration<int>(),
|
2026-07-22 01:53:50 +05:30
|
|
|
slideshowLook<SlideshowLook>(codec: EnumCodec(SlideshowLook.values)),
|
|
|
|
|
slideshowDirection<SlideshowDirection>(codec: EnumCodec(SlideshowDirection.values)),
|
2026-06-30 13:53:13 -05:00
|
|
|
|
|
|
|
|
// Feature message
|
2026-07-22 01:53:50 +05:30
|
|
|
featureMessageSeenRelease<SemVer>(codec: SemVerCodec());
|
2026-05-05 10:45:51 +07:00
|
|
|
|
2026-07-22 01:53:50 +05:30
|
|
|
final ValueCodec<T>? _codecOverride;
|
2026-05-05 10:45:51 +07:00
|
|
|
|
2026-07-22 01:53:50 +05:30
|
|
|
const SettingsKey({ValueCodec<T>? codec}) : _codecOverride = codec;
|
2026-05-05 10:45:51 +07:00
|
|
|
|
2026-07-22 01:53:50 +05:30
|
|
|
ValueCodec<T> get _codec => _codecOverride ?? ValueCodec.forType(T);
|
2026-05-05 10:45:51 +07:00
|
|
|
|
|
|
|
|
String encode(T value) => _codec.encode(value);
|
|
|
|
|
|
2026-05-28 01:19:25 +05:30
|
|
|
T decode(String raw) => _codec.decode(raw);
|
2026-05-05 10:45:51 +07:00
|
|
|
}
|