Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
Binary file modified Assets/.DS_Store
Binary file not shown.
Binary file modified Assets/Plugins/.DS_Store
Binary file not shown.
Binary file modified Assets/Plugins/Web3AuthSDK/.DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion Assets/Plugins/Web3AuthSDK/Editor/BuildPostProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class BuildPostProcess
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
{
#if UNITY_IOS

Uri uri = null;

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

infoPlist.WriteToFile(infoPlistPath);


#endif
}
Expand Down
9 changes: 4 additions & 5 deletions Assets/Plugins/Web3AuthSDK/Samples/Web3AuthSample.unity
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.4439403, g: 0.4931519, b: 0.5722083, a: 1}
m_IndirectSpecularColor: {r: 0.44657815, g: 0.49641192, b: 0.57481617, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down Expand Up @@ -886,8 +886,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3eab2a0bf902d6e4b9c2e968ad89f528, type: 3}
m_Name:
m_EditorClassIdentifier:
clientId: BCtbnOamqh0cJFEUYA0NB5YkvBECZ3HLZsKfvSRBvew2EiiKW3UxpyQASSR0artjQkiUOCHeZ_ZeygXpYpxZjOs
redirectUri: torusapp://org.torusresearch.web3authunity/auth
clientId: BAwFgL-r7wzQKmtcdiz2uHJKNZdK7gzEf2q-m55xfzSZOw8jLOyIi4AVvvzaEQO5nv2dFLEmf9LBkF8kaq3aErg
redirectUri: torusapp://com.torus.Web3AuthUnity/auth
network: 1
--- !u!1 &529774071
GameObject:
Expand Down Expand Up @@ -924,7 +924,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.09670371, y: 0.23700002}
m_AnchorMax: {x: 0.90000004, y: 0.7063542}
m_AnchoredPosition: {x: 2, y: 6.399994}
m_AnchoredPosition: {x: 2, y: 6.4000244}
m_SizeDelta: {x: 21.451538, y: 12.259766}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &529774073
Expand Down Expand Up @@ -1666,7 +1666,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SendPointerHoverToParent: 1
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
Expand Down
18 changes: 5 additions & 13 deletions Assets/Plugins/Web3AuthSDK/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@

public static class Utils
{
//https://qiita.com/lucifuges/items/b17d602417a9a249689f
#if UNITY_IOS
[DllImport("__Internal")]
extern static void launchUrl(string url);
[DllImport("__Internal")]
extern static void dismiss();
extern static void web3auth_launch(string url, string redirectUri, string objectName);
#endif


public static void LaunchUrl(string url)
public static void LaunchUrl(string url, string redirectUri = null, string objectName = null)
{
Debug.Log((new Uri(redirectUri)).Scheme);
#if UNITY_EDITOR || UNITY_STANDALONE_WIN
Application.OpenURL(url);
#elif UNITY_ANDROID
Expand All @@ -30,14 +28,8 @@ public static void LaunchUrl(string url)
}

#elif UNITY_IOS
launchUrl(url);;
#endif
}

public static void Dismiss()
{
#if UNITY_IOS && !UNITY_EDITOR
dismiss();
var uri = new Uri(redirectUri);
web3auth_launch(url, uri.Scheme, objectName);
#endif
}

Expand Down
6 changes: 2 additions & 4 deletions Assets/Plugins/Web3AuthSDK/Web3Auth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ private void IncomingHttpRequest(IAsyncResult result)

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

Utils.LaunchUrl(uriBuilder.ToString());
Utils.LaunchUrl(uriBuilder.ToString(), this.initParams["redirectUrl"].ToString(), gameObject.name);
}

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

#if UNITY_IOS
Utils.Dismiss();
#endif
}

public void login(LoginParams loginParams)
Expand Down
Binary file added Assets/Plugins/Web3AuthSDK/iOS/.DS_Store
Binary file not shown.
24 changes: 0 additions & 24 deletions Assets/Plugins/Web3AuthSDK/iOS/SafariView.mm

This file was deleted.

16 changes: 16 additions & 0 deletions Assets/Plugins/Web3AuthSDK/iOS/WebAuthenticate.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// WebAuthenticate.m
// Web3AuthUnitySwift
//
// Created by Mac on 03/08/2022.
//

