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
7 changes: 3 additions & 4 deletions Config/DefaultEngine.ini
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ AdditionalPlistData=<key>CFBundleURLTypes</key><array> <dict> <key>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

16 changes: 13 additions & 3 deletions Plugins/Web3AuthSDK/Source/Web3AuthSDK/Private/Web3Auth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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));

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Plugins/Web3AuthSDK/Source/Web3AuthSDK/Public/Web3Auth.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ https://docs.unrealengine.com/en-US/SharingAndReleasing/Mobile/UnrealPluginLangu
<!-- Adding your own Permission -->
<addPermission android:name="com.android.permission.READ_EXTERNAL_STORAGE"/>
<addPermission android:name="com.android.permission.WRITE_EXTERNAL_STORAGE"/>
<addPermission android:name="android.permission.INTERNET" />


<!-- update the GameActivity activity -->
<!-- update the GameActivity activity -->
<loopElements tag="activity">
<setStringFromAttribute result="activityName" tag="$" name="android:name"/>
<setBoolIsEqual result="bGameActivity" arg1="$S(activityName)" arg2="com.epicgames.unreal.GameActivity"/>
Expand Down