feat: Add refresh token mechanism and sync request handling in home screen

This commit is contained in:
2026-05-18 20:12:52 +02:00
parent 7da87843cd
commit 75513da17d
3 changed files with 75 additions and 35 deletions
+8
View File
@@ -70,6 +70,7 @@ class _NotesAppState extends State<NotesApp>
_AppSection _currentSection = _AppSection.home;
SyncStatus _syncStatus = SyncStatus.idle;
String? _syncErrorMessage;
int _homeRefreshToken = 0;
@override
void initState() {
@@ -613,6 +614,10 @@ class _NotesAppState extends State<NotesApp>
return;
}
if (_syncStatus == SyncStatus.syncing) {
return;
}
setState(() {
_syncStatus = SyncStatus.syncing;
_syncErrorMessage = null;
@@ -634,6 +639,7 @@ class _NotesAppState extends State<NotesApp>
setState(() {
_syncStatus = SyncStatus.synced;
_syncErrorMessage = null;
_homeRefreshToken += 1;
});
// Reset to idle after 3 seconds
@@ -704,9 +710,11 @@ class _NotesAppState extends State<NotesApp>
key: const ValueKey<String>('home-screen'),
repository: repository,
onOpenSettings: _openSettings,
onRequestSync: _performSync,
onVaultInvalid: _resetLocalVaultData,
syncStatus: _syncStatus,
syncErrorMessage: _syncErrorMessage,
refreshToken: _homeRefreshToken,
)
: SettingsScreen(
key: const ValueKey<String>('settings-screen'),