#import <Foundation/Foundation.h>
#import <AuthenticationServices/ASWebAuthenticationSession.h>
#import <UnityFramework/UnityFramework-Swift.h>

extern "C" {
void web3auth_launch(const char *url, const char *redirectUri, const char *objectName) {
[WebAuthenticate launch:[NSString stringWithUTF8String:url] :[NSString stringWithUTF8String:redirectUri] :[NSString stringWithUTF8String:objectName]];
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions Assets/Plugins/Web3AuthSDK/iOS/WebAuthenticate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import AuthenticationServices
import SafariServices
import UIKit


@objc public class WebAuthenticate: NSObject {
public static let instance = WebAuthenticate();
public static var authSession: ASWebAuthenticationSession? = nil;

@objc public func call(_ url: String,_ redirectUri: String,_ objectName: String) {
WebAuthenticate.authSession = ASWebAuthenticationSession(
url: URL(string: url)!, callbackURLScheme: redirectUri) { callbackURL, authError in
guard authError == nil, let callbackURL = callbackURL else {
return
}

let unity = UnityFramework.getInstance();
unity?.sendMessageToGO(withName: objectName, functionName: "onDeepLinkActivated", message: callbackURL.absoluteString);
}

if #available(iOS 13.0, *) {
WebAuthenticate.authSession?.presentationContextProvider = self
WebAuthenticate.authSession?.prefersEphemeralWebBrowserSession = true
}

WebAuthenticate.authSession?.start();
}

@objc public static func launch(_ url: String,_ redirectUri: String,_ objectName: String) {
instance.call(url, redirectUri, objectName);
}
}


@available(iOS 12.0, *)
extension WebAuthenticate: ASWebAuthenticationPresentationContextProviding {
public func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor {
return UnityFramework.getInstance().appController().window;
}
}
85 changes: 85 additions & 0 deletions Assets/Plugins/Web3AuthSDK/iOS/WebAuthenticate.swift.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Assets/Resources/webauth
Original file line number Diff line number Diff line change
@@ -1 +1 @@
torusapp://org.torusresearch.web3authunity/auth
torusapp://com.torus.Web3AuthUnity/auth
2 changes: 1 addition & 1 deletion Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"url": "https://packages.unity.com"
},
"com.unity.services.core": {
"version": "1.4.0",
"version": "1.3.1",
"depth": 1,
"source": "registry",
"dependencies": {
Expand Down
8 changes: 4 additions & 4 deletions ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,12 @@ PlayerSettings:
applicationIdentifier:
Android: org.torusresearch.web3authunitysdk
Standalone: org.torusresearch.web3authunitysdk
iPhone: org.torusresearch.web3authunitysdk
iPhone: com.torusresearch.web3auth-unity-sdk
buildNumber:
Standalone: 0
iPhone: 0
tvOS: 0
overrideDefaultApplicationIdentifier: 1
overrideDefaultApplicationIdentifier: 0
AndroidBundleVersionCode: 1
AndroidMinSdkVersion: 24
AndroidTargetSdkVersion: 0
Expand Down Expand Up @@ -219,7 +219,8 @@ PlayerSettings:
iOSLaunchScreenCustomStoryboardPath:
iOSLaunchScreeniPadCustomStoryboardPath:
iOSDeviceRequirements: []
iOSURLSchemes: []
iOSURLSchemes:
- torusapp
macOSURLSchemes: []
iOSBackgroundModes: 0
iOSMetalForceHardShadows: 0
Expand Down Expand Up @@ -707,7 +708,6 @@ PlayerSettings:
ps4videoRecordingFeaturesUsed: 0
ps4contentSearchFeaturesUsed: 0
ps4CompatibilityPS5: 0
ps4AllowPS5Detection: 0
ps4GPU800MHz: 1
ps4attribEyeToEyeDistanceSettingVR: 0
ps4IncludedModules: []
Expand Down
4 changes: 2 additions & 2 deletions ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
m_EditorVersion: 2021.3.6f1
m_EditorVersionWithRevision: 2021.3.6f1 (7da38d85baf6)
m_EditorVersion: 2021.3.3f1
m_EditorVersionWithRevision: 2021.3.3f1 (af2e63e8f9bd)