chore: reset remote sync on app update (#23969)

reset remote sync on update

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong
2025-11-19 08:25:01 +05:30
committed by GitHub
parent d310c6f3cd
commit 38d4d1a573
7 changed files with 22 additions and 22 deletions

View File

@@ -29,7 +29,7 @@ import 'package:isar/isar.dart';
// ignore: import_rule_photo_manager
import 'package:photo_manager/photo_manager.dart';
const int targetVersion = 17;
const int targetVersion = 18;
Future<void> migrateDatabaseIfNeeded(Isar db, Drift drift) async {
final hasVersion = Store.tryGet(StoreKey.version) != null;
@@ -63,7 +63,8 @@ Future<void> migrateDatabaseIfNeeded(Isar db, Drift drift) async {
await Store.populateCache();
}
await handleBetaMigration(version, await _isNewInstallation(db, drift), SyncStreamRepository(drift));
final syncStreamRepository = SyncStreamRepository(drift);
await handleBetaMigration(version, await _isNewInstallation(db, drift), syncStreamRepository);
if (version < 17 && Store.isBetaTimelineEnabled) {
final delay = Store.get(StoreKey.backupTriggerDelay, AppSettingsEnum.backupTriggerDelay.defaultValue);
@@ -72,6 +73,11 @@ Future<void> migrateDatabaseIfNeeded(Isar db, Drift drift) async {
}
}
if (version < 18 && Store.isBetaTimelineEnabled) {
await syncStreamRepository.reset();
await Store.put(StoreKey.shouldResetSync, true);
}
if (targetVersion >= 12) {
await Store.put(StoreKey.version, targetVersion);
return;