Merge branch 'krille/implement-tombstone-support' into 'master'

Add tombstone enum

See merge request famedly/famedlysdk!297
This commit is contained in:
Christian Pauly 2020-05-16 07:52:10 +00:00
commit d6f4dba6e7
2 changed files with 14 additions and 4 deletions

View file

@ -126,7 +126,8 @@ class Event {
}
/// Get a State event from a table row or from the event stream.
factory Event.fromJson(Map<String, dynamic> jsonPayload, Room room, [double sortOrder]) {
factory Event.fromJson(Map<String, dynamic> jsonPayload, Room room,
[double sortOrder]) {
final content = Event.getMapFromPayload(jsonPayload['content']);
final unsigned = Event.getMapFromPayload(jsonPayload['unsigned']);
final prevContent = Event.getMapFromPayload(jsonPayload['prev_content']);
@ -242,6 +243,8 @@ class Event {
return EventTypes.Encrypted;
case 'm.room.encryption':
return EventTypes.Encryption;
case 'm.room.tombsone':
return EventTypes.RoomTombstone;
case 'm.call.invite':
return EventTypes.CallInvite;
case 'm.call.answer':
@ -512,7 +515,8 @@ class Event {
uint8list =
(await http.get(mxContent.getDownloadLink(room.client))).bodyBytes;
if (storeable) {
await room.client.database.storeFile(mxContent.toString(), uint8list, DateTime.now());
await room.client.database
.storeFile(mxContent.toString(), uint8list, DateTime.now());
}
}
@ -559,6 +563,9 @@ class Event {
case EventTypes.RoomCreate:
localizedBody = i18n.createdTheChat(senderName);
break;
case EventTypes.RoomTombstone:
localizedBody = i18n.roomHasBeenUpgraded;
break;
case EventTypes.RoomJoinRules:
var joinRules = JoinRules.values.firstWhere(
(r) =>
@ -792,6 +799,7 @@ enum EventTypes {
RoomName,
RoomTopic,
RoomAvatar,
RoomTombstone,
GuestAccess,
HistoryVisibility,
Encryption,

View file

@ -31,6 +31,8 @@ abstract class MatrixLocalizations {
String get you;
String get roomHasBeenUpgraded;
String groupWith(String displayname);
String removedBy(String calcDisplayname);