Fix storing of event status

This commit is contained in:
Christian Pauly 2020-08-04 15:08:25 +02:00
parent a11a0b5925
commit bbd5749aec

View file

@ -6,6 +6,7 @@ import 'package:famedlysdk/matrix_api.dart' as api;
import 'package:olm/olm.dart' as olm;
import '../../matrix_api.dart';
import '../room.dart';
part 'database.g.dart';
@ -357,6 +358,10 @@ class Database extends _$Database {
if (type == 'timeline' || type == 'history') {
// calculate the status
var status = 2;
if (eventContent['unsigned'] is Map<String, dynamic> &&
eventContent['unsigned'][MessageSendingStatusKey] is num) {
status = eventContent['unsigned'][MessageSendingStatusKey];
}
if (eventContent['status'] is num) status = eventContent['status'];
if ((status == 1 || status == -1) &&
eventContent['unsigned'] is Map<String, dynamic> &&