[Room] LastEvent calculation fix

This commit is contained in:
Christian Pauly 2019-08-29 09:50:04 +02:00
parent 7739e9ad01
commit 93b4efe004

View file

@ -124,7 +124,14 @@ class Room {
/// Must be one of [all, mention]
String notificationSettings;
Event get lastEvent => states["m.room.message"]?.timelineEvent;
Event get lastEvent {
ChatTime lastTime = ChatTime(0);
Event lastEvent = null;
states.forEach((String key, RoomState value) {
if (value.time > lastTime) lastEvent = value.timelineEvent;
});
return lastEvent;
}
/// Your current client instance.
final Client client;