marinofaggiana 4 жил өмнө
parent
commit
00ab283d39

+ 58 - 35
iOSClient/Main/Menu/NCCollectionViewCommon+Menu.swift

@@ -82,7 +82,9 @@ extension NCCollectionViewCommon {
             )
             )
         )
         )
 
 
-        // Favorite
+        //
+        // FAVORITE
+        //
         if (layoutKey == k_layout_view_favorite && serverUrl == "") || (layoutKey != k_layout_view_favorite) {
         if (layoutKey == k_layout_view_favorite && serverUrl == "") || (layoutKey != k_layout_view_favorite) {
             actions.append(
             actions.append(
                 NCMenuAction(
                 NCMenuAction(
@@ -99,38 +101,10 @@ extension NCCollectionViewCommon {
             )
             )
         }
         }
         
         
-        // Offline
-        if !isFolderEncrypted && (layoutKey == k_layout_view_offline && serverUrl == "" || (layoutKey != k_layout_view_offline)) {
-            actions.append(
-                NCMenuAction(
-                    title: isOffline ? NSLocalizedString("_remove_available_offline_", comment: "") :  NSLocalizedString("_set_available_offline_", comment: ""),
-                    icon: CCGraphics.changeThemingColorImage(UIImage(named: "offline"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
-                    action: { menuAction in
-                        if isOffline {
-                            if metadata.directory {
-                                NCManageDatabase.sharedInstance.setDirectory(serverUrl: serverUrl, offline: false, account: self.appDelegate.account)
-                            } else {
-                                NCManageDatabase.sharedInstance.setLocalFile(ocId: metadata.ocId, offline: false)
-                            }
-                        } else {
-                            if metadata.directory {
-                                NCManageDatabase.sharedInstance.setDirectory(serverUrl: serverUrl, offline: true, account: self.appDelegate.account)
-                                NCOperationQueue.shared.synchronizationMetadata(metadata, selector: selectorDownloadAllFile)
-                            } else {
-                                NCNetworking.shared.download(metadata: metadata, selector: selectorLoadOffline) { (_) in }
-                                if let metadataLivePhoto = NCManageDatabase.sharedInstance.isLivePhoto(metadata: metadata) {
-                                    NCNetworking.shared.download(metadata: metadataLivePhoto, selector: selectorLoadOffline) { (_) in }
-                                }
-                            }
-                        }
-                        self.reloadDataSource()
-                    }
-                )
-            )
-        }
-
-        // All
-        if !isFolderEncrypted { {
+        //
+        // DETAIL
+        //
+        if !isFolderEncrypted {
             actions.append(
             actions.append(
                 NCMenuAction(
                 NCMenuAction(
                     title: NSLocalizedString("_details_", comment: ""),
                     title: NSLocalizedString("_details_", comment: ""),
@@ -142,6 +116,9 @@ extension NCCollectionViewCommon {
             )
             )
         }
         }
         
         
+        //
+        // OPEN IN
+        //
         if !metadata.directory && !NCBrandOptions.sharedInstance.disable_openin_file {
         if !metadata.directory && !NCBrandOptions.sharedInstance.disable_openin_file {
             actions.append(
             actions.append(
                 NCMenuAction(
                 NCMenuAction(
@@ -154,7 +131,10 @@ extension NCCollectionViewCommon {
             )
             )
         }
         }
         
         
-        if !isFolderEncrypted {
+        //
+        // RENAME
+        //
+        if !(isFolderEncrypted && metadata.serverUrl == serverUrlHome) {
             actions.append(
             actions.append(
                 NCMenuAction(
                 NCMenuAction(
                     title: NSLocalizedString("_rename_", comment: ""),
                     title: NSLocalizedString("_rename_", comment: ""),
@@ -187,6 +167,9 @@ extension NCCollectionViewCommon {
             )
             )
         }
         }
 
 
+        //
+        // COPY - MOVE
+        //
         if !isFolderEncrypted && serverUrl != "" {
         if !isFolderEncrypted && serverUrl != "" {
             actions.append(
             actions.append(
                 NCMenuAction(
                 NCMenuAction(
@@ -199,6 +182,41 @@ extension NCCollectionViewCommon {
             )
             )
         }
         }
         
         
+        //
+        // OFFLINE
+        //
+        if !isFolderEncrypted && (layoutKey == k_layout_view_offline && serverUrl == "" || (layoutKey != k_layout_view_offline)) {
+            actions.append(
+                NCMenuAction(
+                    title: isOffline ? NSLocalizedString("_remove_available_offline_", comment: "") :  NSLocalizedString("_set_available_offline_", comment: ""),
+                    icon: CCGraphics.changeThemingColorImage(UIImage(named: "offline"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
+                    action: { menuAction in
+                        if isOffline {
+                            if metadata.directory {
+                                NCManageDatabase.sharedInstance.setDirectory(serverUrl: serverUrl, offline: false, account: self.appDelegate.account)
+                            } else {
+                                NCManageDatabase.sharedInstance.setLocalFile(ocId: metadata.ocId, offline: false)
+                            }
+                        } else {
+                            if metadata.directory {
+                                NCManageDatabase.sharedInstance.setDirectory(serverUrl: serverUrl, offline: true, account: self.appDelegate.account)
+                                NCOperationQueue.shared.synchronizationMetadata(metadata, selector: selectorDownloadAllFile)
+                            } else {
+                                NCNetworking.shared.download(metadata: metadata, selector: selectorLoadOffline) { (_) in }
+                                if let metadataLivePhoto = NCManageDatabase.sharedInstance.isLivePhoto(metadata: metadata) {
+                                    NCNetworking.shared.download(metadata: metadataLivePhoto, selector: selectorLoadOffline) { (_) in }
+                                }
+                            }
+                        }
+                        self.reloadDataSource()
+                    }
+                )
+            )
+        }
+        
+        //
+        // DELETE
+        //
         actions.append(
         actions.append(
             NCMenuAction(
             NCMenuAction(
                 title: NSLocalizedString("_delete_", comment: ""),
                 title: NSLocalizedString("_delete_", comment: ""),
@@ -217,6 +235,9 @@ extension NCCollectionViewCommon {
             )
             )
         )
         )
         
         
+        //
+        // SET FOLDER E2EE
+        //
         if !metadata.e2eEncrypted && metadata.directory && CCUtility.isEnd(toEndEnabled: appDelegate.account) && metadata.serverUrl == serverUrlHome {
         if !metadata.e2eEncrypted && metadata.directory && CCUtility.isEnd(toEndEnabled: appDelegate.account) && metadata.serverUrl == serverUrlHome {
             actions.append(
             actions.append(
                 NCMenuAction(
                 NCMenuAction(
@@ -239,7 +260,9 @@ extension NCCollectionViewCommon {
             )
             )
         }
         }
         
         
-        
+        //
+        // UNSET FOLDER E2EE
+        //
         if metadata.e2eEncrypted && metadata.directory && CCUtility.isEnd(toEndEnabled: appDelegate.account) && metadata.serverUrl == serverUrlHome {
         if metadata.e2eEncrypted && metadata.directory && CCUtility.isEnd(toEndEnabled: appDelegate.account) && metadata.serverUrl == serverUrlHome {
             actions.append(
             actions.append(
                 NCMenuAction(
                 NCMenuAction(