mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
refactor: move map config to metadata table (#28226)
* refactor: app metadata * refactor to per row store * cleanup * more test * review changes * more refactor * refactor * migrate primary color * migrate dynamic theme * migrate colorfulInterface * cleanup providers * migrate cleanup * migrate mapconfig --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
@@ -1,22 +1,25 @@
|
|||||||
import 'package:immich_mobile/domain/models/config/cleanup_config.dart';
|
import 'package:immich_mobile/domain/models/config/cleanup_config.dart';
|
||||||
|
import 'package:immich_mobile/domain/models/config/map_config.dart';
|
||||||
import 'package:immich_mobile/domain/models/config/theme_config.dart';
|
import 'package:immich_mobile/domain/models/config/theme_config.dart';
|
||||||
|
|
||||||
class AppConfig {
|
class AppConfig {
|
||||||
final ThemeConfig theme;
|
final ThemeConfig theme;
|
||||||
final CleanupConfig cleanup;
|
final CleanupConfig cleanup;
|
||||||
|
final MapConfig map;
|
||||||
|
|
||||||
const AppConfig({this.theme = const .new(), this.cleanup = const .new()});
|
const AppConfig({this.theme = const .new(), this.cleanup = const .new(), this.map = const .new()});
|
||||||
|
|
||||||
AppConfig copyWith({ThemeConfig? theme, CleanupConfig? cleanup}) =>
|
AppConfig copyWith({ThemeConfig? theme, CleanupConfig? cleanup, MapConfig? map}) =>
|
||||||
.new(theme: theme ?? this.theme, cleanup: cleanup ?? this.cleanup);
|
.new(theme: theme ?? this.theme, cleanup: cleanup ?? this.cleanup, map: map ?? this.map);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) =>
|
bool operator ==(Object other) =>
|
||||||
identical(this, other) || (other is AppConfig && other.theme == theme && other.cleanup == cleanup);
|
identical(this, other) ||
|
||||||
|
(other is AppConfig && other.theme == theme && other.cleanup == cleanup && other.map == map);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(theme, cleanup);
|
int get hashCode => Object.hash(theme, cleanup, map);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'AppConfig(theme: $theme, cleanup: $cleanup)';
|
String toString() => 'AppConfig(theme: $theme, cleanup: $cleanup, map: $map)';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class MapConfig {
|
||||||
|
final int relativeDays;
|
||||||
|
final bool favoritesOnly;
|
||||||
|
final bool includeArchived;
|
||||||
|
final ThemeMode themeMode;
|
||||||
|
final bool withPartners;
|
||||||
|
|
||||||
|
const MapConfig({
|
||||||
|
this.relativeDays = 0,
|
||||||
|
this.favoritesOnly = false,
|
||||||
|
this.includeArchived = false,
|
||||||
|
this.themeMode = ThemeMode.system,
|
||||||
|
this.withPartners = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
MapConfig copyWith({
|
||||||
|
int? relativeDays,
|
||||||
|
bool? favoritesOnly,
|
||||||
|
bool? includeArchived,
|
||||||
|
ThemeMode? themeMode,
|
||||||
|
bool? withPartners,
|
||||||
|
}) => MapConfig(
|
||||||
|
relativeDays: relativeDays ?? this.relativeDays,
|
||||||
|
favoritesOnly: favoritesOnly ?? this.favoritesOnly,
|
||||||
|
includeArchived: includeArchived ?? this.includeArchived,
|
||||||
|
themeMode: themeMode ?? this.themeMode,
|
||||||
|
withPartners: withPartners ?? this.withPartners,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
(other is MapConfig &&
|
||||||
|
other.relativeDays == relativeDays &&
|
||||||
|
other.favoritesOnly == favoritesOnly &&
|
||||||
|
other.includeArchived == includeArchived &&
|
||||||
|
other.themeMode == themeMode &&
|
||||||
|
other.withPartners == withPartners);
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(relativeDays, favoritesOnly, includeArchived, themeMode, withPartners);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() =>
|
||||||
|
'MapConfig(relativeDays: $relativeDays, favoritesOnly: $favoritesOnly, includeArchived: $includeArchived, themeMode: $themeMode, withPartners: $withPartners)';
|
||||||
|
}
|
||||||
@@ -26,6 +26,13 @@ enum MetadataKey<T extends Object> {
|
|||||||
// Log
|
// Log
|
||||||
logLevel<LogLevel>(.systemConfig, 'log.level', .info, _EnumCodec(LogLevel.values)),
|
logLevel<LogLevel>(.systemConfig, 'log.level', .info, _EnumCodec(LogLevel.values)),
|
||||||
|
|
||||||
|
// Map
|
||||||
|
mapShowFavoriteOnly<bool>(.appConfig, 'map.showFavoriteOnly', false),
|
||||||
|
mapRelativeDate<int>(.appConfig, 'map.relativeDate', 0),
|
||||||
|
mapIncludeArchived<bool>(.appConfig, 'map.includeArchived', false),
|
||||||
|
mapThemeMode<ThemeMode>(.appConfig, 'map.themeMode', .system, _EnumCodec(ThemeMode.values)),
|
||||||
|
mapWithPartners<bool>(.appConfig, 'map.withPartners', false),
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
cleanupKeepFavorites<bool>(.appConfig, 'cleanup.keepFavorites', true),
|
cleanupKeepFavorites<bool>(.appConfig, 'cleanup.keepFavorites', true),
|
||||||
cleanupKeepMediaType<AssetKeepType>(
|
cleanupKeepMediaType<AssetKeepType>(
|
||||||
|
|||||||
@@ -36,15 +36,9 @@ enum StoreKey<T> {
|
|||||||
advancedTroubleshooting<bool>._(114),
|
advancedTroubleshooting<bool>._(114),
|
||||||
preferRemoteImage<bool>._(116),
|
preferRemoteImage<bool>._(116),
|
||||||
loopVideo<bool>._(117),
|
loopVideo<bool>._(117),
|
||||||
// map related settings
|
|
||||||
mapShowFavoriteOnly<bool>._(118),
|
|
||||||
mapRelativeDate<int>._(119),
|
|
||||||
selfSignedCert<bool>._(120),
|
selfSignedCert<bool>._(120),
|
||||||
mapIncludeArchived<bool>._(121),
|
|
||||||
ignoreIcloudAssets<bool>._(122),
|
ignoreIcloudAssets<bool>._(122),
|
||||||
selectedAlbumSortReverse<bool>._(123),
|
selectedAlbumSortReverse<bool>._(123),
|
||||||
mapThemeMode<int>._(124),
|
|
||||||
mapwithPartners<bool>._(125),
|
|
||||||
enableHapticFeedback<bool>._(126),
|
enableHapticFeedback<bool>._(126),
|
||||||
customHeaders<String>._(127),
|
customHeaders<String>._(127),
|
||||||
|
|
||||||
@@ -93,6 +87,11 @@ enum StoreKey<T> {
|
|||||||
legacyCleanupKeepAlbumIds<String>._(1010),
|
legacyCleanupKeepAlbumIds<String>._(1010),
|
||||||
legacyCleanupCutoffDaysAgo<int>._(1011),
|
legacyCleanupCutoffDaysAgo<int>._(1011),
|
||||||
legacyCleanupDefaultsInitialized<bool>._(1012),
|
legacyCleanupDefaultsInitialized<bool>._(1012),
|
||||||
|
legacyMapRelativeDate<int>._(119),
|
||||||
|
legacyMapShowFavoriteOnly<bool>._(118),
|
||||||
|
legacyMapIncludeArchived<bool>._(121),
|
||||||
|
legacyMapThemeMode<int>._(124),
|
||||||
|
legacyMapwithPartners<bool>._(125),
|
||||||
legacyLogLevel<int>._(115);
|
legacyLogLevel<int>._(115);
|
||||||
|
|
||||||
const StoreKey._(this.id);
|
const StoreKey._(this.id);
|
||||||
|
|||||||
@@ -120,6 +120,13 @@ extension<T extends Object> on MetadataDomain<T> {
|
|||||||
cutoffDaysAgo: repo._read(.cleanupCutoffDaysAgo),
|
cutoffDaysAgo: repo._read(.cleanupCutoffDaysAgo),
|
||||||
defaultsInitialized: repo._read(.cleanupDefaultsInitialized),
|
defaultsInitialized: repo._read(.cleanupDefaultsInitialized),
|
||||||
),
|
),
|
||||||
|
map: .new(
|
||||||
|
relativeDays: repo._read(.mapRelativeDate),
|
||||||
|
favoritesOnly: repo._read(.mapShowFavoriteOnly),
|
||||||
|
includeArchived: repo._read(.mapIncludeArchived),
|
||||||
|
themeMode: repo._read(.mapThemeMode),
|
||||||
|
withPartners: repo._read(.mapWithPartners),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
case .systemConfig:
|
case .systemConfig:
|
||||||
repo._systemConfig = .new(logLevel: repo._read(.logLevel));
|
repo._systemConfig = .new(logLevel: repo._read(.logLevel));
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/domain/models/events.model.dart';
|
import 'package:immich_mobile/domain/models/events.model.dart';
|
||||||
|
import 'package:immich_mobile/domain/models/metadata_key.dart';
|
||||||
import 'package:immich_mobile/domain/utils/event_stream.dart';
|
import 'package:immich_mobile/domain/utils/event_stream.dart';
|
||||||
import 'package:immich_mobile/infrastructure/repositories/timeline.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/timeline.repository.dart';
|
||||||
import 'package:immich_mobile/providers/app_settings.provider.dart';
|
|
||||||
import 'package:immich_mobile/providers/infrastructure/map.provider.dart';
|
import 'package:immich_mobile/providers/infrastructure/map.provider.dart';
|
||||||
|
import 'package:immich_mobile/providers/infrastructure/metadata.provider.dart';
|
||||||
import 'package:immich_mobile/providers/map/map_state.provider.dart';
|
import 'package:immich_mobile/providers/map/map_state.provider.dart';
|
||||||
import 'package:immich_mobile/services/app_settings.service.dart';
|
|
||||||
import 'package:maplibre_gl/maplibre_gl.dart';
|
import 'package:maplibre_gl/maplibre_gl.dart';
|
||||||
|
|
||||||
class MapState {
|
class MapState {
|
||||||
@@ -81,38 +81,38 @@ class MapStateNotifier extends Notifier<MapState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void switchFavoriteOnly(bool isFavoriteOnly) {
|
void switchFavoriteOnly(bool isFavoriteOnly) {
|
||||||
ref.read(appSettingsServiceProvider).setSetting(AppSettingsEnum.mapShowFavoriteOnly, isFavoriteOnly);
|
ref.read(metadataProvider).write(MetadataKey.mapShowFavoriteOnly, isFavoriteOnly);
|
||||||
state = state.copyWith(onlyFavorites: isFavoriteOnly);
|
state = state.copyWith(onlyFavorites: isFavoriteOnly);
|
||||||
EventStream.shared.emit(const MapMarkerReloadEvent());
|
EventStream.shared.emit(const MapMarkerReloadEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
void switchIncludeArchived(bool isIncludeArchived) {
|
void switchIncludeArchived(bool isIncludeArchived) {
|
||||||
ref.read(appSettingsServiceProvider).setSetting(AppSettingsEnum.mapIncludeArchived, isIncludeArchived);
|
ref.read(metadataProvider).write(MetadataKey.mapIncludeArchived, isIncludeArchived);
|
||||||
state = state.copyWith(includeArchived: isIncludeArchived);
|
state = state.copyWith(includeArchived: isIncludeArchived);
|
||||||
EventStream.shared.emit(const MapMarkerReloadEvent());
|
EventStream.shared.emit(const MapMarkerReloadEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
void switchWithPartners(bool isWithPartners) {
|
void switchWithPartners(bool isWithPartners) {
|
||||||
ref.read(appSettingsServiceProvider).setSetting(AppSettingsEnum.mapwithPartners, isWithPartners);
|
ref.read(metadataProvider).write(MetadataKey.mapWithPartners, isWithPartners);
|
||||||
state = state.copyWith(withPartners: isWithPartners);
|
state = state.copyWith(withPartners: isWithPartners);
|
||||||
EventStream.shared.emit(const MapMarkerReloadEvent());
|
EventStream.shared.emit(const MapMarkerReloadEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
void setRelativeTime(int relativeDays) {
|
void setRelativeTime(int relativeDays) {
|
||||||
ref.read(appSettingsServiceProvider).setSetting(AppSettingsEnum.mapRelativeDate, relativeDays);
|
ref.read(metadataProvider).write(MetadataKey.mapRelativeDate, relativeDays);
|
||||||
state = state.copyWith(relativeDays: relativeDays);
|
state = state.copyWith(relativeDays: relativeDays);
|
||||||
EventStream.shared.emit(const MapMarkerReloadEvent());
|
EventStream.shared.emit(const MapMarkerReloadEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
MapState build() {
|
MapState build() {
|
||||||
final appSettingsService = ref.read(appSettingsServiceProvider);
|
final mapConfig = ref.read(appConfigProvider.select((config) => config.map));
|
||||||
return MapState(
|
return MapState(
|
||||||
themeMode: ThemeMode.values[appSettingsService.getSetting(AppSettingsEnum.mapThemeMode)],
|
themeMode: mapConfig.themeMode,
|
||||||
onlyFavorites: appSettingsService.getSetting(AppSettingsEnum.mapShowFavoriteOnly),
|
onlyFavorites: mapConfig.favoritesOnly,
|
||||||
includeArchived: appSettingsService.getSetting(AppSettingsEnum.mapIncludeArchived),
|
includeArchived: mapConfig.includeArchived,
|
||||||
withPartners: appSettingsService.getSetting(AppSettingsEnum.mapwithPartners),
|
withPartners: mapConfig.withPartners,
|
||||||
relativeDays: appSettingsService.getSetting(AppSettingsEnum.mapRelativeDate),
|
relativeDays: mapConfig.relativeDays,
|
||||||
bounds: LatLngBounds(northeast: const LatLng(0, 0), southwest: const LatLng(0, 0)),
|
bounds: LatLngBounds(northeast: const LatLng(0, 0), southwest: const LatLng(0, 0)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,38 +1,38 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:immich_mobile/domain/models/metadata_key.dart';
|
||||||
import 'package:immich_mobile/models/map/map_state.model.dart';
|
import 'package:immich_mobile/models/map/map_state.model.dart';
|
||||||
import 'package:immich_mobile/providers/app_settings.provider.dart';
|
import 'package:immich_mobile/providers/infrastructure/metadata.provider.dart';
|
||||||
import 'package:immich_mobile/providers/server_info.provider.dart';
|
import 'package:immich_mobile/providers/server_info.provider.dart';
|
||||||
import 'package:immich_mobile/services/app_settings.service.dart';
|
|
||||||
|
|
||||||
final mapStateNotifierProvider = NotifierProvider<MapStateNotifier, MapState>(MapStateNotifier.new);
|
final mapStateNotifierProvider = NotifierProvider<MapStateNotifier, MapState>(MapStateNotifier.new);
|
||||||
|
|
||||||
class MapStateNotifier extends Notifier<MapState> {
|
class MapStateNotifier extends Notifier<MapState> {
|
||||||
@override
|
@override
|
||||||
MapState build() {
|
MapState build() {
|
||||||
final appSettingsProvider = ref.read(appSettingsServiceProvider);
|
final mapConfig = ref.read(appConfigProvider.select((config) => config.map));
|
||||||
|
|
||||||
final lightStyleUrl = ref.read(serverInfoProvider).serverConfig.mapLightStyleUrl;
|
final lightStyleUrl = ref.read(serverInfoProvider).serverConfig.mapLightStyleUrl;
|
||||||
final darkStyleUrl = ref.read(serverInfoProvider).serverConfig.mapDarkStyleUrl;
|
final darkStyleUrl = ref.read(serverInfoProvider).serverConfig.mapDarkStyleUrl;
|
||||||
|
|
||||||
return MapState(
|
return MapState(
|
||||||
themeMode: ThemeMode.values[appSettingsProvider.getSetting<int>(AppSettingsEnum.mapThemeMode)],
|
themeMode: mapConfig.themeMode,
|
||||||
showFavoriteOnly: appSettingsProvider.getSetting<bool>(AppSettingsEnum.mapShowFavoriteOnly),
|
showFavoriteOnly: mapConfig.favoritesOnly,
|
||||||
includeArchived: appSettingsProvider.getSetting<bool>(AppSettingsEnum.mapIncludeArchived),
|
includeArchived: mapConfig.includeArchived,
|
||||||
withPartners: appSettingsProvider.getSetting<bool>(AppSettingsEnum.mapwithPartners),
|
withPartners: mapConfig.withPartners,
|
||||||
relativeTime: appSettingsProvider.getSetting<int>(AppSettingsEnum.mapRelativeDate),
|
relativeTime: mapConfig.relativeDays,
|
||||||
lightStyleFetched: AsyncData(lightStyleUrl),
|
lightStyleFetched: AsyncData(lightStyleUrl),
|
||||||
darkStyleFetched: AsyncData(darkStyleUrl),
|
darkStyleFetched: AsyncData(darkStyleUrl),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void switchTheme(ThemeMode mode) {
|
void switchTheme(ThemeMode mode) {
|
||||||
ref.read(appSettingsServiceProvider).setSetting(AppSettingsEnum.mapThemeMode, mode.index);
|
ref.read(metadataProvider).write(MetadataKey.mapThemeMode, mode);
|
||||||
state = state.copyWith(themeMode: mode);
|
state = state.copyWith(themeMode: mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void switchFavoriteOnly(bool isFavoriteOnly) {
|
void switchFavoriteOnly(bool isFavoriteOnly) {
|
||||||
ref.read(appSettingsServiceProvider).setSetting(AppSettingsEnum.mapShowFavoriteOnly, isFavoriteOnly);
|
ref.read(metadataProvider).write(MetadataKey.mapShowFavoriteOnly, isFavoriteOnly);
|
||||||
state = state.copyWith(showFavoriteOnly: isFavoriteOnly, shouldRefetchMarkers: true);
|
state = state.copyWith(showFavoriteOnly: isFavoriteOnly, shouldRefetchMarkers: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,17 +41,17 @@ class MapStateNotifier extends Notifier<MapState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void switchIncludeArchived(bool isIncludeArchived) {
|
void switchIncludeArchived(bool isIncludeArchived) {
|
||||||
ref.read(appSettingsServiceProvider).setSetting(AppSettingsEnum.mapIncludeArchived, isIncludeArchived);
|
ref.read(metadataProvider).write(MetadataKey.mapIncludeArchived, isIncludeArchived);
|
||||||
state = state.copyWith(includeArchived: isIncludeArchived, shouldRefetchMarkers: true);
|
state = state.copyWith(includeArchived: isIncludeArchived, shouldRefetchMarkers: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void switchWithPartners(bool isWithPartners) {
|
void switchWithPartners(bool isWithPartners) {
|
||||||
ref.read(appSettingsServiceProvider).setSetting(AppSettingsEnum.mapwithPartners, isWithPartners);
|
ref.read(metadataProvider).write(MetadataKey.mapWithPartners, isWithPartners);
|
||||||
state = state.copyWith(withPartners: isWithPartners, shouldRefetchMarkers: true);
|
state = state.copyWith(withPartners: isWithPartners, shouldRefetchMarkers: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setRelativeTime(int relativeTime) {
|
void setRelativeTime(int relativeTime) {
|
||||||
ref.read(appSettingsServiceProvider).setSetting(AppSettingsEnum.mapRelativeDate, relativeTime);
|
ref.read(metadataProvider).write(MetadataKey.mapRelativeDate, relativeTime);
|
||||||
state = state.copyWith(relativeTime: relativeTime, shouldRefetchMarkers: true);
|
state = state.copyWith(relativeTime: relativeTime, shouldRefetchMarkers: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,11 +30,6 @@ enum AppSettingsEnum<T> {
|
|||||||
loadOriginalVideo<bool>(StoreKey.loadOriginalVideo, "loadOriginalVideo", false),
|
loadOriginalVideo<bool>(StoreKey.loadOriginalVideo, "loadOriginalVideo", false),
|
||||||
autoPlayVideo<bool>(StoreKey.autoPlayVideo, "autoPlayVideo", true),
|
autoPlayVideo<bool>(StoreKey.autoPlayVideo, "autoPlayVideo", true),
|
||||||
tapToNavigate<bool>(StoreKey.tapToNavigate, "tapToNavigate", false),
|
tapToNavigate<bool>(StoreKey.tapToNavigate, "tapToNavigate", false),
|
||||||
mapThemeMode<int>(StoreKey.mapThemeMode, null, 0),
|
|
||||||
mapShowFavoriteOnly<bool>(StoreKey.mapShowFavoriteOnly, null, false),
|
|
||||||
mapIncludeArchived<bool>(StoreKey.mapIncludeArchived, null, false),
|
|
||||||
mapwithPartners<bool>(StoreKey.mapwithPartners, null, false),
|
|
||||||
mapRelativeDate<int>(StoreKey.mapRelativeDate, null, 0),
|
|
||||||
allowSelfSignedSSLCert<bool>(StoreKey.selfSignedCert, null, false),
|
allowSelfSignedSSLCert<bool>(StoreKey.selfSignedCert, null, false),
|
||||||
ignoreIcloudAssets<bool>(StoreKey.ignoreIcloudAssets, null, false),
|
ignoreIcloudAssets<bool>(StoreKey.ignoreIcloudAssets, null, false),
|
||||||
selectedAlbumSortReverse<bool>(StoreKey.selectedAlbumSortReverse, null, true),
|
selectedAlbumSortReverse<bool>(StoreKey.selectedAlbumSortReverse, null, true),
|
||||||
|
|||||||
@@ -46,11 +46,13 @@ Future<void> _migrateTo25() async {
|
|||||||
|
|
||||||
Future<void> _migrateTo26(Drift drift) async {
|
Future<void> _migrateTo26(Drift drift) async {
|
||||||
final migrator = _StoreMigrator(drift);
|
final migrator = _StoreMigrator(drift);
|
||||||
await migrator.migrateEnumName(StoreKey.legacyThemeMode, MetadataKey.themeMode, ThemeMode.values);
|
|
||||||
await migrator.migrateEnumIndex(StoreKey.legacyLogLevel, MetadataKey.logLevel, LogLevel.values);
|
await migrator.migrateEnumIndex(StoreKey.legacyLogLevel, MetadataKey.logLevel, LogLevel.values);
|
||||||
|
// Theme
|
||||||
|
await migrator.migrateEnumName(StoreKey.legacyThemeMode, MetadataKey.themeMode, ThemeMode.values);
|
||||||
await migrator.migrateEnumName(StoreKey.legacyPrimaryColor, MetadataKey.themePrimaryColor, ImmichColorPreset.values);
|
await migrator.migrateEnumName(StoreKey.legacyPrimaryColor, MetadataKey.themePrimaryColor, ImmichColorPreset.values);
|
||||||
await migrator.migrateBool(StoreKey.legacyDynamicTheme, MetadataKey.themeDynamic);
|
await migrator.migrateBool(StoreKey.legacyDynamicTheme, MetadataKey.themeDynamic);
|
||||||
await migrator.migrateBool(StoreKey.legacyColorfulInterface, MetadataKey.themeColorfulInterface);
|
await migrator.migrateBool(StoreKey.legacyColorfulInterface, MetadataKey.themeColorfulInterface);
|
||||||
|
// Cleanup
|
||||||
final cleanupKeepAlbumIds = await migrator.readLegacyStoreString(StoreKey.legacyCleanupKeepAlbumIds.id);
|
final cleanupKeepAlbumIds = await migrator.readLegacyStoreString(StoreKey.legacyCleanupKeepAlbumIds.id);
|
||||||
if (cleanupKeepAlbumIds != null) {
|
if (cleanupKeepAlbumIds != null) {
|
||||||
final ids = cleanupKeepAlbumIds.split(',').where((id) => id.isNotEmpty).toList();
|
final ids = cleanupKeepAlbumIds.split(',').where((id) => id.isNotEmpty).toList();
|
||||||
@@ -71,6 +73,12 @@ Future<void> _migrateTo26(Drift drift) async {
|
|||||||
);
|
);
|
||||||
await migrator.migrateInt(StoreKey.legacyCleanupCutoffDaysAgo, MetadataKey.cleanupCutoffDaysAgo);
|
await migrator.migrateInt(StoreKey.legacyCleanupCutoffDaysAgo, MetadataKey.cleanupCutoffDaysAgo);
|
||||||
await migrator.migrateBool(StoreKey.legacyCleanupDefaultsInitialized, MetadataKey.cleanupDefaultsInitialized);
|
await migrator.migrateBool(StoreKey.legacyCleanupDefaultsInitialized, MetadataKey.cleanupDefaultsInitialized);
|
||||||
|
// Map
|
||||||
|
await migrator.migrateBool(StoreKey.legacyMapShowFavoriteOnly, MetadataKey.mapShowFavoriteOnly);
|
||||||
|
await migrator.migrateInt(StoreKey.legacyMapRelativeDate, MetadataKey.mapRelativeDate);
|
||||||
|
await migrator.migrateBool(StoreKey.legacyMapIncludeArchived, MetadataKey.mapIncludeArchived);
|
||||||
|
await migrator.migrateEnumIndex(StoreKey.legacyMapThemeMode, MetadataKey.mapThemeMode, ThemeMode.values);
|
||||||
|
await migrator.migrateBool(StoreKey.legacyMapwithPartners, MetadataKey.mapWithPartners);
|
||||||
await migrator.complete();
|
await migrator.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user