marinofaggiana 4 年之前
父節點
當前提交
18a641fd3a

+ 8 - 1
iOSClient/AppDelegate.m

@@ -200,7 +200,14 @@
     // Test Maintenance
     if (self.account.length == 0 || self.maintenanceMode)
         return;
-        
+    
+    // Dismiss FileViewInFolder
+    if (self.activeFileViewInFolder != nil ) {
+        [self.activeFileViewInFolder dismissViewControllerAnimated:false completion:^{
+            self.activeFileViewInFolder = nil;
+        }];        
+    }
+    
     [self updateApplicationIconBadgeNumber];
 }
 

+ 11 - 0
iOSClient/FileViewInFolder/NCFileViewInFolder.swift

@@ -47,6 +47,7 @@ class NCFileViewInFolder: NCCollectionViewCommon  {
             self.navigationItem.title = CCUtility.getLastPath(fromServerUrl: serverUrl, urlBase: appDelegate.urlBase)
         }
         
+        presentationController?.delegate = self
         appDelegate.activeViewController = self
         
         (layout, _, _, groupBy, _, titleButton, itemForLine) = NCUtility.shared.getLayoutForView(key: layoutKey, serverUrl: serverUrl)
@@ -62,11 +63,15 @@ class NCFileViewInFolder: NCCollectionViewCommon  {
         self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_close_", comment: ""), style: .plain, target: self, action: #selector(tapClose(sender:)))       
     }
     
+    // MARK: - NotificationCenter
+
     override func reloadDataSource(_ notification: NSNotification) {
         if self.view?.window == nil { return }
         reloadDataSource()
     }
     
+    // MARK: - TAP EVENT
+
     @objc func tapClose(sender: Any) {
         dismiss(animated: true) {
             self.appDelegate.activeFileViewInFolder = nil
@@ -145,3 +150,9 @@ class NCFileViewInFolder: NCCollectionViewCommon  {
     }
 }
 
+extension NCFileViewInFolder: UIAdaptivePresentationControllerDelegate {
+    public func presentationControllerDidDismiss( _ presentationController: UIPresentationController) {
+        self.appDelegate.activeFileViewInFolder = nil
+    }
+}
+

+ 2 - 0
iOSClient/Main/NCCollectionCommon.swift

@@ -132,6 +132,8 @@ class NCCollectionCommon: NSObject, NCSelectDelegate {
 
         viewController.serverUrl = serverUrl
         viewController.fileName = fileName
+                
+        navigationController.presentationController?.delegate = viewController
         
         appDelegate.window.rootViewController?.present(navigationController, animated: true, completion: nil)
     }