Send read receipts on first room entering

This commit is contained in:
Christian Pauly 2020-01-24 11:05:37 +00:00
parent 328300e598
commit a9b9e80b28

View File

@ -87,7 +87,12 @@ class _ChatState extends State<Chat> {
} }
Future<bool> getTimeline() async { Future<bool> getTimeline() async {
timeline ??= await room.getTimeline(onUpdate: updateView); if (timeline == null) {
timeline = await room.getTimeline(onUpdate: updateView);
if (timeline.events.isNotEmpty) {
room.sendReadReceipt(timeline.events.first.eventId);
}
}
updateView(); updateView();
return true; return true;
} }
@ -249,7 +254,7 @@ class _ChatState extends State<Chat> {
room.notificationCount > 0 && room.notificationCount > 0 &&
timeline != null && timeline != null &&
timeline.events.isNotEmpty) { timeline.events.isNotEmpty) {
room.sendReadReceipt(timeline.events[0].eventId); room.sendReadReceipt(timeline.events.first.eventId);
} }
if (timeline.events.isEmpty) return Container(); if (timeline.events.isEmpty) return Container();