Skip to content

Commit ee02cdc

Browse files
committed
add mechanism for GIDClientID
1 parent f16e57f commit ee02cdc

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

GoogleSignIn/Editor/iOS.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
(c) 2025 CesilCo Pte. Ltd. All rights reserved.
3+
4+
Author/Maintainer: Leow Guan Hao
5+
*/
6+
7+
#if UNITY_EDITOR
8+
using System;
9+
using System.IO;
10+
using System.Linq;
11+
12+
using UnityEditor;
13+
using UnityEditor.iOS.Xcode;
14+
15+
using UnityEditor.Build;
16+
using UnityEditor.Build.Reporting;
17+
18+
public class GameBuilder : IPostprocessBuildWithReport
19+
{
20+
public int callbackOrder => 999;
21+
22+
public void OnPostprocessBuild(BuildReport report)
23+
{
24+
if(report.summary.platform != BuildTarget.iOS)
25+
return;
26+
27+
string infoPlist = Path.Combine(report.summary.outputPath,"Info.plist");
28+
if(!File.Exists(infoPlist))
29+
return;
30+
31+
string googleScheme = PlayerSettings.iOS.iOSUrlSchemes.FirstOrDefault((scheme) => scheme.StartsWith("com.googleusercontent.apps."));
32+
if(string.IsNullOrEmpty(googleScheme))
33+
return;
34+
35+
PlistDocument plistDoc = new();
36+
plistDoc.ReadFromFile(infoPlist);
37+
plistDoc.root.SetString("GIDClientID",string.Join('.',googleScheme.Split('.').Reverse()));
38+
39+
plistDoc.WriteToFile(infoPlist);
40+
}
41+
}
42+
#endif

GoogleSignIn/Editor/iOS/PostBuildProcessor.cs.meta

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)