marinofaggiana 5 жил өмнө
parent
commit
41b01bbcf2

+ 8 - 7
iOSClient/Main/Menu/AppDelegate+Menu.swift

@@ -31,7 +31,8 @@ extension AppDelegate {
         var actions = [NCMenuAction]()
         let appDelegate = UIApplication.shared.delegate as! AppDelegate
         let directEditingCreators = NCManageDatabase.sharedInstance.getDirectEditingCreators(account: appDelegate.activeAccount)
-
+        let isEncrypted = CCUtility.isFolderEncrypted(appDelegate.activeMain.serverUrl, e2eEncrypted: false, account: appDelegate.activeAccount)
+        
         actions.append(
             NCMenuAction(
                 title: NSLocalizedString("_upload_photos_videos_", comment: ""),
@@ -64,7 +65,7 @@ extension AppDelegate {
         )
 #endif
         
-        if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_text}) {
+        if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_text}) && !isEncrypted {
             let directEditingCreator = directEditingCreators!.first(where: { $0.editor == k_editor_text})!
             actions.append(
                 NCMenuAction(title: NSLocalizedString("_create_nextcloudtext_document_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage(named: "file_txt"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
@@ -129,7 +130,7 @@ extension AppDelegate {
 
         if #available(iOS 11.0, *) {
             if let capabilities = NCManageDatabase.sharedInstance.getCapabilites(account: appDelegate.activeAccount) {
-                if (capabilities.versionMajor >= k_nextcloud_version_18_0 && (self.activeMain.richWorkspaceText == nil || self.activeMain.richWorkspaceText.count == 0)) {
+                if (capabilities.versionMajor >= k_nextcloud_version_18_0 && (self.activeMain.richWorkspaceText == nil || self.activeMain.richWorkspaceText.count == 0)) && !isEncrypted {
                     actions.append(
                         NCMenuAction(
                             title: NSLocalizedString("_add_folder_info_", comment: ""),
@@ -143,7 +144,7 @@ extension AppDelegate {
             }
         }
         
-        if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_docx}) {
+        if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_docx}) && !isEncrypted {
             let directEditingCreator = directEditingCreators!.first(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_docx})!
             actions.append(
                 NCMenuAction(
@@ -168,7 +169,7 @@ extension AppDelegate {
             )
         }
         
-        if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_xlsx}) {
+        if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_xlsx}) && !isEncrypted {
             let directEditingCreator = directEditingCreators!.first(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_xlsx})!
             actions.append(
                 NCMenuAction(
@@ -193,7 +194,7 @@ extension AppDelegate {
             )
         }
         
-        if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_pptx}) {
+        if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_pptx}) && !isEncrypted {
             let directEditingCreator = directEditingCreators!.first(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_pptx})!
             actions.append(
                 NCMenuAction(
@@ -219,7 +220,7 @@ extension AppDelegate {
         }
         
         if let richdocumentsMimetypes = NCManageDatabase.sharedInstance.getRichdocumentsMimetypes(account: appDelegate.activeAccount) {
-            if richdocumentsMimetypes.count > 0 && appDelegate.reachability.isReachable() {
+            if richdocumentsMimetypes.count > 0 && appDelegate.reachability.isReachable() && !isEncrypted {
                 actions.append(
                     NCMenuAction(
                         title: NSLocalizedString("_create_new_document_", comment: ""),

+ 4 - 3
iOSClient/Main/Menu/CCMain+Menu.swift

@@ -369,6 +369,7 @@ extension CCMain {
             } else {
                 iconHeader = UIImage(named: metadata.iconName)
             }
+            let isEncrypted = CCUtility.isFolderEncrypted(metadata.serverUrl, e2eEncrypted: metadata.e2eEncrypted, account: metadata.account)
 
             actions.append(
                 NCMenuAction(
@@ -388,7 +389,7 @@ extension CCMain {
                 )
             )
 
-            if (!metadataFolder.e2eEncrypted) {
+            if (!isEncrypted) {
                 actions.append(
                     NCMenuAction(
                         title: NSLocalizedString("_details_", comment: ""),
@@ -441,7 +442,7 @@ extension CCMain {
                 )
             )
             
-            if (!metadataFolder.e2eEncrypted) {
+            if (!isEncrypted) {
                 actions.append(
                     NCMenuAction(
                         title: NSLocalizedString("_move_or_copy_", comment: ""),
@@ -453,7 +454,7 @@ extension CCMain {
                 )
             }
 
-            if (!metadataFolder.e2eEncrypted) {
+            if (!isEncrypted) {
                 let localFile = NCManageDatabase.sharedInstance.getTableLocalFile(predicate: NSPredicate(format: "ocId == %@", metadata.ocId))
                 var title: String!
                 if (localFile == nil || localFile!.offline == false) {

+ 1 - 1
iOSClient/Text/NCText.swift

@@ -110,7 +110,7 @@ class NCText: UIViewController, UITextViewDelegate {
     override func viewDidDisappear(_ animated: Bool) {
         super.viewDidDisappear(animated)
         
-        if appDelegate.activeDetail != nil && appDelegate.activeDetail.backgroundView.subviews.first != nil {
+        if appDelegate.activeDetail != nil && appDelegate.activeDetail.backgroundView?.subviews.first != nil {
             if appDelegate.activeDetail.backgroundView.subviews.first is WKWebView {
                 appDelegate.activeDetail.viewUnload()
             }