瀏覽代碼

fix action delete for me in grouping image view

alqindiirsyam 2 年之前
父節點
當前提交
328db812c5

二進制
appbuilder-ios/DigiXLite/DigiXLite.xcworkspace/xcuserdata/akhmadalqindiirsyam.xcuserdatad/UserInterfaceState.xcuserstate


+ 45 - 13
appbuilder-ios/DigiXLite/DigiXLite/Source/View/Chat/EditorPersonal.swift

@@ -34,7 +34,6 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
     @IBOutlet weak var constraintBottomTableViewWithTextfield: NSLayoutConstraint!
     @IBOutlet weak var viewAttachment: UIStackView!
     public var dataPerson: [String: String?] = [:]
-    var dataMessagesOnGrouping: [String:[[String: Any?]]] = [:]
     var dataMessages: [[String: Any?]] = []
     var dataDates: [String] = []
     var users: [User] = []
@@ -1132,12 +1131,9 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
                         tempImages.append(ImageGrouping(messageId: row["message_id"] as! String, thumbId: row["thumb_id"] as! String, imageId: row["image_id"] as! String, status: row["status"] as! String, time: row["server_date"] as! String, lPin: row["l_pin"] as! String, dataMessage: row, dataPerson: dataPerson))
                     } else if tempImages.count >= 4 {
                         groupImages[tempImages[0].messageId] = tempImages
-                        var tempDataOnGrouping: [[String: Any?]] =  []
                         for _ in 1..<tempImages.count {
-                            tempDataOnGrouping.insert(dataMessages.last!, at: 0)
                             dataMessages.removeLast()
                         }
-                        dataMessagesOnGrouping[tempImages[0].messageId] = tempDataOnGrouping
                         tempImages.removeAll()
                     } else if tempImages.count > 0 {
                         tempImages.removeAll()
@@ -1146,9 +1142,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
                 }
                 if tempImages.count >= 4 {
                     groupImages[tempImages[0].messageId] = tempImages
-                    var tempDataOnGrouping: [[String: Any?]] =  []
                     for _ in 1..<tempImages.count {
-                        tempDataOnGrouping.insert(dataMessages.last!, at: 0)
                         dataMessages.removeLast()
                     }
                 }
@@ -3797,9 +3791,9 @@ extension EditorPersonal: UIContextMenuInteractionDelegate {
             for i in 0..<countSelected {
                 if let groupingImages = groupImages[dataMessages[i]["message_id"] as! String] {
                     var tempData = dataMessages
-                    tempData.remove(at: i)
-                    tempData.insert(contentsOf: dataMessagesOnGrouping[dataMessages[i]["message_id"] as! String]!, at: i)
-                    tempData.insert(dataMessages[i], at: i)
+                    tempData.remove(at: 0)
+                    var dataMessageInGrouping = (groupImages[dataMessages[i]["message_id"] as! String]!).map({ $0.dataMessage })
+                    tempData.insert(contentsOf: dataMessageInGrouping, at: i)
                     dataMessages = tempData
                 }
             }
@@ -3983,6 +3977,7 @@ extension EditorPersonal: UIContextMenuInteractionDelegate {
                                 }
                             }
                         }
