fix: enable photo manager custom filter by default (#19520)

enable photo manager custom filter by default

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong 2025-06-26 07:58:17 +05:30 committed by GitHub
parent fda22c83b9
commit 24a4cba953
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 8 deletions

View file

@ -23,7 +23,7 @@ import 'package:isar/isar.dart';
// ignore: import_rule_photo_manager
import 'package:photo_manager/photo_manager.dart';
const int targetVersion = 12;
const int targetVersion = 13;
Future<void> migrateDatabaseIfNeeded(Isar db) async {
final int version = Store.get(StoreKey.version, targetVersion);
@ -56,14 +56,18 @@ Future<void> migrateDatabaseIfNeeded(Isar db) async {
await drift.close();
}
if (version < 13) {
await Store.put(StoreKey.photoManagerCustomFilter, true);
}
if (targetVersion >= 12) {
await Store.put(StoreKey.version, targetVersion);
return;
}
final shouldTruncate = version < 8 || version < targetVersion;
if (shouldTruncate) {
if (targetVersion == 12) {
await Store.put(StoreKey.version, targetVersion);
return;
}
await _migrateTo(db, targetVersion);
}
}