Browse Source

context Menu

marinofaggiana 4 năm trước cách đây
mục cha
commit
7380990b15

+ 15 - 14
iOSClient/Main/Colleaction Common/NCCollectionViewCommon.swift

@@ -1244,27 +1244,28 @@ extension NCCollectionViewCommon: UICollectionViewDelegate {
             return NCViewerPeekPop(metadata: metadata)
         }, actionProvider: { suggestedActions in
             
+            let detail = UIAction(title: NSLocalizedString("_details_", comment: ""), image: UIImage(systemName: "info") ) { action in
+                NCNetworkingNotificationCenter.shared.openShare(ViewController: self, metadata: metadata, indexPage: 0)
+            }
+            
             let save = UIAction(title: NSLocalizedString("_save_selected_files_", comment: ""), image: UIImage(systemName: "square.and.arrow.down")) { action in
                 NCOperationQueue.shared.download(metadata: metadata, selector: NCBrandGlobal.shared.selectorSaveAlbum, setFavorite: false)
             }
             
-            let moveCopy = UIAction(title: NSLocalizedString("_move_or_copy_", comment: ""), image: UIImage(systemName: "arrow.up.right.square")) { action in
-                NCCollectionCommon.shared.openSelectView(items: [metadata])
+            let openQuickLook = UIAction(title: NSLocalizedString("_open_quicklook_", comment: ""), image: UIImage(systemName: "eye")) { action in
+                NCNetworkingNotificationCenter.shared.downloadOpen(metadata: metadata, selector: NCBrandGlobal.shared.selectorLoadFileQuickLook)
             }
             
+            
             let openIn = UIAction(title: NSLocalizedString("_open_in_", comment: ""), image: UIImage(systemName: "square.and.arrow.up") ) { action in
                 NCNetworkingNotificationCenter.shared.downloadOpen(metadata: metadata, selector: NCBrandGlobal.shared.selectorOpenIn)
             }
             
-            let share = UIAction(title: NSLocalizedString("_share_", comment: ""), image: UIImage(systemName: "square.and.arrow.up") ) { action in
-                NCNetworkingNotificationCenter.shared.openShare(ViewController: self, metadata: metadata, indexPage: 2)
+            let moveCopy = UIAction(title: NSLocalizedString("_move_or_copy_", comment: ""), image: UIImage(systemName: "arrow.up.right.square")) { action in
+                NCCollectionCommon.shared.openSelectView(items: [metadata])
             }
             
-            let openQuickLook = UIAction(title: NSLocalizedString("_open_quicklook_", comment: ""), image: UIImage(systemName: "eye")) { action in
-                NCNetworkingNotificationCenter.shared.downloadOpen(metadata: metadata, selector: NCBrandGlobal.shared.selectorLoadFileQuickLook)
-            }
-
-            let deleteFile = UIAction(title: NSLocalizedString("_delete_", comment: ""), image: UIImage(systemName: "trash"), attributes: .destructive) { action in
+            let deleteConfirm = UIAction(title: NSLocalizedString("_delete_", comment: ""), image: UIImage(systemName: "trash"), attributes: .destructive) { action in
                 
                 NCNetworking.shared.deleteMetadata(metadata, account: self.appDelegate.account, urlBase: self.appDelegate.urlBase, onlyLocal: false) { (errorCode, errorDescription) in
                     if errorCode != 0 {
@@ -1273,14 +1274,14 @@ extension NCCollectionViewCommon: UICollectionViewDelegate {
                 }
             }
             
-            let delete = UIMenu(title: NSLocalizedString("_delete_", comment: ""), image: UIImage(systemName: "trash"), options: .destructive, children: [deleteFile])
-            
+            let delete = UIMenu(title: NSLocalizedString("_delete_", comment: ""), image: UIImage(systemName: "trash"), options: .destructive, children: [deleteConfirm])
+
             if metadata.directory {
-                return UIMenu(title: "", children: [moveCopy, share, delete])
+                return UIMenu(title: "", children: [detail, moveCopy, delete])
             } else if metadata.typeFile == NCBrandGlobal.shared.metadataTypeFileImage || metadata.typeFile == NCBrandGlobal.shared.metadataTypeFileVideo {
-                return UIMenu(title: "", children: [save, moveCopy, share, openIn, openQuickLook, delete])
+                return UIMenu(title: "", children: [detail, save, openQuickLook, openIn, moveCopy, delete])
             } else {
-                return UIMenu(title: "", children: [moveCopy, share, openIn, openQuickLook, delete])
+                return UIMenu(title: "", children: [detail, openQuickLook, openIn, moveCopy, delete])
             }
         })
     }

+ 8 - 8
iOSClient/Media/NCMedia.swift

@@ -507,15 +507,15 @@ extension NCMedia: UICollectionViewDelegate {
                 NCOperationQueue.shared.download(metadata: metadata, selector: NCBrandGlobal.shared.selectorSaveAlbum, setFavorite: false)
             }
             
+            let openIn = UIAction(title: NSLocalizedString("_open_in_", comment: ""), image: UIImage(systemName: "square.and.arrow.up") ) { action in
+                NCNetworkingNotificationCenter.shared.downloadOpen(metadata: metadata, selector: NCBrandGlobal.shared.selectorOpenIn)
+            }
+            
             let moveCopy = UIAction(title: NSLocalizedString("_move_or_copy_", comment: ""), image: UIImage(systemName: "arrow.up.right.square")) { action in
                 NCCollectionCommon.shared.openSelectView(items: [metadata])
             }
             
-            let openIn = UIAction(title: NSLocalizedString("_open_in_", comment: ""), image: UIImage(systemName: "square.and.arrow.up") ) { action in
-                NCNetworkingNotificationCenter.shared.downloadOpen(metadata: metadata, selector: NCBrandGlobal.shared.selectorOpenIn)
-            }
-
-            let deleteFile = UIAction(title: NSLocalizedString("_delete_", comment: ""), image: UIImage(systemName: "trash"), attributes: .destructive) { action in
+            let deleteConfirm = UIAction(title: NSLocalizedString("_delete_", comment: ""), image: UIImage(systemName: "trash"), attributes: .destructive) { action in
                 
                 NCNetworking.shared.deleteMetadata(metadata, account: self.appDelegate.account, urlBase: self.appDelegate.urlBase, onlyLocal: false) { (errorCode, errorDescription) in
                     if errorCode != 0 {
@@ -524,9 +524,9 @@ extension NCMedia: UICollectionViewDelegate {
                 }
             }
             
-            let delete = UIMenu(title: NSLocalizedString("_delete_", comment: ""), image: UIImage(systemName: "trash"), options: .destructive, children: [deleteFile])
-            
-            return UIMenu(title: "", children: [save, moveCopy, openIn, delete])
+            let delete = UIMenu(title: NSLocalizedString("_delete_", comment: ""), image: UIImage(systemName: "trash"), options: .destructive, children: [deleteConfirm])
+                        
+            return UIMenu(title: "", children: [save, openIn, moveCopy, delete])
         })
     }
 }