marinofaggiana 4 年之前
父節點
當前提交
946032515d

+ 1 - 1
iOSClient/Main/Colleaction Common/NCCollectionCommon.swift

@@ -366,7 +366,7 @@ class NCCollectionCommon: NSObject, NCSelectDelegate {
              return UIMenu(title: "", children: [detail, moveCopy, delete])
         }
         
-        var children: [UIMenuElement] = [copy, detail, moveCopy, open, delete]
+        var children: [UIMenuElement] = [detail, copy, moveCopy, open, delete]
 
         if metadata.typeFile == NCBrandGlobal.shared.metadataTypeFileImage || metadata.typeFile == NCBrandGlobal.shared.metadataTypeFileVideo {
             children.insert(save, at: 4)

+ 26 - 2
iOSClient/Main/Colleaction Common/NCCollectionViewCommon.swift

@@ -24,8 +24,8 @@
 import Foundation
 import NCCommunication
 
-class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UISearchResultsUpdating, UISearchControllerDelegate, UISearchBarDelegate, NCListCellDelegate, NCGridCellDelegate, NCSectionHeaderMenuDelegate, UIAdaptivePresentationControllerDelegate, NCEmptyDataSetDelegate  {
-
+class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UISearchResultsUpdating, UISearchControllerDelegate, UISearchBarDelegate, NCListCellDelegate, NCGridCellDelegate, NCSectionHeaderMenuDelegate, UIAdaptivePresentationControllerDelegate, NCEmptyDataSetDelegate, UIContextMenuInteractionDelegate  {
+    
     @IBOutlet weak var collectionView: UICollectionView!
 
     let appDelegate = UIApplication.shared.delegate as! AppDelegate
@@ -705,7 +705,31 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
     }
     
     @objc func longPressCollecationView(_ gestureRecognizer: UILongPressGestureRecognizer) {
+        
         openMenuItems(with: nil, gestureRecognizer: gestureRecognizer)
+        /*
+        if #available(iOS 13.0, *) {
+            
+            let interaction = UIContextMenuInteraction(delegate: self)
+            self.view.addInteraction(interaction)
+        }
+        */
+    }
+    
+    @available(iOS 13.0, *)
+    func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? {
+        
+        return UIContextMenuConfiguration(identifier: nil, previewProvider: {
+            
+            return nil
+            
+        }, actionProvider: { suggestedActions in
+            
+            //let share = UIAction(title: "Share Pupper", image: UIImage(systemName: "square.and.arrow.up")) { action in
+            //}
+            //return UIMenu(title: "Main Menu", children: [share])
+            return nil
+        })
     }
     
     func openMenuItems(with objectId: String?, gestureRecognizer: UILongPressGestureRecognizer) {

+ 8 - 0
iOSClient/Main/NCMainTabBar.swift

@@ -235,5 +235,13 @@ class NCMainTabBar: UITabBar {
             }
         }
     }
+    
+    func getCenterButton() -> UIView? {
+        if let centerButton = self.viewWithTag(99) {
+            return centerButton
+        } else {
+            return nil
+        }
+    }
 }