feat: Implement force sync functionality in settings screen and update initial sync logic

This commit is contained in:
2026-05-18 21:04:59 +02:00
parent da0654cd4e
commit beadf860e2
2 changed files with 206 additions and 100 deletions
+4 -2
View File
@@ -202,8 +202,9 @@ class _NotesAppState extends State<NotesApp>
// Start periodic sync
_startPeriodicSync();
// Run an initial full sync immediately to pull server changes
unawaited(_performSync(forceFull: true));
// Run an initial sync immediately and let the repository use the
// stored lastSyncAt when it exists.
unawaited(_performSync());
} catch (e) {
// If the database file is not a valid SQLite DB (e.g., wrong key or corruption),
// reset the local vault so the app doesn't crash. The reset will delete DB files
@@ -720,6 +721,7 @@ class _NotesAppState extends State<NotesApp>
key: const ValueKey<String>('settings-screen'),
onDeleteAllData: _resetLocalVaultData,
onBackToHome: _openHome,
onForceSync: () => _performSync(forceFull: true),
);
return MaterialApp(