alqindiirsyam 2 anni fa
parent
commit
e5246ef92d

+ 4 - 8
appbuilder-ios/AppBuilder/AppBuilder/SecondTabViewController.swift

@@ -449,7 +449,8 @@ class SecondTabViewController: UIViewController, UIScrollViewDelegate, UIGesture
                     let newChat = Chat.getData(messageId: chatData[CoreMessage_TMessageKey.MESSAGE_ID] ?? "")
                     if newChat.count > 0 {
                         if indexChat != nil {
-                            chats[0] = newChat[0]
+                            chats.remove(at: indexChat!)
+                            chats.insert(newChat[0], at: 0)
                             let indexPathToMove = IndexPath(row: indexChat!, section: 0)
                             let indexPathNewPosition = IndexPath(row: 0, section: 0)
                             tableView.performBatchUpdates({
@@ -459,13 +460,8 @@ class SecondTabViewController: UIViewController, UIScrollViewDelegate, UIGesture
                             tableView.reloadRows(at: [IndexPath(row: 0, section: 0)], with: .none)
                             tableView.endUpdates()
                         } else {
-                            if noData {
-                                chats.insert(newChat[0], at: 0)
-                                tableView.reloadData()
-                            } else {
-                                chats.insert(newChat[0], at: 0)
-                                tableView.reloadData()
-                            }
+                            chats.insert(newChat[0], at: 0)
+                            tableView.reloadData()
                         }
                     }
                 }

+ 4 - 8
appbuilder-ios/DigiXLite/DigiXLite/Source/View/Control/ContactChatViewController.swift

@@ -288,7 +288,8 @@ class ContactChatViewController: UITableViewController {
                     let newChat = Chat.getData(messageId: chatData[CoreMessage_TMessageKey.MESSAGE_ID] ?? "")
                     if newChat.count > 0 {
                         if indexChat != nil {
-                            chats[0] = newChat[0]
+                            chats.remove(at: indexChat!)
+                            chats.insert(newChat[0], at: 0)
                             let indexPathToMove = IndexPath(row: indexChat!, section: 0)
                             let indexPathNewPosition = IndexPath(row: 0, section: 0)
                             tableView.performBatchUpdates({
@@ -298,13 +299,8 @@ class ContactChatViewController: UITableViewController {
                             tableView.reloadRows(at: [IndexPath(row: 0, section: 0)], with: .none)
                             tableView.endUpdates()
                         } else {
-                            if noData {
-                                chats.insert(newChat[0], at: 0)
-                                tableView.reloadData()
-                            } else {
-                                chats.insert(newChat[0], at: 0)
-                                tableView.reloadData()
-                            }
+                            chats.insert(newChat[0], at: 0)
+                            tableView.reloadData()
                         }
                     }
                 }

+ 4 - 8
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Control/ContactChatViewController.swift

@@ -288,7 +288,8 @@ class ContactChatViewController: UITableViewController {
                     let newChat = Chat.getData(messageId: chatData[CoreMessage_TMessageKey.MESSAGE_ID] ?? "")
                     if newChat.count > 0 {
                         if indexChat != nil {
-                            chats[0] = newChat[0]
+                            chats.remove(at: indexChat!)
+                            chats.insert(newChat[0], at: 0)
                             let indexPathToMove = IndexPath(row: indexChat!, section: 0)
                             let indexPathNewPosition = IndexPath(row: 0, section: 0)
                             tableView.performBatchUpdates({
@@ -298,13 +299,8 @@ class ContactChatViewController: UITableViewController {
                             tableView.reloadRows(at: [IndexPath(row: 0, section: 0)], with: .none)
                             tableView.endUpdates()
                         } else {
-                            if noData {
-                                chats.insert(newChat[0], at: 0)
-                                tableView.reloadData()
-                            } else {
-                                chats.insert(newChat[0], at: 0)
-                                tableView.reloadData()
-                            }
+                            chats.insert(newChat[0], at: 0)
+                            tableView.reloadData()
                         }
                     }
                 }