make shouldScrollToBottom based on the table view's content offset.

pull/425/head
ryanzhao 4 years ago
parent f46d736f1b
commit 4c99b9ed05

@ -334,10 +334,10 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat
case .insert: case .insert:
// Perform inserts before updates // Perform inserts before updates
self.messagesTableView.insertRows(at: [ IndexPath(row: Int(update.newIndex), section: 0) ], with: .fade) self.messagesTableView.insertRows(at: [ IndexPath(row: Int(update.newIndex), section: 0) ], with: .fade)
shouldScrollToBottom = (self.scrollButton.alpha == 0) shouldScrollToBottom = Int(self.lastPageTop - self.messagesTableView.contentOffset.y) <= 0
case .update: case .update:
self.messagesTableView.reloadRows(at: [ IndexPath(row: Int(update.oldIndex), section: 0) ], with: .fade) self.messagesTableView.reloadRows(at: [ IndexPath(row: Int(update.oldIndex), section: 0) ], with: .fade)
shouldScrollToBottom = (self.scrollButton.alpha == 0) shouldScrollToBottom = Int(self.lastPageTop - self.messagesTableView.contentOffset.y) <= 0
default: preconditionFailure() default: preconditionFailure()
} }
} }

Loading…
Cancel
Save