diff --git a/Config/DefaultEngine.ini b/Config/DefaultEngine.ini index 3c51847..7b9d166 100644 --- a/Config/DefaultEngine.ini +++ b/Config/DefaultEngine.ini @@ -106,8 +106,7 @@ AdditionalPlistData=CFBundleURLTypes CFB bCookOnTheFlyForLaunchOn=False [/Web3AuthSDK/AuthInterface.AuthInterface_C] -Web3AuthOptionsClientId=BAwFgL-r7wzQKmtcdiz2uHJKNZdK7gzEf2q-m55xfzSZOw8jLOyIi4AVvvzaEQO5nv2dFLEmf9LBkF8kaq3aErg -Web3AuthOptionsRedirectUrl=torusapp://com.torus.Web3AuthUnity/auth -Web3AuthOptionsSdkUrl=https://sdk.openlogin.com +Web3AuthOptionsClientId="BJRZ6qdDTbj6Vd5YXvV994TYCqY42-PxldCetmvGTUdoq6pkCqdpuC1DIehz76zuYdaq1RJkXGHuDraHRhCQHvA" +Web3AuthOptionsRedirectUrl="torusapp://com.torus.web3authunity/auth" +Web3AuthOptionsSdkUrl="https://sdk.openlogin.com/" Web3AuthOptionsNetwork=MAINNET - diff --git a/Plugins/Web3AuthSDK/Source/Web3AuthSDK/Private/Web3Auth.cpp b/Plugins/Web3AuthSDK/Source/Web3AuthSDK/Private/Web3Auth.cpp index 7a4c3bf..979f5f4 100644 --- a/Plugins/Web3AuthSDK/Source/Web3AuthSDK/Private/Web3Auth.cpp +++ b/Plugins/Web3AuthSDK/Source/Web3AuthSDK/Private/Web3Auth.cpp @@ -9,14 +9,21 @@ #endif #if PLATFORM_ANDROID + +// Need to keep a pointer to self later. +// How this works is: +// 1) Just before opening BrowserView, assign thiz to the current instance. Code then moves from C++ to Java. +// 2) When returning from BrowserView, onDeepLink is called. Code returns to C++ from Java +// 3) In the implementation of onDeepLink, thiz is used to call the c++ method (setResultUrl) on this instance. +UWeb3Auth* thiz = nullptr; + JNI_METHOD void Java_com_epicgames_unreal_GameActivity_onDeepLink(JNIEnv* env, jclass clazz, jstring uri) { if (JNIEnv* Env = FAndroidApplication::GetJavaEnv(true)) { const char* UTFString = Env->GetStringUTFChars(uri, 0); FString result = FString(UTF8_TO_TCHAR(UTFString)); UE_LOG(LogTemp, Warning, TEXT("redirect %s"), *result); - - UWeb3Auth::setResultUrl(result); + thiz->setResultUrl(result); Env->ReleaseStringUTFChars(uri, UTFString); Env->DeleteLocalRef(uri); @@ -129,6 +136,8 @@ void UWeb3Auth::request(FString path, FLoginParams* loginParams = NULL, TShared FString url = web3AuthOptions.sdkUrl + "/" + path + "#" + base64; #if PLATFORM_ANDROID + thiz = this; + if (JNIEnv* Env = FAndroidApplication::GetJavaEnv(true)) { jstring jurl = Env->NewStringUTF(TCHAR_TO_UTF8(*url)); @@ -310,7 +319,8 @@ void UWeb3Auth::setLogoutEvent(FOnLogout _event) { #if PLATFORM_IOS void UWeb3Auth::callBackFromWebAuthenticateIOS(NSString* sResult) { FString result = FString(sResult); - UWeb3Auth::setResultUrl(result); + //TODO: Fix this + //UWeb3Auth::setResultUrl(result); } #endif diff --git a/Plugins/Web3AuthSDK/Source/Web3AuthSDK/Public/Web3Auth.h b/Plugins/Web3AuthSDK/Source/Web3AuthSDK/Public/Web3Auth.h index 510bdc3..3006ec0 100644 --- a/Plugins/Web3AuthSDK/Source/Web3AuthSDK/Public/Web3Auth.h +++ b/Plugins/Web3AuthSDK/Source/Web3AuthSDK/Public/Web3Auth.h @@ -590,7 +590,7 @@ class WEB3AUTHSDK_API UWeb3Auth : public UGameInstanceSubsystem UPROPERTY(VisibleAnywhere, BlueprintReadOnly) FWeb3AuthResponse web3AuthResponse; - UPROPERTY(BlueprintReadOnly) + UPROPERTY(VisibleAnywhere, BlueprintReadOnly) FString sessionId = FString(); UFUNCTION(BlueprintCallable) diff --git a/Plugins/Web3AuthSDK/Source/Web3AuthSDK/Web3AuthSDK_Android.xml b/Plugins/Web3AuthSDK/Source/Web3AuthSDK/Web3AuthSDK_Android.xml index 55d618a..2e12ae7 100644 --- a/Plugins/Web3AuthSDK/Source/Web3AuthSDK/Web3AuthSDK_Android.xml +++ b/Plugins/Web3AuthSDK/Source/Web3AuthSDK/Web3AuthSDK_Android.xml @@ -42,9 +42,9 @@ https://docs.unrealengine.com/en-US/SharingAndReleasing/Mobile/UnrealPluginLangu + - - +