+                        self.groupImages.removeValue(forKey: groupingImages[0].messageId)
                     } else {
                         self.deleteMessage(l_pin: dataMessages[i]["l_pin"] as! String, message_id: dataMessages[i]["message_id"] as! String, scope: "3", type: "1", chat: "")
                         let idx = self.dataMessages.firstIndex(where: { $0["message_id"] as? String == dataMessages[i]["message_id"] as? String})
@@ -4010,7 +4005,9 @@ extension EditorPersonal: UIContextMenuInteractionDelegate {
                             }
                         }
                         if let idx = self.dataMessages.firstIndex(where: { $0["message_id"] as? String == groupingImages[0].messageId}) {
-                            self.dataMessages.insert(contentsOf: dataMessagesOnGrouping[groupingImages[0].messageId]!, at: idx+1)
+                            var dataMessageInGrouping = (groupImages[dataMessages[i]["message_id"] as! String]!).map({ $0.dataMessage })
+                            dataMessageInGrouping.remove(at: 0)
+                            self.dataMessages.insert(contentsOf: dataMessageInGrouping, at: idx+1)
                             self.groupImages.removeValue(forKey: groupingImages[0].messageId)
                         }
                     } else {
@@ -5514,9 +5511,44 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
         listGroupingImages.listGroupingImages = sender.listImageFromGrouping
         listGroupingImages.titleName = titleText
         listGroupingImages.isInitiator = sender.isInitiator
-        listGroupingImages.updateEditor = { [self] updatedData, replyData in
-            if updatedData.count != 0 {
-                groupImages[sender.listImageFromGrouping[0].messageId] = updatedData
+        listGroupingImages.updateEditor = { [self] updatedData, replyData, isUpdateDelete in
+            if replyData.count == 0 {
+                if updatedData.count != 0 && !isUpdateDelete {
+                    groupImages[sender.listImageFromGrouping[0].messageId] = updatedData
+                    DispatchQueue.main.async { [self] in
+                        tableChatView.reloadData()
+                    }
+                } else {
+                    if updatedData.filter({ $0.dataMessage["lock"] as? String == "1" }).count != 0 {
+                        
+                    } else {
+                        if updatedData.count >= 4 {
+                            if updatedData[0].messageId == sender.listImageFromGrouping[0].messageId {
+                                groupImages[sender.listImageFromGrouping[0].messageId] = updatedData
+                            } else {
+                                if let idx = self.dataMessages.firstIndex(where: { $0["message_id"] as! String == sender.listImageFromGrouping[0].messageId }) {
+                                    self.dataMessages.remove(at: idx)
+                                    self.dataMessages.insert(updatedData[0].dataMessage, at: idx)
+                                    groupImages.removeValue(forKey: sender.listImageFromGrouping[0].messageId)
+                                    groupImages[updatedData[0].messageId] = updatedData
+                                }
+                            }
+                        } else {
+                            if updatedData.count > 0 {
+                                if let idx = self.dataMessages.firstIndex(where: { $0["message_id"] as! String == sender.listImageFromGrouping[0].messageId }) {
+                                    self.dataMessages.remove(at: idx)
+                                    let dataMessageInGrouping = updatedData.map({ $0.dataMessage })
+                                    self.dataMessages.insert(contentsOf: dataMessageInGrouping, at: idx)
+                                }
+                            } else {
+                                groupImages.removeValue(forKey: sender.listImageFromGrouping[0].messageId)
+                                if let idx = self.dataMessages.firstIndex(where: { $0["message_id"] as! String == sender.listImageFromGrouping[0].messageId }) {
+                                    self.dataMessages.remove(at: idx)
+                                }
+                            }
+                        }
+                    }
+                }
                 DispatchQueue.main.async { [self] in
                     tableChatView.reloadData()
                 }

+ 84 - 14
appbuilder-ios/DigiXLite/DigiXLite/Source/View/Chat/ListGroupImages.swift

@@ -21,17 +21,17 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
     var startYVisible: CGFloat!
     var endYVisible: CGFloat!
     var indexSelected = 0
-    var updateEditor: (([ImageGrouping], [String: Any?]) -> ())?
+    var updateEditor: (([ImageGrouping], [String: Any?], Bool) -> ())?
     var isSelectAll = false
     var viewMultipleSelect = UIView()
     var constraintBottomViewMultipleSelect: NSLayoutConstraint!
+    let centeredTitleView = CenteredTitleSubtitleView(frame: CGRect(x: 0, y: 0, width: 200, height: 44))
 
     override func viewDidLoad() {
         super.viewDidLoad()
         
         view.backgroundColor = .white
 
-        let centeredTitleView = CenteredTitleSubtitleView(frame: CGRect(x: 0, y: 0, width: 200, height: 44))
         centeredTitleView.titleLabel.text = titleName
         centeredTitleView.subtitleLabel.text = String(listGroupingImages.count) + " " + "images".localized()
         navigationItem.titleView = centeredTitleView
@@ -55,7 +55,7 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
         center.addObserver(self, selector: #selector(onStatusChat(notification:)), name: NSNotification.Name(rawValue: DigiX.listenerStatusChat), object: nil)
         
         self.view.addSubview(viewMultipleSelect)
-        viewMultipleSelect.backgroundColor = .white.withAlphaComponent(0.8)
+        viewMultipleSelect.backgroundColor = .white.withAlphaComponent(0.9)
         viewMultipleSelect.anchor(left: self.view.safeAreaLayoutGuide.leftAnchor, right: self.view.safeAreaLayoutGuide.rightAnchor, height: 50)
         constraintBottomViewMultipleSelect = viewMultipleSelect.bottomAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.bottomAnchor, constant: 50)
         constraintBottomViewMultipleSelect.isActive = true
@@ -214,7 +214,7 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
             iconSelected.anchor(top: containerSelect.topAnchor, left: containerSelect.leftAnchor, paddingTop: 10, paddingLeft: 10, width: 25.0, height: 25.0)
             
             if listGroupingImages[indexPath.row].isSelected {
-                containerSelect.backgroundColor = .white.withAlphaComponent(0.1)
+                containerSelect.backgroundColor = .white.withAlphaComponent(0.2)
                 iconSelected.image = UIImage(systemName: "checkmark.circle.fill")
             }
         }
@@ -254,11 +254,11 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
                     listGroupingImages[indexSelected].dataMessage["is_stared"] = "0"
                 }
                 tableViewImages.reloadRows(at: [IndexPath(row: indexSelected, section: 0)], with: .none)
-                updateEditor!(listGroupingImages, [:])
+                updateEditor!(listGroupingImages, [:], false)
             case 1:
                 popover.dismiss()
                 self.navigationController?.popViewController(animated: true)
-                updateEditor!([], listGroupingImages[indexSelected].dataMessage)
+                updateEditor!([], listGroupingImages[indexSelected].dataMessage, false)
             case 2:
                 popover.dismiss()
                 listGroupingImages[indexSelected].isSelected = true
@@ -349,24 +349,28 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
         navigationItem.rightBarButtonItem = doneButton
         deleteSession = isDeleteSession
         forwardSession = !isDeleteSession
-        addSubviewMultipleSelect()
-        tableViewImages.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 50, right: 0)
         constraintBottomViewMultipleSelect.constant = 0
         UIView.animate(withDuration: 0.35, animations: {
             self.view.layoutIfNeeded()
         })
+        addSubviewMultipleSelect()
+        tableViewImages.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 50, right: 0)
         tableViewImages.reloadData()
     }
     
     @objc func selectAllAction() {
         listGroupingImages.forEach({ $0.isSelected = true })
         changetoLeftBarButton(isSelectAllButton: false)
+        viewMultipleSelect.subviews.forEach({ $0.removeFromSuperview() })
+        addSubviewMultipleSelect()
         tableViewImages.reloadData()
     }
     
     @objc func deselectAllAction() {
         listGroupingImages.forEach({ $0.isSelected = false })
         changetoLeftBarButton(isSelectAllButton: true)
+        viewMultipleSelect.subviews.forEach({ $0.removeFromSuperview() })
+        addSubviewMultipleSelect()
         tableViewImages.reloadData()
     }
     
@@ -403,6 +407,7 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
     }
     
     func addSubviewMultipleSelect() {
+        viewMultipleSelect.addTopBorder(with: .lightGray, andWidth: 1)
         let container = UIView()
         viewMultipleSelect.addSubview(container)
         container.translatesAutoresizingMaskIntoConstraints = false
@@ -412,11 +417,6 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
             container.bottomAnchor.constraint(equalTo: viewMultipleSelect.bottomAnchor),
             container.heightAnchor.constraint(equalToConstant: 50)
         ])
