From 4cd19ed7e8420ad41f72d1710d7e777b0dfdbb0e Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Fri, 5 Nov 2021 08:38:45 +0100 Subject: [PATCH] Always mark chats as unread if they have an unread count > 0 Fixes chats not being marked as unread that have a high non-message event amount. Change-Id: I441fd21c3719109db4f61bc88ef81c6db54be55c --- .../sdk/internal/session/room/summary/RoomSummaryUpdater.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryUpdater.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryUpdater.kt index a5f69c8a48..68b52bf7f0 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryUpdater.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryUpdater.kt @@ -146,16 +146,19 @@ internal class RoomSummaryUpdater @Inject constructor( } roomSummaryEntity.hasUnreadMessages = roomSummaryEntity.notificationCount > 0 || + (roomSummaryEntity.unreadCount?.let { it > 0 } ?: false) || // avoid this call if we are sure there are unread events !isEventRead(realm.configuration, userId, roomId, latestPreviewableEvent?.eventId) roomSummaryEntity.hasUnreadContentMessages = roomSummaryEntity.notificationCount > 0 || + (roomSummaryEntity.unreadCount?.let { it > 0 } ?: false) || // avoid this call if we are sure there are unread events (latestPreviewableContentEvent != null && !isEventRead(realm.configuration, userId, roomId, latestPreviewableContentEvent.eventId)) roomSummaryEntity.hasUnreadOriginalContentMessages = roomSummaryEntity.notificationCount > 0 || + (roomSummaryEntity.unreadCount?.let { it > 0 } ?: false) || // avoid this call if we are sure there are unread events (latestPreviewableOriginalContentEvent != null && - !isEventRead(realm.configuration, userId, roomId, latestPreviewableOriginalContentEvent.eventId)) + !isEventRead(realm.configuration, userId, roomId, latestPreviewableOriginalContentEvent.eventId)) roomSummaryEntity.displayName = roomDisplayNameResolver.resolve(realm, roomId) roomSummaryEntity.avatarUrl = roomAvatarResolver.resolve(realm, roomId)