Fixed an issue where call messages wouldn't get marked as read when the last message in a conversation

This commit is contained in:
Morgan Pretty 2023-09-08 11:04:47 +10:00
parent ab610578e6
commit b79de0cf32
1 changed files with 15 additions and 7 deletions

View File

@ -1951,14 +1951,22 @@ 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
}
guard let cell: UITableViewCell = tableView.cellForRow(at: indexPath) else { return nil }
return (
view.convert(cell.frame, from: tableView),
self.viewModel.interactionData[indexPath.section].elements[indexPath.row]
)
switch cell {
case is VisibleMessageCell, is CallMessageCell, is InfoMessageCell:
return (
view.convert(cell.frame, from: tableView),
self.viewModel.interactionData[indexPath.section].elements[indexPath.row]
)
case is TypingIndicatorCell, is DateHeaderCell, is UnreadMarkerCell:
return nil
default:
SNLog("[ConversationVC] Warning: Processing unhandled cell type when marking as read, this could result in intermittent failures")
return nil
}
})
// Exclude messages that are partially off the bottom of the screen
.filter({ $0.frame.maxY <= tableVisualBottom })