Răsfoiți Sursa

Managed App Configuration

marinofaggiana 5 ani în urmă
părinte
comite
fa60926a37
2 a modificat fișierele cu 33 adăugiri și 1 ștergeri
  1. 18 0
      iOSClient/AppDelegate.m
  2. 15 1
      iOSClient/Brand/NCBrand.swift

+ 18 - 0
iOSClient/AppDelegate.m

@@ -284,6 +284,24 @@ PKPushRegistry *pushRegistry;
     
     @synchronized (self) {
 
+        // use appConfig [MDM]
+        if ([NCBrandOptions sharedInstance].use_configuration) {
+            
+            NSDictionary *serverConfig = [[NSUserDefaults standardUserDefaults] dictionaryForKey:NCBrandConfiguration.sharedInstance.key];
+            NSString *serverUrl = serverConfig[NCBrandConfiguration.sharedInstance.serverUrl];
+            NSString *username = serverConfig[NCBrandConfiguration.sharedInstance.username];
+            NSString *password = serverConfig[NCBrandConfiguration.sharedInstance.password];
+            
+            if (serverUrl && [serverUrl isKindOfClass:[NSString class]] && username && [username isKindOfClass:[NSString class]] && password && [password isKindOfClass:[NSString class]]) {
+            
+            } else {
+                [self messageNotification:@"MDM" description:@"Parameter XML error" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeInfo errorCode:0];
+            }
+            
+            return;
+        }
+        
+        
         // only for personalized LoginWeb [customer]
         if ([NCBrandOptions sharedInstance].use_login_web_personalized) {
             

+ 15 - 1
iOSClient/Brand/NCBrand.swift

@@ -119,7 +119,8 @@ class NCBrandColor: NSObject {
     @objc public let use_themingLogo:                   Bool = false     
     @objc public let use_middlewarePing:                Bool = false
     @objc public let use_storeLocalAutoUploadAll:       Bool = false
-    @objc public let use_imi_viewer:                    Bool = false                                                 // Don't touch me !!
+    @objc public let use_imi_viewer:                    Bool = false                                                // Don't touch me !!
+    @objc public let use_configuration:                 Bool = false                                                // Don't touch me !!
 
     @objc public let disable_intro:                     Bool = false
     @objc public let disable_request_login_url:         Bool = false
@@ -136,3 +137,16 @@ class NCBrandColor: NSObject {
     }
 }
 
+@objc class NCBrandConfiguration: NSObject {
+    
+    @objc static let sharedInstance: NCBrandConfiguration = {
+        let instance = NCBrandConfiguration()
+        return instance
+    }()
+    
+    @objc public let key:                               String = "com.apple.configuration.managed"
+    @objc public let serverUrl:                         String = "serverUrl"
+    @objc public let username:                          String = "username"
+    @objc public let password:                          String = "password"
+}
+