[Room] Fix request User method
This commit is contained in:
parent
7842c509e1
commit
eccc880fcb
|
@ -282,12 +282,12 @@ class Room {
|
||||||
|
|
||||||
// Try to manipulate the file size and create a thumbnail
|
// Try to manipulate the file size and create a thumbnail
|
||||||
try {
|
try {
|
||||||
Image image = copyResize(decodeImage(file.readAsBytesSync()), width: 1200);
|
Image image =
|
||||||
|
copyResize(decodeImage(file.readAsBytesSync()), width: 1200);
|
||||||
Image thumbnail = copyResize(image, width: 800);
|
Image thumbnail = copyResize(image, width: 800);
|
||||||
|
|
||||||
file = File(path)..writeAsBytesSync(encodePng(image));
|
file = File(path)..writeAsBytesSync(encodePng(image));
|
||||||
File thumbnailFile = File(path)
|
File thumbnailFile = File(path)..writeAsBytesSync(encodePng(thumbnail));
|
||||||
..writeAsBytesSync(encodePng(thumbnail));
|
|
||||||
final dynamic uploadThumbnailResp =
|
final dynamic uploadThumbnailResp =
|
||||||
await client.connection.upload(thumbnailFile);
|
await client.connection.upload(thumbnailFile);
|
||||||
if (uploadThumbnailResp is ErrorResponse) throw (uploadThumbnailResp);
|
if (uploadThumbnailResp is ErrorResponse) throw (uploadThumbnailResp);
|
||||||
|
@ -652,9 +652,10 @@ class Room {
|
||||||
type: HTTPType.GET,
|
type: HTTPType.GET,
|
||||||
action: "/client/r0/rooms/$id/state/m.room.member/$mxID");
|
action: "/client/r0/rooms/$id/state/m.room.member/$mxID");
|
||||||
if (resp is ErrorResponse) return null;
|
if (resp is ErrorResponse) return null;
|
||||||
// Somehow we miss the mxid in the response and only get the content of the event.
|
return User(mxID,
|
||||||
resp["matrix_id"] = mxID;
|
displayName: resp["displayname"],
|
||||||
return RoomState.fromJson(resp, this).asUser;
|
avatarUrl: resp["avatar_url"],
|
||||||
|
room: this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Searches for the event in the store. If it isn't found, try to request it
|
/// Searches for the event in the store. If it isn't found, try to request it
|
||||||
|
|
16
pubspec.lock
16
pubspec.lock
|
@ -28,14 +28,14 @@ packages:
|
||||||
name: async
|
name: async
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.0"
|
version: "2.3.0"
|
||||||
boolean_selector:
|
boolean_selector:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: boolean_selector
|
name: boolean_selector
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.4"
|
version: "1.0.5"
|
||||||
build:
|
build:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -276,7 +276,7 @@ packages:
|
||||||
name: meta
|
name: meta
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.6"
|
version: "1.1.7"
|
||||||
mime:
|
mime:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -311,14 +311,14 @@ packages:
|
||||||
name: path
|
name: path
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.6.2"
|
version: "1.6.4"
|
||||||
pedantic:
|
pedantic:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
name: pedantic
|
name: pedantic
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.7.0"
|
version: "1.8.0+1"
|
||||||
petitparser:
|
petitparser:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -353,7 +353,7 @@ packages:
|
||||||
name: quiver
|
name: quiver
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.3"
|
version: "2.0.5"
|
||||||
shelf:
|
shelf:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -393,7 +393,7 @@ packages:
|
||||||
name: sqflite
|
name: sqflite
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.5"
|
version: "1.1.6+4"
|
||||||
stack_trace:
|
stack_trace:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -421,7 +421,7 @@ packages:
|
||||||
name: string_scanner
|
name: string_scanner
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.4"
|
version: "1.0.5"
|
||||||
synchronized:
|
synchronized:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -12,7 +12,7 @@ dependencies:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
sqflite: ^1.1.0
|
sqflite: ^1.1.6+4
|
||||||
path: ^1.6.2
|
path: ^1.6.2
|
||||||
|
|
||||||
# Connection
|
# Connection
|
||||||
|
|
|
@ -66,17 +66,8 @@ class FakeMatrixApi extends MockClient {
|
||||||
"GET": {
|
"GET": {
|
||||||
"/client/r0/rooms/!localpart:server.abc/state/m.room.member/@getme:example.com":
|
"/client/r0/rooms/!localpart:server.abc/state/m.room.member/@getme:example.com":
|
||||||
(var req) => {
|
(var req) => {
|
||||||
"content": {
|
"avatar_url": "mxc://test",
|
||||||
"membership": "join",
|
"displayname": "You got me",
|
||||||
"displayname": "You got me",
|
|
||||||
},
|
|
||||||
"type": "m.room.member",
|
|
||||||
"event_id": "143273582443PhrSn:example.org",
|
|
||||||
"room_id": "!localpart:server.abc",
|
|
||||||
"sender": "@getme:example.com",
|
|
||||||
"state_key": "@getme:example.com",
|
|
||||||
"origin_server_ts": 1432735824653,
|
|
||||||
"unsigned": {"age": 1234}
|
|
||||||
},
|
},
|
||||||
"/client/r0/rooms/!localpart:server.abc/event/1234": (var req) => {
|
"/client/r0/rooms/!localpart:server.abc/event/1234": (var req) => {
|
||||||
"content": {
|
"content": {
|
||||||
|
|
Loading…
Reference in New Issue