Просмотр исходного кода

add multiple select in grouping image view

alqindiirsyam 2 лет назад
Родитель
Сommit
87ea0c2e18

BIN
appbuilder-ios/DigiXLite/DigiXLite.xcworkspace/xcuserdata/akhmadalqindiirsyam.xcuserdatad/UserInterfaceState.xcuserstate


+ 1 - 0
appbuilder-ios/DigiXLite/DigiXLite/Source/View/Chat/EditorPersonal.swift

@@ -6340,6 +6340,7 @@ public class ImageGrouping {
     public var lPin = ""
     public var dataMessage: [String: Any?] = [:]
     public var dataPerson: [String: String?] = [:]
+    public var isSelected = false
     
     public init(messageId: String, thumbId: String, imageId: String, status: String, time: String, lPin: String, dataMessage: [String: Any?], dataPerson: [String: String?]) {
         self.messageId = messageId

+ 182 - 5
appbuilder-ios/DigiXLite/DigiXLite/Source/View/Chat/ListGroupImages.swift

@@ -14,7 +14,6 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
     var titleName: String!
     let tableViewImages = UITableView()
     var isInitiator = false
-    var copySession = false
     var forwardSession = false
     var deleteSession = false
     var tableViewPopOver = UITableView()
@@ -23,10 +22,13 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
     var endYVisible: CGFloat!
     var indexSelected = 0
     var updateEditor: (([ImageGrouping], [String: Any?]) -> ())?
+    var isSelectAll = false
+    var viewMultipleSelect = UIView()
+    var constraintBottomViewMultipleSelect: NSLayoutConstraint!
 
     override func viewDidLoad() {
         super.viewDidLoad()
-
+        
         view.backgroundColor = .white
 
         let centeredTitleView = CenteredTitleSubtitleView(frame: CGRect(x: 0, y: 0, width: 200, height: 44))
@@ -51,6 +53,12 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
         
         let center: NotificationCenter = NotificationCenter.default
         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.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
     }
     
     @objc func onStatusChat(notification: NSNotification) {
@@ -113,9 +121,9 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
         let containerImages = UIImageView()
         containerImages.contentMode = .scaleAspectFit
         cell.contentView.addSubview(containerImages)
-        containerImages.anchor(top: cell.contentView.topAnchor, left: cell.contentView.leftAnchor, bottom: cell.contentView.bottomAnchor, right: cell.contentView.rightAnchor, paddingBottom: 15, height: ListGroupImages.getImageSize(image: listGroupingImages[indexPath.row].imageId, screenWidth: UIScreen.main.bounds.width, screenHeight: UIScreen.main.bounds.height)!.height)
+        containerImages.anchor(top: cell.contentView.topAnchor, left: cell.contentView.leftAnchor, right: cell.contentView.rightAnchor, height: ListGroupImages.getImageSize(image: listGroupingImages[indexPath.row].thumbId, screenWidth: UIScreen.main.bounds.width, screenHeight: UIScreen.main.bounds.height)!.height)
         
-        if !copySession && !forwardSession && !deleteSession {
+        if !forwardSession && !deleteSession {
             let longPressRecognizer = LongPressImageVIew(target: self, action: #selector(handleLongPress(_:)))
             longPressRecognizer.imageView = containerImages
             longPressRecognizer.index = indexPath.row
@@ -131,7 +139,7 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
             let image    = UIImage(contentsOfFile: imageURL.path)
             if image == nil {
                 let thumbURL = URL(fileURLWithPath: dirPath).appendingPathComponent(listGroupingImages[indexPath.row].thumbId)
-                let image    = UIImage(contentsOfFile: imageURL.path)
+                let image    = UIImage(contentsOfFile: thumbURL.path)
                 containerImages.image = image
             } else {
                 containerImages.image = image
@@ -189,9 +197,37 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
             iconStar.image = UIImage(systemName: "star.fill")
             iconStar.tintColor = .white
         }
+        
+        if deleteSession || forwardSession {
+            let containerSelect = UIView()
+            containerImages.addSubview(containerSelect)
+            containerSelect.anchor(top: containerImages.topAnchor, left: containerImages.leftAnchor, bottom: containerImages.bottomAnchor, right: containerImages.rightAnchor)
+            
+            let iconSelected = UIImageView(frame: CGRect(x: 0, y: 0, width: 25.0, height: 25.0))
+            iconSelected.backgroundColor = .lightGray.withAlphaComponent(0.3)
+            iconSelected.layer.borderWidth = 2
+            iconSelected.layer.borderColor = UIColor.black.cgColor
+            iconSelected.layer.cornerRadius = 12.5
+            iconSelected.layer.masksToBounds = true
+            iconSelected.tintColor = .black
+            containerSelect.addSubview(iconSelected)
+            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)
+                iconSelected.image = UIImage(systemName: "checkmark.circle.fill")
+            }
+        }
         return cell
     }
     
+    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
+        if tableView == tableViewImages {
+            return ListGroupImages.getImageSize(image: listGroupingImages[indexPath.row].thumbId, screenWidth: UIScreen.main.bounds.width, screenHeight: UIScreen.main.bounds.height)!.height + 15
+        }
+        return UITableView.automaticDimension
+    }
+    
     func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
         if tableView == tableViewPopOver {
             popover.dismiss()
@@ -225,6 +261,8 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
                 updateEditor!([], listGroupingImages[indexSelected].dataMessage)
             case 2:
                 popover.dismiss()
+                listGroupingImages[indexSelected].isSelected = true
+                selectActions(isDeleteSession: false)
             case 3:
                 popover.dismiss()
                 let messageInfoVC = MessageInfo()
@@ -233,7 +271,23 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
                 self.navigationController?.pushViewController(messageInfoVC, animated: true)
             default :
                 popover.dismiss()
+                listGroupingImages[indexSelected].isSelected = true
+                selectActions(isDeleteSession: true)
             }
+        } else if deleteSession || forwardSession {
+            if listGroupingImages[indexPath.row].isSelected {
+                listGroupingImages[indexPath.row].isSelected = false
+            } else {
+                listGroupingImages[indexPath.row].isSelected = true
+            }
+            if listGroupingImages.filter({ $0.isSelected }).count != listGroupingImages.count && isSelectAll {
+                changetoLeftBarButton(isSelectAllButton: true)
+            } else if listGroupingImages.filter({ $0.isSelected }).count == listGroupingImages.count && !isSelectAll {
+                changetoLeftBarButton(isSelectAllButton: false)
+            }
+            viewMultipleSelect.subviews.forEach({ $0.removeFromSuperview() })
+            addSubviewMultipleSelect()
+            tableView.reloadRows(at: [indexPath], with: .none)
         }
     }
     
