/// <summary> /// Updates the schemes settings. /// </summary> /// <param name="urlSchemes">URL schemes.</param> public void UpdateSchemesSettings(string[] urlSchemes) { if (xmlDict.ContainsKey("CFBundleURLTypes")) { //Debug.Log ("Find CFBundleURLTypes"); var currentSchemas = (List <object>)xmlDict ["CFBundleURLTypes"]; for (int i = 0; i < currentSchemas.Count; i++) { // if it's not a dictionary, go to next index if (currentSchemas [i].GetType() == typeof(PListDict)) { var bundleTypeNode = (PListDict)currentSchemas [i]; if (bundleTypeNode.ContainsKey("CFBundleURLSchemes") && bundleTypeNode ["CFBundleURLSchemes"].GetType() == typeof(List <object>)) { var appIdsFromPListDict = (List <object>)bundleTypeNode ["CFBundleURLSchemes"]; appIdsFromPListDict.Clear(); for (int j = 0; j < urlSchemes.Length; j++) { string modifiedID = urlSchemes [j]; appIdsFromPListDict.Add((object)modifiedID); } return; } } } // Didn't find schema, let's add schema to the list of schemas already present var appIds = new List <object> (); for (int j = 0; j < urlSchemes.Length; j++) { string modifiedID = urlSchemes [j]; appIds.Add((object)modifiedID); } var schemaEntry = new PListDict(); schemaEntry.Add("CFBundleURLSchemes", appIds); currentSchemas.Add(schemaEntry); return; } else { //Debug.Log ("Didn't find any CFBundleURLTypes"); var appIds = new List <object> (); for (int j = 0; j < urlSchemes.Length; j++) { Debug.Log("urlScheme : " + urlSchemes [j]); string modifiedID = urlSchemes [j]; appIds.Add((object)modifiedID); } var schemaEntry = new PListDict(); schemaEntry.Add("CFBundleURLSchemes", appIds); var currentSchemas = new List <object> (); currentSchemas.Add(schemaEntry); xmlDict.Add("CFBundleURLTypes", currentSchemas); } }
public void UpdateDomainSecuritySettings(string[] domains) { string currentKey = "NSAppTransportSecurity"; if (xmlDict.ContainsKey(currentKey)) { xmlDict.Remove(currentKey); } if (domains.Length == 0) { var dictSecurity = new PListDict(); object setVlaue = "true"; dictSecurity.Add("NSAllowsArbitraryLoads", setVlaue); xmlDict.Add(currentKey, dictSecurity); } else { var dictSecurity = new PListDict(); var dictDomains = new PListDict(); var settings = new PListDict(); object setVlaue; setVlaue = "true"; settings.Add("NSExceptionAllowsInsecureHTTPLoads", setVlaue); setVlaue = "false"; settings.Add("NSExceptionRequiresForwardSecrecy", setVlaue); setVlaue = "true"; settings.Add("NSIncludesSubdomains", setVlaue); for (int j = 0; j < domains.Length; j++) { string domain = domains [j]; dictDomains.Add(domain, settings); } dictSecurity.Add("NSExceptionDomains", dictDomains); xmlDict.Add(currentKey, dictSecurity); } }