Ver Fonte

update status message

alqindiirsyam há 1 ano atrás
pai
commit
a92c7e034e

+ 4 - 4
appbuilder-ios/AppBuilder/AppBuilder/ViewController.swift

@@ -89,10 +89,10 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
         
         self.delegate = self
         
-        firstTab?.tabBarItem = UITabBarItem(title: "", image: resizeImage(image: self.traitCollection.userInterfaceStyle == .dark ? UIImage(named: "tab_1_icon")!.withTintColor(.white) : UIImage(named: "tab_1_icon")!, targetSize: CGSize(width: 25, height: 25)).withRenderingMode(.alwaysOriginal), selectedImage: resizeImage(image: UIImage(named: "tab_1_icon")!, targetSize: CGSize(width: 25, height: 25)).withRenderingMode(.alwaysOriginal).withTintColor(.mainColor))
-        secondTab?.tabBarItem = UITabBarItem(title: "", image: resizeImage(image: self.traitCollection.userInterfaceStyle == .dark ? UIImage(named: "tab_2_icon")!.withTintColor(.white) : UIImage(named: "tab_2_icon")!, targetSize: CGSize(width: 25, height: 25)).withRenderingMode(.alwaysOriginal), selectedImage: resizeImage(image: UIImage(named: "tab_2_icon")!, targetSize: CGSize(width: 25, height: 25)).withRenderingMode(.alwaysOriginal).withTintColor(.mainColor))
-        thirdTab?.tabBarItem = UITabBarItem(title: "", image: resizeImage(image: self.traitCollection.userInterfaceStyle == .dark ? UIImage(named: "tab_3_icon")!.withTintColor(.white) : UIImage(named: "tab_3_icon")!, targetSize: CGSize(width: 25, height: 25)).withRenderingMode(.alwaysOriginal), selectedImage: resizeImage(image: UIImage(named: "tab_3_icon")!, targetSize: CGSize(width: 25, height: 25)).withRenderingMode(.alwaysOriginal).withTintColor(.mainColor))
-        fourthTab?.tabBarItem = UITabBarItem(title: "", image: resizeImage(image: self.traitCollection.userInterfaceStyle == .dark ? UIImage(named: "tab_4_icon")!.withTintColor(.white) : UIImage(named: "tab_4_icon")!, targetSize: CGSize(width: 25, height: 25)).withRenderingMode(.alwaysOriginal), selectedImage: resizeImage(image: UIImage(named: "tab_4_icon")!, targetSize: CGSize(width: 25, height: 25)).withRenderingMode(.alwaysOriginal).withTintColor(.mainColor))
+        firstTab?.tabBarItem = UITabBarItem(title: "", image: resizeImage(image: self.traitCollection.userInterfaceStyle == .dark ? UIImage(named: "tab_1_icon")!.withTintColor(.white) : UIImage(named: "tab_1_icon")!, targetSize: CGSize(width: 25, height: 25)).withRenderingMode(.alwaysOriginal), selectedImage: resizeImage(image: UIImage(named: "tab_1_icon")!, targetSize: CGSize(width: 25, height: 25)).withRenderingMode(.alwaysOriginal).withTintColor(self.traitCollection.userInterfaceStyle == .dark ? .lightGray : .mainColor))
+        secondTab?.tabBarItem = UITabBarItem(title: "", image: resizeImage(image: self.traitCollection.userInterfaceStyle == .dark ? UIImage(named: "tab_2_icon")!.withTintColor(.white) : UIImage(named: "tab_2_icon")!, targetSize: CGSize(width: 25, height: 25)).withRenderingMode(.alwaysOriginal), selectedImage: resizeImage(image: UIImage(named: "tab_2_icon")!, targetSize: CGSize(width: 25, height: 25)).withRenderingMode(.alwaysOriginal).withTintColor(self.traitCollection.userInterfaceStyle == .dark ? .lightGray : .mainColor))
+        thirdTab?.tabBarItem = UITabBarItem(title: "", image: resizeImage(image: self.traitCollection.userInterfaceStyle == .dark ? UIImage(named: "tab_3_icon")!.withTintColor(.white) : UIImage(named: "tab_3_icon")!, targetSize: CGSize(width: 25, height: 25)).withRenderingMode(.alwaysOriginal), selectedImage: resizeImage(image: UIImage(named: "tab_3_icon")!, targetSize: CGSize(width: 25, height: 25)).withRenderingMode(.alwaysOriginal).withTintColor(self.traitCollection.userInterfaceStyle == .dark ? .lightGray : .mainColor))
+        fourthTab?.tabBarItem = UITabBarItem(title: "", image: resizeImage(image: self.traitCollection.userInterfaceStyle == .dark ? UIImage(named: "tab_4_icon")!.withTintColor(.white) : UIImage(named: "tab_4_icon")!, targetSize: CGSize(width: 25, height: 25)).withRenderingMode(.alwaysOriginal), selectedImage: resizeImage(image: UIImage(named: "tab_4_icon")!, targetSize: CGSize(width: 25, height: 25)).withRenderingMode(.alwaysOriginal).withTintColor(self.traitCollection.userInterfaceStyle == .dark ? .lightGray : .mainColor))
         var i = 0
         var j = 0
         while j < customTab.count {

+ 1 - 4
appbuilder-ios/NexilisLite/NexilisLite/Source/FloatingButton/FloatingButton.swift

@@ -87,10 +87,7 @@ public class FloatingButton: UIView {
             defaultWidthFB = widthFBAnim
             defaultHeightFB = heightFBAnim
             nexilis_button.sd_setImage(with: URL(string: Utils.getConfigModeFB() == MODE_VERTICAL_ANIMATION ? Utils.getIconCenterAnim2()! :  Utils.getIconCenterAnim4()!)) { [self] (image, error, cacheType, imageURL) in
-                if error != nil {
-                    //print("Error loading GIF: \(error.localizedDescription)")
-                } else {
-                    // Configure the animation
+                if error == nil {
                     nexilis_button.animationImages = image?.images
                     nexilis_button.animationDuration = image?.duration ?? 0.0
                     nexilis_button.animationRepeatCount = 0

+ 50 - 38
appbuilder-ios/NexilisLite/NexilisLite/Source/Nexilis.swift

@@ -1335,47 +1335,59 @@ public class Nexilis: NSObject {
                     if t == "-1" || t == "-2" {
                         continue
                     }
-                    if status == "3" {
-                        _ = Database.shared.updateRecord(fmdb: fmdb, table: "MESSAGE_STATUS", cvalues: [
-                                                            "status" : status,
-                                                            "time_delivered" : String(Date().currentTimeMillis()),
-                                                            "last_update" : String(Date().currentTimeMillis())], _where: "message_id = '\(t)' and f_pin = '\(l_pin)'")
-                    } else if status == "4" {
-                        _ = Database.shared.updateRecord(fmdb: fmdb, table: "MESSAGE_STATUS", cvalues: [
-                                                            "status" : status,
-                                                            "time_read" : String(Date().currentTimeMillis()),
-                                                            "last_update" : String(Date().currentTimeMillis())], _where: "message_id = '\(t)' and f_pin = '\(l_pin)'")
-                    } else if status == "8" {
-                        _ = Database.shared.updateRecord(fmdb: fmdb, table: "MESSAGE_STATUS", cvalues: [
-                                                            "status" : status,
-                                                            "time_ack" : String(Date().currentTimeMillis()),
-                                                            "last_update" : String(Date().currentTimeMillis())], _where: "message_id = '\(t)' and f_pin = '\(l_pin)'")
-                    } else {
-                        _ = Database.shared.updateRecord(fmdb: fmdb, table: "MESSAGE_STATUS", cvalues: [
-                                                            "status" : status,
-                                                            "last_update" : String(Date().currentTimeMillis())], _where: "message_id = '\(t)' and f_pin = '\(l_pin)'")
+                    if let cursorStatus = Database.shared.getRecords(fmdb: fmdb, query: "SELECT status FROM MESSAGE_STATUS where message_id = '\(t)'"), cursorStatus.next() {
+                        let lastStatus = cursorStatus.int(forColumnIndex: 0)
+                        if lastStatus < Int(status)! {
+                            if status == "3" {
+                                _ = Database.shared.updateRecord(fmdb: fmdb, table: "MESSAGE_STATUS", cvalues: [
+                                                                    "status" : status,
+                                                                    "time_delivered" : String(Date().currentTimeMillis()),
+                                                                    "last_update" : String(Date().currentTimeMillis())], _where: "message_id = '\(t)' and f_pin = '\(l_pin)'")
+                            } else if status == "4" {
+                                _ = Database.shared.updateRecord(fmdb: fmdb, table: "MESSAGE_STATUS", cvalues: [
+                                                                    "status" : status,
+                                                                    "time_read" : String(Date().currentTimeMillis()),
+                                                                    "last_update" : String(Date().currentTimeMillis())], _where: "message_id = '\(t)' and f_pin = '\(l_pin)'")
+                            } else if status == "8" {
+                                _ = Database.shared.updateRecord(fmdb: fmdb, table: "MESSAGE_STATUS", cvalues: [
+                                                                    "status" : status,
+                                                                    "time_ack" : String(Date().currentTimeMillis()),
+                                                                    "last_update" : String(Date().currentTimeMillis())], _where: "message_id = '\(t)' and f_pin = '\(l_pin)'")
+                            } else {
+                                _ = Database.shared.updateRecord(fmdb: fmdb, table: "MESSAGE_STATUS", cvalues: [
+                                                                    "status" : status,
+                                                                    "last_update" : String(Date().currentTimeMillis())], _where: "message_id = '\(t)' and f_pin = '\(l_pin)'")
+                            }
+                        }
+                        cursorStatus.close()
                     }
                 }
             } else {
-                if status == "3" {
-                    _ = Database.shared.updateRecord(fmdb: fmdb, table: "MESSAGE_STATUS", cvalues: [
-                                                        "status" : status,
-                                                        "time_delivered" : String(Date().currentTimeMillis()),
-                                                        "last_update" : String(Date().currentTimeMillis())], _where: "message_id = '\(message_id)' and f_pin = '\(l_pin)'")
-                } else if status == "4" {
-                    _ = Database.shared.updateRecord(fmdb: fmdb, table: "MESSAGE_STATUS", cvalues: [
-                                                        "status" : status,
-                                                        "time_read" : String(Date().currentTimeMillis()),
-                                                        "last_update" : String(Date().currentTimeMillis())], _where: "message_id = '\(message_id)' and f_pin = '\(l_pin)'")
-                } else if status == "8" {
-                    _ = Database.shared.updateRecord(fmdb: fmdb, table: "MESSAGE_STATUS", cvalues: [
-                                                        "status" : status,
-                                                        "time_ack" : String(Date().currentTimeMillis()),
-                                                        "last_update" : String(Date().currentTimeMillis())], _where: "message_id = '\(message_id)' and f_pin = '\(l_pin)'")
-                } else {
-                    _ = Database.shared.updateRecord(fmdb: fmdb, table: "MESSAGE_STATUS", cvalues: [
-                                                        "status" : status,
-                                                        "last_update" : String(Date().currentTimeMillis())], _where: "message_id = '\(message_id)' and f_pin = '\(l_pin)'")
+                if let cursorStatus = Database.shared.getRecords(fmdb: fmdb, query: "SELECT status FROM MESSAGE_STATUS where message_id = '\(message_id)'"), cursorStatus.next() {
+                    let lastStatus = cursorStatus.int(forColumnIndex: 0)
+                    if lastStatus < Int(status)! {
+                        if status == "3" {
+                            _ = Database.shared.updateRecord(fmdb: fmdb, table: "MESSAGE_STATUS", cvalues: [
+                                                                "status" : status,
+                                                                "time_delivered" : String(Date().currentTimeMillis()),
+                                                                "last_update" : String(Date().currentTimeMillis())], _where: "message_id = '\(message_id)' and f_pin = '\(l_pin)'")
+                        } else if status == "4" {
+                            _ = Database.shared.updateRecord(fmdb: fmdb, table: "MESSAGE_STATUS", cvalues: [
+                                                                "status" : status,
+                                                                "time_read" : String(Date().currentTimeMillis()),
+                                                                "last_update" : String(Date().currentTimeMillis())], _where: "message_id = '\(message_id)' and f_pin = '\(l_pin)'")
+                        } else if status == "8" {
+                            _ = Database.shared.updateRecord(fmdb: fmdb, table: "MESSAGE_STATUS", cvalues: [
+                                                                "status" : status,
+                                                                "time_ack" : String(Date().currentTimeMillis()),
+                                                                "last_update" : String(Date().currentTimeMillis())], _where: "message_id = '\(message_id)' and f_pin = '\(l_pin)'")
+                        } else {
+                            _ = Database.shared.updateRecord(fmdb: fmdb, table: "MESSAGE_STATUS", cvalues: [
+                                                                "status" : status,
+                                                                "last_update" : String(Date().currentTimeMillis())], _where: "message_id = '\(message_id)' and f_pin = '\(l_pin)'")
+                        }
+                    }
+                    cursorStatus.close()
                 }
             }
         })

+ 0 - 5
appbuilder-ios/NexilisLite/NexilisLite/Source/Utils.swift

@@ -333,11 +333,6 @@ public final class Utils {
         var request = URLRequest(url: url)
         request.httpMethod = "GET"
         request.setValue(Utils.getUserAgent(), forHTTPHeaderField: "User-Agent")
-//        let cookies = HTTPCookieStorage.shared.cookies ?? []
-//        if let cookieHeader = HTTPCookie.requestHeaderFields(with: cookies)["Cookie"] {
-        //print("listCookiee: \(cookieHeader)")
-//           request.setValue(cookieHeader, forHTTPHeaderField: "Cookie")
-//        }
         request.setValue(Utils.getCookiesMobile(), forHTTPHeaderField: "Cookie")
         //print("DATA SEND MOBILE \(Utils.getUserAgent()) <> \(Utils.getCookiesMobile())")
         let task = URLSession.shared.dataTask(with: request, completionHandler: completion)

+ 66 - 42
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Chat/EditorGroup.swift

@@ -913,62 +913,52 @@ public class EditorGroup: UIViewController {
                 let chatData = dataMessage.mBodies
                 if (chatData[CoreMessage_TMessageKey.F_PIN] == idMe || chatData[CoreMessage_TMessageKey.L_PIN] == self.dataGroup["group_id"] as? String || chatData[CoreMessage_TMessageKey.F_PIN] == self.dataGroup["group_id"] as? String) && chatData[CoreMessage_TMessageKey.MESSAGE_SCOPE_ID] == "4" {
                     if (chatData.keys.contains(CoreMessage_TMessageKey.MESSAGE_ID) && !(chatData[CoreMessage_TMessageKey.MESSAGE_ID]!).contains("-2,")) {
-                        let idx = self.dataMessages.firstIndex(where: { $0["message_id"] as! String == chatData[CoreMessage_TMessageKey.MESSAGE_ID]! })
+                        var idx = self.dataMessages.firstIndex(where: { $0["message_id"] as! String == chatData[CoreMessage_TMessageKey.MESSAGE_ID]! })
+                        if let idxMessageIdParent = self.groupImages.firstIndex(where: { $0.value.contains(where: { $0.messageId == chatData[CoreMessage_TMessageKey.MESSAGE_ID]! }) }) {
+                            if let idxInImages = self.groupImages[idxMessageIdParent].value.firstIndex(where: { $0.messageId == chatData[CoreMessage_TMessageKey.MESSAGE_ID]! }) {
+                                self.groupImages[idxMessageIdParent].value[idxInImages].status = chatData[CoreMessage_TMessageKey.STATUS]!
+                                self.groupImages[idxMessageIdParent].value[idxInImages].dataMessage["status"] = chatData[CoreMessage_TMessageKey.STATUS]!
+                            }
+                            idx = self.dataMessages.firstIndex(where: { $0["message_id"] as? String == self.groupImages[idxMessageIdParent].key })
+                        }
                         if (idx != nil) {
                             if (chatData[CoreMessage_TMessageKey.DELETE_MESSAGE_FLAG] == "1") {
-                                self.dataMessages[idx!]["lock"] = "1"
-                                self.dataMessages[idx!]["reff_id"] = ""
-                                let section = self.dataDates.firstIndex(of: self.dataMessages[idx!]["chat_date"] as! String)
-                                let row = self.dataMessages.filter({ $0["chat_date"] as! String == self.dataMessages[idx!]["chat_date"] as! String}).firstIndex(where: { $0["message_id"] as! String == self.dataMessages[idx!]["message_id"] as! String })
-                                if row != nil && section != nil  {
-                                    self.tableChatView.reloadRows(at: [IndexPath(row: row!, section: section!)], with: .none)
-                                }
-                                if self.reffId != nil && self.reffId == chatData[CoreMessage_TMessageKey.MESSAGE_ID]! {
-                                    self.deleteReplyView()
-                                }
+                                self.updateStatusDelete(idx: idx, chatData: chatData)
                             } else {
-                                self.dataMessages[idx!]["status"] = chatData[CoreMessage_TMessageKey.STATUS]!
-                                let section = self.dataDates.firstIndex(of: self.dataMessages[idx!]["chat_date"] as! String)
-                                let row = self.dataMessages.filter({ $0["chat_date"] as! String == self.dataMessages[idx!]["chat_date"] as! String}).firstIndex(where: { $0["message_id"] as! String == self.dataMessages[idx!]["message_id"] as! String })
-                                if row != nil && section != nil  {
-                                    self.tableChatView.reloadRows(at: [IndexPath(row: row!, section: section!)], with: .none)
-                                }
+                                self.updateStatusMessage(idx: idx, chatData: chatData)
                             }
                         }
                     }
                     else if (chatData.keys.contains("message_id")) {
-                        let idx = self.dataMessages.firstIndex(where: { "'\($0["message_id"] as! String)'" == chatData["message_id"]! })
+                        var idx = self.dataMessages.firstIndex(where: { "'\(String(describing: $0["message_id"] as? String))'" == chatData["message_id"]! })
+                        if let idxMessageIdParent = self.groupImages.firstIndex(where: { $0.value.contains(where: { $0.messageId == chatData["message_id"]! }) }) {
+                            if let idxInImages = self.groupImages[idxMessageIdParent].value.firstIndex(where: { $0.messageId == chatData["message_id"]! }) {
+                                self.groupImages[idxMessageIdParent].value[idxInImages].status = chatData[CoreMessage_TMessageKey.STATUS]!
+                                self.groupImages[idxMessageIdParent].value[idxInImages].dataMessage["status"] = chatData[CoreMessage_TMessageKey.STATUS]!
+                            }
+                            idx = self.dataMessages.firstIndex(where: { $0["message_id"] as? String == self.groupImages[idxMessageIdParent].key })
+                        }
                         if (idx != nil) {
                             if (chatData[CoreMessage_TMessageKey.DELETE_MESSAGE_FLAG] == "1") {
-                                self.dataMessages[idx!]["lock"] = "1"
-                                self.dataMessages[idx!]["reff_id"] = ""
-                                let section = self.dataDates.firstIndex(of: self.dataMessages[idx!]["chat_date"] as! String)
-                                let row = self.dataMessages.filter({ $0["chat_date"] as! String == self.dataMessages[idx!]["chat_date"] as! String}).firstIndex(where: { $0["message_id"] as! String == self.dataMessages[idx!]["message_id"] as! String })
-                                if row != nil && section != nil  {
-                                    self.tableChatView.reloadRows(at: [IndexPath(row: row!, section: section!)], with: .none)
-                                }
-                                if self.reffId != nil && self.reffId == chatData["message_id"]! {
-                                    self.deleteReplyView()
-                                }
+                                self.updateStatusDelete(idx: idx, chatData: chatData)
                             } else {
-                                self.dataMessages[idx!]["status"] = chatData[CoreMessage_TMessageKey.STATUS]!
-                                let section = self.dataDates.firstIndex(of: self.dataMessages[idx!]["chat_date"] as! String)
-                                let row = self.dataMessages.filter({ $0["chat_date"] as! String == self.dataMessages[idx!]["chat_date"] as! String}).firstIndex(where: { $0["message_id"] as! String == self.dataMessages[idx!]["message_id"] as! String })
-                                if row != nil && section != nil  {
-                                    self.tableChatView.reloadRows(at: [IndexPath(row: row!, section: section!)], with: .none)
-                                }
+                                self.updateStatusMessage(idx: idx, chatData: chatData)
                             }
                         }
                     }
                     else {
-                        let messageId = chatData[CoreMessage_TMessageKey.MESSAGE_ID]!.split(separator: ",")[1]
-                        let idx = self.dataMessages.firstIndex(where: { $0["message_id"] as! String == messageId })
-                        if (idx != nil) {
-                            self.dataMessages[idx!]["status"] = chatData[CoreMessage_TMessageKey.STATUS]!
-                            let section = self.dataDates.firstIndex(of: self.dataMessages[idx!]["chat_date"] as! String)
-                            let row = self.dataMessages.filter({ $0["chat_date"] as! String == self.dataMessages[idx!]["chat_date"] as! String}).firstIndex(where: { $0["message_id"] as! String == self.dataMessages[idx!]["message_id"] as! String })
-                            if row != nil && section != nil  {
-                                self.tableChatView.reloadRows(at: [IndexPath(row: row!, section: section!)], with: .none)
+                        let listMessageId = chatData[CoreMessage_TMessageKey.MESSAGE_ID]!.split(separator: ",")
+                        for i in 1..<listMessageId.count {
+                            var idx = self.dataMessages.firstIndex(where: { $0["message_id"] as? String ?? "" == listMessageId[i] })
+                            if let idxMessageIdParent = self.groupImages.firstIndex(where: { $0.value.contains(where: { $0.messageId == listMessageId[i] }) }) {
+                                if let idxInImages = self.groupImages[idxMessageIdParent].value.firstIndex(where: { $0.messageId == listMessageId[i] }) {
+                                    self.groupImages[idxMessageIdParent].value[idxInImages].status = chatData[CoreMessage_TMessageKey.STATUS]!
+                                    self.groupImages[idxMessageIdParent].value[idxInImages].dataMessage["status"] = chatData[CoreMessage_TMessageKey.STATUS]!
+                                }
+                                idx = self.dataMessages.firstIndex(where: { $0["message_id"] as? String == self.groupImages[idxMessageIdParent].key })
+                            }
+                            if (idx != nil) {
+                                self.updateStatusMessage(idx: idx, chatData: chatData)
                             }
                         }
                     }
@@ -977,6 +967,40 @@ public class EditorGroup: UIViewController {
         }
     }
     
+    private func updateStatusDelete(idx: Int?, chatData: [String: String]) {
+        do {
+            if self.dataMessages[idx!]["lock"] as! String == "1" {
+                return
+            }
+            self.dataMessages[idx!]["lock"] = "1"
+            self.dataMessages[idx!]["reff_id"] = ""
+            let section = self.dataDates.firstIndex(of: self.dataMessages[idx!]["chat_date"] as! String)
+            let row = self.dataMessages.filter({ $0["chat_date"] as! String == self.dataMessages[idx!]["chat_date"] as! String}).firstIndex(where: { $0["message_id"] as! String == self.dataMessages[idx!]["message_id"] as! String })
+            if row != nil && section != nil  {
+                self.tableChatView.reloadRows(at: [IndexPath(row: row!, section: section!)], with: .none)
+            }
+            if self.reffId != nil && self.reffId == chatData["message_id"]! {
+                self.deleteReplyView()
+            }
+        } catch {
+        }
+    }
+    
+    private func updateStatusMessage(idx: Int?, chatData: [String: String]) {
+        do {
+            if Int(self.dataMessages[idx!]["status"] as! String)! > Int(chatData[CoreMessage_TMessageKey.STATUS]!)! {
+                return
+            }
+            self.dataMessages[idx!]["status"] = chatData[CoreMessage_TMessageKey.STATUS]!
+            let section = self.dataDates.firstIndex(of: self.dataMessages[idx!]["chat_date"] as! String)
+            let row = self.dataMessages.filter({ $0["chat_date"] as! String == self.dataMessages[idx!]["chat_date"] as! String}).firstIndex(where: { $0["message_id"] as! String == self.dataMessages[idx!]["message_id"] as! String })
+            if row != nil && section != nil  {
+                self.tableChatView.reloadRows(at: [IndexPath(row: row!, section: section!)], with: .none)
+            }
+        } catch {
+        }
+    }
+    
     @objc func onMemberTopic(notification: NSNotification) {
         let data:[AnyHashable : Any] = notification.userInfo!
         DispatchQueue.main.async { [self] in

+ 62 - 61
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Chat/EditorPersonal.swift

@@ -1610,29 +1610,9 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
                         }
                         if (idx != nil) {
                             if (chatData[CoreMessage_TMessageKey.DELETE_MESSAGE_FLAG] == "1") {
-                                self.dataMessages[idx!]["lock"] = "1"
-                                self.dataMessages[idx!]["reff_id"] = ""
-                                let section = self.dataDates.firstIndex(of: self.dataMessages[idx!]["chat_date"] as! String)
-                                let row = self.dataMessages.filter({ $0["chat_date"] as! String == self.dataMessages[idx!]["chat_date"] as! String}).firstIndex(where: { $0["message_id"] as? String == self.dataMessages[idx!]["message_id"] as? String })
-                                if row != nil && section != nil  {
-                                    self.tableChatView.reloadRows(at: [IndexPath(row: row!, section: section!)], with: .none)
-                                }
-                                if self.listTimerCredential[self.dataMessages[idx!]["message_id"] as! String] != nil {
-                                    self.listTimerCredential.removeValue(forKey: self.dataMessages[idx!]["message_id"] as! String)
-                                    self.timerCredential[self.dataMessages[idx!]["message_id"] as! String]?.invalidate()
-                                    self.timerCredential.removeValue(forKey: self.dataMessages[idx!]["message_id"] as! String)
-                                    UserDefaults.standard.removeObject(forKey: self.dataMessages[idx!]["message_id"] as! String)
-                                }
-                                if self.reffId != nil && self.reffId == chatData[CoreMessage_TMessageKey.MESSAGE_ID]! {
-                                    self.deleteReplyView()
-                                }
+                                self.updateStatusDelete(idx: idx, chatData: chatData)
                             } else {
-                                self.dataMessages[idx!]["status"] = chatData[CoreMessage_TMessageKey.STATUS]!
-                                let section = self.dataDates.firstIndex(of: self.dataMessages[idx!]["chat_date"] as! String)
-                                let row = self.dataMessages.filter({ $0["chat_date"] as! String == self.dataMessages[idx!]["chat_date"] as! String}).firstIndex(where: { $0["message_id"] as? String == self.dataMessages[idx!]["message_id"] as? String })
-                                if row != nil && section != nil  {
-                                    self.tableChatView.reloadRows(at: [IndexPath(row: row!, section: section!)], with: .none)
-                                }
+                                self.updateStatusMessage(idx: idx, chatData: chatData)
                             }
                         }
                     }
@@ -1647,48 +1627,25 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
                         }
                         if (idx != nil) {
                             if (chatData[CoreMessage_TMessageKey.DELETE_MESSAGE_FLAG] == "1") {
-                                self.dataMessages[idx!]["lock"] = "1"
-                                self.dataMessages[idx!]["reff_id"] = ""
-                                let section = self.dataDates.firstIndex(of: self.dataMessages[idx!]["chat_date"] as! String)
-                                let row = self.dataMessages.filter({ $0["chat_date"] as! String == self.dataMessages[idx!]["chat_date"] as! String}).firstIndex(where: { $0["message_id"] as? String == self.dataMessages[idx!]["message_id"] as? String })
-                                if row != nil && section != nil  {
-                                    self.tableChatView.reloadRows(at: [IndexPath(row: row!, section: section!)], with: .none)
-                                }
-                                if self.listTimerCredential[self.dataMessages[idx!]["message_id"] as! String] != nil {
-                                    self.listTimerCredential.removeValue(forKey: self.dataMessages[idx!]["message_id"] as! String)
-                                    self.timerCredential[self.dataMessages[idx!]["message_id"] as! String]?.invalidate()
-                                    self.timerCredential.removeValue(forKey: self.dataMessages[idx!]["message_id"] as! String)
-                                    UserDefaults.standard.removeObject(forKey: self.dataMessages[idx!]["message_id"] as! String)
-                                }
-                                if self.reffId != nil && self.reffId == chatData["message_id"]! {
-                                    self.deleteReplyView()
-                                }
+                                self.updateStatusDelete(idx: idx, chatData: chatData)
                             } else {
-                                self.dataMessages[idx!]["status"] = chatData[CoreMessage_TMessageKey.STATUS]!
-                                let section = self.dataDates.firstIndex(of: self.dataMessages[idx!]["chat_date"] as! String)
-                                let row = self.dataMessages.filter({ $0["chat_date"] as! String == self.dataMessages[idx!]["chat_date"] as! String}).firstIndex(where: { $0["message_id"] as? String == self.dataMessages[idx!]["message_id"] as? String })
-                                if row != nil && section != nil  {
-                                    self.tableChatView.reloadRows(at: [IndexPath(row: row!, section: section!)], with: .none)
-                                }
+                                self.updateStatusMessage(idx: idx, chatData: chatData)
                             }
                         }
                     }
                     else {
-                        let messageId = chatData[CoreMessage_TMessageKey.MESSAGE_ID]!.split(separator: ",")[1]
-                        var idx = self.dataMessages.firstIndex(where: { $0["message_id"] as? String ?? "" == messageId })
-                        if let idxMessageIdParent = self.groupImages.firstIndex(where: { $0.value.contains(where: { $0.messageId == messageId }) }) {
-                            if let idxInImages = self.groupImages[idxMessageIdParent].value.firstIndex(where: { $0.messageId == messageId }) {
-                                self.groupImages[idxMessageIdParent].value[idxInImages].status = chatData[CoreMessage_TMessageKey.STATUS]!
-                                self.groupImages[idxMessageIdParent].value[idxInImages].dataMessage["status"] = chatData[CoreMessage_TMessageKey.STATUS]!
+                        let listMessageId = chatData[CoreMessage_TMessageKey.MESSAGE_ID]!.split(separator: ",")
+                        for i in 1..<listMessageId.count {
+                            var idx = self.dataMessages.firstIndex(where: { $0["message_id"] as? String ?? "" == listMessageId[i] })
+                            if let idxMessageIdParent = self.groupImages.firstIndex(where: { $0.value.contains(where: { $0.messageId == listMessageId[i] }) }) {
+                                if let idxInImages = self.groupImages[idxMessageIdParent].value.firstIndex(where: { $0.messageId == listMessageId[i] }) {
+                                    self.groupImages[idxMessageIdParent].value[idxInImages].status = chatData[CoreMessage_TMessageKey.STATUS]!
+                                    self.groupImages[idxMessageIdParent].value[idxInImages].dataMessage["status"] = chatData[CoreMessage_TMessageKey.STATUS]!
+                                }
+                                idx = self.dataMessages.firstIndex(where: { $0["message_id"] as? String == self.groupImages[idxMessageIdParent].key })
                             }
-                            idx = self.dataMessages.firstIndex(where: { $0["message_id"] as? String == self.groupImages[idxMessageIdParent].key })
-                        }
-                        if (idx != nil) {
-                            self.dataMessages[idx!]["status"] = chatData[CoreMessage_TMessageKey.STATUS]!
-                            let section = self.dataDates.firstIndex(of: self.dataMessages[idx!]["chat_date"] as! String)
-                            let row = self.dataMessages.filter({ $0["chat_date"] as! String == self.dataMessages[idx!]["chat_date"] as! String}).firstIndex(where: { $0["message_id"] as? String == self.dataMessages[idx!]["message_id"] as? String })
-                            if row != nil && section != nil  {
-                                self.tableChatView.reloadRows(at: [IndexPath(row: row!, section: section!)], with: .none)
+                            if (idx != nil) {
+                                self.updateStatusMessage(idx: idx, chatData: chatData)
                             }
                         }
                     }
@@ -1697,6 +1654,46 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
         }
     }
     
+    private func updateStatusDelete(idx: Int?, chatData: [String: String]) {
+        do {
+            if self.dataMessages[idx!]["lock"] as! String == "1" {
+                return
+            }
+            self.dataMessages[idx!]["lock"] = "1"
+            self.dataMessages[idx!]["reff_id"] = ""
+            let section = self.dataDates.firstIndex(of: self.dataMessages[idx!]["chat_date"] as! String)
+            let row = self.dataMessages.filter({ $0["chat_date"] as! String == self.dataMessages[idx!]["chat_date"] as! String}).firstIndex(where: { $0["message_id"] as? String == self.dataMessages[idx!]["message_id"] as? String })
+            if row != nil && section != nil  {
+                self.tableChatView.reloadRows(at: [IndexPath(row: row!, section: section!)], with: .none)
+            }
+            if self.listTimerCredential[self.dataMessages[idx!]["message_id"] as! String] != nil {
+                self.listTimerCredential.removeValue(forKey: self.dataMessages[idx!]["message_id"] as! String)
+                self.timerCredential[self.dataMessages[idx!]["message_id"] as! String]?.invalidate()
+                self.timerCredential.removeValue(forKey: self.dataMessages[idx!]["message_id"] as! String)
+                UserDefaults.standard.removeObject(forKey: self.dataMessages[idx!]["message_id"] as! String)
+            }
+            if self.reffId != nil && self.reffId == chatData["message_id"]! {
+                self.deleteReplyView()
+            }
+        } catch {
+        }
+    }
+    
+    private func updateStatusMessage(idx: Int?, chatData: [String: String]) {
+        do {
+            if Int(self.dataMessages[idx!]["status"] as! String)! > Int(chatData[CoreMessage_TMessageKey.STATUS]!)! {
+                return
+            }
+            self.dataMessages[idx!]["status"] = chatData[CoreMessage_TMessageKey.STATUS]!
+            let section = self.dataDates.firstIndex(of: self.dataMessages[idx!]["chat_date"] as! String)
+            let row = self.dataMessages.filter({ $0["chat_date"] as! String == self.dataMessages[idx!]["chat_date"] as! String}).firstIndex(where: { $0["message_id"] as? String == self.dataMessages[idx!]["message_id"] as? String })
+            if row != nil && section != nil  {
+                self.tableChatView.reloadRows(at: [IndexPath(row: row!, section: section!)], with: .none)
+            }
+        } catch {
+        }
+    }
+    
     @objc func onTyping(notification: NSNotification) {
         DispatchQueue.main.async { [self] in
             let data:[AnyHashable : Any] = notification.userInfo!
@@ -2219,7 +2216,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
         }
     }
     
-    private func sendChat(message_scope_id:String =  "3", status:String =  "2", message_text:String =  "", credential:String = "0", attachment_flag: String = "0", ex_blog_id: String = "", message_large_text: String = "", ex_format: String = "", image_id: String = "", audio_id: String = "", video_id: String = "", file_id: String = "", thumb_id: String = "", reff_id: String = "", read_receipts: String = "4", chat_id: String = "", is_call_center: String = "0", call_center_id: String = "", viewController: UIViewController, isAutoSendCC : Bool = false) {
+    private func sendChat(message_scope_id:String =  "3", status:String =  "1", message_text:String =  "", credential:String = "0", attachment_flag: String = "0", ex_blog_id: String = "", message_large_text: String = "", ex_format: String = "", image_id: String = "", audio_id: String = "", video_id: String = "", file_id: String = "", thumb_id: String = "", reff_id: String = "", read_receipts: String = "4", chat_id: String = "", is_call_center: String = "0", call_center_id: String = "", viewController: UIViewController, isAutoSendCC : Bool = false) {
         if viewController is EditorPersonal && file_id == "" && dataMessageForward == nil && !isAutoSendCC{
             if ((textFieldSend.text!.trimmingCharacters(in: .whitespacesAndNewlines) == "Send message".localized() && textFieldSend.textColor == UIColor.lightGray && attachment_flag != "11") || textFieldSend.text!.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty ) {
                 dismissKeyboard()
@@ -4660,7 +4657,9 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
                 statusMessage.trailingAnchor.constraint(equalTo: containerMessage.leadingAnchor, constant: -8).isActive = true
                 statusMessage.widthAnchor.constraint(equalToConstant: 15).isActive = true
                 statusMessage.heightAnchor.constraint(equalToConstant: 15).isActive = true
-                if (dataMessages[indexPath.row]["status"]! as! String == "1" || dataMessages[indexPath.row]["status"]! as! String == "2" ) {
+                if dataMessages[indexPath.row]["status"]! as! String == "1" {
+                    statusMessage.image = UIImage(systemName: "clock.arrow.circlepath")!.withTintColor(UIColor.lightGray, renderingMode: .alwaysOriginal)
+                } else if (dataMessages[indexPath.row]["status"]! as! String == "2" ) {
                     statusMessage.image = UIImage(named: "checklist", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!.withTintColor(UIColor.lightGray)
                 } else if (dataMessages[indexPath.row]["status"]! as! String == "3") {
                     statusMessage.image = UIImage(named: "double-checklist", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!.withTintColor(UIColor.lightGray)
@@ -5063,7 +5062,9 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
                         let statusInImage = UIImageView()
                         containerTimeStatus.addSubview(statusInImage)
                         statusInImage.anchor(right: containerTimeStatus.rightAnchor, centerY: containerTimeStatus.centerYAnchor, width: 15, height: 15)
-                        if listImages[i].status == "1" || listImages[i].status == "2"  {
+                        if listImages[i].status == "1" {
+                            statusInImage.image = UIImage(systemName: "clock.arrow.circlepath")!.withTintColor(UIColor.white, renderingMode: .alwaysOriginal)
+                        } else if listImages[i].status == "2"  {
                             statusInImage.image = UIImage(named: "checklist", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!.withTintColor(UIColor.white)
                         } else if listImages[i].status == "3" {
                             statusInImage.image = UIImage(named: "double-checklist", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!.withTintColor(UIColor.white)