Browse Source

clear code

marinofaggiana 4 years ago
parent
commit
a28a8cd694
3 changed files with 16 additions and 16 deletions
  1. 0 1
      iOSClient/AppDelegate.h
  2. 8 12
      iOSClient/AppDelegate.m
  3. 8 3
      iOSClient/Networking/NCService.swift

+ 0 - 1
iOSClient/AppDelegate.h

@@ -111,7 +111,6 @@
 // Setting Account & Communication
 - (void)settingAccount:(NSString *)account urlBase:(NSString *)urlBase user:(NSString *)user userID:(NSString *)userID password:(NSString *)password;
 - (void)deleteAccount:(NSString *)account wipe:(BOOL)wipe;
-- (void)settingSetupCommunication:(NSString *)account;
 
 @end
 

+ 8 - 12
iOSClient/AppDelegate.m

@@ -439,7 +439,14 @@
     (void)[NCNetworkingNotificationCenter shared];
 
     [[NCCommunicationCommon shared] setupWithAccount:account user:user userId:userID password:password urlBase:urlBase];
-    [self settingSetupCommunication:account];
+    
+    NSInteger serverVersionMajor = [[NCManageDatabase shared] getCapabilitiesServerIntWithAccount:account elements:NCElementsJSON.shared.capabilitiesVersionMajor];
+    if (serverVersionMajor > 0) {
+        [[NCCommunicationCommon shared] setupWithNextcloudVersion:serverVersionMajor];
+    }
+    
+    [[NCCommunicationCommon shared] setupWithWebDav:[[NCUtilityFileSystem shared] getWebDAVWithAccount:account]];
+    [[NCCommunicationCommon shared] setupWithDav:[[NCUtilityFileSystem shared] getDAV]];
 }
 
 - (void)deleteAccount:(NSString *)account wipe:(BOOL)wipe
@@ -476,17 +483,6 @@
     }
 }
 
-- (void)settingSetupCommunication:(NSString *)account
-{
-    NSInteger serverVersionMajor = [[NCManageDatabase shared] getCapabilitiesServerIntWithAccount:account elements:NCElementsJSON.shared.capabilitiesVersionMajor];
-    if (serverVersionMajor > 0) {
-        [[NCCommunicationCommon shared] setupWithNextcloudVersion:serverVersionMajor];
-    }
-    
-    [[NCCommunicationCommon shared] setupWithWebDav:[[NCUtilityFileSystem shared] getWebDAVWithAccount:account]];
-    [[NCCommunicationCommon shared] setupWithDav:[[NCUtilityFileSystem shared] getDAV]];
-}
-
 #pragma mark Push Notifications
 
 -(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler

+ 8 - 3
iOSClient/Networking/NCService.swift

@@ -154,9 +154,15 @@ class NCService: NSObject {
                 
                     NCManageDatabase.shared.addCapabilitiesJSon(data!, account: account)
                 
+                    let serverVersionMajor = NCManageDatabase.shared.getCapabilitiesServerInt(account: account, elements: NCElementsJSON.shared.capabilitiesVersionMajor)
+                    
                     // Setup communication
-                    self.appDelegate.settingSetupCommunication(account)
-                
+                    if serverVersionMajor > 0 {
+                        NCCommunicationCommon.shared.setup(nextcloudVersion: serverVersionMajor)
+                    }
+                    NCCommunicationCommon.shared.setup(webDav: NCUtilityFileSystem.shared.getWebDAV(account: account))
+                    NCCommunicationCommon.shared.setup(dav: NCUtilityFileSystem.shared.getDAV())
+                    
                     // Theming
                     NCBrandColor.shared.settingThemingColor(account: account)
                 
@@ -191,7 +197,6 @@ class NCService: NSObject {
                     }
                 
                     // Text direct editor detail
-                    let serverVersionMajor = NCManageDatabase.shared.getCapabilitiesServerInt(account: account, elements: NCElementsJSON.shared.capabilitiesVersionMajor)
                     if serverVersionMajor >= NCBrandGlobal.shared.nextcloudVersion18 {
                         NCCommunication.shared.NCTextObtainEditorDetails() { (account, editors, creators, errorCode, errorMessage) in
                             if errorCode == 0 && account == self.appDelegate.account {