diff options
author | marinofaggiana <ios@nextcloud.com> | 2022-08-02 19:58:33 +0300 |
---|---|---|
committer | marinofaggiana <ios@nextcloud.com> | 2022-08-02 19:58:33 +0300 |
commit | df74d8cec9d247f5ef02a97ae08353e9160c579c (patch) | |
tree | 9ddc2f5dbe496722b3a8b40b9bf5a8107333789f /iOSClient | |
parent | c939a4970e4c3014bfebb295651c5d786803267e (diff) |
test
Signed-off-by: marinofaggiana <ios@nextcloud.com>
Diffstat (limited to 'iOSClient')
-rw-r--r-- | iOSClient/Main/NCFunctionCenter.swift | 74 |
1 files changed, 38 insertions, 36 deletions
diff --git a/iOSClient/Main/NCFunctionCenter.swift b/iOSClient/Main/NCFunctionCenter.swift index 8ec067f86..71fbccb5d 100644 --- a/iOSClient/Main/NCFunctionCenter.swift +++ b/iOSClient/Main/NCFunctionCenter.swift @@ -456,50 +456,52 @@ import Photos func openFileViewInFolder(serverUrl: String, fileNameBlink: String?) { - var topNavigationController: UINavigationController? - var pushServerUrl = NCUtilityFileSystem.shared.getHomeServer(account: appDelegate.account) - var mostViewController = UIApplication.shared.keyWindow!.rootViewController!.topMostViewController() + DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { + var topNavigationController: UINavigationController? + var pushServerUrl = NCUtilityFileSystem.shared.getHomeServer(account: self.appDelegate.account) + var mostViewController = UIApplication.shared.keyWindow!.rootViewController!.topMostViewController() + + if mostViewController.isModal { + mostViewController.dismiss(animated: false) + mostViewController = UIApplication.shared.keyWindow!.rootViewController!.topMostViewController() + } + mostViewController.navigationController?.popToRootViewController(animated: false) - if mostViewController.isModal { - mostViewController.dismiss(animated: false) - mostViewController = UIApplication.shared.keyWindow!.rootViewController!.topMostViewController() - } - mostViewController.navigationController?.popToRootViewController(animated: false) - - if let tabBarController = appDelegate.window?.rootViewController as? UITabBarController { - tabBarController.selectedIndex = 0 - if let navigationController = tabBarController.viewControllers?.first as? UINavigationController { - navigationController.popToRootViewController(animated: false) - topNavigationController = navigationController + if let tabBarController = self.appDelegate.window?.rootViewController as? UITabBarController { + tabBarController.selectedIndex = 0 + if let navigationController = tabBarController.viewControllers?.first as? UINavigationController { + navigationController.popToRootViewController(animated: false) + topNavigationController = navigationController + } } - } - if pushServerUrl == serverUrl { - let viewController = topNavigationController?.topViewController as? NCFiles - viewController?.blinkCell(fileName: fileNameBlink) - return - } - guard let topNavigationController = topNavigationController else { return } + if pushServerUrl == serverUrl { + let viewController = topNavigationController?.topViewController as? NCFiles + viewController?.blinkCell(fileName: fileNameBlink) + return + } + guard let topNavigationController = topNavigationController else { return } - let diffDirectory = serverUrl.replacingOccurrences(of: pushServerUrl, with: "") - var subDirs = diffDirectory.split(separator: "/") + let diffDirectory = serverUrl.replacingOccurrences(of: pushServerUrl, with: "") + var subDirs = diffDirectory.split(separator: "/") - while pushServerUrl != serverUrl, subDirs.count > 0 { + while pushServerUrl != serverUrl, subDirs.count > 0 { - guard let dir = subDirs.first, let viewController = UIStoryboard(name: "NCFiles", bundle: nil).instantiateInitialViewController() as? NCFiles else { return } - pushServerUrl = pushServerUrl + "/" + dir + guard let dir = subDirs.first, let viewController = UIStoryboard(name: "NCFiles", bundle: nil).instantiateInitialViewController() as? NCFiles else { return } + pushServerUrl = pushServerUrl + "/" + dir - viewController.serverUrl = pushServerUrl - viewController.isRoot = false - viewController.titleCurrentFolder = String(dir) - if pushServerUrl == serverUrl { - viewController.fileNameBlink = fileNameBlink - } - appDelegate.listFilesVC[serverUrl] = viewController + viewController.serverUrl = pushServerUrl + viewController.isRoot = false + viewController.titleCurrentFolder = String(dir) + if pushServerUrl == serverUrl { + viewController.fileNameBlink = fileNameBlink + } + self.appDelegate.listFilesVC[serverUrl] = viewController - viewController.navigationItem.backButtonTitle = viewController.titleCurrentFolder - topNavigationController.pushViewController(viewController, animated: false) + viewController.navigationItem.backButtonTitle = viewController.titleCurrentFolder + topNavigationController.pushViewController(viewController, animated: false) - subDirs.remove(at: 0) + subDirs.remove(at: 0) + } } } |