Fix initial scroll position bug

pull/347/head
Niels Andriesse 3 years ago
parent 907925496f
commit 6a810d959b

@ -218,4 +218,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 2fca3f32c171e1324c9e3809b96a32d4a929d05c
COCOAPODS: 1.10.1
COCOAPODS: 1.10.0.rc.1

@ -96,6 +96,7 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc
let gifVC = GifPickerViewController(thread: thread)
gifVC.delegate = self
let navController = OWSNavigationController(rootViewController: gifVC)
navController.modalPresentationStyle = .fullScreen
present(navController, animated: true) { }
}

@ -1,7 +1,6 @@
// TODO
// Tapping replies
// Initial scroll position
// Moderator icons
// Slight paging glitch
// Image detail VC transition glitch
@ -27,7 +26,7 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, UITableViewD
var mentions: [Mention] = []
// Scrolling & paging
private var isUserScrolling = false
private var hasPerformedInitialScroll = false
private var didFinishInitialLayout = false
private var isLoadingMore = false
private var scrollDistanceToBottomBeforeUpdate: CGFloat?
@ -132,14 +131,16 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, UITableViewD
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
if !hasPerformedInitialScroll {
scrollToBottom(isAnimated: false)
hasPerformedInitialScroll = true
if !didFinishInitialLayout {
DispatchQueue.main.async {
self.scrollToBottom(isAnimated: false)
}
}
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
didFinishInitialLayout = true
markAllAsRead()
}

Loading…
Cancel
Save