Minor fixes

This commit is contained in:
Christian Pauly 2019-06-12 12:04:52 +02:00
parent f8557c38f5
commit d5d1aa53b2
2 changed files with 6 additions and 7 deletions

View file

@ -44,7 +44,7 @@ class Room {
String topic; String topic;
/// The avatar of the room if set by a participant. /// The avatar of the room if set by a participant.
MxContent avatar; MxContent avatar = MxContent("");
/// The count of unread notifications. /// The count of unread notifications.
int notificationCount; int notificationCount;

View file

@ -132,20 +132,19 @@ class User {
if (roomID != null) return roomID; if (roomID != null) return roomID;
// Start a new direct chat // Start a new direct chat
Map<String, dynamic> resp = await room.client.connection final dynamic resp = await room.client.connection
.jsonRequest(type: "POST", action: "/client/r0/createRoom", data: { .jsonRequest(type: "POST", action: "/client/r0/createRoom", data: {
"invite": [id], "invite": [id],
"is_direct": true, "is_direct": true,
"preset": "trusted_private_chat" "preset": "trusted_private_chat"
}); });
if (resp is ErrorResponse) return null; if (resp is ErrorResponse || resp["room_id"] == null) return null;
// TODO: Update m.direct data final String newRoomID = resp["room_id"];
/*room.client.connection.jsonRequest(type: "PUT", action: "/client/r0/user/${room.client.userID}/account_data/m.direct", data: {
});*/ await Room(id: newRoomID).addToDirectChat(id);
return resp["room_id"]; return newRoomID;
} }
} }