Parcourir la source

always scroll down if user has sent a message

cyberta il y a 4 ans
Parent
commit
3497941618
1 fichiers modifiés avec 1 ajouts et 13 suppressions
  1. 1 13
      deltachat-ios/Chat/ChatViewControllerNew.swift

+ 1 - 13
deltachat-ios/Chat/ChatViewControllerNew.swift

@@ -856,23 +856,11 @@ class ChatViewControllerNew: UITableViewController {
     func insertMessage(_ message: DcMsg) {
         dcContext.markSeenMessages(messageIds: [UInt32(message.id)])
         messageIds.append(message.id)
-        //messageList.append(message)
         emptyStateView.isHidden = true
-        /// TODO:  Reload last section to update header/footer labels and insert a new one
-        /*messagesCollectionView.performBatchUpdates({
-         messagesCollectionView.insertSections([messageList.count - 1])
-         if messageList.count >= 2 {
-         messagesCollectionView.reloadSections([messageList.count - 2])
-         }
-         }, completion: { [weak self] _ in
-         if self?.isLastSectionVisible() == true {
-         self?.messagesCollectionView.scrollToBottom(animated: true)
-         }
-         })*/
 
         let wasLastSectionVisible = isLastSectionVisible()
         tableView.reloadData()
-        if wasLastSectionVisible {
+        if wasLastSectionVisible || message.isFromCurrentSender {
             scrollToBottom(animated: true)
         }
     }