feat(mobile): use efficient sync (#8842)

* feat(mobile): use efficient sync

review feedback

* adapt to changed  server endpoints

* formatting

* fix memory lane bug

* fix: bad merge

* fix call not returning correct number of asset

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
Fynn Petersen-Frey 2024-05-14 17:35:37 +02:00 committed by GitHub
parent acc611a3d9
commit 116043b2b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 185 additions and 125 deletions

View file

@ -70,7 +70,7 @@ class UserService {
}
}
Future<bool> refreshUsers() async {
Future<List<User>?> getUsersFromServer() async {
final List<User>? users = await _getAllUsers(isAll: true);
final List<User>? sharedBy =
await _partnerService.getPartners(PartnerDirection.sharedBy);
@ -79,7 +79,7 @@ class UserService {
if (users == null || sharedBy == null || sharedWith == null) {
_log.warning("Failed to refresh users");
return false;
return null;
}
users.sortBy((u) => u.id);
@ -108,6 +108,12 @@ class UserService {
onlySecond: (_) {},
);
return users;
}
Future<bool> refreshUsers() async {
final users = await getUsersFromServer();
if (users == null) return false;
return _syncService.syncUsersFromServer(users);
}
}