diff options
author | marinofaggiana <marino@marinofaggiana.com> | 2020-10-01 17:37:57 +0300 |
---|---|---|
committer | marinofaggiana <marino@marinofaggiana.com> | 2020-10-01 17:37:57 +0300 |
commit | d4f9ab13fa433b1100487188be1fa73103cdf6e2 (patch) | |
tree | c5ed7805bae6ae2702750a17994b8595e14b1137 /iOSClient | |
parent | febcb0c3d55d9a59a2e5f1fd15862549755fd435 (diff) |
coding
Diffstat (limited to 'iOSClient')
-rw-r--r-- | iOSClient/AppDelegate.m | 23 | ||||
-rw-r--r-- | iOSClient/Main/NCCollectionCommon.swift | 11 |
2 files changed, 29 insertions, 5 deletions
diff --git a/iOSClient/AppDelegate.m b/iOSClient/AppDelegate.m index 5208ffba1..f6f461c3d 100644 --- a/iOSClient/AppDelegate.m +++ b/iOSClient/AppDelegate.m @@ -1065,9 +1065,8 @@ return YES; NSString *scheme = url.scheme; - - dispatch_time_t timer = 0; - if (self.activeFiles == nil) timer = 1; + NSString *fileName; + NSString *serverUrl; if ([scheme isEqualToString:@"nextcloud"]) { @@ -1112,7 +1111,21 @@ if (matchedAccount) { - + NSString *webDAV = [[NCUtility shared] getWebDAVWithAccount:self.account]; + //NSString *fileNamePath = [NSString stringWithFormat:@"%@/%@/%@", matchedAccount.urlBase, webDAV, path]; + + if ([path containsString:@"/"]) { + + fileName = [[path stringByDeletingLastPathComponent] lastPathComponent]; + serverUrl = [CCUtility deletingLastPathComponentFromServerUrl:[NSString stringWithFormat:@"%@/%@/%@", matchedAccount.urlBase, webDAV, [path stringByDeletingLastPathComponent]]]; + + } else { + + fileName = [[path stringByDeletingLastPathComponent] lastPathComponent]; + serverUrl = [NSString stringWithFormat:@"%@/%@", matchedAccount.urlBase, webDAV]; + } + + [[NCCollectionCommon shared] openFilesViewControllerWithServerUrl:serverUrl fileName:fileName]; } else { @@ -1151,7 +1164,7 @@ if ([navigationControllerMaster isKindOfClass:[UINavigationController class]]) { UIViewController *uploadNavigationViewController = [[UIStoryboard storyboardWithName:@"CCUploadFromOtherUpp" bundle:nil] instantiateViewControllerWithIdentifier:@"CCUploadNavigationViewController"]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, timer * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ [navigationControllerMaster presentViewController:uploadNavigationViewController animated:YES completion:nil]; }); } diff --git a/iOSClient/Main/NCCollectionCommon.swift b/iOSClient/Main/NCCollectionCommon.swift index e8cbc2eef..d76e13910 100644 --- a/iOSClient/Main/NCCollectionCommon.swift +++ b/iOSClient/Main/NCCollectionCommon.swift @@ -122,6 +122,17 @@ class NCCollectionCommon: NSObject, NCSelectDelegate { navigationController.modalPresentationStyle = .fullScreen viewController.present(navigationController, animated: true, completion: nil) } + + @objc func openFilesViewController(serverUrl: String, fileName: String) { + + let appDelegate = UIApplication.shared.delegate as! AppDelegate + + let viewController = UIStoryboard(name: "NCFiles", bundle: nil).instantiateInitialViewController() as! NCFiles + let navigationController = UINavigationController.init(rootViewController: viewController) + + navigationController.modalPresentationStyle = UIModalPresentationStyle.fullScreen + appDelegate.window.rootViewController?.present(navigationController, animated: true, completion: nil) + } } // MARK: - List Layout |