Cache Jarvis app config on startup

This commit is contained in:
zsolt
2026-08-13 02:28:02 +02:00
parent eb3d7cd446
commit 0cde10d2c7
4 changed files with 81 additions and 4 deletions
+8 -4
View File
@@ -7,6 +7,7 @@ class AccountsPage extends StatefulWidget {
required this.cachedEvents,
required this.people,
required this.jarvisSettings,
required this.serverClientId,
required this.onChanged,
required this.onSyncedEventsChanged,
});
@@ -15,6 +16,7 @@ class AccountsPage extends StatefulWidget {
final List<CalendarEvent> cachedEvents;
final List<Person> people;
final JarvisSettings jarvisSettings;
final String serverClientId;
final ValueChanged<List<GoogleCalendarConnection>> onChanged;
final ValueChanged<List<CalendarEvent>> onSyncedEventsChanged;
@@ -51,9 +53,10 @@ class _AccountsPageState extends State<AccountsPage> {
statusMessage = 'Google napt\u00e1rkapcsolat el\u0151k\u00e9sz\u00edt\u00e9se...';
});
final configuredClientId = await _loadGoogleServerClientId();
runtimeServerClientId = widget.serverClientId.trim().isNotEmpty
? widget.serverClientId.trim()
: await _loadGoogleServerClientId();
if (!mounted) return;
runtimeServerClientId = configuredClientId?.trim();
await _initializeGoogle();
}
@@ -147,8 +150,9 @@ class _AccountsPageState extends State<AccountsPage> {
try {
if (!initialized) {
final configuredClientId = await _loadGoogleServerClientId();
runtimeServerClientId = configuredClientId?.trim();
runtimeServerClientId = widget.serverClientId.trim().isNotEmpty
? widget.serverClientId.trim()
: await _loadGoogleServerClientId();
await _ensureGoogleInitialized();
initialized = true;
}