Merge branch 'contactlist-enhance-get-from-rooms' into 'master'

[ContactList] Get list from rooms

See merge request famedly/famedlysdk!97
This commit is contained in:
Christian Pauly 2019-10-14 13:20:05 +00:00
commit 95f95ad976
2 changed files with 19 additions and 5 deletions

View file

@ -298,8 +298,15 @@ class Client {
.getRoomByAlias("#famedlyContactDiscovery:${userID.split(":")[1]}"); .getRoomByAlias("#famedlyContactDiscovery:${userID.split(":")[1]}");
if (contactDiscoveryRoom != null) if (contactDiscoveryRoom != null)
contacts = await contactDiscoveryRoom.requestParticipants(); contacts = await contactDiscoveryRoom.requestParticipants();
else else {
contacts = await store?.loadContacts(); Map<String, User> userMap = {};
for (int i = 0; i < roomList.rooms.length; i++) {
List<User> roomUsers = roomList.rooms[i].getParticipants();
for (int j = 0; j < roomUsers.length; j++)
userMap[roomUsers[i].id] = roomUsers[i];
}
userMap.forEach((String id, User user) => contacts.add(user));
}
return contacts; return contacts;
} }

View file

@ -113,6 +113,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.1" version: "2.1.1"
coverage:
dependency: transitive
description:
name: coverage
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.3"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
@ -427,7 +434,7 @@ packages:
name: test name: test
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" version: "1.9.1"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
@ -441,7 +448,7 @@ packages:
name: test_core name: test_core
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.10" version: "0.2.12"
timing: timing:
dependency: transitive dependency: transitive
description: description:
@ -462,7 +469,7 @@ packages:
name: vm_service name: vm_service
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.1" version: "1.2.0"
watcher: watcher:
dependency: transitive dependency: transitive
description: description: