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
+7
View File
@@ -125,6 +125,7 @@ class AppJsonStore {
syncedEvents: const [],
todoSuggestions: const [],
jarvisSettings: JarvisSettings.defaults(),
googleServerClientId: googleCalendarServerClientId,
);
await save(settings);
return settings;
@@ -141,6 +142,7 @@ class AppJsonStore {
syncedEvents: const [],
todoSuggestions: const [],
jarvisSettings: JarvisSettings.defaults(),
googleServerClientId: googleCalendarServerClientId,
);
}
}
@@ -161,6 +163,7 @@ class AppSettings {
required this.syncedEvents,
required this.todoSuggestions,
required this.jarvisSettings,
required this.googleServerClientId,
});
final List<Person> people;
@@ -169,6 +172,7 @@ class AppSettings {
final List<CalendarEvent> syncedEvents;
final List<String> todoSuggestions;
final JarvisSettings jarvisSettings;
final String googleServerClientId;
factory AppSettings.fromJson(Map<String, dynamic> json) {
final rawPeople = json['people'];
@@ -204,6 +208,8 @@ class AppSettings {
jarvisSettings: rawJarvisSettings is Map<String, dynamic>
? JarvisSettings.fromJson(rawJarvisSettings)
: JarvisSettings.defaults(),
googleServerClientId:
json['googleServerClientId'] as String? ?? googleCalendarServerClientId,
);
}
@@ -216,6 +222,7 @@ class AppSettings {
'syncedEvents': syncedEvents.map((event) => event.toJson()).toList(),
'todoSuggestions': todoSuggestions,
'jarvisSettings': jarvisSettings.toJson(),
'googleServerClientId': googleServerClientId,
};
}