From f8d0ac207559571369d8f795b58a54adee0f2460 Mon Sep 17 00:00:00 2001 From: Ryan Zhao Date: Thu, 22 Jun 2023 11:54:46 +1000 Subject: [PATCH] fix an issue where disappearing messages config messages could not be marked as read when opening a conversation --- Session/Conversations/ConversationVC.swift | 23 ++++++++++++++----- .../Message Cells/UnreadMarkerCell.swift | 2 +- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Session/Conversations/ConversationVC.swift b/Session/Conversations/ConversationVC.swift index dc289050d..8ef5b93a8 100644 --- a/Session/Conversations/ConversationVC.swift +++ b/Session/Conversations/ConversationVC.swift @@ -1947,14 +1947,25 @@ final class ConversationVC: BaseVC, SessionUtilRespondingViewController, Convers .sorted() .filter({ $0.section == messagesSection }) .compactMap({ indexPath -> (frame: CGRect, cellViewModel: MessageViewModel)? in - guard let cell: VisibleMessageCell = tableView.cellForRow(at: indexPath) as? VisibleMessageCell else { - return nil + let cellViewModel: MessageViewModel = self.viewModel.interactionData[indexPath.section].elements[indexPath.row] + + // Deal with disappearing messages control message + if let cell: InfoMessageCell = tableView.cellForRow(at: indexPath) as? InfoMessageCell, cellViewModel.variant == .infoDisappearingMessagesUpdate { + return ( + view.convert(cell.frame, from: tableView), + cellViewModel + ) } - return ( - view.convert(cell.frame, from: tableView), - self.viewModel.interactionData[indexPath.section].elements[indexPath.row] - ) + // Deal with visible messages + if let cell: VisibleMessageCell = tableView.cellForRow(at: indexPath) as? VisibleMessageCell { + return ( + view.convert(cell.frame, from: tableView), + cellViewModel + ) + } + + return nil }) // Exclude messages that are partially off the bottom of the screen .filter({ $0.frame.maxY <= tableVisualBottom }) diff --git a/Session/Conversations/Message Cells/UnreadMarkerCell.swift b/Session/Conversations/Message Cells/UnreadMarkerCell.swift index 76410c050..36b04457b 100644 --- a/Session/Conversations/Message Cells/UnreadMarkerCell.swift +++ b/Session/Conversations/Message Cells/UnreadMarkerCell.swift @@ -20,7 +20,7 @@ final class UnreadMarkerCell: MessageCell { private lazy var titleLabel: UILabel = { let result = UILabel() - result.font = .boldSystemFont(ofSize: Values.smallFontSize) + result.font = .boldSystemFont(ofSize: Values.verySmallFontSize) result.text = "UNREAD_MESSAGES".localized() result.themeTextColor = .unreadMarker result.textAlignment = .center