marinofaggiana %!s(int64=4) %!d(string=hai) anos
pai
achega
271d4463dd

+ 6 - 0
iOSClient/Main/Menu/NCCollectionViewCommon+Menu.swift

@@ -333,6 +333,9 @@ extension NCCollectionViewCommon {
             )
         )
         
+        //
+        // COPY - MOVE
+        //
         actions.append(
             NCMenuAction(
                 title: NSLocalizedString("_move_or_copy_selected_files_", comment: ""),
@@ -352,6 +355,9 @@ extension NCCollectionViewCommon {
             )
         )
         
+        //
+        // DELETE
+        //
         actions.append(
             NCMenuAction(
                 title: NSLocalizedString("_delete_selected_files_", comment: ""),

+ 32 - 7
iOSClient/Media/NCMedia.swift

@@ -41,7 +41,7 @@ class NCMedia: UIViewController, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate,
     private var predicate: NSPredicate?
 
     private var isEditMode = false
-    private var selectocId: [String] = []
+    private var selectOcId: [String] = []
     
     private var filterTypeFileImage = false
     private var filterTypeFileVideo = false
@@ -307,19 +307,44 @@ class NCMedia: UIViewController, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate,
                     icon: CCGraphics.changeThemingColorImage(UIImage(named: "cancel"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
                     action: { menuAction in
                         self.isEditMode = false
-                        self.selectocId.removeAll()
+                        self.selectOcId.removeAll()
                         self.reloadDataThenPerform { }
                     }
                 )
             )
             
+            //
+            // COPY - MOVE
+            //
+            actions.append(
+                NCMenuAction(
+                    title: NSLocalizedString("_move_or_copy_selected_files_", comment: ""),
+                    icon: CCGraphics.changeThemingColorImage(UIImage(named: "move"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
+                    action: { menuAction in
+                        self.isEditMode = false
+                        var meradatasSelect = [tableMetadata]()
+                        for ocId in self.selectOcId {
+                            if let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
+                                meradatasSelect.append(metadata)
+                            }
+                        }
+                        if meradatasSelect.count > 0 {
+                            NCCollectionCommon.shared.openSelectView(viewController: self, items: meradatasSelect)
+                        }
+                    }
+                )
+            )
+            
+            //
+            // DELETE
+            //
             actions.append(
                 NCMenuAction(
                     title: NSLocalizedString("_delete_", comment: ""),
                     icon: CCGraphics.changeThemingColorImage(UIImage(named: "trash"), width: 50, height: 50, color: .red),
                     action: { menuAction in
                         self.isEditMode = false
-                        for ocId in self.selectocId {
+                        for ocId in self.selectOcId {
                             if let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
                                 NCNetworking.shared.deleteMetadata(metadata, account: self.appDelegate.account, urlBase: self.appDelegate.urlBase, onlyLocal: false) { (errorCode, errorDescription) in
                                     if errorCode != 0 {
@@ -500,10 +525,10 @@ extension NCMedia: UICollectionViewDelegate {
         metadataTouch = metadata
         
         if isEditMode {
-            if let index = selectocId.firstIndex(of: metadata.ocId) {
-                selectocId.remove(at: index)
+            if let index = selectOcId.firstIndex(of: metadata.ocId) {
+                selectOcId.remove(at: index)
             } else {
-                selectocId.append(metadata.ocId)
+                selectOcId.append(metadata.ocId)
             }
             if indexPath.section <  collectionView.numberOfSections && indexPath.row < collectionView.numberOfItems(inSection: indexPath.section) {
                 collectionView.reloadItems(at: [indexPath])
@@ -578,7 +603,7 @@ extension NCMedia: UICollectionViewDataSource {
         
         if isEditMode {
             cell.imageSelect.isHidden = false
-            if selectocId.contains(metadata.ocId) {
+            if selectOcId.contains(metadata.ocId) {
                 cell.imageSelect.image = NCCollectionCommon.images.cellCheckedYes
                 cell.imageVisualEffect.isHidden = false
                 cell.imageVisualEffect.alpha = 0.4

+ 4 - 4
iOSClient/Select/NCSelect.swift

@@ -71,7 +71,7 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, NCListCellDelegat
     
     private var isEditMode = false
     private var networkInProgress = false
-    private var selectocId: [String] = []
+    private var selectOcId: [String] = []
     private var overwrite = false
     
     private var dataSource = NCDataSource()
@@ -365,10 +365,10 @@ extension NCSelect: UICollectionViewDelegate {
         guard let metadata = dataSource.cellForItemAt(indexPath: indexPath) else { return }
         
         if isEditMode {
-            if let index = selectocId.firstIndex(of: metadata.ocId) {
-                selectocId.remove(at: index)
+            if let index = selectOcId.firstIndex(of: metadata.ocId) {
+                selectOcId.remove(at: index)
             } else {
-                selectocId.append(metadata.ocId)
+                selectOcId.append(metadata.ocId)
             }
             collectionView.reloadItems(at: [indexPath])
             return

+ 8 - 8
iOSClient/Trash/NCTrash.swift

@@ -35,7 +35,7 @@ class NCTrash: UIViewController, UIGestureRecognizerDelegate, NCTrashListCellDel
     private let appDelegate = UIApplication.shared.delegate as! AppDelegate
     
     private var isEditMode = false
-    private var selectocId: [String] = []
+    private var selectOcId: [String] = []
     
     private var datasource: [tableTrash] = []
     
@@ -209,11 +209,11 @@ class NCTrash: UIViewController, UIGestureRecognizerDelegate, NCTrashListCellDel
                     action: { menuAction in
                         let alert = UIAlertController(title: NSLocalizedString("_trash_delete_selected_", comment: ""), message: "", preferredStyle: .alert)
                         alert.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .destructive, handler: { _ in
-                            for ocId in self.selectocId {
+                            for ocId in self.selectOcId {
                                 self.deleteItem(with: ocId)
                             }
                             self.isEditMode = false
-                            self.selectocId.removeAll()
+                            self.selectOcId.removeAll()
                             self.collectionView.reloadData()
                         }))
                         alert.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel, handler: { _ in
@@ -399,10 +399,10 @@ extension NCTrash: UICollectionViewDelegate {
         let tableTrash = datasource[indexPath.item]
         
         if isEditMode {
-            if let index = selectocId.firstIndex(of: tableTrash.fileId) {
-                selectocId.remove(at: index)
+            if let index = selectOcId.firstIndex(of: tableTrash.fileId) {
+                selectOcId.remove(at: index)
             } else {
-                selectocId.append(tableTrash.fileId)
+                selectOcId.append(tableTrash.fileId)
             }
             collectionView.reloadItems(at: [indexPath])
             return
@@ -503,7 +503,7 @@ extension NCTrash: UICollectionViewDataSource {
                 cell.imageItemLeftConstraint.constant = 45
                 cell.imageSelect.isHidden = false
                 
-                if selectocId.contains(tableTrash.fileId) {
+                if selectOcId.contains(tableTrash.fileId) {
                     cell.imageSelect.image = CCGraphics.scale(UIImage.init(named: "checkedYes"), to: CGSize(width: 50, height: 50), isAspectRation: true)
                     cell.backgroundView = NCUtility.shared.cellBlurEffect(with: cell.bounds)
                 } else {
@@ -537,7 +537,7 @@ extension NCTrash: UICollectionViewDataSource {
             
             if isEditMode {
                 cell.imageSelect.isHidden = false
-                if selectocId.contains(tableTrash.fileId) {
+                if selectOcId.contains(tableTrash.fileId) {
                     cell.imageSelect.image = CCGraphics.scale(UIImage.init(named: "checkedYes"), to: CGSize(width: 50, height: 50), isAspectRation: true)
                     cell.backgroundView = NCUtility.shared.cellBlurEffect(with: cell.bounds)
                 } else {