fix: Set readmarker sometimes not working

This commit is contained in:
Krille 2023-09-29 10:22:28 +02:00
parent f5cf1b4d70
commit bb96a0a4a3
No known key found for this signature in database

View file

@ -379,13 +379,12 @@ class ChatController extends State<ChatPageWithRoom> {
final timeline = this.timeline;
if (timeline == null || timeline.events.isEmpty) return;
eventId ??= timeline.events.first.eventId;
Logs().v('Set read marker...', eventId);
// ignore: unawaited_futures
_setReadMarkerFuture = timeline.setReadMarker(eventId: eventId).then((_) {
_setReadMarkerFuture = null;
});
if (eventId == timeline.events.first.eventId) {
if (eventId == null || eventId == timeline.room.lastEvent?.eventId) {
Matrix.of(context).backgroundPush?.cancelNotification(roomId);
}
}