Cache Jarvis app config on startup
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user