Merge branch 'main' into td/codecov
This commit is contained in:
commit
7bec90b8cf
|
|
@ -2988,9 +2988,6 @@ class Client extends MatrixApi {
|
|||
chatUpdate.unreadNotifications?.notificationCount ?? 0;
|
||||
rooms[roomIndex].highlightCount =
|
||||
chatUpdate.unreadNotifications?.highlightCount ?? 0;
|
||||
if (chatUpdate.timeline?.prevBatch != null) {
|
||||
rooms[roomIndex].prev_batch = chatUpdate.timeline?.prevBatch;
|
||||
}
|
||||
|
||||
final summary = chatUpdate.summary;
|
||||
if (summary != null) {
|
||||
|
|
|
|||
|
|
@ -792,7 +792,13 @@ class Event extends MatrixEvent {
|
|||
throw ('Unable to decrypt file');
|
||||
}
|
||||
}
|
||||
return MatrixFile(bytes: uint8list, name: body);
|
||||
|
||||
final filename = content.tryGet<String>('filename') ?? body;
|
||||
return MatrixFile(
|
||||
bytes: uint8list,
|
||||
name: filename,
|
||||
mimeType: attachmentMimetype,
|
||||
);
|
||||
}
|
||||
|
||||
/// Returns if this is a known event type.
|
||||
|
|
|
|||
|
|
@ -744,6 +744,8 @@ class Room {
|
|||
'msgtype': file.msgType,
|
||||
'body': file.name,
|
||||
'filename': file.name,
|
||||
'info': file.info,
|
||||
if (extraContent != null) ...extraContent,
|
||||
},
|
||||
type: EventTypes.Message,
|
||||
eventId: txid,
|
||||
|
|
@ -1322,7 +1324,6 @@ class Room {
|
|||
);
|
||||
|
||||
if (onHistoryReceived != null) onHistoryReceived();
|
||||
this.prev_batch = resp.end;
|
||||
|
||||
Future<void> loadFn() async {
|
||||
if (!((resp.chunk.isNotEmpty) && resp.end != null)) return;
|
||||
|
|
@ -1363,13 +1364,14 @@ class Room {
|
|||
: null,
|
||||
),
|
||||
),
|
||||
direction: Direction.b,
|
||||
direction: direction,
|
||||
);
|
||||
}
|
||||
|
||||
if (client.database != null) {
|
||||
await client.database?.transaction(() async {
|
||||
if (storeInDatabase) {
|
||||
if (storeInDatabase && direction == Direction.b) {
|
||||
this.prev_batch = resp.end;
|
||||
await client.database?.setRoomPrevBatch(resp.end, id, client);
|
||||
}
|
||||
await loadFn();
|
||||
|
|
|
|||
|
|
@ -41,9 +41,10 @@ class MatrixFile {
|
|||
}
|
||||
|
||||
MatrixFile({required this.bytes, required String name, String? mimeType})
|
||||
: mimeType = mimeType ??
|
||||
lookupMimeType(name, headerBytes: bytes) ??
|
||||
'application/octet-stream',
|
||||
: mimeType = mimeType != null && mimeType.isNotEmpty
|
||||
? mimeType
|
||||
: lookupMimeType(name, headerBytes: bytes) ??
|
||||
'application/octet-stream',
|
||||
name = name.split('/').last;
|
||||
|
||||
/// derivatives the MIME type from the [bytes] and correspondingly creates a
|
||||
|
|
|
|||
Loading…
Reference in New Issue