/// <summary> /// plistの更新をする /// </summary> /// <param name="buildPath"></param> /// <param name="settings"></param> private static void UpdatePlist(string buildPath, GoogleSettings settings) { #if UNITY_IOS PlistDocument plist = new PlistDocument(); string filePath = Path.Combine(buildPath, "Info.plist"); plist.ReadFromFile(filePath); PlistElement bundleUrlTypes = null; if (!plist.root.values.TryGetValue("CFBundleURLTypes", out bundleUrlTypes)) { bundleUrlTypes = plist.root.CreateArray("CFBundleURLTypes"); } // set url scheme PlistElementDict urlSchemeDict = bundleUrlTypes.AsArray().AddDict(); urlSchemeDict.SetString("CFBundleTypeRole", "Editor"); urlSchemeDict.CreateArray("CFBundleURLSchemes").AddString(settings.IOS.URLScheme); // set bundle id PlistElementDict bundleIdDict = bundleUrlTypes.AsArray().AddDict(); bundleIdDict.SetString("CFBundleTypeRole", "Editor"); #if UNITY_5_6_OR_NEWER bundleIdDict.CreateArray("CFBundleURLSchemes").AddString(Application.identifier); #else bundleIdDict.CreateArray("CFBundleURLSchemes").AddString(Application.bundleIdentifier); #endif plist.WriteToFile(filePath); #endif }
private static void OnPostProcessBuild(BuildTarget buildTarget, string buildPath) { if (buildTarget != BuildTarget.iOS) { return; } GoogleSettings settings = SettingsUtility.Load <GoogleSettings>(); UpdateCocoaPods(); UpdatePlist(buildPath, settings); }
/// <summary> /// Sign-in /// </summary> /// <param name="requestEmail"></param> /// <param name="requestId"></param> /// <param name="requestIdToken"></param> /// <param name="requestServerAuthCode"></param> /// <param name="requestProfile"></param> /// <returns>CoroutineEnumerator</returns> public IEnumerator SignIn(bool requestEmail, bool requestId, bool requestIdToken, bool requestServerAuthCode, bool requestProfile) { GoogleSettings settings = null; yield return(SettingsUtility.LoadAsync <GoogleSettings>(x => settings = x)); if (settings == null) { Error = "NotFound GoogleSettings"; yield break; } yield return(SignIn(settings.Target.ClientId, settings.Target.ClientSecret, requestEmail, requestId, requestIdToken, requestServerAuthCode, requestProfile)); }