From 1f8f6ffdf12e0169dcd2d12fb2989bd1376d97c8 Mon Sep 17 00:00:00 2001 From: Flescio Date: Thu, 9 Feb 2023 09:01:16 +0100 Subject: [PATCH] "Mark as unread" dot appears on rooms that are actually unread, not marked as such (#7352) * fix green dot only to appear for marked action --- .../Common/Recents/Views/RecentTableViewCell.m | 15 +++++++++------ .../MatrixKit/Models/RoomList/MXKRecentCellData.m | 8 ++++++-- .../Models/RoomList/MXKRecentCellDataStoring.h | 1 + changelog.d/7530.bugfix | 1 + 4 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 changelog.d/7530.bugfix diff --git a/Riot/Modules/Common/Recents/Views/RecentTableViewCell.m b/Riot/Modules/Common/Recents/Views/RecentTableViewCell.m index d1ac3d914..a21996333 100644 --- a/Riot/Modules/Common/Recents/Views/RecentTableViewCell.m +++ b/Riot/Modules/Common/Recents/Views/RecentTableViewCell.m @@ -92,12 +92,17 @@ self.lastEventDecriptionLabelTrailingConstraint.constant = self.unsentImageView.hidden ? 10 : 30; // Notify unreads and bing - if (roomCellData.hasUnread) + if (roomCellData.isRoomMarkedAsUnread) { - + self.missedNotifAndUnreadBadgeBgView.hidden = NO; + self.missedNotifAndUnreadBadgeBgView.backgroundColor = ThemeService.shared.theme.tintColor; + self.missedNotifAndUnreadBadgeBgViewWidthConstraint.constant = 20; + } + else if (roomCellData.hasUnread) + { + self.missedNotifAndUnreadIndicator.hidden = NO; if (0 < roomCellData.notificationCount) { - self.missedNotifAndUnreadIndicator.hidden = NO; self.missedNotifAndUnreadIndicator.backgroundColor = roomCellData.highlightCount ? ThemeService.shared.theme.noticeColor : ThemeService.shared.theme.noticeSecondaryColor; self.missedNotifAndUnreadBadgeBgView.hidden = NO; @@ -110,9 +115,7 @@ } else { - self.missedNotifAndUnreadBadgeBgView.hidden = NO; - self.missedNotifAndUnreadBadgeBgView.backgroundColor = ThemeService.shared.theme.tintColor; - self.missedNotifAndUnreadBadgeBgViewWidthConstraint.constant = 20; + self.missedNotifAndUnreadIndicator.backgroundColor = ThemeService.shared.theme.unreadRoomIndentColor; } // Use bold font for the room title diff --git a/Riot/Modules/MatrixKit/Models/RoomList/MXKRecentCellData.m b/Riot/Modules/MatrixKit/Models/RoomList/MXKRecentCellData.m index 4e6ebbe80..474494d59 100644 --- a/Riot/Modules/MatrixKit/Models/RoomList/MXKRecentCellData.m +++ b/Riot/Modules/MatrixKit/Models/RoomList/MXKRecentCellData.m @@ -63,8 +63,12 @@ - (BOOL)hasUnread { - bool isRoomUnread = [[self mxSession] isRoomMarkedAsUnread:roomSummary.roomId]; - return (roomSummary.localUnreadEventCount != 0 || isRoomUnread); + return (roomSummary.localUnreadEventCount != 0); +} + +- (BOOL)isRoomMarkedAsUnread +{ + return [[self mxSession] isRoomMarkedAsUnread:roomSummary.roomId];; } - (NSString *)roomIdentifier diff --git a/Riot/Modules/MatrixKit/Models/RoomList/MXKRecentCellDataStoring.h b/Riot/Modules/MatrixKit/Models/RoomList/MXKRecentCellDataStoring.h index 7185ae4eb..3c417c1fa 100644 --- a/Riot/Modules/MatrixKit/Models/RoomList/MXKRecentCellDataStoring.h +++ b/Riot/Modules/MatrixKit/Models/RoomList/MXKRecentCellDataStoring.h @@ -50,6 +50,7 @@ @property (nonatomic, readonly) NSString *lastEventDate; @property (nonatomic, readonly) BOOL hasUnread; +@property (nonatomic, readonly) BOOL isRoomMarkedAsUnread; @property (nonatomic, readonly) NSUInteger notificationCount; @property (nonatomic, readonly) NSUInteger highlightCount; @property (nonatomic, readonly) NSString *notificationCountStringValue; diff --git a/changelog.d/7530.bugfix b/changelog.d/7530.bugfix new file mode 100644 index 000000000..7309798a9 --- /dev/null +++ b/changelog.d/7530.bugfix @@ -0,0 +1 @@ +Fixes #7350 - Fix green dot only to appear for marked action \ No newline at end of file