-        container.layer.shadowOpacity = 0.7
-        container.layer.shadowOffset = CGSize(width: 3, height: 3)
-        container.layer.shadowRadius = 3.0
-        container.layer.shadowColor = UIColor.black.cgColor
-        container.backgroundColor = .secondaryColor
         
         let title = UILabel()
         container.addSubview(title)
@@ -460,7 +460,77 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
     }
     
     @objc func sessionAction() {
-        
+        if forwardSession {
+            let tempDataMessages = listGroupingImages.filter({ $0.isSelected })
+            var dataMessages: [[String: Any?]] = []
+            for i in 0..<tempDataMessages.count {
+                dataMessages.append(tempDataMessages[i].dataMessage)
+            }
+            let contactChatNav = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "contactChatNav") as! UINavigationController
+            contactChatNav.modalPresentationStyle = .custom
+            contactChatNav.navigationBar.tintColor = .white
+            contactChatNav.navigationBar.barTintColor = .mainColor
+            contactChatNav.navigationBar.isTranslucent = false
+            let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
+            contactChatNav.navigationBar.titleTextAttributes = textAttributes
+            contactChatNav.view.backgroundColor = .mainColor
+            if let controller = contactChatNav.viewControllers.first as? ContactChatViewController {
+                controller.isChooser = { [weak self] scope, pin in
+                    if scope == "3" {
+                        let editorPersonalVC = AppStoryBoard.Palio.instance.instantiateViewController(identifier: "editorPersonalVC") as! EditorPersonal
+                        editorPersonalVC.unique_l_pin = pin
+                        editorPersonalVC.dataMessageForward = dataMessages
+                        self?.navigationController?.replaceAllViewController(with: editorPersonalVC, animated: true)
+                    } else {
+                        let editorGroupVC = AppStoryBoard.Palio.instance.instantiateViewController(identifier: "editorGroupVC") as! EditorGroup
+                        editorGroupVC.unique_l_pin = pin
+                        editorGroupVC.dataMessageForward = dataMessages
+                        self?.navigationController?.replaceAllViewController(with: editorGroupVC, animated: true)
+                    }
+                }
+            }
+            self.present(contactChatNav, animated: true, completion: nil)
+        } else if deleteSession {
+            let tempDataMessages = listGroupingImages.filter({ $0.isSelected })
+            var countSelected = tempDataMessages.count
+            if countSelected == 0 {
+                return
+            }
+            let alertController = LibAlertController(title: "Delete".localized() + " \(countSelected) " + "messages?", message: nil, preferredStyle: .actionSheet)
+
+            if let action = self.actionDelete(for: "me", title: "Delete".localized() + " \(countSelected) " + "For Me".localized(), dataMessages: tempDataMessages) {
+                alertController.addAction(action)
+            }
+            let idMe = UserDefaults.standard.string(forKey: "me") as String?
+            if tempDataMessages[0].dataMessage["f_pin"] as? String == idMe {
+                if let action = self.actionDelete(for: "everyone", title: "Delete".localized() + " \(countSelected) " + "For Everyone".localized(), dataMessages: tempDataMessages) {
+                    alertController.addAction(action)
+                }
+            }
+            alertController.addAction(UIAlertAction(title: "Cancel".localized(), style: .cancel, handler: nil))
+            self.present(alertController, animated: true)
+        }
+    }
+    
+    private func actionDelete(for type: String, title: String, dataMessages: [ImageGrouping]) -> UIAlertAction? {
+        return UIAlertAction(title: title, style: .destructive) { [unowned self] _ in
+            for i in 0..<dataMessages.count {
+                if (type == "me") {
+                    self.deleteMessage(l_pin: dataMessages[i].lPin, message_id: dataMessages[i].messageId, scope: "3", type: "1", chat: "")
+                    listGroupingImages.removeAll(where: { $0.messageId == dataMessages[i].messageId })
+                } else {
+                    
+                }
+            }
+            centeredTitleView.subtitleLabel.text = String(listGroupingImages.count) + " " + "images".localized()
+            updateEditor!(listGroupingImages, [:], true)
+            doneAction()
+        }
+    }
+    
+    private func deleteMessage(l_pin: String, message_id: String, scope: String, type: String, chat: String) {
+        let tmessage = CoreMessage_TMessageBank.deleteMessage(l_pin: l_pin, messageId: message_id, scope: scope, type: type, chat: chat)
+        DigiX.deleteQueueMessage(message: tmessage)
     }
     
     static func getImageSize(image: String, screenWidth: CGFloat, screenHeight: CGFloat) -> CGSize? {

+ 45 - 14
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Chat/EditorPersonal.swift

@@ -34,7 +34,6 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
     @IBOutlet weak var constraintBottomTableViewWithTextfield: NSLayoutConstraint!
     @IBOutlet weak var viewAttachment: UIStackView!
     public var dataPerson: [String: String?] = [:]
-    var dataMessagesOnGrouping: [String:[[String: Any?]]] = [:]
     var dataMessages: [[String: Any?]] = []
     var dataDates: [String] = []
     var users: [User] = []
@@ -1133,12 +1132,9 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
                         tempImages.append(ImageGrouping(messageId: row["message_id"] as! String, thumbId: row["thumb_id"] as! String, imageId: row["image_id"] as! String, status: row["status"] as! String, time: row["server_date"] as! String, lPin: row["l_pin"] as! String, dataMessage: row, dataPerson: dataPerson))
                     } else if tempImages.count >= 4 {
                         groupImages[tempImages[0].messageId] = tempImages
-                        var tempDataOnGrouping: [[String: Any?]] =  []
                         for _ in 1..<tempImages.count {
-                            tempDataOnGrouping.insert(dataMessages.last!, at: 0)
                             dataMessages.removeLast()
                         }
-                        dataMessagesOnGrouping[tempImages[0].messageId] = tempDataOnGrouping
                         tempImages.removeAll()
                     } else if tempImages.count > 0 {
                         tempImages.removeAll()
@@ -1147,12 +1143,9 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
                 }
                 if tempImages.count >= 4 {
                     groupImages[tempImages[0].messageId] = tempImages
-                    var tempDataOnGrouping: [[String: Any?]] =  []
                     for _ in 1..<tempImages.count {
-                        tempDataOnGrouping.insert(dataMessages.last!, at: 0)
                         dataMessages.removeLast()
                     }
-                    dataMessagesOnGrouping[tempImages[0].messageId] = tempDataOnGrouping
                 }
                 cursorData.close()
             }
