Skip to content

[DX-2506] feat: new passport login without wallet #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jan 25, 2024
Binary file not shown.
Binary file modified Content/PackagedResources/index.uasset
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
// Fill out your copyright notice in the Description page of Project Settings.

#include "Immutable/Actions/ImtblConnectImxAsyncAction.h"

#include "Immutable/ImmutablePassport.h"
#include "Immutable/ImmutableSubsystem.h"
#include "Immutable/Misc/ImtblLogging.h"


UImtblConnectionAsyncActions* UImtblConnectionAsyncActions::Login(UObject* WorldContextObject, bool UseCachedSession)
{
UImtblConnectionAsyncActions* PassportInitBlueprintNode = NewObject<UImtblConnectionAsyncActions>();

PassportInitBlueprintNode->WorldContextObject = WorldContextObject;
PassportInitBlueprintNode->bUseCachedSession = UseCachedSession;
PassportInitBlueprintNode->bIsConnectImx = false;

return PassportInitBlueprintNode;
}

UImtblConnectionAsyncActions* UImtblConnectionAsyncActions::ConnectImx(UObject* WorldContextObject, bool UseCachedSession)
{
UImtblConnectionAsyncActions* PassportInitBlueprintNode = NewObject<UImtblConnectionAsyncActions>();

PassportInitBlueprintNode->WorldContextObject = WorldContextObject;
PassportInitBlueprintNode->bUseCachedSession = UseCachedSession;
PassportInitBlueprintNode->bIsConnectImx = true;

return PassportInitBlueprintNode;
}

UImtblConnectionAsyncActions* UImtblConnectionAsyncActions::LoginPKCE(UObject* WorldContextObject)
{
UImtblConnectionAsyncActions* PassportInitBlueprintNode = NewObject<UImtblConnectionAsyncActions>();

PassportInitBlueprintNode->WorldContextObject = WorldContextObject;
PassportInitBlueprintNode->bIsConnectImx = false;
PassportInitBlueprintNode->bIsPKCE = true;

return PassportInitBlueprintNode;
}

UImtblConnectionAsyncActions* UImtblConnectionAsyncActions::ConnectImxPKCE(UObject* WorldContextObject)
{
UImtblConnectionAsyncActions* PassportInitBlueprintNode = NewObject<UImtblConnectionAsyncActions>();

PassportInitBlueprintNode->WorldContextObject = WorldContextObject;
PassportInitBlueprintNode->bIsConnectImx = true;
PassportInitBlueprintNode->bIsPKCE = true;

return PassportInitBlueprintNode;
}

void UImtblConnectionAsyncActions::Activate()
{
if (!WorldContextObject || !WorldContextObject->GetWorld())
{
FString Error = "Connect failed due to missing world or world context object.";
IMTBL_WARN("%s", *Error)
Failed.Broadcast(Error);

return;
}

GetSubsystem()->WhenReady(this, &UImtblConnectionAsyncActions::DoConnect);
}

void UImtblConnectionAsyncActions::DoConnect(TWeakObjectPtr<UImtblJSConnector> JSConnector)
{
auto Passport = GetSubsystem()->GetPassport();

if (Passport.IsValid())
{
if (bIsPKCE)
{
#if PLATFORM_ANDROID | PLATFORM_IOS | PLATFORM_MAC
Passport->ConnectPKCE(bIsConnectImx, UImmutablePassport::FImtblPassportResponseDelegate::CreateUObject
(this, &UImtblConnectionAsyncActions::OnConnect));
#endif
}
else
{
Passport->Connect(bIsConnectImx, bUseCachedSession, UImmutablePassport::FImtblPassportResponseDelegate::CreateUObject
(this, &UImtblConnectionAsyncActions::OnConnect));
}
}
else
{
IMTBL_ERR("Passport was not valid while trying to connect")
}
}

void UImtblConnectionAsyncActions::OnConnect(FImmutablePassportResult Result)
{
if (Result.Success)
{
Success.Broadcast(TEXT(""));
}
else
{
Failed.Broadcast(Result.Message);
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "Immutable/ImmutablePassport.h"
#include "Immutable/ImmutableSubsystem.h"
#include "Immutable/ImmutableResponses.h"
#include "Immutable/Misc/ImtblLogging.h"

UImmutablePassportImxBatchNftTransferAsyncAction *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "Immutable/ImmutablePassport.h"
#include "Immutable/ImmutableSubsystem.h"
#include "Immutable/ImmutableResponses.h"
#include "Immutable/Misc/ImtblLogging.h"


Expand Down
Loading