marinofaggiana 4 years ago
parent
commit
95a86a5a3d
1 changed files with 5 additions and 2 deletions
  1. 5 2
      iOSClient/Main/Menu/AppDelegate+Menu.swift

+ 5 - 2
iOSClient/Main/Menu/AppDelegate+Menu.swift

@@ -29,6 +29,7 @@ import NCCommunication
 extension AppDelegate {
 
     @objc public func showMenuIn(viewController: UIViewController) {
+        
         let mainMenuViewController = UIStoryboard.init(name: "NCMenu", bundle: nil).instantiateViewController(withIdentifier: "NCMainMenuTableViewController") as! NCMainMenuTableViewController
         mainMenuViewController.actions = self.initMenu()
 
@@ -42,10 +43,12 @@ extension AppDelegate {
     }
     
     private func initMenu() -> [NCMenuAction] {
+        
         var actions: [NCMenuAction] = []
         let appDelegate = UIApplication.shared.delegate as! AppDelegate
         let directEditingCreators = NCManageDatabase.sharedInstance.getDirectEditingCreators(account: appDelegate.account)
-        let isEncrypted = CCUtility.isFolderEncrypted(appDelegate.activeMain.serverUrl, e2eEncrypted: false, account: appDelegate.account, urlBase: appDelegate.urlBase)
+        let isEncrypted = CCUtility.isFolderEncrypted(appDelegate.activeServerUrl, e2eEncrypted: false, account: appDelegate.account, urlBase: appDelegate.urlBase)
+        let directory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.account, appDelegate.activeServerUrl))
         let serverVersionMajor = NCManageDatabase.sharedInstance.getCapabilitiesServerInt(account: appDelegate.account, elements: NCElementsJSON.shared.capabilitiesVersionMajor)
         
         actions.append(
@@ -155,7 +158,7 @@ extension AppDelegate {
             )
         )
 
-        if serverVersionMajor >= k_nextcloud_version_18_0 && (self.activeMain.richWorkspaceText == nil || self.activeMain.richWorkspaceText.count == 0) && !isEncrypted && NCCommunication.shared.isNetworkReachable() {
+        if serverVersionMajor >= k_nextcloud_version_18_0 && directory?.richWorkspace == nil && !isEncrypted && NCCommunication.shared.isNetworkReachable() {
             actions.append(
                 NCMenuAction(
                     title: NSLocalizedString("_add_folder_info_", comment: ""),