@@ -3808,9 +3801,9 @@ extension EditorPersonal: UIContextMenuInteractionDelegate {
             for i in 0..<countSelected {
                 if let groupingImages = groupImages[dataMessages[i]["message_id"] as! String] {
                     var tempData = dataMessages
-                    tempData.remove(at: i)
-                    tempData.insert(contentsOf: dataMessagesOnGrouping[dataMessages[i]["message_id"] as! String]!, at: i)
-                    tempData.insert(dataMessages[i], at: i)
+                    tempData.remove(at: 0)
+                    var dataMessageInGrouping = (groupImages[dataMessages[i]["message_id"] as! String]!).map({ $0.dataMessage })
+                    tempData.insert(contentsOf: dataMessageInGrouping, at: i)
                     dataMessages = tempData
                 }
             }
@@ -3994,6 +3987,7 @@ extension EditorPersonal: UIContextMenuInteractionDelegate {
                                 }
                             }
                         }
+                        self.groupImages.removeValue(forKey: groupingImages[0].messageId)
                     } else {
                         self.deleteMessage(l_pin: dataMessages[i]["l_pin"] as! String, message_id: dataMessages[i]["message_id"] as! String, scope: "3", type: "1", chat: "")
                         let idx = self.dataMessages.firstIndex(where: { $0["message_id"] as? String == dataMessages[i]["message_id"] as? String})
@@ -4021,7 +4015,9 @@ extension EditorPersonal: UIContextMenuInteractionDelegate {
                             }
                         }
                         if let idx = self.dataMessages.firstIndex(where: { $0["message_id"] as? String == groupingImages[0].messageId}) {
-                            self.dataMessages.insert(contentsOf: dataMessagesOnGrouping[groupingImages[0].messageId]!, at: idx+1)
+                            var dataMessageInGrouping = (groupImages[dataMessages[i]["message_id"] as! String]!).map({ $0.dataMessage })
+                            dataMessageInGrouping.remove(at: 0)
+                            self.dataMessages.insert(contentsOf: dataMessageInGrouping, at: idx+1)
                             self.groupImages.removeValue(forKey: groupingImages[0].messageId)
                         }
                     } else {
@@ -5536,9 +5532,44 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
         listGroupingImages.listGroupingImages = sender.listImageFromGrouping
         listGroupingImages.titleName = titleText
         listGroupingImages.isInitiator = sender.isInitiator
-        listGroupingImages.updateEditor = { [self] updatedData, replyData in
-            if updatedData.count != 0 {
-                groupImages[sender.listImageFromGrouping[0].messageId] = updatedData
+        listGroupingImages.updateEditor = { [self] updatedData, replyData, isUpdateDelete in
+            if replyData.count == 0 {
+                if updatedData.count != 0 && !isUpdateDelete {
+                    groupImages[sender.listImageFromGrouping[0].messageId] = updatedData
+                    DispatchQueue.main.async { [self] in
+                        tableChatView.reloadData()
+                    }
+                } else {
+                    if updatedData.filter({ $0.dataMessage["lock"] as? String == "1" }).count != 0 {
+                        
+                    } else {
+                        if updatedData.count >= 4 {
+                            if updatedData[0].messageId == sender.listImageFromGrouping[0].messageId {
+                                groupImages[sender.listImageFromGrouping[0].messageId] = updatedData
+                            } else {
+                                if let idx = self.dataMessages.firstIndex(where: { $0["message_id"] as! String == sender.listImageFromGrouping[0].messageId }) {
+                                    self.dataMessages.remove(at: idx)
+                                    self.dataMessages.insert(updatedData[0].dataMessage, at: idx)
+                                    groupImages.removeValue(forKey: sender.listImageFromGrouping[0].messageId)
+                                    groupImages[updatedData[0].messageId] = updatedData
+                                }
+                            }
+                        } else {
+                            if updatedData.count > 0 {
+                                if let idx = self.dataMessages.firstIndex(where: { $0["message_id"] as! String == sender.listImageFromGrouping[0].messageId }) {
+                                    self.dataMessages.remove(at: idx)
+                                    let dataMessageInGrouping = updatedData.map({ $0.dataMessage })
+                                    self.dataMessages.insert(contentsOf: dataMessageInGrouping, at: idx)
+                                }
+                            } else {
+                                groupImages.removeValue(forKey: sender.listImageFromGrouping[0].messageId)
+                                if let idx = self.dataMessages.firstIndex(where: { $0["message_id"] as! String == sender.listImageFromGrouping[0].messageId }) {
+                                    self.dataMessages.remove(at: idx)
+                                }
+                            }
+                        }
+                    }
+                }
                 DispatchQueue.main.async { [self] in
                     tableChatView.reloadData()
                 }

+ 84 - 14
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Chat/ListGroupImages.swift

@@ -21,17 +21,17 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
     var startYVisible: CGFloat!
     var endYVisible: CGFloat!
     var indexSelected = 0
-    var updateEditor: (([ImageGrouping], [String: Any?]) -> ())?
+    var updateEditor: (([ImageGrouping], [String: Any?], Bool) -> ())?
     var isSelectAll = false
     var viewMultipleSelect = UIView()
     var constraintBottomViewMultipleSelect: NSLayoutConstraint!
+    let centeredTitleView = CenteredTitleSubtitleView(frame: CGRect(x: 0, y: 0, width: 200, height: 44))
 
     override func viewDidLoad() {
         super.viewDidLoad()
         
         view.backgroundColor = .white
 
-        let centeredTitleView = CenteredTitleSubtitleView(frame: CGRect(x: 0, y: 0, width: 200, height: 44))
         centeredTitleView.titleLabel.text = titleName
         centeredTitleView.subtitleLabel.text = String(listGroupingImages.count) + " " + "images".localized()
         navigationItem.titleView = centeredTitleView
@@ -55,7 +55,7 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
         center.addObserver(self, selector: #selector(onStatusChat(notification:)), name: NSNotification.Name(rawValue: Nexilis.listenerStatusChat), object: nil)
         
         self.view.addSubview(viewMultipleSelect)
-        viewMultipleSelect.backgroundColor = .white.withAlphaComponent(0.8)
+        viewMultipleSelect.backgroundColor = .white.withAlphaComponent(0.9)
         viewMultipleSelect.anchor(left: self.view.safeAreaLayoutGuide.leftAnchor, right: self.view.safeAreaLayoutGuide.rightAnchor, height: 50)
         constraintBottomViewMultipleSelect = viewMultipleSelect.bottomAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.bottomAnchor, constant: 50)
         constraintBottomViewMultipleSelect.isActive = true
@@ -214,7 +214,7 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
             iconSelected.anchor(top: containerSelect.topAnchor, left: containerSelect.leftAnchor, paddingTop: 10, paddingLeft: 10, width: 25.0, height: 25.0)
             
             if listGroupingImages[indexPath.row].isSelected {
-                containerSelect.backgroundColor = .white.withAlphaComponent(0.1)
+                containerSelect.backgroundColor = .white.withAlphaComponent(0.2)
                 iconSelected.image = UIImage(systemName: "checkmark.circle.fill")
             }
         }
@@ -254,11 +254,11 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
                     listGroupingImages[indexSelected].dataMessage["is_stared"] = "0"
                 }
                 tableViewImages.reloadRows(at: [IndexPath(row: indexSelected, section: 0)], with: .none)
-                updateEditor!(listGroupingImages, [:])
+                updateEditor!(listGroupingImages, [:], false)
             case 1:
                 popover.dismiss()
                 self.navigationController?.popViewController(animated: true)
-                updateEditor!([], listGroupingImages[indexSelected].dataMessage)
+                updateEditor!([], listGroupingImages[indexSelected].dataMessage, false)
             case 2:
                 popover.dismiss()
                 listGroupingImages[indexSelected].isSelected = true
@@ -349,24 +349,28 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
         navigationItem.rightBarButtonItem = doneButton
         deleteSession = isDeleteSession
         forwardSession = !isDeleteSession
-        addSubviewMultipleSelect()
-        tableViewImages.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 50, right: 0)
         constraintBottomViewMultipleSelect.constant = 0
         UIView.animate(withDuration: 0.35, animations: {
             self.view.layoutIfNeeded()
         })
+        addSubviewMultipleSelect()
+        tableViewImages.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 50, right: 0)
         tableViewImages.reloadData()
     }
     
     @objc func selectAllAction() {
         listGroupingImages.forEach({ $0.isSelected = true })
         changetoLeftBarButton(isSelectAllButton: false)
+        viewMultipleSelect.subviews.forEach({ $0.removeFromSuperview() })
+        addSubviewMultipleSelect()
         tableViewImages.reloadData()
     }
     
     @objc func deselectAllAction() {
         listGroupingImages.forEach({ $0.isSelected = false })
         changetoLeftBarButton(isSelectAllButton: true)
+        viewMultipleSelect.subviews.forEach({ $0.removeFromSuperview() })
+        addSubviewMultipleSelect()
         tableViewImages.reloadData()
     }
     
@@ -403,6 +407,7 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
     }
     
     func addSubviewMultipleSelect() {
+        viewMultipleSelect.addTopBorder(with: .lightGray, andWidth: 1)
         let container = UIView()
         viewMultipleSelect.addSubview(container)
         container.translatesAutoresizingMaskIntoConstraints = false
@@ -412,11 +417,6 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
             container.bottomAnchor.constraint(equalTo: viewMultipleSelect.bottomAnchor),
             container.heightAnchor.constraint(equalToConstant: 50)
         ])
