Răsfoiți Sursa

Coding

Signed-off-by: marinofaggiana <marino@marinofaggiana.com>
marinofaggiana 3 ani în urmă
părinte
comite
1055d78f80

+ 3 - 7
iOSClient/AppDelegate.swift

@@ -243,11 +243,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
         if account == "" { return }
         
         // Dismiss FileViewInFolder
-        if activeFileViewInFolder != nil {
-            activeFileViewInFolder?.dismiss(animated: false, completion: {
-                self.activeFileViewInFolder = nil
-            })
-        }
+        //activeFileViewInFolder?.dismiss(animated: false)
         
         // Clear operation queue
         NCOperationQueue.shared.cancelAllQueue()
@@ -719,8 +715,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
             requestAccount(startTimer: false)
             return
         }
-        
-        if passcodeViewController == nil {
+                
+        if passcodeViewController?.view.window == nil {
             passcodeViewController = TOPasscodeViewController.init(passcodeType: .sixDigits, allowCancel: false)
             passcodeViewController?.delegate = self
             passcodeViewController?.keypadButtonShowLettering = false

+ 1 - 3
iOSClient/FileViewInFolder/NCFileViewInFolder.swift

@@ -71,9 +71,7 @@ class NCFileViewInFolder: NCCollectionViewCommon {
     // MARK: - TAP EVENT
 
     @objc func tapClose(sender: Any) {
-        dismiss(animated: true) {
-            self.appDelegate.activeFileViewInFolder = nil
-        }
+        dismiss(animated: true)
     }
     
     // MARK: - DataSource + NC Endpoint

+ 1 - 5
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -218,10 +218,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         let viewController = presentationController.presentedViewController
         if viewController is NCViewerRichWorkspaceWebView {
             closeRichWorkspaceWebView()
-        } else if viewController is UINavigationController {
-            if (viewController as! UINavigationController).topViewController is NCFileViewInFolder {
-                appDelegate.activeFileViewInFolder = nil
-            }
         }
     }
     
@@ -1217,7 +1213,7 @@ extension NCCollectionViewCommon: UICollectionViewDelegate {
             
             pushMetadata(metadata)
             
-        } else {
+        } else if !(self is NCFileViewInFolder) {
             
             let imageIcon = UIImage(contentsOfFile: CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag))
             

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

@@ -44,9 +44,7 @@ extension AppDelegate {
                 title: NSLocalizedString("_upload_photos_videos_", comment: ""), icon: UIImage(named: "file_photo")!.image(color: NCBrandColor.shared.gray, size: 50), action: { menuAction in
                     NCAskAuthorization.shared.askAuthorizationPhotoLibrary(viewController: viewController) { (hasPermission) in
                         if hasPermission {
-                            if let viewController = appDelegate.window?.rootViewController {
-                                NCPhotosPickerViewController.init(viewController: viewController, maxSelectedAssets: 0, singleSelectedMode: false)
-                            }
+                            NCPhotosPickerViewController.init(viewController: viewController, maxSelectedAssets: 0, singleSelectedMode: false)
                         }
                     }
                 }

+ 14 - 17
iOSClient/Menu/NCCollectionViewCommon+Menu.swift

@@ -195,7 +195,13 @@ extension NCCollectionViewCommon {
                     title: NSLocalizedString("_open_in_", comment: ""),
                     icon: NCUtility.shared.loadImage(named: "square.and.arrow.up"),
                     action: { menuAction in
-                        NCFunctionCenter.shared.openDownload(metadata: metadata, selector: NCGlobal.shared.selectorOpenIn)
+                        if self is NCFileViewInFolder {
+                            self.dismiss(animated: true) {
+                                NCFunctionCenter.shared.openDownload(metadata: metadata, selector: NCGlobal.shared.selectorOpenIn)
+                            }
+                        } else {
+                            NCFunctionCenter.shared.openDownload(metadata: metadata, selector: NCGlobal.shared.selectorOpenIn)
+                        }                        
                     }
                 )
             )
@@ -319,21 +325,6 @@ extension NCCollectionViewCommon {
             )
         }
         
-        //
-        // VIEW IN FOLDER
-        //
-        if layoutKey == NCGlobal.shared.layoutViewRecent && appDelegate.activeFileViewInFolder == nil {
-            actions.append(
-                NCMenuAction(
-                    title: NSLocalizedString("_view_in_folder_", comment: ""),
-                    icon: NCUtility.shared.loadImage(named: "arrow.forward.square"),
-                    action: { menuAction in
-                        NCFunctionCenter.shared.openFileViewInFolder(serverUrl: metadata.serverUrl, fileName: metadata.fileName)
-                    }
-                )
-            )
-        }
-        
         /*
         //
         // USE AS BACKGROUND
@@ -367,7 +358,13 @@ extension NCCollectionViewCommon {
                         title: NSLocalizedString("_modify_", comment: ""),
                         icon: NCUtility.shared.loadImage(named: "pencil.tip.crop.circle"),
                         action: { menuAction in
-                            NCFunctionCenter.shared.openDownload(metadata: metadata, selector: NCGlobal.shared.selectorLoadFileQuickLook)
+                            if self is NCFileViewInFolder {
+                                self.dismiss(animated: true) {
+                                    NCFunctionCenter.shared.openDownload(metadata: metadata, selector: NCGlobal.shared.selectorLoadFileQuickLook)
+                                }
+                            } else {
+                                NCFunctionCenter.shared.openDownload(metadata: metadata, selector: NCGlobal.shared.selectorLoadFileQuickLook)
+                            }
                         }
                     )
                 )

+ 8 - 10
iOSClient/Menu/NCViewer+Menu.swift

@@ -246,17 +246,15 @@ extension NCViewer {
         // VIEW IN FOLDER
         //
         if !webView {
-            if appDelegate.activeFileViewInFolder == nil {
-                actions.append(
-                    NCMenuAction(
-                        title: NSLocalizedString("_view_in_folder_", comment: ""),
-                        icon: NCUtility.shared.loadImage(named: "arrow.forward.square"),
-                        action: { menuAction in
-                            NCFunctionCenter.shared.openFileViewInFolder(serverUrl: metadata.serverUrl, fileName: metadata.fileName)
-                        }
-                    )
+            actions.append(
+                NCMenuAction(
+                    title: NSLocalizedString("_view_in_folder_", comment: ""),
+                    icon: NCUtility.shared.loadImage(named: "arrow.forward.square"),
+                    action: { menuAction in
+                        NCFunctionCenter.shared.openFileViewInFolder(serverUrl: metadata.serverUrl, fileName: metadata.fileName)
+                    }
                 )
-            }
+            )
         }
         
         //