From a9b9e80b28bb4da3d8434270ddbfea66aad57c6b Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Fri, 24 Jan 2020 11:05:37 +0000 Subject: [PATCH] Send read receipts on first room entering --- lib/views/chat.dart | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/views/chat.dart b/lib/views/chat.dart index dab09f8..21d8c42 100644 --- a/lib/views/chat.dart +++ b/lib/views/chat.dart @@ -87,7 +87,12 @@ class _ChatState extends State { } Future 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(); return true; } @@ -249,7 +254,7 @@ class _ChatState extends State { room.notificationCount > 0 && timeline != null && timeline.events.isNotEmpty) { - room.sendReadReceipt(timeline.events[0].eventId); + room.sendReadReceipt(timeline.events.first.eventId); } if (timeline.events.isEmpty) return Container();