further fix for input view not scrollable issue

pull/614/head
Ryan Zhao 3 years ago
parent 5bb287f258
commit 102a29b8e3

@ -95,4 +95,5 @@ protocol ContextMenuActionDelegate : AnyObject {
func save(_ viewItem: ConversationViewItem) func save(_ viewItem: ConversationViewItem)
func ban(_ viewItem: ConversationViewItem) func ban(_ viewItem: ConversationViewItem)
func banAndDeleteAllMessages(_ viewItem: ConversationViewItem) func banAndDeleteAllMessages(_ viewItem: ConversationViewItem)
func contextMenuDismissed()
} }

@ -132,6 +132,7 @@ final class ContextMenuVC : UIViewController {
self.timestampLabel.alpha = 0 self.timestampLabel.alpha = 0
}, completion: { _ in }, completion: { _ in
self.dismiss() self.dismiss()
self.delegate?.contextMenuDismissed()
}) })
} }
} }

@ -786,6 +786,10 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc
present(alert, animated: true, completion: nil) present(alert, animated: true, completion: nil)
} }
func contextMenuDismissed() {
recoverInputView()
}
func handleQuoteViewCancelButtonTapped() { func handleQuoteViewCancelButtonTapped() {
snInputView.quoteDraftInfo = nil snInputView.quoteDraftInfo = nil
} }

@ -425,6 +425,7 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat
highlightFocusedMessageIfNeeded() highlightFocusedMessageIfNeeded()
didFinishInitialLayout = true didFinishInitialLayout = true
markAllAsRead() markAllAsRead()
recoverInputView()
} }
override func viewWillDisappear(_ animated: Bool) { override func viewWillDisappear(_ animated: Bool) {
@ -442,9 +443,7 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat
} }
override func appDidBecomeActive(_ notification: Notification) { override func appDidBecomeActive(_ notification: Notification) {
// This is a workaround for an issue where the textview is not scrollable recoverInputView()
// after the app goes into background and goes back in foreground.
self.snInputView.text = self.snInputView.text
} }
deinit { deinit {
@ -737,6 +736,14 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat
} }
} }
func recoverInputView() {
// This is a workaround for an issue where the textview is not scrollable
// after the app goes into background and goes back in foreground.
DispatchQueue.main.async {
self.snInputView.text = self.snInputView.text
}
}
func markAllAsRead() { func markAllAsRead() {
guard let lastSortID = viewItems.last?.interaction.sortId else { return } guard let lastSortID = viewItems.last?.interaction.sortId else { return }
OWSReadReceiptManager.shared().markAsReadLocally( OWSReadReceiptManager.shared().markAsReadLocally(

Loading…
Cancel
Save