marinofaggiana 4 years ago
parent
commit
15d56538ad

+ 1 - 1
iOSClient/AppDelegate.h

@@ -90,7 +90,7 @@
 @property (nonatomic, retain) TOPasscodeViewController *passcodeViewController;
 
 @property (nonatomic, retain) NSString *activeServerUrl;
-@property (nonatomic, retain) id activeViewController;
+@property (nonatomic, retain) UIViewController *activeViewController;
 
 @property (nonatomic, retain) NCFiles *activeFiles;
 @property (nonatomic, retain) NCFileViewInFolder *activeFileViewInFolder;

+ 5 - 7
iOSClient/FileViewInFolder/NCFileViewInFolder.swift

@@ -24,7 +24,7 @@
 import Foundation
 import NCCommunication
 
-class NCFileViewInFolder: NCCollectionViewCommon  {
+class NCFileViewInFolder: NCCollectionViewCommon, UIAdaptivePresentationControllerDelegate  {
     
     internal var fileName: String?
 
@@ -63,6 +63,10 @@ class NCFileViewInFolder: NCCollectionViewCommon  {
         self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_close_", comment: ""), style: .plain, target: self, action: #selector(tapClose(sender:)))       
     }
     
+    public func presentationControllerDidDismiss( _ presentationController: UIPresentationController) {
+        self.appDelegate.activeFileViewInFolder = nil
+    }
+    
     // MARK: - TAP EVENT
 
     @objc func tapClose(sender: Any) {
@@ -143,9 +147,3 @@ class NCFileViewInFolder: NCCollectionViewCommon  {
     }
 }
 
-extension NCFileViewInFolder: UIAdaptivePresentationControllerDelegate {
-    public func presentationControllerDidDismiss( _ presentationController: UIPresentationController) {
-        self.appDelegate.activeFileViewInFolder = nil
-    }
-}
-

+ 1 - 1
iOSClient/Main/Menu/AppDelegate+Menu.swift

@@ -176,7 +176,7 @@ extension AppDelegate: NCAudioRecorderViewControllerDelegate {
                     icon: CCGraphics.changeThemingColorImage(UIImage(named: "addFolderInfo"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
                     action: { menuAction in
                         let richWorkspaceCommon = NCRichWorkspaceCommon()
-                        if let viewController = appDelegate.window.rootViewController {
+                        if let viewController = self.activeViewController {
                             if NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameView LIKE[c] %@", appDelegate.account, appDelegate.activeServerUrl, k_fileNameRichWorkspace.lowercased())) == nil {
                                 richWorkspaceCommon.createViewerNextcloudText(serverUrl: appDelegate.activeServerUrl, viewController: viewController)
                             } else {