Merge pull request #901 from mpretty-cyro/fix/call-messages-not-marking-as-read

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:30:38 +10:00 committed by GitHub
commit fbae340bda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 7 deletions

View File

@ -1951,14 +1951,22 @@ 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 { guard let cell: UITableViewCell = tableView.cellForRow(at: indexPath) else { return nil }
return nil
}
return ( switch cell {
view.convert(cell.frame, from: tableView), case is VisibleMessageCell, is CallMessageCell, is InfoMessageCell:
self.viewModel.interactionData[indexPath.section].elements[indexPath.row] 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 // Exclude messages that are partially off the bottom of the screen
.filter({ $0.frame.maxY <= tableVisualBottom }) .filter({ $0.frame.maxY <= tableVisualBottom })