marinofaggiana 4 年之前
父節點
當前提交
4fce263f9d
共有 3 個文件被更改,包括 2 次插入31 次删除
  1. 0 1
      iOSClient/AppDelegate.h
  2. 0 28
      iOSClient/AppDelegate.m
  3. 2 2
      iOSClient/Main/CCMain.m

+ 0 - 1
iOSClient/AppDelegate.h

@@ -133,7 +133,6 @@
 
 // TabBarController
 - (void)createTabBarController:(UITabBarController *)tabBarController;
-- (NSString *)getTabBarControllerActiveServerUrl;
 
 // Push Notification
 - (void)pushNotification;

+ 0 - 28
iOSClient/AppDelegate.m

@@ -869,34 +869,6 @@
     }
 }
 
-- (NSString *)getTabBarControllerActiveServerUrl
-{
-    NSString *serverUrl = [[NCUtility shared] getHomeServerWithUrlBase:self.urlBase account:self.account];
-
-    UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController;
-    if ([splitViewController isKindOfClass:[UISplitViewController class]]) {
-        UINavigationController *masterNavigationController = [splitViewController.viewControllers firstObject];
-        if ([masterNavigationController isKindOfClass:[UINavigationController class]]) {
-            UITabBarController *tabBarController = [masterNavigationController.viewControllers firstObject];
-            if ([tabBarController isKindOfClass:[UITabBarController class]]) {
-                NSInteger index = tabBarController.selectedIndex;
-                   
-                // select active serverUrl
-                if (index == k_tabBarApplicationIndexFile) {
-                    serverUrl = self.activeMain.serverUrl;
-                } else if (index == k_tabBarApplicationIndexFavorite) {
-                    if (self.activeFavorite.serverUrl)
-                        serverUrl = self.activeFavorite.serverUrl;
-                } else if (index == k_tabBarApplicationIndexMedia) {
-                    serverUrl = [[NCManageDatabase sharedInstance] getAccountAutoUploadPathWithUrlBase:self.urlBase account:self.account];
-                }
-            }
-        }
-    }
-    
-    return serverUrl;
-}
-
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ===== Theming Color =====
 #pragma --------------------------------------------------------------------------------------------

+ 2 - 2
iOSClient/Main/CCMain.m

@@ -716,7 +716,7 @@
         
         [coordinator coordinateReadingItemAtURL:url options:NSFileCoordinatorReadingForUploading error:&error byAccessor:^(NSURL *newURL) {
             
-            NSString *serverUrl = [appDelegate getTabBarControllerActiveServerUrl];
+            NSString *serverUrl = appDelegate.activeServerUrl;
             NSString *fileName =  [url lastPathComponent];
             NSString *ocId = [[NSUUID UUID] UUIDString];
             NSData *data = [NSData dataWithContentsOfURL:newURL];
@@ -786,7 +786,7 @@
     [viewController openPhotosPickerViewControllerWithPhAssets:^(NSArray<PHAsset *> * _Nullable assets) {
         if (assets.count > 0) {
             dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.2 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
-                NSString *serverUrl = [appDelegate getTabBarControllerActiveServerUrl];
+                NSString *serverUrl = appDelegate.activeServerUrl;
                 
                 NCCreateFormUploadAssets *form = [[NCCreateFormUploadAssets alloc] initWithServerUrl:serverUrl assets:(NSMutableArray *)assets cryptated:NO session:NCNetworking.shared.sessionIdentifierBackground delegate:self];