Browse Source

clear code

marinofaggiana 4 years ago
parent
commit
678c8bfada

+ 4 - 1
iOSClient/Brand/NCBrand.swift

@@ -220,9 +220,12 @@ class NCBrandColor: NSObject {
     @objc let appDatabaseNextcloud                  = "Library/Application Support/Nextcloud"
 
     // Nextcloud version
+    @objc let nextcloudVersion12: Int               =  12
+    let nextcloudVersion15: Int                     =  15
     let nextcloudVersion17: Int                     =  17
     let nextcloudVersion18: Int                     =  18
-    
+    let nextcloudVersion20: Int                     =  20
+
     // Database Realm
     let databaseDefault                             = "nextcloud.realm"
     let databaseSchemaVersion: UInt64               = 160

+ 0 - 13
iOSClient/CCGlobal.h

@@ -64,11 +64,6 @@
 #define k_intro_login                                   0
 #define k_intro_signup                                  1
 
-// Login
-#define k_login_Add                                     0
-#define k_login_Add_Forced                              1
-#define k_login_Add_SignUp                              2
-
 // Constants to identify the different permissions of a file
 #define k_permission_shared                             @"S"
 #define k_permission_can_share                          @"R"
@@ -180,14 +175,6 @@
 #define k_activityDebugActionCapabilities               @"Capabilities Of Server"
 #define k_activityDebugActionEndToEndEncryption         @"End To End Encryption "
 
-// Flow Version
-#define k_flow_version_available                        12
-
-// New capabilities version
-#define k_trash_version_available                       14
-#define k_trash_version_available_more_fix              15
-#define k_files_comments                                20
-
 //Share permission
 //permissions - (int) 1 = read; 2 = update; 4 = create; 8 = delete; 16 = share; 31 = all (default: 31, for public shares: 1)
 #define k_read_share_permission                         1

+ 2 - 2
iOSClient/Login/CCLogin.m

@@ -215,7 +215,7 @@
                 }
                 
                 // Login Flow
-                else if (_user.hidden && _password.hidden && versionMajor >= k_flow_version_available) {
+                else if (_user.hidden && _password.hidden && versionMajor >= [[NCBrandGlobal shared] nextcloudVersion12]) {
                     
                     NCLoginWeb *activeLoginWeb = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"NCLoginWeb"];
                     activeLoginWeb.urlBase = self.baseUrl.text;
@@ -224,7 +224,7 @@
                 }
                 
                 // NO Login Flow available
-                else if (versionMajor < k_flow_version_available) {
+                else if (versionMajor < [[NCBrandGlobal shared] nextcloudVersion12]) {
                     
                     [self.loginTypeView setHidden:YES];
                     

+ 1 - 1
iOSClient/More/NCMore.swift

@@ -138,7 +138,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
         
         // ITEM : Trash
         let serverVersionMajor = NCManageDatabase.shared.getCapabilitiesServerInt(account: appDelegate.account, elements: NCElementsJSON.shared.capabilitiesVersionMajor)
-        if serverVersionMajor >= Int(k_trash_version_available) {
+        if serverVersionMajor >= NCBrandGlobal.shared.nextcloudVersion15 {
 
             item = NCCommunicationExternalSite()
             item.name = "_trash_view_"

+ 1 - 1
iOSClient/Share/NCSharePaging.swift

@@ -44,7 +44,7 @@ class NCSharePaging: UIViewController {
         // Verify Comments & Sharing enabled
         let serverVersionMajor = NCManageDatabase.shared.getCapabilitiesServerInt(account: appDelegate.account, elements: NCElementsJSON.shared.capabilitiesVersionMajor)
         let comments = NCManageDatabase.shared.getCapabilitiesServerBool(account: appDelegate.account, elements: NCElementsJSON.shared.capabilitiesFilesComments, exists: false)
-        if serverVersionMajor >= k_files_comments && comments == false {
+        if serverVersionMajor >= NCBrandGlobal.shared.nextcloudVersion20 && comments == false {
             commentsEnabled = false
         }
         let sharing = NCManageDatabase.shared.getCapabilitiesServerBool(account: appDelegate.account, elements: NCElementsJSON.shared.capabilitiesFileSharingApiEnabled, exists: false)