Skip to content

Commit

Permalink
Merge pull request #164 from 0xsequence/Fix/QOL_Fixes_Post_Federation
Browse files Browse the repository at this point in the history
Fix/qol fixes post federation
  • Loading branch information
ZemindJan authored Sep 25, 2024
2 parents c00bf73 + 0e5cc5b commit c89e2db
Show file tree
Hide file tree
Showing 38 changed files with 196 additions and 149 deletions.
6 changes: 6 additions & 0 deletions Plugins/SequencePlugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1440,3 +1440,9 @@ During the Unreal Package process in the event a code signing error occurs you c
12) Click on Mac and Applevision Pro under supported destinations and hit the delete key
13) Now the project can be built (if the build fails at first, wait a few moments then try again. It can sometimes take a bit before the build registers the run script)
14) Once you have finished running the project, and want to make changes to the code, REMEMBER to delete this xcodeproj file in the sequence-unreal folder to ensure that a new xcodeproj is creating when you packaging the project again._

## TroubleShooting

In events where the editor crashes on launch, try deleting the following file, Saved/SaveGames/Cr.sav
This file contains the savegame data for credentials and if modified can result in an engine crash.
Deleting this file deletes local credentials, so you'll need to log back in.
4 changes: 2 additions & 2 deletions Plugins/SequencePlugin/SequencePlugin.uplugin
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"EngineVersion":"5.4",
"FileVersion": 3,
"Version": 2,
"VersionName": "1.1",
"Version": 3,
"VersionName": "1.3",
"FriendlyName": "SequencePlugin",
"Description": "",
"Category": "Sequence",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "SequenceEncryptor.h"
#include "Sequence/SequenceAPI.h"
#include "Tests/TestSequenceAPI.h"
#include "Authenticator.h"
#include "SequenceAuthenticator.h"

// Sets default values
AGeneralTesting::AGeneralTesting()
Expand Down Expand Up @@ -216,7 +216,7 @@ void AGeneralTesting::TestLoadTransakUrl() const

void AGeneralTesting::TestGuestLogin()
{
UAuthenticator * Auth = NewObject<UAuthenticator>();
USequenceAuthenticator * Auth = NewObject<USequenceAuthenticator>();
Auth->GuestLogin(false);
}

Expand Down Expand Up @@ -248,7 +248,7 @@ void AGeneralTesting::TestTokenBalances() const
UE_LOG(LogTemp, Display, TEXT("Error with getting balances"));
};

const UAuthenticator * Auth = NewObject<UAuthenticator>();
const USequenceAuthenticator * Auth = NewObject<USequenceAuthenticator>();
const TOptional<USequenceWallet*> WalletOptional = USequenceWallet::Get(Auth->GetStoredCredentials().GetCredentials());
if (WalletOptional.IsSet() && WalletOptional.GetValue())
{
Expand Down Expand Up @@ -276,7 +276,7 @@ void AGeneralTesting::TestHistory() const
UE_LOG(LogTemp, Display, TEXT("Error with getting history"));
};

