Browse Source

reduce scroll annoyance when opening a chat with an drafted attachment

cyberta 4 years ago
parent
commit
9fdfff0dcc
1 changed files with 6 additions and 6 deletions
  1. 6 6
      deltachat-ios/Chat/ChatViewController.swift

+ 6 - 6
deltachat-ios/Chat/ChatViewController.swift

@@ -166,12 +166,12 @@ class ChatViewController: UITableViewController {
     }
 
     @objc func keyboardWillShow(_ notification: Notification) {
-        if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue {
-            if keyboardSize.height > tableView.inputAccessoryView?.frame.height ?? 0 {
-                if self.isLastRowVisible() {
-                    DispatchQueue.main.async { [weak self] in
-                        self?.scrollToBottom(animated: true)
-                    }
+        if self.isLastRowVisible() {
+            DispatchQueue.main.async { [weak self] in
+                if self?.messageInputBar.keyboardHeight ?? 0 > 0 {
+                    self?.scrollToBottom(animated: true)
+                } else { // inputbar height increased, probably because of draft area changes
+                    self?.scrollToBottom(animated: false)
                 }
             }
         }