fix an issue where disappearing messages config messages could not be marked as read when opening a conversation

pull/941/head
Ryan Zhao 1 year ago
parent f7c7c75527
commit f8d0ac2075

@ -1947,14 +1947,25 @@ final class ConversationVC: BaseVC, SessionUtilRespondingViewController, Convers
.sorted() .sorted()
.filter({ $0.section == messagesSection }) .filter({ $0.section == messagesSection })
.compactMap({ indexPath -> (frame: CGRect, cellViewModel: MessageViewModel)? in .compactMap({ indexPath -> (frame: CGRect, cellViewModel: MessageViewModel)? in
guard let cell: VisibleMessageCell = tableView.cellForRow(at: indexPath) as? VisibleMessageCell else { let cellViewModel: MessageViewModel = self.viewModel.interactionData[indexPath.section].elements[indexPath.row]
return nil
// 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 ( // Deal with visible messages
view.convert(cell.frame, from: tableView), if let cell: VisibleMessageCell = tableView.cellForRow(at: indexPath) as? VisibleMessageCell {
self.viewModel.interactionData[indexPath.section].elements[indexPath.row] return (
) view.convert(cell.frame, from: tableView),
cellViewModel
)
}
return nil
}) })
// Exclude messages that are partially off the bottom of the screen // Exclude messages that are partially off the bottom of the screen
.filter({ $0.frame.maxY <= tableVisualBottom }) .filter({ $0.frame.maxY <= tableVisualBottom })

@ -20,7 +20,7 @@ final class UnreadMarkerCell: MessageCell {
private lazy var titleLabel: UILabel = { private lazy var titleLabel: UILabel = {
let result = UILabel() let result = UILabel()
result.font = .boldSystemFont(ofSize: Values.smallFontSize) result.font = .boldSystemFont(ofSize: Values.verySmallFontSize)
result.text = "UNREAD_MESSAGES".localized() result.text = "UNREAD_MESSAGES".localized()
result.themeTextColor = .unreadMarker result.themeTextColor = .unreadMarker
result.textAlignment = .center result.textAlignment = .center

Loading…
Cancel
Save