Browse Source

clear code

marinofaggiana 4 years ago
parent
commit
f1d61426d1

+ 4 - 0
iOSClient/Brand/NCBrand.swift

@@ -223,6 +223,10 @@ class NCBrandColor: NSObject {
     public let databaseDefault: String              = "nextcloud.realm"
     public let databaseSchemaVersion: UInt64        = 160
     
+    // E2EE
+    public let e2eeMaxFileSize: UInt64              = 524288000   // 500 MB
+    @objc public let e2eeVersion: String            = "1.1"
+    
     // NCSharePaging
     public let indexPageActivity: Int               = 0
     public let indexPageComments: Int               = 1

+ 0 - 10
iOSClient/CCGlobal.h

@@ -72,8 +72,6 @@
 #define k_dismissAfterSecond                            4
 #define k_dismissAfterSecondLong                        10
 
-#define k_daysOfActivity                                7
-
 #define k_sizePreview                                   1024
 #define k_sizeIcon                                      512
 
@@ -218,10 +216,6 @@
 #define k_activityDebugActionCapabilities               @"Capabilities Of Server"
 #define k_activityDebugActionEndToEndEncryption         @"End To End Encryption "
 
-// E2EE
-#define k_max_filesize_E2EE                             524288000   // 500 MB
-#define k_E2EE_API                                      @"1.1"
-
 // Flow Version
 #define k_flow_version_available                        12
 
@@ -230,10 +224,6 @@
 #define k_trash_version_available_more_fix              15
 #define k_files_comments                                20
 
-// Toolbar Detail
-#define k_detail_Toolbar_Height                         49
-
-
 //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

+ 1 - 1
iOSClient/Networking/NCNetworkingE2EE.swift

@@ -202,7 +202,7 @@ import Alamofire
         let serverUrl = metadata.serverUrl
         
         // Verify max size
-        if metadata.size > Int64(k_max_filesize_E2EE) {
+        if metadata.size > NCBrandGlobal.shared.e2eeMaxFileSize {
             NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", ocIdTemp))
 
             NotificationCenter.default.postOnMainThread(name: k_notificationCenter_uploadedFile, userInfo: ["ocId":metadata.ocId, "ocIdTemp":ocIdTemp, "errorCode":k_CCErrorInternalError, "errorDescription":"E2E Error file too big"])

+ 2 - 2
iOSClient/Settings/NCManageEndToEndEncryption.m

@@ -46,11 +46,11 @@
     BOOL isE2EEEnabled = [[NCManageDatabase shared] getCapabilitiesServerBoolWithAccount:appDelegate.account elements:NCElementsJSON.shared.capabilitiesE2EEEnabled exists:false];
     NSString *versionE2EE = [[NCManageDatabase shared] getCapabilitiesServerStringWithAccount:appDelegate.account elements:NCElementsJSON.shared.capabilitiesE2EEApiVersion];
     
-    if (![versionE2EE isEqual:k_E2EE_API] && isE2EEEnabled) {
+    if (![versionE2EE isEqual:[[NCBrandGlobal shared] e2eeVersion]] && isE2EEEnabled) {
         [[NCContentPresenter shared] messageNotification:@"_error_e2ee_" description:@"_err_e2ee_app_version_" delay:k_dismissAfterSecond type:messageTypeError errorCode:k_CCErrorInternalError forced:true];
     }
     
-    if (isE2EEEnabled == NO || ![versionE2EE isEqual:k_E2EE_API]) {
+    if (isE2EEEnabled == NO || ![versionE2EE isEqual:[[NCBrandGlobal shared] e2eeVersion]]) {
         
         // Section SERVICE NOT AVAILABLE -------------------------------------------------
         

+ 2 - 2
iOSClient/Utility/CCUtility.m

@@ -364,8 +364,8 @@
     NSString *privateKey = [self getEndToEndPrivateKey:account];
     NSString *passphrase = [self getEndToEndPassphrase:account];
     NSString *publicKeyServer = [self getEndToEndPublicKeyServer:account];    
-    
-    if (passphrase.length > 0 && privateKey.length > 0 && publicKey.length > 0 && publicKeyServer.length > 0 && isE2EEEnabled && [versionE2EE isEqual:k_E2EE_API]) {
+            
+    if (passphrase.length > 0 && privateKey.length > 0 && publicKey.length > 0 && publicKeyServer.length > 0 && isE2EEEnabled && [versionE2EE isEqual:[[NCBrandGlobal shared] e2eeVersion]]) {
        
         return YES;