From 4c99b9ed05ce0f4887e258a07fe5b56628778187 Mon Sep 17 00:00:00 2001 From: ryanzhao Date: Fri, 4 Jun 2021 15:30:24 +1000 Subject: [PATCH] make shouldScrollToBottom based on the table view's content offset. --- Session/Conversations/ConversationVC.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Session/Conversations/ConversationVC.swift b/Session/Conversations/ConversationVC.swift index f4bee31f6..c10938997 100644 --- a/Session/Conversations/ConversationVC.swift +++ b/Session/Conversations/ConversationVC.swift @@ -334,10 +334,10 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat case .insert: // Perform inserts before updates 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: 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() } }