migrate primary color

This commit is contained in:
shenlong-tanwen
2026-05-03 21:16:46 +07:00
parent 6fdb841732
commit 68a718fab4
12 changed files with 41 additions and 46 deletions
+8
View File
@@ -2,6 +2,7 @@ import 'dart:async';
import 'package:drift/drift.dart';
import 'package:flutter/material.dart';
import 'package:immich_mobile/constants/colors.dart';
import 'package:immich_mobile/domain/models/log.model.dart';
import 'package:immich_mobile/domain/models/metadata_key.dart';
import 'package:immich_mobile/domain/models/store.model.dart';
@@ -57,6 +58,13 @@ Future<void> _migrateTo26(Drift drift) async {
migrated.add(StoreKey.legacyLogLevel.id);
}
final primaryColorIndex = await _readLegacyStoreInt(drift, StoreKey.legacyPrimaryColor.id);
if (primaryColorIndex != null) {
final primaryColor = ImmichColorPreset.values.elementAtOrNull(primaryColorIndex) ?? ImmichColorPreset.indigo;
await repo.write(MetadataKey.primaryColor, primaryColor);
migrated.add(StoreKey.legacyPrimaryColor.id);
}
await _deleteLegacyStoreRows(drift, migrated);
}