From dd5814cd586c440e23232e923439afbdfb889326 Mon Sep 17 00:00:00 2001
From: Christian <christian-pauly@posteo.de>
Date: Fri, 26 Jul 2019 14:07:29 +0000
Subject: [PATCH] [ContactList] Fallback with old loadContacts

---
 lib/src/Client.dart | 6 +++++-
 lib/src/Store.dart  | 1 -
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/src/Client.dart b/lib/src/Client.dart
index 38fdc14..9b12501 100644
--- a/lib/src/Client.dart
+++ b/lib/src/Client.dart
@@ -224,9 +224,13 @@ class Client {
   /// the famedlyContactDiscovery room, which is
   /// defined by the autojoin room feature in Synapse.
   Future<List<User>> loadFamedlyContacts() async {
+    List<User> contacts = [];
     Room contactDiscoveryRoom = await store
         .getRoomByAlias("#famedlyContactDiscovery:${userID.split(":")[1]}");
-    List<User> contacts = await contactDiscoveryRoom.requestParticipants();
+    if (contactDiscoveryRoom != null)
+      contacts = await contactDiscoveryRoom.requestParticipants();
+    else
+      contacts = await store.loadContacts();
     return contacts;
   }
 
diff --git a/lib/src/Store.dart b/lib/src/Store.dart
index 45b3a28..6bc7c81 100644
--- a/lib/src/Store.dart
+++ b/lib/src/Store.dart
@@ -458,7 +458,6 @@ class Store {
 
   /// Loads all Users in the database to provide a contact list
   /// except users who are in the Room with the ID [exceptRoomID].
-  @deprecated
   Future<List<User>> loadContacts({String exceptRoomID = ""}) async {
     List<Map<String, dynamic>> res = await db.rawQuery(
         "SELECT * FROM Users WHERE matrix_id!=? AND chat_id!=? GROUP BY matrix_id ORDER BY displayname",