const UAuthenticator * Auth = NewObject<UAuthenticator>();
const USequenceAuthenticator * Auth = NewObject<USequenceAuthenticator>();
const TOptional<USequenceWallet*> WalletOptional = USequenceWallet::Get(Auth->GetStoredCredentials().GetCredentials());
if (WalletOptional.IsSet() && WalletOptional.GetValue())
{
Expand All @@ -292,7 +292,7 @@ void AGeneralTesting::TestHistory() const

void AGeneralTesting::TestGetWalletAddress() const
{
const UAuthenticator * Auth = NewObject<UAuthenticator>();
const USequenceAuthenticator * Auth = NewObject<USequenceAuthenticator>();
const TOptional<USequenceWallet*> WalletOptional = USequenceWallet::Get(Auth->GetStoredCredentials().GetCredentials());
if (WalletOptional.IsSet() && WalletOptional.GetValue())
{
Expand All @@ -316,7 +316,7 @@ void AGeneralTesting::TestEncryption() const

void AGeneralTesting::TestMisc()
{//used for testing various things in the engine to verify behaviour
UAuthenticator * Authenticator = NewObject<UAuthenticator>();
USequenceAuthenticator * Authenticator = NewObject<USequenceAuthenticator>();
//Authenticator->PlayFabRegisterAndLogin(TEXT("TBPTest1"), TEXT("[email protected]"), TEXT("Ac-123Bd-456#!ef"));
Authenticator->PlayFabLogin(TEXT("TBPTest1"), TEXT("Ac-123Bd-456#!ef"), false);
//Authenticator->GuestLogin(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2024 Horizon Blockchain Games Inc. All rights reserved.

#include "Indexer/Indexer.h"
#include "ConfigFetcher.h"
#include "Util/Async.h"
#include "JsonObjectConverter.h"
#include "Http.h"
Expand Down Expand Up @@ -49,6 +50,7 @@ void UIndexer::HTTPPost(const int64& ChainID,const FString& Endpoint,const FStri
HTTP_Post_Req->SetVerb("POST");
HTTP_Post_Req->SetHeader("Content-Type", "application/json");//2 differing headers for the request
HTTP_Post_Req->SetHeader("Accept", "application/json");
HTTP_Post_Req->SetHeader("X-Access-Key",UConfigFetcher::GetConfigVar(UConfigFetcher::ProjectAccessKey));
HTTP_Post_Req->SetTimeout(30);
HTTP_Post_Req->SetURL(Url);
HTTP_Post_Req->SetContentAsString(Args);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
// Copyright 2024 Horizon Blockchain Games Inc. All rights reserved.
#include "NativeOAuth.h"
#include "Authenticator.h"
#include "SequenceAuthenticator.h"
#include "AppleBridge.h"
#include "Async/TaskGraphInterfaces.h"
#include "Async/Async.h"
#include "Android/Support/AndroidSupport.h"

namespace NativeOAuth
{
void RequestAuthWebView(const FString& requestUrl, const FString& redirectUrl, UAuthenticator * AuthCallback)
void RequestAuthWebView(const FString& requestUrl, const FString& redirectUrl, USequenceAuthenticator * AuthCallback)
{
Callback = AuthCallback;
#if PLATFORM_ANDROID
AndroidThunkCpp_RequestAuthInWebView(requestUrl,redirectUrl);
#endif
}

void SignInWithGoogle(const FString& clientId, UAuthenticator * AuthCallback)
void SignInWithGoogle(const FString& clientId, USequenceAuthenticator * AuthCallback)
{
Callback = AuthCallback;
#if PLATFORM_ANDROID
AndroidThunkCpp_SignInWithGoogle(clientId);
#endif // PLATFORM_ANDROID
}

void SignInWithGoogle_IOS(const FString& Url, const FString& Scheme, UAuthenticator * AuthCallback)
void SignInWithGoogle_IOS(const FString& Url, const FString& Scheme, USequenceAuthenticator * AuthCallback)
{
Callback = AuthCallback;
UAppleBridge::InitiateGoogleSSO(Url,Scheme,ProcessIosTokenizedUrlCallback);
Expand All @@ -33,7 +33,7 @@ namespace NativeOAuth
void ProcessIosTokenizedUrlCallback(char * tokenizedUrl)
{
const FString token = FString(UTF8_TO_TCHAR(tokenizedUrl));
UAuthenticator * CallbackLcl = Callback;
USequenceAuthenticator * CallbackLcl = Callback;
AsyncTask(ENamedThreads::GameThread, [CallbackLcl,token]() {
CallbackLcl->UpdateMobileLogin(token);
});
Expand All @@ -42,13 +42,13 @@ namespace NativeOAuth
void ProcessIosCallback(char * idToken)
{
const FString token = FString(UTF8_TO_TCHAR(idToken));
UAuthenticator * CallbackLcl = Callback;
USequenceAuthenticator * CallbackLcl = Callback;
AsyncTask(ENamedThreads::GameThread, [CallbackLcl,token]() {
CallbackLcl->UpdateMobileLogin_IdToken(token);
});
}

void SignInWithApple(const FString& clientID, UAuthenticator * AuthCallback)
void SignInWithApple(const FString& clientID, USequenceAuthenticator * AuthCallback)
{
Callback = AuthCallback;
UAppleBridge::InitiateIosSSO(clientID, ProcessIosCallback);
Expand Down Expand Up @@ -147,7 +147,7 @@ JNI_METHOD void Java_com_epicgames_unreal_GameActivity_nativeSequenceHandleRedir
{
const char* redirectUrlChars = jenv->GetStringUTFChars(jRedirectUrl, 0);
FString redirectUrl = FString(UTF8_TO_TCHAR(redirectUrlChars));
UAuthenticator * CallbackLcl = Callback;
USequenceAuthenticator * CallbackLcl = Callback;
AsyncTask(ENamedThreads::GameThread, [CallbackLcl,redirectUrl]() {
CallbackLcl->UpdateMobileLogin(redirectUrl);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2024 Horizon Blockchain Games Inc. All rights reserved.
#pragma once
#include "Authenticator.h"
#include "SequenceAuthenticator.h"

#if PLATFORM_ANDROID
#include "Android/AndroidJNI.h"
Expand All @@ -14,11 +14,11 @@ namespace NativeOAuth
void AndroidThunkCpp_RequestAuthInWebView(const FString& requestUrl, const FString& redirectUrl);
void AndroidLog(const FString& message);
#endif // PLATFORM_ANDROID
inline UAuthenticator * Callback = nullptr;
void SignInWithGoogle(const FString& clientId, UAuthenticator * AuthCallback);
void SignInWithGoogle_IOS(const FString& Url, const FString& RedirectUri, UAuthenticator * AuthCallback);
void RequestAuthWebView(const FString& requestUrl, const FString& redirectUrl, UAuthenticator * AuthCallback);
void SignInWithApple(const FString& clientID, UAuthenticator * AuthCallback);
inline USequenceAuthenticator * Callback = nullptr;
void SignInWithGoogle(const FString& clientId, USequenceAuthenticator * AuthCallback);
void SignInWithGoogle_IOS(const FString& Url, const FString& RedirectUri, USequenceAuthenticator * AuthCallback);
void RequestAuthWebView(const FString& requestUrl, const FString& redirectUrl, USequenceAuthenticator * AuthCallback);
void SignInWithApple(const FString& clientID, USequenceAuthenticator * AuthCallback);
void ProcessIosTokenizedUrlCallback(char * tokenizedUrl);
void ProcessIosCallback(char * idToken);
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ TOptional<USequenceWallet*> USequenceWallet::Get()
else
{
UE_LOG(LogTemp,Warning,TEXT("Wallet is NOT registered and valid checking on disk credentials"));
const UAuthenticator * Auth = NewObject<UAuthenticator>();
const USequenceAuthenticator * Auth = NewObject<USequenceAuthenticator>();
FStoredCredentials_BE StoredCredentials = Auth->GetStoredCredentials();

if (StoredCredentials.GetValid())
Expand Down Expand Up @@ -254,7 +254,7 @@ void USequenceWallet::ListSessions(const TSuccessCallback<TArray<FSeqListSession

void USequenceWallet::SignOut() const
{
const UAuthenticator * Auth = NewObject<UAuthenticator>();
const USequenceAuthenticator * Auth = NewObject<USequenceAuthenticator>();
if (this->Credentials.IsRegistered())
{
const TFunction<void()> OnSuccess = [Auth]
Expand Down Expand Up @@ -309,7 +309,7 @@ int64 USequenceWallet::GetNetworkId() const
void USequenceWallet::UpdateNetworkId(int64 NewNetwork)
{
this->Credentials.UpdateNetwork(NewNetwork);
const UAuthenticator * auth = NewObject<UAuthenticator>();
const USequenceAuthenticator * auth = NewObject<USequenceAuthenticator>();
auth->StoreCredentials(this->Credentials);
}

Expand Down
Loading

0 comments on commit c89e2db

Please sign in to comment.