@@ -283,6 +337,129 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
     }
     
     @objc func selectAction() {
+        selectActions(isDeleteSession: true)
+    }
+    
+    func selectActions(isDeleteSession: Bool) {
+        self.navigationItem.setHidesBackButton(true, animated: true)
+        changetoLeftBarButton(isSelectAllButton: true)
+        
+        let doneButton = UIBarButtonItem(title: "Done".localized(), style: .plain, target: self, action: #selector(doneAction))
+        doneButton.setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.white, NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 16)], for: .normal)
+        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()
+        })
+        tableViewImages.reloadData()
+    }
+    
+    @objc func selectAllAction() {
+        listGroupingImages.forEach({ $0.isSelected = true })
+        changetoLeftBarButton(isSelectAllButton: false)
+        tableViewImages.reloadData()
+    }
+    
+    @objc func deselectAllAction() {
+        listGroupingImages.forEach({ $0.isSelected = false })
+        changetoLeftBarButton(isSelectAllButton: true)
+        tableViewImages.reloadData()
+    }
+    
+    @objc func doneAction() {
+        navigationItem.leftBarButtonItem = nil
+        let selectButton = UIBarButtonItem(title: "Select".localized(), style: .plain, target: self, action: #selector(selectAction))
+        selectButton.setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.white, NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16)], for: .normal)
+        navigationItem.rightBarButtonItem = selectButton
+        self.navigationItem.setHidesBackButton(false, animated: true)
+        listGroupingImages.forEach({ $0.isSelected = false })
+        deleteSession = false
+        forwardSession = false
+        tableViewImages.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
+        constraintBottomViewMultipleSelect.constant = 50
+        viewMultipleSelect.subviews.forEach({ $0.removeFromSuperview() })
+        UIView.animate(withDuration: 0.35, animations: {
+            self.view.layoutIfNeeded()
+        })
+        tableViewImages.reloadData()
+    }
+    
+    func changetoLeftBarButton(isSelectAllButton: Bool) {
+        if isSelectAllButton {
+            let selectAllButton = UIBarButtonItem(title: "Select All".localized(), style: .plain, target: self, action: #selector(selectAllAction))
+            selectAllButton.setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.white, NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16)], for: .normal)
+            navigationItem.leftBarButtonItem = selectAllButton
+            isSelectAll = false
+        } else {
+            let deselectAllButton = UIBarButtonItem(title: "Deselect All".localized(), style: .plain, target: self, action: #selector(deselectAllAction))
+            deselectAllButton.setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.white, NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16)], for: .normal)
+            navigationItem.leftBarButtonItem = deselectAllButton
+            isSelectAll = true
+        }
+    }
+    
+    func addSubviewMultipleSelect() {
+        let container = UIView()
+        viewMultipleSelect.addSubview(container)
+        container.translatesAutoresizingMaskIntoConstraints = false
+        NSLayoutConstraint.activate([
+            container.leadingAnchor.constraint(equalTo: viewMultipleSelect.leadingAnchor),
+            container.trailingAnchor.constraint(equalTo:viewMultipleSelect.trailingAnchor),
+            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)
+        title.translatesAutoresizingMaskIntoConstraints = false
+        NSLayoutConstraint.activate([
+            title.centerXAnchor.constraint(equalTo: container.centerXAnchor),
+            title.centerYAnchor.constraint(equalTo:container.centerYAnchor),
+        ])
+        let countSelected = listGroupingImages.filter({ $0.isSelected }).count
+        title.text = "\(countSelected) " + "Selected".localized()
+        title.textColor = .mainColor
+        title.font = UIFont.systemFont(ofSize: 15.0).bold
+        
+        let button = UIImageView()
+        container.addSubview(button)
+        button.translatesAutoresizingMaskIntoConstraints = false
+        NSLayoutConstraint.activate([
+            button.leadingAnchor.constraint(equalTo: container.leadingAnchor, constant: 15),
+            button.centerYAnchor.constraint(equalTo:container.centerYAnchor),
+            button.widthAnchor.constraint(equalToConstant: 30),
+            button.heightAnchor.constraint(equalToConstant: 30),
+        ])
+        if forwardSession {
+            button.image = UIImage(systemName: "arrowshape.turn.up.right")
+            if countSelected == 0 {
+                button.tintColor = .gray
+            } else {
+                button.tintColor = .mainColor
+            }
+        } else if deleteSession {
+            button.image = UIImage(systemName: "trash")
+            if countSelected == 0 {
+                button.tintColor = .gray
+            } else {
+                button.tintColor = .red
+            }
+        }
+        let buttonGesture = UITapGestureRecognizer(target: self, action: #selector(sessionAction))
+        button.isUserInteractionEnabled = true
+        button.addGestureRecognizer(buttonGesture)
+    }
+    
+    @objc func sessionAction() {
         
     }
     

+ 1 - 0
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Chat/EditorPersonal.swift

@@ -6363,6 +6363,7 @@ public class ImageGrouping {
     public var lPin = ""
     public var dataMessage: [String: Any?] = [:]
     public var dataPerson: [String: String?] = [:]
+    public var isSelected = false
     
     public init(messageId: String, thumbId: String, imageId: String, status: String, time: String, lPin: String, dataMessage: [String: Any?], dataPerson: [String: String?]) {
         self.messageId = messageId

+ 181 - 4
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Chat/ListGroupImages.swift

@@ -14,7 +14,6 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
     var titleName: String!
     let tableViewImages = UITableView()
     var isInitiator = false
-    var copySession = false
     var forwardSession = false
     var deleteSession = false
     var tableViewPopOver = UITableView()
@@ -23,6 +22,9 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
     var endYVisible: CGFloat!
     var indexSelected = 0
     var updateEditor: (([ImageGrouping], [String: Any?]) -> ())?
+    var isSelectAll = false
+    var viewMultipleSelect = UIView()
+    var constraintBottomViewMultipleSelect: NSLayoutConstraint!
 
     override func viewDidLoad() {
         super.viewDidLoad()
@@ -51,6 +53,12 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
         
         let center: NotificationCenter = NotificationCenter.default
         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.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
     }
     
     @objc func onStatusChat(notification: NSNotification) {
@@ -113,9 +121,9 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
         let containerImages = UIImageView()
         containerImages.contentMode = .scaleAspectFit
         cell.contentView.addSubview(containerImages)
-        containerImages.anchor(top: cell.contentView.topAnchor, left: cell.contentView.leftAnchor, bottom: cell.contentView.bottomAnchor, right: cell.contentView.rightAnchor, paddingBottom: 15, height: ListGroupImages.getImageSize(image: listGroupingImages[indexPath.row].imageId, screenWidth: UIScreen.main.bounds.width, screenHeight: UIScreen.main.bounds.height)!.height)
+        containerImages.anchor(top: cell.contentView.topAnchor, left: cell.contentView.leftAnchor, right: cell.contentView.rightAnchor, height: ListGroupImages.getImageSize(image: listGroupingImages[indexPath.row].thumbId, screenWidth: UIScreen.main.bounds.width, screenHeight: UIScreen.main.bounds.height)!.height)
         
-        if !copySession && !forwardSession && !deleteSession {
+        if !forwardSession && !deleteSession {
             let longPressRecognizer = LongPressImageVIew(target: self, action: #selector(handleLongPress(_:)))
             longPressRecognizer.imageView = containerImages
             longPressRecognizer.index = indexPath.row
@@ -131,7 +139,7 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
             let image    = UIImage(contentsOfFile: imageURL.path)
             if image == nil {
                 let thumbURL = URL(fileURLWithPath: dirPath).appendingPathComponent(listGroupingImages[indexPath.row].thumbId)
-                let image    = UIImage(contentsOfFile: imageURL.path)
+                let image    = UIImage(contentsOfFile: thumbURL.path)
                 containerImages.image = image
             } else {
                 containerImages.image = image
@@ -189,9 +197,37 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
             iconStar.image = UIImage(systemName: "star.fill")
             iconStar.tintColor = .white
         }
+        
+        if deleteSession || forwardSession {
+            let containerSelect = UIView()
+            containerImages.addSubview(containerSelect)
+            containerSelect.anchor(top: containerImages.topAnchor, left: containerImages.leftAnchor, bottom: containerImages.bottomAnchor, right: containerImages.rightAnchor)
+            
+            let iconSelected = UIImageView(frame: CGRect(x: 0, y: 0, width: 25.0, height: 25.0))
+            iconSelected.backgroundColor = .lightGray.withAlphaComponent(0.3)
+            iconSelected.layer.borderWidth = 2
+            iconSelected.layer.borderColor = UIColor.black.cgColor
+            iconSelected.layer.cornerRadius = 12.5
+            iconSelected.layer.masksToBounds = true
+            iconSelected.tintColor = .black
+            containerSelect.addSubview(iconSelected)
+            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)
+                iconSelected.image = UIImage(systemName: "checkmark.circle.fill")
+            }
+        }
         return cell
     }
     
+    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
+        if tableView == tableViewImages {
+            return ListGroupImages.getImageSize(image: listGroupingImages[indexPath.row].thumbId, screenWidth: UIScreen.main.bounds.width, screenHeight: UIScreen.main.bounds.height)!.height + 15
+        }
+        return UITableView.automaticDimension
+    }
+    
     func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
         if tableView == tableViewPopOver {
             popover.dismiss()
@@ -225,6 +261,8 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
                 updateEditor!([], listGroupingImages[indexSelected].dataMessage)
             case 2:
                 popover.dismiss()
+                listGroupingImages[indexSelected].isSelected = true
+                selectActions(isDeleteSession: false)
             case 3:
                 popover.dismiss()
                 let messageInfoVC = MessageInfo()
@@ -233,7 +271,23 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
                 self.navigationController?.pushViewController(messageInfoVC, animated: true)
             default :
                 popover.dismiss()
+                listGroupingImages[indexSelected].isSelected = true
+                selectActions(isDeleteSession: true)
+            }
+        } else if deleteSession || forwardSession {
+            if listGroupingImages[indexPath.row].isSelected {
+                listGroupingImages[indexPath.row].isSelected = false
+            } else {
+                listGroupingImages[indexPath.row].isSelected = true
+            }
+            if listGroupingImages.filter({ $0.isSelected }).count != listGroupingImages.count && isSelectAll {
+                changetoLeftBarButton(isSelectAllButton: true)
+            } else if listGroupingImages.filter({ $0.isSelected }).count == listGroupingImages.count && !isSelectAll {
+                changetoLeftBarButton(isSelectAllButton: false)
             }
+            viewMultipleSelect.subviews.forEach({ $0.removeFromSuperview() })
+            addSubviewMultipleSelect()
+            tableView.reloadRows(at: [indexPath], with: .none)
         }
     }
     
@@ -283,6 +337,129 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
     }
     
     @objc func selectAction() {
+        selectActions(isDeleteSession: true)
+    }
+    
+    func selectActions(isDeleteSession: Bool) {
+        self.navigationItem.setHidesBackButton(true, animated: true)
+        changetoLeftBarButton(isSelectAllButton: true)
+        
+        let doneButton = UIBarButtonItem(title: "Done".localized(), style: .plain, target: self, action: #selector(doneAction))
+        doneButton.setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.white, NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 16)], for: .normal)
+        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()
+        })
+        tableViewImages.reloadData()
+    }
+    
+    @objc func selectAllAction() {
+        listGroupingImages.forEach({ $0.isSelected = true })
+        changetoLeftBarButton(isSelectAllButton: false)
+        tableViewImages.reloadData()
+    }
+    
+    @objc func deselectAllAction() {
+        listGroupingImages.forEach({ $0.isSelected = false })
+        changetoLeftBarButton(isSelectAllButton: true)
+        tableViewImages.reloadData()
+    }
+    
+    @objc func doneAction() {
+        navigationItem.leftBarButtonItem = nil
+        let selectButton = UIBarButtonItem(title: "Select".localized(), style: .plain, target: self, action: #selector(selectAction))
+        selectButton.setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.white, NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16)], for: .normal)
+        navigationItem.rightBarButtonItem = selectButton
+        self.navigationItem.setHidesBackButton(false, animated: true)
+        listGroupingImages.forEach({ $0.isSelected = false })
+        deleteSession = false
+        forwardSession = false
+        tableViewImages.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
+        constraintBottomViewMultipleSelect.constant = 50
+        viewMultipleSelect.subviews.forEach({ $0.removeFromSuperview() })
+        UIView.animate(withDuration: 0.35, animations: {
+            self.view.layoutIfNeeded()
+        })
+        tableViewImages.reloadData()
+    }
+    
+    func changetoLeftBarButton(isSelectAllButton: Bool) {
+        if isSelectAllButton {
+            let selectAllButton = UIBarButtonItem(title: "Select All".localized(), style: .plain, target: self, action: #selector(selectAllAction))
+            selectAllButton.setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.white, NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16)], for: .normal)
+            navigationItem.leftBarButtonItem = selectAllButton
+            isSelectAll = false
+        } else {
+            let deselectAllButton = UIBarButtonItem(title: "Deselect All".localized(), style: .plain, target: self, action: #selector(deselectAllAction))
+            deselectAllButton.setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.white, NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16)], for: .normal)
+            navigationItem.leftBarButtonItem = deselectAllButton
+            isSelectAll = true
+        }
+    }
+    
+    func addSubviewMultipleSelect() {
+        let container = UIView()
+        viewMultipleSelect.addSubview(container)
+        container.translatesAutoresizingMaskIntoConstraints = false
+        NSLayoutConstraint.activate([
+            container.leadingAnchor.constraint(equalTo: viewMultipleSelect.leadingAnchor),
+            container.trailingAnchor.constraint(equalTo:viewMultipleSelect.trailingAnchor),
+            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)
+        title.translatesAutoresizingMaskIntoConstraints = false
+        NSLayoutConstraint.activate([
+            title.centerXAnchor.constraint(equalTo: container.centerXAnchor),
+            title.centerYAnchor.constraint(equalTo:container.centerYAnchor),
+        ])
+        let countSelected = listGroupingImages.filter({ $0.isSelected }).count
+        title.text = "\(countSelected) " + "Selected".localized()
+        title.textColor = .mainColor
+        title.font = UIFont.systemFont(ofSize: 15.0).bold
+        
+        let button = UIImageView()
+        container.addSubview(button)
+        button.translatesAutoresizingMaskIntoConstraints = false
+        NSLayoutConstraint.activate([
+            button.leadingAnchor.constraint(equalTo: container.leadingAnchor, constant: 15),
+            button.centerYAnchor.constraint(equalTo:container.centerYAnchor),
+            button.widthAnchor.constraint(equalToConstant: 30),
+            button.heightAnchor.constraint(equalToConstant: 30),
+        ])
+        if forwardSession {
+            button.image = UIImage(systemName: "arrowshape.turn.up.right")
+            if countSelected == 0 {
+                button.tintColor = .gray
+            } else {
+                button.tintColor = .mainColor
+            }
+        } else if deleteSession {
+            button.image = UIImage(systemName: "trash")
+            if countSelected == 0 {
+                button.tintColor = .gray
+            } else {
+                button.tintColor = .red
+            }
+        }
+        let buttonGesture = UITapGestureRecognizer(target: self, action: #selector(sessionAction))
+        button.isUserInteractionEnabled = true
+        button.addGestureRecognizer(buttonGesture)
+    }
+    
+    @objc func sessionAction() {
         
     }