Save user+client in Prefs and only background-fetch them on startup

This commit is contained in:
2024-06-17 22:53:03 +02:00
parent c8bc7665f7
commit 5b8a1e86e0
4 changed files with 121 additions and 28 deletions

View File

@@ -32,6 +32,19 @@ class Client {
);
}
Map<String, dynamic> toJson() {
return {
'client_id': clientID,
'user_id': userID,
'type': type,
'fcm_token': fcmToken,
'timestamp_created': timestampCreated,
'agent_model': agentModel,
'agent_version': agentVersion,
'name': name,
};
}
static List<Client> fromJsonArray(List<dynamic> jsonArr) {
return jsonArr.map<Client>((e) => Client.fromJson(e as Map<String, dynamic>)).toList();
}