[Client] Directchatroom should exist
This commit is contained in:
parent
f885dfbecc
commit
37866359be
|
@ -123,12 +123,14 @@ class Client {
|
|||
|
||||
/// Returns the (first) room ID from the store which is a private chat with the user [userId].
|
||||
/// Returns null if there is none.
|
||||
String getDirectChatFromUserId(String userId) =>
|
||||
accountData["m.direct"] != null &&
|
||||
accountData["m.direct"].content[userId] is List<dynamic> &&
|
||||
accountData["m.direct"].content[userId].length > 0
|
||||
? accountData["m.direct"].content[userId][0]
|
||||
: null;
|
||||
String getDirectChatFromUserId(String userId) => accountData["m.direct"] !=
|
||||
null &&
|
||||
accountData["m.direct"].content[userId] is List<dynamic> &&
|
||||
accountData["m.direct"].content[userId].length > 0 &&
|
||||
roomList.getRoomById(accountData["m.direct"].content[userId][0]) !=
|
||||
null
|
||||
? accountData["m.direct"].content[userId][0]
|
||||
: null;
|
||||
|
||||
/// Checks the supported versions of the Matrix protocol and the supported
|
||||
/// login types. Returns false if the server is not compatible with the
|
||||
|
|
|
@ -78,6 +78,13 @@ class RoomList {
|
|||
return null;
|
||||
}
|
||||
|
||||
Room getRoomById(String id) {
|
||||
for (int j = 0; j < rooms.length; j++) {
|
||||
if (rooms[j].id == id) return rooms[j];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void _handleRoomUpdate(RoomUpdate chatUpdate) {
|
||||
// Update the chat list item.
|
||||
// Search the room in the rooms
|
||||
|
|
Loading…
Reference in a new issue