Skip to content

Commit 6b90f62

Browse files
hugtorusmankaiz
andauthored
Ios (#5)
* ios changes * ios auth updated Co-authored-by: Muhammad Usman <[email protected]>
1 parent add878f commit 6b90f62

File tree

18 files changed

+170
-58
lines changed

18 files changed

+170
-58
lines changed

.DS_Store

0 Bytes
Binary file not shown.

Assets/.DS_Store

0 Bytes
Binary file not shown.

Assets/Plugins/.DS_Store

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

Assets/Plugins/Web3AuthSDK/Editor/BuildPostProcess.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class BuildPostProcess
1313
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
1414
{
1515
#if UNITY_IOS
16-
16+
1717
Uri uri = null;
1818

1919
try
@@ -39,6 +39,7 @@ public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProj
3939
urlSchemes.AddString(uri.Scheme);
4040

4141
infoPlist.WriteToFile(infoPlistPath);
42+
4243

4344
#endif
4445
}

Assets/Plugins/Web3AuthSDK/Samples/Web3AuthSample.unity

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ RenderSettings:
3838
m_ReflectionIntensity: 1
3939
m_CustomReflection: {fileID: 0}
4040
m_Sun: {fileID: 0}
41-
m_IndirectSpecularColor: {r: 0.4439403, g: 0.4931519, b: 0.5722083, a: 1}
41+
m_IndirectSpecularColor: {r: 0.44657815, g: 0.49641192, b: 0.57481617, a: 1}
4242
m_UseRadianceAmbientProbe: 0
4343
--- !u!157 &3
4444
LightmapSettings:
@@ -886,8 +886,8 @@ MonoBehaviour:
886886
m_Script: {fileID: 11500000, guid: 3eab2a0bf902d6e4b9c2e968ad89f528, type: 3}
887887
m_Name:
888888
m_EditorClassIdentifier:
889-
clientId: BCtbnOamqh0cJFEUYA0NB5YkvBECZ3HLZsKfvSRBvew2EiiKW3UxpyQASSR0artjQkiUOCHeZ_ZeygXpYpxZjOs
890-
redirectUri: torusapp://org.torusresearch.web3authunity/auth
889+
clientId: BAwFgL-r7wzQKmtcdiz2uHJKNZdK7gzEf2q-m55xfzSZOw8jLOyIi4AVvvzaEQO5nv2dFLEmf9LBkF8kaq3aErg
890+
redirectUri: torusapp://com.torus.Web3AuthUnity/auth
891891
network: 1
892892
--- !u!1 &529774071
893893
GameObject:
@@ -924,7 +924,7 @@ RectTransform:
924924
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
925925
m_AnchorMin: {x: 0.09670371, y: 0.23700002}
926926
m_AnchorMax: {x: 0.90000004, y: 0.7063542}
927-
m_AnchoredPosition: {x: 2, y: 6.399994}
927+
m_AnchoredPosition: {x: 2, y: 6.4000244}
928928
m_SizeDelta: {x: 21.451538, y: 12.259766}
929929
m_Pivot: {x: 0.5, y: 0.5}
930930
--- !u!114 &529774073
@@ -1666,7 +1666,6 @@ MonoBehaviour:
16661666
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
16671667
m_Name:
16681668
m_EditorClassIdentifier:
1669-
m_SendPointerHoverToParent: 1
16701669
m_HorizontalAxis: Horizontal
16711670
m_VerticalAxis: Vertical
16721671
m_SubmitButton: Submit

Assets/Plugins/Web3AuthSDK/Utils.cs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,15 @@
88

99
public static class Utils
1010
{
11-
//https://qiita.com/lucifuges/items/b17d602417a9a249689f
1211
#if UNITY_IOS
1312
[DllImport("__Internal")]
14-
extern static void launchUrl(string url);
15-
[DllImport("__Internal")]
16-
extern static void dismiss();
13+
extern static void web3auth_launch(string url, string redirectUri, string objectName);
1714
#endif
1815

1916

20-
public static void LaunchUrl(string url)
17+
public static void LaunchUrl(string url, string redirectUri = null, string objectName = null)
2118
{
19+
Debug.Log((new Uri(redirectUri)).Scheme);
2220
#if UNITY_EDITOR || UNITY_STANDALONE_WIN
2321
Application.OpenURL(url);
2422
#elif UNITY_ANDROID
@@ -30,14 +28,8 @@ public static void LaunchUrl(string url)
3028
}
3129

3230
#elif UNITY_IOS
33-
launchUrl(url);;
34-
#endif
35-
}
36-
37-
public static void Dismiss()
38-
{
39-
#if UNITY_IOS && !UNITY_EDITOR
40-
dismiss();
31+
var uri = new Uri(redirectUri);
32+
web3auth_launch(url, uri.Scheme, objectName);
4133
#endif
4234
}
4335

Assets/Plugins/Web3AuthSDK/Web3Auth.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ private void IncomingHttpRequest(IAsyncResult result)
190190

191191
private void request(string path, LoginParams loginParams = null, Dictionary<string, object> extraParams = null)
192192
{
193+
Debug.Log(redirectUri);
193194
#if UNITY_STANDALONE || UNITY_EDITOR
194195
this.initParams["redirectUrl"] = StartLocalWebserver();
195196
#endif
@@ -213,7 +214,7 @@ private void request(string path, LoginParams loginParams = null, Dictionary<st
213214
uriBuilder.Path = path;
214215
uriBuilder.Fragment = hash;
215216

216-
Utils.LaunchUrl(uriBuilder.ToString());
217+
Utils.LaunchUrl(uriBuilder.ToString(), this.initParams["redirectUrl"].ToString(), gameObject.name);
217218
}
218219

219220
public void setResultUrl(Uri uri)
@@ -238,9 +239,6 @@ public void setResultUrl(Uri uri)
238239
else
239240
this.Enqueue(() => this.onLogin?.Invoke(this.web3AuthResponse));
240241

241-
#if UNITY_IOS
242-
Utils.Dismiss();
243-
#endif
244242
}
245243

246244
public void login(LoginParams loginParams)
6 KB
Binary file not shown.

Assets/Plugins/Web3AuthSDK/iOS/SafariView.mm

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)