Merge branch 'ChristianPauly-master-patch-10645' into 'master'
Remove deprecated contactlist method See merge request famedly/famedlysdk!378
This commit is contained in:
commit
e88e60ec09
|
@ -446,29 +446,6 @@ class Client {
|
||||||
return archiveList;
|
return archiveList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Loads the contact list for this user excluding the user itself.
|
|
||||||
/// Currently the contacts are found by discovering the contacts of
|
|
||||||
/// the famedlyContactDiscovery room, which is
|
|
||||||
/// defined by the autojoin room feature in Synapse.
|
|
||||||
Future<List<User>> loadFamedlyContacts() async {
|
|
||||||
var contacts = <User>[];
|
|
||||||
var contactDiscoveryRoom =
|
|
||||||
getRoomByAlias('#famedlyContactDiscovery:${userID.domain}');
|
|
||||||
if (contactDiscoveryRoom != null) {
|
|
||||||
contacts = await contactDiscoveryRoom.requestParticipants();
|
|
||||||
} else {
|
|
||||||
var userMap = <String, bool>{};
|
|
||||||
for (var i = 0; i < rooms.length; i++) {
|
|
||||||
var roomUsers = rooms[i].getParticipants();
|
|
||||||
for (var j = 0; j < roomUsers.length; j++) {
|
|
||||||
if (userMap[roomUsers[j].id] != true) contacts.add(roomUsers[j]);
|
|
||||||
userMap[roomUsers[j].id] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return contacts;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Changes the user's displayname.
|
/// Changes the user's displayname.
|
||||||
Future<void> setDisplayname(String displayname) =>
|
Future<void> setDisplayname(String displayname) =>
|
||||||
api.setDisplayname(userID, displayname);
|
api.setDisplayname(userID, displayname);
|
||||||
|
|
|
@ -151,9 +151,6 @@ void main() {
|
||||||
expect(matrix.rooms.length, 2);
|
expect(matrix.rooms.length, 2);
|
||||||
expect(matrix.rooms[1].canonicalAlias,
|
expect(matrix.rooms[1].canonicalAlias,
|
||||||
"#famedlyContactDiscovery:${matrix.userID.split(":")[1]}");
|
"#famedlyContactDiscovery:${matrix.userID.split(":")[1]}");
|
||||||
final contacts = await matrix.loadFamedlyContacts();
|
|
||||||
expect(contacts.length, 2);
|
|
||||||
expect(contacts[0].senderId, '@alice:example.com');
|
|
||||||
expect(matrix.presences['@alice:example.com'].presence.presence,
|
expect(matrix.presences['@alice:example.com'].presence.presence,
|
||||||
PresenceType.online);
|
PresenceType.online);
|
||||||
expect(presenceCounter, 1);
|
expect(presenceCounter, 1);
|
||||||
|
@ -207,10 +204,6 @@ void main() {
|
||||||
matrix.getRoomByAlias(
|
matrix.getRoomByAlias(
|
||||||
"#famedlyContactDiscovery:${matrix.userID.split(":")[1]}"),
|
"#famedlyContactDiscovery:${matrix.userID.split(":")[1]}"),
|
||||||
null);
|
null);
|
||||||
final altContacts = await matrix.loadFamedlyContacts();
|
|
||||||
altContacts.forEach((u) => print(u.id));
|
|
||||||
expect(altContacts.length, 2);
|
|
||||||
expect(altContacts[0].senderId, '@alice:example.com');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Logout', () async {
|
test('Logout', () async {
|
||||||
|
|
Loading…
Reference in a new issue