Browse Source

better orientation change handling and clean up

cyberta 4 years ago
parent
commit
ca7c5c0fd9
1 changed files with 5 additions and 6 deletions
  1. 5 6
      deltachat-ios/Chat/ChatViewControllerNew.swift

+ 5 - 6
deltachat-ios/Chat/ChatViewControllerNew.swift

@@ -156,10 +156,8 @@ class ChatViewControllerNew: UITableViewController {
         if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue {
             if keyboardSize.height > tableView.inputAccessoryView?.frame.height ?? 0 {
                 if self.isLastRowVisible() {
-                    DispatchQueue.global(qos: .userInteractive).asyncAfter(deadline: .now() + 0.01) {
-                        DispatchQueue.main.async { [weak self] in
-                            self?.scrollToBottom(animated: true)
-                        }
+                    DispatchQueue.main.async { [weak self] in
+                        self?.scrollToBottom(animated: true)
                     }
                 }
             }
@@ -309,9 +307,10 @@ class ChatViewControllerNew: UITableViewController {
             completion: {[weak self] _ in
                 guard let self = self else { return }
                 self.updateTitle(chat: self.dcContext.getChat(chatId: self.chatId))
-                self.tableView.reloadData()
                 if lastSectionVisibleBeforeTransition {
-                    self.scrollToBottom(animated: false)
+                    DispatchQueue.main.async { [weak self] in
+                        self?.scrollToBottom(animated: true)
+                    }
                 }
             }
         )