-        container.layer.shadowOpacity = 0.7
-        container.layer.shadowOffset = CGSize(width: 3, height: 3)
-        container.layer.shadowRadius = 3.0
-        container.layer.shadowColor = UIColor.black.cgColor
-        container.backgroundColor = .secondaryColor
         
         let title = UILabel()
         container.addSubview(title)
@@ -460,7 +460,77 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
     }
     
     @objc func sessionAction() {
-        
+        if forwardSession {
+            let tempDataMessages = listGroupingImages.filter({ $0.isSelected })
+            var dataMessages: [[String: Any?]] = []
+            for i in 0..<tempDataMessages.count {
+                dataMessages.append(tempDataMessages[i].dataMessage)
+            }
+            let contactChatNav = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "contactChatNav") as! UINavigationController
+            contactChatNav.modalPresentationStyle = .custom
+            contactChatNav.navigationBar.tintColor = .white
+            contactChatNav.navigationBar.barTintColor = .mainColor
+            contactChatNav.navigationBar.isTranslucent = false
+            let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
+            contactChatNav.navigationBar.titleTextAttributes = textAttributes
+            contactChatNav.view.backgroundColor = .mainColor
+            if let controller = contactChatNav.viewControllers.first as? ContactChatViewController {
+                controller.isChooser = { [weak self] scope, pin in
+                    if scope == "3" {
+                        let editorPersonalVC = AppStoryBoard.Palio.instance.instantiateViewController(identifier: "editorPersonalVC") as! EditorPersonal
+                        editorPersonalVC.unique_l_pin = pin
+                        editorPersonalVC.dataMessageForward = dataMessages
+                        self?.navigationController?.replaceAllViewController(with: editorPersonalVC, animated: true)
+                    } else {
+                        let editorGroupVC = AppStoryBoard.Palio.instance.instantiateViewController(identifier: "editorGroupVC") as! EditorGroup
+                        editorGroupVC.unique_l_pin = pin
+                        editorGroupVC.dataMessageForward = dataMessages
+                        self?.navigationController?.replaceAllViewController(with: editorGroupVC, animated: true)
+                    }
+                }
+            }
+            self.present(contactChatNav, animated: true, completion: nil)
+        } else if deleteSession {
+            let tempDataMessages = listGroupingImages.filter({ $0.isSelected })
+            var countSelected = tempDataMessages.count
+            if countSelected == 0 {
+                return
+            }
+            let alertController = LibAlertController(title: "Delete".localized() + " \(countSelected) " + "messages?", message: nil, preferredStyle: .actionSheet)
+
+            if let action = self.actionDelete(for: "me", title: "Delete".localized() + " \(countSelected) " + "For Me".localized(), dataMessages: tempDataMessages) {
+                alertController.addAction(action)
+            }
+            let idMe = UserDefaults.standard.string(forKey: "me") as String?
+            if tempDataMessages[0].dataMessage["f_pin"] as? String == idMe {
+                if let action = self.actionDelete(for: "everyone", title: "Delete".localized() + " \(countSelected) " + "For Everyone".localized(), dataMessages: tempDataMessages) {
+                    alertController.addAction(action)
+                }
+            }
+            alertController.addAction(UIAlertAction(title: "Cancel".localized(), style: .cancel, handler: nil))
+            self.present(alertController, animated: true)
+        }
+    }
+    
+    private func actionDelete(for type: String, title: String, dataMessages: [ImageGrouping]) -> UIAlertAction? {
+        return UIAlertAction(title: title, style: .destructive) { [unowned self] _ in
+            for i in 0..<dataMessages.count {
+                if (type == "me") {
+                    self.deleteMessage(l_pin: dataMessages[i].lPin, message_id: dataMessages[i].messageId, scope: "3", type: "1", chat: "")
+                    listGroupingImages.removeAll(where: { $0.messageId == dataMessages[i].messageId })
+                } else {
+                    
+                }
+            }
+            centeredTitleView.subtitleLabel.text = String(listGroupingImages.count) + " " + "images".localized()
+            updateEditor!(listGroupingImages, [:], true)
+            doneAction()
+        }
+    }
+    
+    private func deleteMessage(l_pin: String, message_id: String, scope: String, type: String, chat: String) {
+        let tmessage = CoreMessage_TMessageBank.deleteMessage(l_pin: l_pin, messageId: message_id, scope: scope, type: type, chat: chat)
+        Nexilis.deleteQueueMessage(message: tmessage)
     }
     
     static func getImageSize(image: String, screenWidth: CGFloat, screenHeight: CGFloat) -> CGSize? {