reduce mark as read on initial scroll in conversation screen

pull/941/head
Ryan Zhao 2 years ago
parent 4cc6d24404
commit 28ee331421

@ -1023,7 +1023,7 @@ final class ConversationVC: BaseVC, ConversationSearchControllerDelegate, UITabl
// When the unread message count is more than the number of view items of a page, // When the unread message count is more than the number of view items of a page,
// the screen will scroll to the bottom instead of the first unread message // the screen will scroll to the bottom instead of the first unread message
if let focusedInteractionId: Int64 = self.viewModel.focusedInteractionId { if let focusedInteractionId: Int64 = self.viewModel.focusedInteractionId {
self.scrollToInteractionIfNeeded(with: focusedInteractionId, isAnimated: false, highlight: true) self.scrollToInteractionIfNeeded(with: focusedInteractionId, isAnimated: false, highlight: true, isInitialScroll: true)
} }
else { else {
self.scrollToBottom(isAnimated: false) self.scrollToBottom(isAnimated: false)
@ -1636,12 +1636,13 @@ final class ConversationVC: BaseVC, ConversationSearchControllerDelegate, UITabl
position: UITableView.ScrollPosition = .middle, position: UITableView.ScrollPosition = .middle,
isJumpingToLastInteraction: Bool = false, isJumpingToLastInteraction: Bool = false,
isAnimated: Bool = true, isAnimated: Bool = true,
highlight: Bool = false highlight: Bool = false,
isInitialScroll: Bool = false
) { ) {
// Store the info incase we need to load more data (call will be re-triggered) // Store the info incase we need to load more data (call will be re-triggered)
self.focusedInteractionId = interactionId self.focusedInteractionId = interactionId
self.shouldHighlightNextScrollToInteraction = highlight self.shouldHighlightNextScrollToInteraction = highlight
self.viewModel.markAsRead(beforeInclusive: interactionId) if !isInitialScroll { self.viewModel.markAsRead(beforeInclusive: interactionId) }
// Ensure the target interaction has been loaded // Ensure the target interaction has been loaded
guard guard

Loading…
Cancel
Save