From 2fecf4c2338c7fe610a321d7f7f10130a5972b9f Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Mon, 14 Oct 2019 13:20:03 +0000 Subject: [PATCH] [ContactList] Get list from rooms --- lib/src/Client.dart | 11 +++++++++-- pubspec.lock | 13 ++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/lib/src/Client.dart b/lib/src/Client.dart index b0f4b7e..9a68d9c 100644 --- a/lib/src/Client.dart +++ b/lib/src/Client.dart @@ -298,8 +298,15 @@ class Client { .getRoomByAlias("#famedlyContactDiscovery:${userID.split(":")[1]}"); if (contactDiscoveryRoom != null) contacts = await contactDiscoveryRoom.requestParticipants(); - else - contacts = await store?.loadContacts(); + else { + Map userMap = {}; + for (int i = 0; i < roomList.rooms.length; i++) { + List 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; } diff --git a/pubspec.lock b/pubspec.lock index effcc1e..976f101 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -113,6 +113,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.1" + coverage: + dependency: transitive + description: + name: coverage + url: "https://pub.dartlang.org" + source: hosted + version: "0.13.3" crypto: dependency: transitive description: @@ -427,7 +434,7 @@ packages: name: test url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.9.1" test_api: dependency: transitive description: @@ -441,7 +448,7 @@ packages: name: test_core url: "https://pub.dartlang.org" source: hosted - version: "0.2.10" + version: "0.2.12" timing: dependency: transitive description: @@ -462,7 +469,7 @@ packages: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "1.2.0" watcher: dependency: transitive description: