Forráskód Böngészése

improved e2ee

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 éve
szülő
commit
cbe468ea3f
1 módosított fájl, 20 hozzáadás és 21 törlés
  1. 20 21
      iOSClient/Menu/AppDelegate+Menu.swift

+ 20 - 21
iOSClient/Menu/AppDelegate+Menu.swift

@@ -114,36 +114,35 @@ extension AppDelegate {
             )
         )
 
-        if CCUtility.isEnd(toEndEnabled: appDelegate.account) && appDelegate.activeServerUrl == serverUrlHome {
+        if CCUtility.isEnd(toEndEnabled: appDelegate.account) {
             actions.append(.seperator(order: 0))
         }
 
-        let titleCreateFolder = isEncrypted ? NSLocalizedString("_create_folder_e2ee_", comment: "") : NSLocalizedString("_create_folder_", comment: "")
-        let imageCreateFolder = isEncrypted ? UIImage(named: "folderEncrypted")! : UIImage(named: "folder")!
-
-        actions.append(
-            NCMenuAction(title: titleCreateFolder,
-                icon: imageCreateFolder.image(color: NCBrandColor.shared.brandElement, size: 50), action: { _ in
-                    guard !appDelegate.activeServerUrl.isEmpty else { return }
-                    let alertController = UIAlertController.createFolder(serverUrl: appDelegate.activeServerUrl, urlBase: appDelegate)
-                    appDelegate.window?.rootViewController?.present(alertController, animated: true, completion: nil)
-                }
-            )
-        )
+        if !NCUtility.shared.isFolderEncrypted(serverUrl: appDelegate.activeServerUrl, userBase: appDelegate) {
+            actions.append(
+                NCMenuAction(title: NSLocalizedString("_create_folder_", comment: ""),
+                             icon: UIImage(named: "folder")!.image(color: NCBrandColor.shared.brandElement, size: 50),
+                             action: { _ in
+                                 guard !appDelegate.activeServerUrl.isEmpty else { return }
+                                 let alertController = UIAlertController.createFolder(serverUrl: appDelegate.activeServerUrl, urlBase: appDelegate)
+                                 appDelegate.window?.rootViewController?.present(alertController, animated: true, completion: nil)
+                             })
+                )
+        }
 
-        if CCUtility.isEnd(toEndEnabled: appDelegate.account) && appDelegate.activeServerUrl == serverUrlHome {
+        if CCUtility.isEnd(toEndEnabled: appDelegate.account) {
             actions.append(
                 NCMenuAction(title: NSLocalizedString("_create_folder_e2ee_", comment: ""),
-                    icon: UIImage(named: "folderEncrypted")!.image(color: NCBrandColor.shared.brandElement, size: 50), action: { _ in
-                        guard !appDelegate.activeServerUrl.isEmpty else { return }
-                        let alertController = UIAlertController.createFolder(serverUrl: appDelegate.activeServerUrl, urlBase: appDelegate, markE2ee: true)
-                        appDelegate.window?.rootViewController?.present(alertController, animated: true, completion: nil)
-                    }
-                )
+                             icon: UIImage(named: "folderEncrypted")!.image(color: NCBrandColor.shared.brandElement, size: 50),
+                             action: { _ in
+                                 guard !appDelegate.activeServerUrl.isEmpty else { return }
+                                 let alertController = UIAlertController.createFolder(serverUrl: appDelegate.activeServerUrl, urlBase: appDelegate, markE2ee: true)
+                                 appDelegate.window?.rootViewController?.present(alertController, animated: true, completion: nil)
+                             })
             )
         }
 
-        if CCUtility.isEnd(toEndEnabled: appDelegate.account) && appDelegate.activeServerUrl == serverUrlHome {
+        if CCUtility.isEnd(toEndEnabled: appDelegate.account) {
             actions.append(.seperator(order: 0))
         }