Skip to content

Commit

Permalink
Automatically register url scheme to plist on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
BellringerQuinn committed Dec 15, 2023
1 parent 3b407dd commit c7aef86
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 23 deletions.
24 changes: 2 additions & 22 deletions Assets/Editor/SetUrlScheme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProj
}
_urlScheme = config.UrlScheme;

_plistPath = Path.Combine(pathToBuiltProject, "Contents/Info.plist");

if (target == BuildTarget.iOS)
{
_plistPath = Path.Combine(pathToBuiltProject, "Info.plist");
SetPlistUrlScheme();
}
else if (target == BuildTarget.StandaloneOSX)
{
_plistPath = Path.Combine(pathToBuiltProject, "Contents/Info.plist");
SetPlistUrlScheme();
}

Expand Down Expand Up @@ -70,25 +70,5 @@ private static void SetPlistUrlScheme()

plist.WriteToFile(_plistPath);
}

private static void AddPlistValue(string key, PlistElement[] elements)
{
PlistDocument plist = new PlistDocument();
plist.ReadFromFile(_plistPath);

PlistElementDict rootDict = plist.root;
if (rootDict.values.ContainsKey(key) && rootDict.values[key] is PlistElementArray existingArray)
{
existingArray.values.AddRange(elements);
}
else
{
PlistElementArray newArray = new PlistElementArray();
newArray.values.AddRange(elements);
rootDict.values[key] = newArray;
}

plist.WriteToFile(_plistPath);
}
}
}
2 changes: 1 addition & 1 deletion Assets/Resources/OpenIdAuthenticatorConfig.asset
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c31bdc7ca06145c58d72ef6ca48f8e02, type: 3}
m_Name: OpenIdAuthenticatorConfig
m_EditorClassIdentifier:
UrlScheme: sdk-powered-by-sequence
UrlScheme: ios-test

0 comments on commit c7aef86

Please sign in to comment.