private void OnFocus()
        {
            Dictionary <string, string> dictionary = GenerateXmlFromGoogleServicesJson.ReadProjectFields();

            if (!dictionary.TryGetValue("project_id", out SettingsWindow.s_androidProjectId))
            {
                SettingsWindow.s_androidProjectId = null;
            }
            XcodeProjectPatcher.ReadConfig(false, null);
            Dictionary <string, string> config = XcodeProjectPatcher.GetConfig();

            if (!config.TryGetValue("PROJECT_ID", out SettingsWindow.s_iosProjectId))
            {
                SettingsWindow.s_iosProjectId = null;
            }
            base.Repaint();
        }
        private static string CheckBundleId(string bundleId, bool promptUpdate = true, bool logErrorOnMissingBundleId = true)
        {
            if (XcodeProjectPatcher.configFile == null)
            {
                return(null);
            }
            Dictionary <string, string> config = XcodeProjectPatcher.GetConfig();
            string text;

            if (!config.TryGetValue("BUNDLE_ID", out text))
            {
                return(null);
            }
            if (!text.Equals(bundleId) && logErrorOnMissingBundleId && XcodeProjectPatcher.allBundleIds.Count > 0)
            {
                string[] array        = XcodeProjectPatcher.allBundleIds.ToArray <string>();
                string   errorMessage = DocStrings.DocRef.GoogleServicesFileBundleIdMissing.Format(new object[]
                {
                    bundleId,
                    "GoogleServices-Info.plist",
                    string.Join(", ", array),
                    DocStrings.Link.IOSAddApp
                });
                if (promptUpdate && !XcodeProjectPatcher.spamguard)
                {
                    ChooserDialog.Show("Please fix your Bundle ID", "Select a valid Bundle ID from your Firebase configuration.", string.Format("Your bundle ID {0} is not present in your Firebase configuration.  A mismatched bundle ID will result in your application to fail to initialize.\n\nNew Bundle ID:", bundleId), array, 0, "Apply", "Cancel", delegate(string selectedBundleId) {
                        if (!string.IsNullOrEmpty(selectedBundleId))
                        {
                            UnityCompat.ApplicationId = selectedBundleId;
                        }
                        else
                        {
                            XcodeProjectPatcher.spamguard = true;
                            Debug.LogError(errorMessage);
                        }
                        XcodeProjectPatcher.ReadConfig(true, null);
                    });
                }
                else
                {
                    Debug.LogError(errorMessage);
                }
            }
            return(text);
        }
        internal static void ReadAndApplyFirebaseConfig(BuildTarget buildTarget, string pathToBuiltProject)
        {
            string           text    = "Firebase.Invites.dll";
            HashSet <string> hashSet = new HashSet <string>
            {
                "Firebase.Auth.dll",
                "Firebase.DynamicLinks.dll",
                text
            };
            bool flag  = false;
            bool flag2 = false;

            string[] array = AssetDatabase.FindAssets("t:Object");
            for (int i = 0; i < array.Length; i++)
            {
                string text2    = array[i];
                string fileName = Path.GetFileName(AssetDatabase.GUIDToAssetPath(text2));
                if (hashSet.Contains(fileName))
                {
                    flag  = true;
                    flag2 = (fileName == text);
                }
            }
            if (!flag2 && !flag)
            {
                return;
            }
            XcodeProjectPatcher.ReadConfig(true, null);
            Dictionary <string, string> config = XcodeProjectPatcher.GetConfig();

            if (config.Count == 0)
            {
                return;
            }
            string text3 = null;
            string text4 = null;

            if (!config.TryGetValue("REVERSED_CLIENT_ID", out text3))
            {
                Debug.LogError(DocStrings.DocRef.PropertyMissingForGoogleSignIn.Format(new object[]
                {
                    "GoogleService-Info.plist",
                    "REVERSED_CLIENT_ID",
                    DocStrings.Link.IOSAddApp
                }));
            }
            if (!config.TryGetValue("BUNDLE_ID", out text4))
            {
                Debug.LogError(DocStrings.DocRef.PropertyMissingForGoogleSignIn.Format(new object[]
                {
                    "GoogleService-Info.plist",
                    "BUNDLE_ID",
                    DocStrings.Link.IOSAddApp
                }));
            }
            string        path          = Path.Combine(pathToBuiltProject, "Info.plist");
            PlistDocument plistDocument = new PlistDocument();

            plistDocument.ReadFromString(File.ReadAllText(path));
            PlistElementDict  root = plistDocument.root;
            PlistElementArray plistElementArray = null;

            if (root.values.ContainsKey("CFBundleURLTypes"))
            {
                plistElementArray = root["CFBundleURLTypes"].AsArray();
            }
            if (plistElementArray == null)
            {
                plistElementArray = root.CreateArray("CFBundleURLTypes");
            }
            if (text3 != null)
            {
                PlistElementDict plistElementDict = plistElementArray.AddDict();
                plistElementDict.SetString("CFBundleTypeRole", "Editor");
                plistElementDict.SetString("CFBundleURLName", "google");
                plistElementDict.CreateArray("CFBundleURLSchemes").AddString(text3);
            }
            if (text4 != null)
            {
                PlistElementDict plistElementDict2 = plistElementArray.AddDict();
                plistElementDict2.SetString("CFBundleTypeRole", "Editor");
                plistElementDict2.SetString("CFBundleURLName", text4);
                plistElementDict2.CreateArray("CFBundleURLSchemes").AddString(text4);
            }
            if (flag2 && !root.values.ContainsKey("NSContactsUsageDescription"))
            {
                root.SetString("NSContactsUsageDescription", "Invite others to use the app.");
            }
            File.WriteAllText(path, plistDocument.WriteToString());
        }