From c8185061bfd6733d8abf2c2356303ce8bdc237fd Mon Sep 17 00:00:00 2001 From: Dom Murray Date: Thu, 9 Nov 2023 09:47:21 +1100 Subject: [PATCH] fix: formatting --- ...ImtblPassportGetAccessTokenAsyncAction.cpp | 10 ++-- .../Private/Immutable/ImmutablePassport.cpp | 52 +++++++++---------- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/Source/Immutable/Private/Immutable/Actions/ImtblPassportGetAccessTokenAsyncAction.cpp b/Source/Immutable/Private/Immutable/Actions/ImtblPassportGetAccessTokenAsyncAction.cpp index c0526a8..197cf33 100644 --- a/Source/Immutable/Private/Immutable/Actions/ImtblPassportGetAccessTokenAsyncAction.cpp +++ b/Source/Immutable/Private/Immutable/Actions/ImtblPassportGetAccessTokenAsyncAction.cpp @@ -7,7 +7,8 @@ #include "Immutable/Misc/ImtblLogging.h" UImtblPassportGetAccessTokenAsyncAction * -UImtblPassportGetAccessTokenAsyncAction::GetAccessToken(UObject *WorldContextObject) { +UImtblPassportGetAccessTokenAsyncAction::GetAccessToken( + UObject *WorldContextObject) { UImtblPassportGetAccessTokenAsyncAction *PassportInitBlueprintNode = NewObject(); PassportInitBlueprintNode->WorldContextObject = WorldContextObject; @@ -23,8 +24,8 @@ void UImtblPassportGetAccessTokenAsyncAction::Activate() { return; } - GetSubsystem()->WhenReady(this, - &UImtblPassportGetAccessTokenAsyncAction::DoGetAccessToken); + GetSubsystem()->WhenReady( + this, &UImtblPassportGetAccessTokenAsyncAction::DoGetAccessToken); } void UImtblPassportGetAccessTokenAsyncAction::DoGetAccessToken( @@ -34,7 +35,8 @@ void UImtblPassportGetAccessTokenAsyncAction::DoGetAccessToken( // Run GetAccessToken Passport->GetAccessToken( UImmutablePassport::FImtblPassportResponseDelegate::CreateUObject( - this, &UImtblPassportGetAccessTokenAsyncAction::OnGetAccessTokenResponse)); + this, + &UImtblPassportGetAccessTokenAsyncAction::OnGetAccessTokenResponse)); } void UImtblPassportGetAccessTokenAsyncAction::OnGetAccessTokenResponse( diff --git a/Source/Immutable/Private/Immutable/ImmutablePassport.cpp b/Source/Immutable/Private/Immutable/ImmutablePassport.cpp index 87ee7eb..dde7164 100644 --- a/Source/Immutable/Private/Immutable/ImmutablePassport.cpp +++ b/Source/Immutable/Private/Immutable/ImmutablePassport.cpp @@ -250,11 +250,11 @@ void UImmutablePassport::GetIdToken( } void UImmutablePassport::GetAccessToken( - const FImtblPassportResponseDelegate &ResponseDelegate) { - CallJS(ImmutablePassportAction::CheckStoredCredentials, TEXT(""), - ResponseDelegate, - FImtblJSResponseDelegate::CreateUObject( - this, &UImmutablePassport::OnGetAccessTokenResponse)); + const FImtblPassportResponseDelegate &ResponseDelegate) { + CallJS(ImmutablePassportAction::CheckStoredCredentials, TEXT(""), + ResponseDelegate, + FImtblJSResponseDelegate::CreateUObject( + this, &UImmutablePassport::OnGetAccessTokenResponse)); } void UImmutablePassport::GetAddress( @@ -592,26 +592,26 @@ void UImmutablePassport::OnGetIdTokenResponse(FImtblJSResponse Response) { } void UImmutablePassport::OnGetAccessTokenResponse(FImtblJSResponse Response) { - if (auto ResponseDelegate = GetResponseDelegate(Response)) { - // Extract the credentials - auto Credentials = - JsonObjectToUStruct(Response.JsonObject); - - if (!Response.success || !Credentials.IsSet() || - !Credentials->accessToken.Len()) { - IMTBL_LOG("No stored credentials found."); - FString Msg; - Response.Error.IsSet() - ? Msg = Response.Error->ToString() - : Msg = Response.JsonObject->GetStringField(TEXT("error")); - ResponseDelegate->ExecuteIfBound( - FImmutablePassportResult{false, Msg, Response}); - } else { - IMTBL_LOG("Stored access token found."); - ResponseDelegate->ExecuteIfBound( - FImmutablePassportResult{true, Credentials->accessToken}); - } - } + if (auto ResponseDelegate = GetResponseDelegate(Response)) { + // Extract the credentials + auto Credentials = + JsonObjectToUStruct(Response.JsonObject); + + if (!Response.success || !Credentials.IsSet() || + !Credentials->accessToken.Len()) { + IMTBL_LOG("No stored credentials found."); + FString Msg; + Response.Error.IsSet() + ? Msg = Response.Error->ToString() + : Msg = Response.JsonObject->GetStringField(TEXT("error")); + ResponseDelegate->ExecuteIfBound( + FImmutablePassportResult{false, Msg, Response}); + } else { + IMTBL_LOG("Stored access token found."); + ResponseDelegate->ExecuteIfBound( + FImmutablePassportResult{true, Credentials->accessToken}); + } + } } void UImmutablePassport::OnGetAddressResponse(FImtblJSResponse Response) { @@ -921,4 +921,4 @@ void UImmutablePassport::CallJniStaticVoidMethod(JNIEnv *Env, // { // OnPassportReady.Add(Delegate); // } -// } +// } \ No newline at end of file