Browse Source

add useragent in brand

marinofaggiana 6 years ago
parent
commit
4aa84db805
2 changed files with 5 additions and 1 deletions
  1. 3 0
      iOSClient/Brand/NCBrand.swift
  2. 2 1
      iOSClient/Utility/CCUtility.m

+ 3 - 0
iOSClient/Brand/NCBrand.swift

@@ -93,6 +93,9 @@ class NCBrandColor: NSObject {
     // Database key 64 char ASCII (for encryption AES-256+SHA2)
     @objc public var databaseEncryptionKey:             String = "1234567890123456789012345678901234567890123456789012345678901234"
     
+    // User Agent
+    @objc public var userAgent:                         String = "Nextcloud-iOS"                                    // Don't touch me !!
+    
     // Options
     @objc public let use_login_web_personalized:        Bool = false                                                // Don't touch me !!
     @objc public let use_default_auto_upload:           Bool = false

+ 2 - 1
iOSClient/Utility/CCUtility.m

@@ -588,8 +588,9 @@
 + (NSString *)getUserAgent
 {
     NSString *appVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
+    NSString *userAgent = [[NCBrandOptions sharedInstance] userAgent];
     
-    return [NSString stringWithFormat:@"%@%@",@"Mozilla/5.0 (iOS) Nextcloud-iOS/",appVersion];
+    return [NSString stringWithFormat:@"Mozilla/5.0 (iOS) %@/%@", userAgent, appVersion];
 }
 
 + (NSString *)dateDiff:(NSDate *) convertedDate