From 63e69eaa2781611ce777badf5f6d4b79d0a549f6 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Mon, 14 Feb 2022 10:48:57 +0100 Subject: [PATCH 1/2] feat: Add hasNewMessages flag to room This makes it possible to check if muted rooms have unread messages. --- lib/src/room.dart | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/src/room.dart b/lib/src/room.dart index 8225357a..f9d0a4e9 100644 --- a/lib/src/room.dart +++ b/lib/src/room.dart @@ -511,7 +511,16 @@ class Room { .unread; } - /// Returns true if this room is unread + /// Checks if the last event has a read marker of the user. + bool get hasNewMessages { + final lastEvent = this.lastEvent; + return lastEvent != null && + !lastEvent.receipts + .any((receipt) => receipt.user.senderId == client.userID!); + } + + /// Returns true if this room is unread. To check if there are new messages + /// in muted rooms, use [hasNewMessages]. bool get isUnread => notificationCount > 0 || markedUnread; @Deprecated('Use [markUnread] instead') From e7e7f248b39e51cdb56e56c39a1525ff2a9e0d41 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Mon, 14 Feb 2022 11:08:46 +0100 Subject: [PATCH 2/2] chore: Bump version --- CHANGELOG.md | 4 ++++ pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a55d5d2..14015c16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [0.8.6] - 14nd Feb 2022 +- feat: Add hasNewMessages flag to room +- fix: Sort rooms after updating the UI on web + ## [0.8.5] - 14nd Feb 2022 - fix: exception on removed widgets - fix: Fix black screen when end screensharing with system buttons. diff --git a/pubspec.yaml b/pubspec.yaml index dd18e2c7..61a99f77 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: matrix description: Matrix Dart SDK -version: 0.8.5 +version: 0.8.6 homepage: https://famedly.com repository: https://gitlab.com/famedly/company/frontend/famedlysdk.git