private static void CheckConfiguration() { Delegate arg_22_0 = EditorApplication.update; if (XcodeProjectPatcher.f__mgcache7 == null) { XcodeProjectPatcher.f__mgcache7 = new EditorApplication.CallbackFunction(XcodeProjectPatcher.CheckConfiguration); } EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(arg_22_0, XcodeProjectPatcher.f__mgcache7); XcodeProjectPatcher.CheckBundleId(UnityCompat.ApplicationId, true, true); XcodeProjectPatcher.CheckBuildEnvironment(); }
internal static void AddGoogleServicePlist(BuildTarget buildTarget, string pathToBuiltProject) { XcodeProjectPatcher.ReadConfig(true, null); if (XcodeProjectPatcher.configFile == null) { return; } XcodeProjectPatcher.CheckBundleId(UnityCompat.ApplicationId, false, true); string fileName = Path.GetFileName(XcodeProjectPatcher.configFile); File.Copy(XcodeProjectPatcher.configFile, Path.Combine(pathToBuiltProject, fileName), true); string projectPath = IOSResolver.GetProjectPath(pathToBuiltProject); PBXProject pBXProject = new PBXProject(); pBXProject.ReadFromString(File.ReadAllText(projectPath)); pBXProject.AddFileToBuild(pBXProject.TargetGuidByName(IOSResolver.TARGET_NAME), pBXProject.AddFile(fileName, fileName, PBXSourceTree.Source)); File.WriteAllText(projectPath, pBXProject.WriteToString()); }
private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromPath) { if (!XcodeProjectPatcher.Enabled) { return; } bool flag = false; for (int i = 0; i < importedAssets.Length; i++) { string path = importedAssets[i]; if (Path.GetFileName(path) == "GoogleService-Info.plist") { flag = true; break; } } if (flag) { XcodeProjectPatcher.spamguard = false; XcodeProjectPatcher.ReadConfig(false, null); XcodeProjectPatcher.CheckBundleId(UnityCompat.ApplicationId, true, true); } }
internal static string FindConfig(bool errorOnNoConfig = true) { string value = XcodeProjectPatcher.configFile; SortedDictionary <string, string> sortedDictionary = new SortedDictionary <string, string>(); XcodeProjectPatcher.allBundleIds.Clear(); string[] array = AssetDatabase.FindAssets("GoogleService-Info"); for (int i = 0; i < array.Length; i++) { string text = array[i]; string text2 = AssetDatabase.GUIDToAssetPath(text); if (Path.GetFileName(text2) == "GoogleService-Info.plist") { sortedDictionary[text2] = text2; } } string[] array2 = new string[sortedDictionary.Keys.Count]; sortedDictionary.Keys.CopyTo(array2, 0); string text3 = (array2.Length < 1) ? null : array2[0]; if (array2.Length == 0) { if (errorOnNoConfig && XcodeProjectPatcher.Enabled) { Debug.LogError(DocStrings.DocRef.GoogleServicesIOSFileMissing.Format(new object[] { "GoogleService-Info.plist", DocStrings.Link.IOSAddApp })); } } else if (array2.Length > 1) { string applicationId = UnityCompat.ApplicationId; string text4 = null; string[] array3 = array2; for (int j = 0; j < array3.Length; j++) { string text5 = array3[j]; string filename = text5; XcodeProjectPatcher.ReadConfig(true, filename); string text6 = XcodeProjectPatcher.CheckBundleId(applicationId, true, false); text4 = (text4 ?? text6); if (text6 == applicationId) { text3 = text5; text4 = applicationId; } } if (string.IsNullOrEmpty(value) || !text3.Equals(value)) { Debug.LogWarning(DocStrings.DocRef.GoogleServicesFileMultipleFiles.Format(new object[] { "GoogleService-Info.plist", text3, text4, string.Join("\n", array2) })); } } return(text3); }
private static void OnBundleIdChanged(object sender, PlayServicesResolver.BundleIdChangedEventArgs args) { XcodeProjectPatcher.ReadConfig(false, null); XcodeProjectPatcher.CheckBundleId(UnityCompat.ApplicationId, true, true); }