diff --git a/README.md b/README.md index 83e8545..c4e21f3 100644 --- a/README.md +++ b/README.md @@ -27,19 +27,7 @@ The plugin's core logic is built from Rust, making it lightning-fast and minimiz ## Packaging -Windows, Linux, and Android all package natively and can be used in blueprint-only projects - -### Mac - -The plugin currently makes use of the [Web Browser][web-browser-doc] runtime module which bundles [CEF3][cef-forum]. -Changes to the engine are currently required for modern xcode targets as Unreal Engine does not properly link -the framework during packaging. This requires either an engine patch or moving the framework post-build and -then codesigning your build again. - -In the [CEF3.build.cs][cef3-build-cs] you need to bypass the `if` check for modern xcode. This can be accomplished by -adding `|| true` to the end of the if check on line 102. - -Additionally, you need to add `bCompileCEF3 = true;` to your build target +Windows, Linux, Mac and Android all package natively and can be used in blueprint-only projects ## Supported Platforms & Architectures diff --git a/Source/Thirdweb/Private/Browser/ThirdwebOAuthBrowserUserWidget.cpp b/Source/Thirdweb/Private/Browser/ThirdwebOAuthBrowserUserWidget.cpp index 622e470..edd929f 100644 --- a/Source/Thirdweb/Private/Browser/ThirdwebOAuthBrowserUserWidget.cpp +++ b/Source/Thirdweb/Private/Browser/ThirdwebOAuthBrowserUserWidget.cpp @@ -5,7 +5,6 @@ #include "ThirdwebLog.h" #include "ThirdwebRuntimeSettings.h" #include "Blueprint/WidgetTree.h" -#include "Browser/ThirdwebOAuthBrowserWidget.h" #include "Browser/ThirdwebOAuthExternalBrowser.h" #include "Components/Overlay.h" #include "Components/OverlaySlot.h" @@ -17,13 +16,14 @@ #endif const FString UThirdwebOAuthBrowserUserWidget::BackendUrlPrefix = TEXT("https://embedded-wallet.thirdweb.com/"); +const FString UThirdwebOAuthBrowserUserWidget::DummyUrl = TEXT("http://localhost:8789/callback"); TSharedRef UThirdwebOAuthBrowserUserWidget::RebuildWidget() { // RebuildWidget is not called until the widget is first added to the // viewport. - UPanelWidget* RootWidget = Cast(GetRootWidget()); + UPanelWidget *RootWidget = Cast(GetRootWidget()); // Construct root widget if needed if (!RootWidget) @@ -35,19 +35,6 @@ TSharedRef UThirdwebOAuthBrowserUserWidget::RebuildWidget() // Construct children if (RootWidget) { - // Construct browser widget - Browser = WidgetTree->ConstructWidget( - UThirdwebOAuthBrowserWidget::StaticClass(), TEXT("ThirdwebOauthBrowser")); - Browser->OnUrlChanged.AddUObject(this, &ThisClass::HandleUrlChanged); - Browser->OnPageLoaded.AddUObject(this, &ThisClass::HandlePageLoaded); - Browser->OnBeforePopup.AddUObject(this, &ThisClass::HandleOnBeforePopup); - UPanelSlot* PanelSlot = RootWidget->AddChild(Browser); - if (UOverlaySlot* RootWidgetSlot = Cast(PanelSlot)) - { - RootWidgetSlot->SetHorizontalAlignment(HAlign_Fill); - RootWidgetSlot->SetVerticalAlignment(VAlign_Fill); - } - // Construct External browser ExternalBrowser = NewObject(this); ExternalBrowser->OnAuthenticated.BindUObject(this, &ThisClass::HandleAuthenticated); @@ -77,14 +64,19 @@ void UThirdwebOAuthBrowserUserWidget::BeginDestroy() { ExternalBrowser->ConditionalBeginDestroy(); } - if (Browser) - { - Browser->ConditionalBeginDestroy(); - } Super::BeginDestroy(); } -void UThirdwebOAuthBrowserUserWidget::Authenticate(const FInAppWalletHandle& InAppWallet) +FString UThirdwebOAuthBrowserUserWidget::GetDummyUrl() +{ +#if PLATFORM_ANDROID + return UThirdwebRuntimeSettings::GetAppUri(); +#else + return DummyUrl; +#endif +} + +void UThirdwebOAuthBrowserUserWidget::Authenticate(const FInAppWalletHandle &InAppWallet) { // Validate Wallet if (!InAppWallet.IsValid()) @@ -100,62 +92,40 @@ void UThirdwebOAuthBrowserUserWidget::Authenticate(const FInAppWalletHandle& InA ExternalBrowser->Authenticate(TEXT("SIWE")); return; } - + // Get Login URL FString Link; - if (FString Error; !Wallet.FetchOAuthLoginURL(UThirdwebOAuthBrowserWidget::GetDummyUrl(), Link, Error)) + if (FString Error; !Wallet.FetchOAuthLoginURL(GetDummyUrl(), Link, Error)) { return HandleError(Error); } TW_LOG(VeryVerbose, TEXT("OAuthBrowserUserWidget::Authenticate::Authenticating against %s"), *Link); - // Check Browser Type - if (UThirdwebRuntimeSettings::IsExternalOAuthBackend(Wallet.GetOAuthProvider())) - { #if PLATFORM_ANDROID - if (JNIEnv* Env = FAndroidApplication::GetJavaEnv()) - { - jstring JUrl = Env->NewStringUTF(TCHAR_TO_UTF8(*Link)); - jclass JClass = FAndroidApplication::FindJavaClass("com/thirdweb/unrealengine/ThirdwebActivity"); - static jmethodID JLaunchUrl = FJavaWrapper::FindStaticMethod(Env, JClass, "startActivity", "(Landroid/app/Activity;Ljava/lang/String;)V", false); - ThirdwebUtils::Internal::Android::CallJniStaticVoidMethod(Env, JClass, JLaunchUrl, FJavaWrapper::GameActivityThis, JUrl); - TW_LOG(Verbose, TEXT("OAuthBrowserUserWidget::Authenticate::Opening CustomTabs")); - return; - } - TW_LOG(Error, TEXT("OAuthBrowserUserWidget::Authenticate::No JNIEnv found")); + if (JNIEnv *Env = FAndroidApplication::GetJavaEnv()) + { + jstring JUrl = Env->NewStringUTF(TCHAR_TO_UTF8(*Link)); + jclass JClass = FAndroidApplication::FindJavaClass("com/thirdweb/unrealengine/ThirdwebActivity"); + static jmethodID JLaunchUrl = FJavaWrapper::FindStaticMethod(Env, JClass, "startActivity", "(Landroid/app/Activity;Ljava/lang/String;)V", false); + ThirdwebUtils::Internal::Android::CallJniStaticVoidMethod(Env, JClass, JLaunchUrl, FJavaWrapper::GameActivityThis, JUrl); + TW_LOG(Verbose, TEXT("OAuthBrowserUserWidget::Authenticate::Opening CustomTabs")); return; -#endif - - return ExternalBrowser->Authenticate(Link); } - return Browser->Authenticate(Link); -} - - -bool UThirdwebOAuthBrowserUserWidget::IsBlank() const -{ - const FString Url = Browser->GetUrl(); - - return Url.IsEmpty() || Url.StartsWith(BackendUrlPrefix); -} + TW_LOG(Error, TEXT("OAuthBrowserUserWidget::Authenticate::No JNIEnv found")); + return; +#endif -FString UThirdwebOAuthBrowserUserWidget::GetUrl() const -{ - if (Browser) - { - return Browser->GetUrl(); - } - return TEXT(""); + return ExternalBrowser->Authenticate(Link); } -void UThirdwebOAuthBrowserUserWidget::HandleUrlChanged(const FString& Url) +void UThirdwebOAuthBrowserUserWidget::HandleUrlChanged(const FString &Url) { TW_LOG(Verbose, TEXT("OAuthBrowserUserWidget::HandleUrlChanged::%s"), *Url); if (Url.IsEmpty() || (Url.StartsWith(BackendUrlPrefix) && !Url.StartsWith(BackendUrlPrefix + TEXT("sdk/oauth")))) { return SetVisible(false); } - if (Url.StartsWith(UThirdwebOAuthBrowserWidget::GetDummyUrl())) + if (Url.StartsWith(GetDummyUrl())) { SetVisible(false); FString Left, Right; @@ -168,7 +138,7 @@ void UThirdwebOAuthBrowserUserWidget::HandleUrlChanged(const FString& Url) bShouldBeVisible = true; } -void UThirdwebOAuthBrowserUserWidget::HandlePageLoaded(const FString& Url) +void UThirdwebOAuthBrowserUserWidget::HandlePageLoaded(const FString &Url) { if (bShouldBeVisible) { @@ -176,45 +146,34 @@ void UThirdwebOAuthBrowserUserWidget::HandlePageLoaded(const FString& Url) } } -void UThirdwebOAuthBrowserUserWidget::HandleOnBeforePopup(const FString& Url, const FString& Frame) +void UThirdwebOAuthBrowserUserWidget::HandleOnBeforePopup(const FString &Url, const FString &Frame) { - if (UPanelWidget* RootWidget = Cast(GetRootWidget())) - { - // Construct browser widget - UThirdwebOAuthBrowserWidget* Popup = WidgetTree->ConstructWidget( - UThirdwebOAuthBrowserWidget::StaticClass(), TEXT("ThirdwebOAuthBrowserPopUp")); - Popup->OnUrlChanged.AddUObject(this, &ThisClass::HandleUrlChanged); - Popup->OnPageLoaded.AddUObject(this, &ThisClass::HandlePageLoaded); - Popup->OnBeforePopup.AddUObject(this, &ThisClass::HandleOnBeforePopup); - RootWidget->AddChild(Popup); - Popup->LoadUrl(Url); - } return OnPopup.Broadcast(Url, Frame); } -void UThirdwebOAuthBrowserUserWidget::HandleAuthenticated(const FString& AuthResult) +void UThirdwebOAuthBrowserUserWidget::HandleAuthenticated(const FString &AuthResult) { OnAuthenticated.Broadcast(AuthResult); } -void UThirdwebOAuthBrowserUserWidget::HandleSiweComplete(const FString& Signature, const FString& Payload) +void UThirdwebOAuthBrowserUserWidget::HandleSiweComplete(const FString &Signature, const FString &Payload) { OnSiweComplete.Broadcast(Signature, Payload); } -void UThirdwebOAuthBrowserUserWidget::HandleError(const FString& Error) +void UThirdwebOAuthBrowserUserWidget::HandleError(const FString &Error) { OnError.Broadcast(Error); } #if PLATFORM_ANDROID -void UThirdwebOAuthBrowserUserWidget::HandleDeepLink(const FString& Url) +void UThirdwebOAuthBrowserUserWidget::HandleDeepLink(const FString &Url) { TW_LOG(VeryVerbose, TEXT("UThirdwebOAuthBrowserUserWidget::HandleDeepLink::%s"), *Url); HandleUrlChanged(Url); } -void UThirdwebOAuthBrowserUserWidget::HandleCustomTabsDismissed(const FString& Url) +void UThirdwebOAuthBrowserUserWidget::HandleCustomTabsDismissed(const FString &Url) { TW_LOG(VeryVerbose, TEXT("UThirdwebOAuthBrowserUserWidget::HandleCustomTabsDismissed::%s"), *Url); HandleUrlChanged(Url); diff --git a/Source/Thirdweb/Private/Browser/ThirdwebOAuthBrowserWidget.cpp b/Source/Thirdweb/Private/Browser/ThirdwebOAuthBrowserWidget.cpp deleted file mode 100644 index 2111cc8..0000000 --- a/Source/Thirdweb/Private/Browser/ThirdwebOAuthBrowserWidget.cpp +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) 2024 Thirdweb. All Rights Reserved. - -#include "Browser/ThirdwebOAuthBrowserWidget.h" - -#include "ThirdwebLog.h" -#include "ThirdwebRuntimeSettings.h" -#include "Async/Async.h" -#include "Async/TaskGraphInterfaces.h" -#include "GenericPlatform/GenericPlatformHttp.h" -#include "Widgets/Layout/SBox.h" -#include "Widgets/Text/STextBlock.h" -#if WITH_CEF -#include "SWebBrowser.h" -#endif - -#define ENSURE_VALID_BROWSER(FunctionName) \ - if (!Browser.IsValid()) \ - { \ - TW_LOG(Error, TEXT("OAuthBrowserWidget::%s::Web browser invalid"), TEXT(FunctionName)); \ - return; \ - } - -const FString UThirdwebOAuthBrowserWidget::DummyUrl = TEXT("http://localhost:8789/callback"); - -bool UThirdwebOAuthBrowserWidget::IsPageLoaded() const -{ -#if WITH_CEF - return Browser.IsValid() && Browser->IsLoaded(); -#else - return false; -#endif -} - -FString UThirdwebOAuthBrowserWidget::GetUrl() const -{ -#if WITH_CEF - if (Browser.IsValid()) - { - if (FString Url = Browser->GetUrl(); !Url.IsEmpty()) - { - return Url; - } - } -#endif - return TEXT(""); -} - -FString UThirdwebOAuthBrowserWidget::GetDummyUrl() -{ -#if PLATFORM_ANDROID - return UThirdwebRuntimeSettings::GetAppUri(); -#else - return DummyUrl; -#endif -} - -void UThirdwebOAuthBrowserWidget::ReleaseSlateResources(const bool bReleaseChildren) -{ - Super::ReleaseSlateResources(bReleaseChildren); -#if WITH_CEF - Browser.Reset(); -#endif -} - -#if WITH_EDITOR -const FText UThirdwebOAuthBrowserWidget::GetPaletteCategory() -{ - return NSLOCTEXT("Thirdweb", "Thirdweb", "Thirdweb"); -} -#endif - -// ReSharper disable once CppUE4BlueprintCallableFunctionMayBeConst -void UThirdwebOAuthBrowserWidget::Authenticate(const FString& OAuthLoginUrl) -{ -#if WITH_CEF - ENSURE_VALID_BROWSER("Authenticate") - TW_LOG(VeryVerbose, TEXT("OAuthBrowserWidget::Authenticate::Loading %s"), *OAuthLoginUrl); - Browser->LoadURL(OAuthLoginUrl); -#endif -} - -void UThirdwebOAuthBrowserWidget::HandleUrlChanged(const FText& InUrl) -{ -#if WITH_CEF - ENSURE_VALID_BROWSER("HandleUrlChanged") - if (IsInGameThread()) - { - FString Url = InUrl.ToString(); - if (Url.IsEmpty()) - { - Url = Browser->GetUrl(); - } - TW_LOG(VeryVerbose, TEXT("ThirdwebOAuthBrowserWidget::HandleUrlChanged:%s"), *Url); - OnUrlChanged.Broadcast(FGenericPlatformHttp::UrlDecode(Url)); - } - else - { - // Retry on the GameThread. - TWeakObjectPtr WeakThis = this; - FFunctionGraphTask::CreateAndDispatchWhenReady([WeakThis, InUrl]() - { - if (WeakThis.IsValid()) - { - WeakThis->HandleUrlChanged(InUrl); - } - }, TStatId(), nullptr, ENamedThreads::GameThread); - } - -#endif -} - -void UThirdwebOAuthBrowserWidget::HandleOnLoadComplete() -{ -#if WITH_CEF - ENSURE_VALID_BROWSER("HandleOnLoadComplete") - if (IsInGameThread()) - { - TW_LOG(VeryVerbose, TEXT("ThirdwebOAuthBrowserWidget::HandleOnLoadComplete:%s"), *Browser->GetUrl()); - OnPageLoaded.Broadcast(Browser->GetUrl()); - return; - } - - TWeakObjectPtr WeakThis = this; - FFunctionGraphTask::CreateAndDispatchWhenReady([WeakThis]() - { - if (WeakThis.IsValid()) - { - WeakThis->HandleOnLoadComplete(); - } - }, TStatId(), nullptr, ENamedThreads::GameThread); -#endif -} - -bool UThirdwebOAuthBrowserWidget::HandleOnBeforePopup(FString Url, FString Frame) -{ - TW_LOG(VeryVerbose, TEXT("ThirdwebOAuthBrowserWidget::HandleOnBeforePopup::%s | %s"), *Url, *Frame) - if (OnBeforePopup.IsBound()) - { - if (IsInGameThread()) - { - OnBeforePopup.Broadcast(Url, Frame); - return true; - } - - TWeakObjectPtr WeakThis = this; - FFunctionGraphTask::CreateAndDispatchWhenReady([WeakThis, Url, Frame]() - { - if (WeakThis.IsValid()) - { - WeakThis->HandleOnBeforePopup(Url, Frame); - } - }, TStatId(), nullptr, ENamedThreads::GameThread); - return true; - } - return false; -} - -bool UThirdwebOAuthBrowserWidget::HandleOnCreateWindow(const TWeakPtr& Window, const TWeakPtr& Features) -{ - TW_LOG(Error, TEXT("ThirdwebOAuthBrowserWidget::HandleOnCreateWindow::Unsupported")) - return false; -} - -void UThirdwebOAuthBrowserWidget::HandleOnLoadError() -{ - TW_LOG(Error, TEXT("ThirdwebOAuthBrowserWidget::HandleOnLoadError::Error loading")) -} - -bool UThirdwebOAuthBrowserWidget::HandleOnCloseWindow(const TWeakPtr& Window) -{ - TW_LOG(VeryVerbose, TEXT("ThirdwebOAuthBrowserWidget::HandleOnCloseWindow::Called")) - RemoveFromParent(); - return true; -} - -void UThirdwebOAuthBrowserWidget::LoadUrl(const FString& Url) -{ -#if WITH_CEF - ENSURE_VALID_BROWSER("LoadUrl") - Browser->LoadURL(Url); -#endif -} - -TSharedRef UThirdwebOAuthBrowserWidget::RebuildWidget() -{ -#if WITH_CEF - if (!IsDesignTime()) - { - Browser = SNew(SWebBrowser) - .InitialURL(InitialUrl) - .ShowControls(false) - .ShowAddressBar(false) - .SupportsTransparency(bSupportsTransparency) - .ShowInitialThrobber(bShowInitialThrobber) - .OnCreateWindow(BIND_UOBJECT_DELEGATE(FOnCreateWindowDelegate, HandleOnCreateWindow)) - .OnLoadError(BIND_UOBJECT_DELEGATE(FSimpleDelegate, HandleOnLoadError)) - .OnUrlChanged(BIND_UOBJECT_DELEGATE(FOnTextChanged, HandleUrlChanged)) - .OnLoadCompleted(BIND_UOBJECT_DELEGATE(FSimpleDelegate, HandleOnLoadComplete)) - .OnCloseWindow(BIND_UOBJECT_DELEGATE(FOnCloseWindowDelegate, HandleOnCloseWindow)) - .OnBeforePopup(BIND_UOBJECT_DELEGATE(FOnBeforePopupDelegate, HandleOnBeforePopup)); - - return Browser.ToSharedRef(); - } -#endif - return SNew(SBox).HAlign(HAlign_Fill).VAlign(VAlign_Fill) - [ - SNew(STextBlock).Text(NSLOCTEXT("Thirdweb", "Thirdweb OAuth Browser", "Thirdweb OAuth Browser")) - ]; -} - -void UThirdwebOAuthBrowserWidget::OnWidgetRebuilt() -{ - Super::OnWidgetRebuilt(); -} diff --git a/Source/Thirdweb/Private/ThirdwebRuntimeSettings.cpp b/Source/Thirdweb/Private/ThirdwebRuntimeSettings.cpp index 7c4da2f..b67df34 100644 --- a/Source/Thirdweb/Private/ThirdwebRuntimeSettings.cpp +++ b/Source/Thirdweb/Private/ThirdwebRuntimeSettings.cpp @@ -10,16 +10,6 @@ #include "HAL/FileManager.h" #include "Misc/Paths.h" -// These Providers do not work with an embedded browser for various reasons: -// - Google: https://accounts.youtube.com/accounts/SetSID does not load -// - Facebook: https://www.facebook.com/privacy/consent/gdp does not load -// - Telegram: Forced transient pop-up window -const TArray UThirdwebRuntimeSettings::ExternalOnlyProviders = { - EThirdwebOAuthProvider::Google, - EThirdwebOAuthProvider::Facebook, - EThirdwebOAuthProvider::Telegram, -}; - const FString UThirdwebRuntimeSettings::DefaultExternalAuthRedirectUri = TEXT("https://static.thirdweb.com/auth/complete"); UThirdwebRuntimeSettings::UThirdwebRuntimeSettings() @@ -27,13 +17,11 @@ UThirdwebRuntimeSettings::UThirdwebRuntimeSettings() bSendAnalytics = true; bOverrideExternalAuthRedirectUri = false; CustomExternalAuthRedirectUri = DefaultExternalAuthRedirectUri; - bOverrideOAuthBrowserProviderBackends = false; bOverrideAppUri = false; - for (const EThirdwebOAuthProvider Provider : ExternalOnlyProviders) OAuthBrowserProviderBackendOverrides[static_cast(Provider)] = EThirdwebOAuthBrowserBackend::External; } #if WITH_EDITOR -void UThirdwebRuntimeSettings::PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent) +void UThirdwebRuntimeSettings::PostEditChangeProperty(struct FPropertyChangedEvent &PropertyChangedEvent) { Super::PostEditChangeProperty(PropertyChangedEvent); @@ -45,24 +33,12 @@ void UThirdwebRuntimeSettings::PostEditChangeProperty(struct FPropertyChangedEve GET_MEMBER_NAME_CHECKED(UThirdwebRuntimeSettings, PartnerId), GET_MEMBER_NAME_CHECKED(UThirdwebRuntimeSettings, EngineBaseUrl), GET_MEMBER_NAME_CHECKED(UThirdwebRuntimeSettings, EngineAccessToken), - GET_MEMBER_NAME_CHECKED(UThirdwebRuntimeSettings, CustomAppUri) - }; + GET_MEMBER_NAME_CHECKED(UThirdwebRuntimeSettings, CustomAppUri)}; bool bChanged = false; // ReSharper disable once CppTooWideScopeInitStatement const FName CurrentPropertyName = PropertyChangedEvent.GetMemberPropertyName(); UE_LOG(LogTemp, Warning, TEXT("PropertyChangedEvent=%s"), *CurrentPropertyName.ToString()) - if (CurrentPropertyName == GET_MEMBER_NAME_CHECKED(UThirdwebRuntimeSettings, OAuthBrowserProviderBackendOverrides)) - { - for (const EThirdwebOAuthProvider Provider : ExternalOnlyProviders) - { - if (OAuthBrowserProviderBackendOverrides[static_cast(Provider)] != EThirdwebOAuthBrowserBackend::External) - { - OAuthBrowserProviderBackendOverrides[static_cast(Provider)] = EThirdwebOAuthBrowserBackend::External; - bChanged = true; - } - } - } if (Trimmable.Contains(CurrentPropertyName)) { FString Value; @@ -109,7 +85,7 @@ void UThirdwebRuntimeSettings::PostEditChangeProperty(struct FPropertyChangedEve } } -bool UThirdwebRuntimeSettings::CanEditChange(const FProperty* InProperty) const +bool UThirdwebRuntimeSettings::CanEditChange(const FProperty *InProperty) const { if (!Super::CanEditChange(InProperty)) { @@ -139,7 +115,7 @@ void UThirdwebRuntimeSettings::GenerateEncryptionKey() TArray UThirdwebRuntimeSettings::GetEngineSigners() { - if (const UThirdwebRuntimeSettings* Settings = Get()) + if (const UThirdwebRuntimeSettings *Settings = Get()) { return Settings->EngineSigners; } @@ -148,7 +124,7 @@ TArray UThirdwebRuntimeSettings::GetEngineSigners() FString UThirdwebRuntimeSettings::GetEngineSigner() { - if (const UThirdwebRuntimeSettings* Settings = Get()) + if (const UThirdwebRuntimeSettings *Settings = Get()) { if (Settings->EngineSigners.Num() > 0) { @@ -160,7 +136,7 @@ FString UThirdwebRuntimeSettings::GetEngineSigner() FString UThirdwebRuntimeSettings::GetExternalAuthRedirectUri() { - if (const UThirdwebRuntimeSettings* Settings = Get()) + if (const UThirdwebRuntimeSettings *Settings = Get()) { if (Settings->bOverrideExternalAuthRedirectUri && !Settings->CustomExternalAuthRedirectUri.IsEmpty()) { @@ -172,7 +148,7 @@ FString UThirdwebRuntimeSettings::GetExternalAuthRedirectUri() FString UThirdwebRuntimeSettings::GetEncryptionKey() { - if (const UThirdwebRuntimeSettings* Settings = Get()) + if (const UThirdwebRuntimeSettings *Settings = Get()) { return Settings->EncryptionKey; } @@ -186,28 +162,9 @@ FString UThirdwebRuntimeSettings::GetStorageDirectory() return StorageDir; } -bool UThirdwebRuntimeSettings::IsExternalOAuthBackend(const EThirdwebOAuthProvider Provider) -{ - if (ExternalOnlyProviders.Contains(Provider)) return true; -#if PLATFORM_APPLE - // Apple natively handles apple auth links, so we want to enforce that flow - if (Provider == EThirdwebOAuthProvider::Apple) return true; -#endif - - if (const UThirdwebRuntimeSettings* Settings = Get()) - { - if (Settings->bOverrideOAuthBrowserProviderBackends) - { - return static_cast(Settings->OAuthBrowserProviderBackendOverrides[static_cast(Provider)]) == 1; - } - return static_cast(StaticClass()->GetDefaultObject()->OAuthBrowserProviderBackendOverrides[static_cast(Provider)]) == 1; - } - return false; -} - FString UThirdwebRuntimeSettings::GetEcosystemId() { - if (const UThirdwebRuntimeSettings* Settings = Get()) + if (const UThirdwebRuntimeSettings *Settings = Get()) { return Settings->EcosystemId.TrimStartAndEnd(); } @@ -231,7 +188,7 @@ bool UThirdwebRuntimeSettings::IsEcosystem() FString UThirdwebRuntimeSettings::GetClientId() { - if (const UThirdwebRuntimeSettings* Settings = Get()) + if (const UThirdwebRuntimeSettings *Settings = Get()) { return Settings->ClientId.TrimStartAndEnd(); } @@ -240,7 +197,7 @@ FString UThirdwebRuntimeSettings::GetClientId() FString UThirdwebRuntimeSettings::GetBundleId() { - if (const UThirdwebRuntimeSettings* Settings = Get()) + if (const UThirdwebRuntimeSettings *Settings = Get()) { return Settings->BundleId.TrimStartAndEnd(); } @@ -249,7 +206,7 @@ FString UThirdwebRuntimeSettings::GetBundleId() bool UThirdwebRuntimeSettings::AnalyticsEnabled() { - if (const UThirdwebRuntimeSettings* Settings = Get()) + if (const UThirdwebRuntimeSettings *Settings = Get()) { return Settings->bSendAnalytics; } @@ -258,7 +215,7 @@ bool UThirdwebRuntimeSettings::AnalyticsEnabled() FString UThirdwebRuntimeSettings::GetEngineBaseUrl() { - if (const UThirdwebRuntimeSettings* Settings = Get()) + if (const UThirdwebRuntimeSettings *Settings = Get()) { FString Url = Settings->EngineBaseUrl.TrimStartAndEnd(); return Url.EndsWith("/") ? Url.LeftChop(1) : Url; @@ -268,7 +225,7 @@ FString UThirdwebRuntimeSettings::GetEngineBaseUrl() FString UThirdwebRuntimeSettings::GetEngineAccessToken() { - if (const UThirdwebRuntimeSettings* Settings = Get()) + if (const UThirdwebRuntimeSettings *Settings = Get()) { return Settings->EngineAccessToken.TrimStartAndEnd(); } @@ -277,7 +234,7 @@ FString UThirdwebRuntimeSettings::GetEngineAccessToken() FString UThirdwebRuntimeSettings::GetAppUri() { - if (const UThirdwebRuntimeSettings* Settings = Get()) + if (const UThirdwebRuntimeSettings *Settings = Get()) { if (Settings->bOverrideAppUri) { @@ -291,8 +248,8 @@ FString UThirdwebRuntimeSettings::GetAppUri() void UThirdwebRuntimeSettings::FetchEngineSigners() { #if WITH_EDITOR - ThirdwebEngine::BackendWallet::FGetAllDelegate SuccessDelegate = ThirdwebEngine::BackendWallet::FGetAllDelegate::CreateWeakLambda(this, [this](const TArray& BackendWallets) - { + ThirdwebEngine::BackendWallet::FGetAllDelegate SuccessDelegate = ThirdwebEngine::BackendWallet::FGetAllDelegate::CreateWeakLambda(this, [this](const TArray &BackendWallets) + { TArray Addresses; for (const FThirdwebBackendWallet& BackendWallet : BackendWallets) { @@ -303,12 +260,9 @@ void UThirdwebRuntimeSettings::FetchEngineSigners() if (MarkPackageDirty()) { PostEditChange(); - } - }); - FStringDelegate ErrorDelegate = FStringDelegate::CreateWeakLambda(this, [](const FString& ErrorMessage) - { - TW_LOG(Error, TEXT("UThirdwebRuntimeSettings::FetchEngineSigners::Failed to fetch engine signers::Error=%s"), *ErrorMessage); - }); + } }); + FStringDelegate ErrorDelegate = FStringDelegate::CreateWeakLambda(this, [](const FString &ErrorMessage) + { TW_LOG(Error, TEXT("UThirdwebRuntimeSettings::FetchEngineSigners::Failed to fetch engine signers::Error=%s"), *ErrorMessage); }); ThirdwebEngine::BackendWallet::GetAll(this, 1, 10, SuccessDelegate, ErrorDelegate); #endif } diff --git a/Source/Thirdweb/Public/Browser/ThirdwebOAuthBrowserUserWidget.h b/Source/Thirdweb/Public/Browser/ThirdwebOAuthBrowserUserWidget.h index d801de3..d32cc32 100644 --- a/Source/Thirdweb/Public/Browser/ThirdwebOAuthBrowserUserWidget.h +++ b/Source/Thirdweb/Public/Browser/ThirdwebOAuthBrowserUserWidget.h @@ -6,90 +6,81 @@ #include "Wallets/ThirdwebInAppWalletHandle.h" #include "ThirdwebOAuthBrowserUserWidget.generated.h" -UCLASS(DisplayName="OAuth Browser") +UCLASS(DisplayName = "OAuth Browser") class THIRDWEB_API UThirdwebOAuthBrowserUserWidget : public UUserWidget { GENERATED_BODY() public: - DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnAuthenticatedDelegate, const FString&, AuthResult); - UPROPERTY(BlueprintAssignable, Category="Thirdweb|OAuth Browser") + DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnAuthenticatedDelegate, const FString &, AuthResult); + UPROPERTY(BlueprintAssignable, Category = "Thirdweb|OAuth Browser") FOnAuthenticatedDelegate OnAuthenticated; - DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSiweCompleteDelegate, const FString&, Signature, const FString&, Payload); - UPROPERTY(BlueprintAssignable, Category="Thirdweb|OAuth Browser") + DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSiweCompleteDelegate, const FString &, Signature, const FString &, Payload); + UPROPERTY(BlueprintAssignable, Category = "Thirdweb|OAuth Browser") FOnSiweCompleteDelegate OnSiweComplete; - - DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnErrorDelegate, const FString&, Error); - UPROPERTY(BlueprintAssignable, Category="Thirdweb|OAuth Browser") + + DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnErrorDelegate, const FString &, Error); + UPROPERTY(BlueprintAssignable, Category = "Thirdweb|OAuth Browser") FOnErrorDelegate OnError; - DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FUrlDelegate, const FString&, URL); - UPROPERTY(BlueprintAssignable, DisplayName="On URL Changed", Category="Thirdweb|OAuth Browser") + DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FUrlDelegate, const FString &, URL); + UPROPERTY(BlueprintAssignable, DisplayName = "On URL Changed", Category = "Thirdweb|OAuth Browser") FUrlDelegate OnUrlChanged; - UPROPERTY(BlueprintAssignable, Category="Thirdweb|OAuth Browser") + UPROPERTY(BlueprintAssignable, Category = "Thirdweb|OAuth Browser") FUrlDelegate OnPageLoaded; - - DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FPopupDelegate, const FString&, URL, const FString&, Frame); - UPROPERTY(BlueprintAssignable, Category="Thirdweb|OAuth Browser") + + DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FPopupDelegate, const FString &, URL, const FString &, Frame); + UPROPERTY(BlueprintAssignable, Category = "Thirdweb|OAuth Browser") FPopupDelegate OnPopup; - + protected: /** Automatically collapse the widget when the page is blank */ - UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="Browser") + UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Browser") bool bCollapseWhenBlank = true; /** Automatically authenticate on Construct. Only works when created with a Wallet */ - UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="Browser") + UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Browser") bool bAuthenticateOnConstruct = false; - - UPROPERTY(BlueprintReadOnly, Transient, Category="Internal", meta=(ExposeOnSpawn=true)) + + UPROPERTY(BlueprintReadOnly, Transient, Category = "Internal", meta = (ExposeOnSpawn = true)) FInAppWalletHandle Wallet; - + private: UPROPERTY(Transient) - class UThirdwebOAuthBrowserWidget* Browser = nullptr; + class UThirdwebOAuthExternalBrowser *ExternalBrowser = nullptr; - UPROPERTY(Transient) - class UThirdwebOAuthExternalBrowser* ExternalBrowser = nullptr; - static const FString BackendUrlPrefix; + static const FString DummyUrl; bool bShouldBeVisible = false; - + public: virtual TSharedRef RebuildWidget() override; virtual void OnWidgetRebuilt() override; virtual void BeginDestroy() override; - + #if WITH_EDITOR virtual const FText GetPaletteCategory() override; #endif protected: void SetVisible(const bool bVisible); - virtual void HandleUrlChanged(const FString& Url); - virtual void HandlePageLoaded(const FString& Url); - virtual void HandleOnBeforePopup(const FString& Url, const FString& Frame); - - virtual void HandleAuthenticated(const FString& AuthResult); - virtual void HandleSiweComplete(const FString& Signature, const FString& Payload); - virtual void HandleError(const FString& Error); - + virtual FString GetDummyUrl(); + virtual void HandleUrlChanged(const FString &Url); + virtual void HandlePageLoaded(const FString &Url); + virtual void HandleOnBeforePopup(const FString &Url, const FString &Frame); + + virtual void HandleAuthenticated(const FString &AuthResult); + virtual void HandleSiweComplete(const FString &Signature, const FString &Payload); + virtual void HandleError(const FString &Error); + public: #if PLATFORM_ANDROID - void HandleDeepLink(const FString& Url); - void HandleCustomTabsDismissed(const FString& Url); + void HandleDeepLink(const FString &Url); + void HandleCustomTabsDismissed(const FString &Url); #endif - - UFUNCTION(BlueprintCallable, Category="Thirdweb|OAuth Browser") - void Authenticate(const FInAppWalletHandle& InAppWallet); - - /** Returns true if the page content is blank. Normally the case at startup, and mid-oauth flow */ - UFUNCTION(BlueprintPure, Category="Thirdweb|OAuth Browser") - bool IsBlank() const; - - UFUNCTION(BlueprintPure, Category="Thirdweb|OAuth Browser") - FString GetUrl() const; -}; + UFUNCTION(BlueprintCallable, Category = "Thirdweb|OAuth Browser") + void Authenticate(const FInAppWalletHandle &InAppWallet); +}; diff --git a/Source/Thirdweb/Public/Browser/ThirdwebOAuthBrowserWidget.h b/Source/Thirdweb/Public/Browser/ThirdwebOAuthBrowserWidget.h deleted file mode 100644 index 3a8899c..0000000 --- a/Source/Thirdweb/Public/Browser/ThirdwebOAuthBrowserWidget.h +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2024 Thirdweb. All Rights Reserved. - -#pragma once - -#if WITH_CEF -#include "SWebBrowser.h" -#endif -#include "Components/Widget.h" -#include "Wallets/ThirdwebInAppWalletHandle.h" -#include "ThirdwebOAuthBrowserWidget.generated.h" - -DECLARE_MULTICAST_DELEGATE_OneParam(FSimpleStringDelegate, const FString&); -DECLARE_MULTICAST_DELEGATE_TwoParams(FSimpleDoubleStringDelegate, const FString&, const FString&); -DECLARE_DELEGATE_RetVal_ThreeParams(bool, FOnLoadUrl, const FString& /*Method*/, const FString& /*Url*/, FString& /* Response */) - -UCLASS(NotBlueprintable, NotBlueprintType, Hidden) -class THIRDWEB_API UThirdwebOAuthBrowserWidget : public UWidget -{ - GENERATED_BODY() - -public: - //~ Begin Public Overrides - virtual void ReleaseSlateResources(bool bReleaseChildren) override; - -#if WITH_EDITOR - virtual const FText GetPaletteCategory() override; -#endif - //~ End Public Overrides - - //~ Begin SWebBrowser Handlers - virtual void HandleUrlChanged(const FText& InUrl); - virtual void HandleOnLoadComplete(); - virtual bool HandleOnBeforePopup(FString Url, FString Frame); - virtual bool HandleOnCreateWindow(const TWeakPtr& Window, const TWeakPtr& Features); - virtual void HandleOnLoadError(); - virtual bool HandleOnCloseWindow(const TWeakPtr& Window); - //~ End SWebBrowser Handlers - - //~ Begin SWebBrowser Wrappers - virtual void LoadUrl(const FString& Url); - bool IsPageLoaded() const; - FString GetUrl() const; - //~ End SWebBrowser Wrappers - - static FString GetDummyUrl(); - - UFUNCTION(BlueprintCallable, Category="Thirdweb|OAuth Browser") - void Authenticate(const FString& OAuthLoginUrl); - -protected: - virtual TSharedRef RebuildWidget() override; - virtual void OnWidgetRebuilt() override; - -public: - FSimpleStringDelegate OnUrlChanged; - FSimpleStringDelegate OnPageLoaded; - FSimpleDoubleStringDelegate OnBeforePopup; - - - -private: - FString InitialUrl; - bool bSupportsTransparency = false; - bool bShowInitialThrobber = false; - static const FString DummyUrl; - -#if WITH_CEF - TSharedPtr Browser; -#endif -}; diff --git a/Source/Thirdweb/Public/ThirdwebCommon.h b/Source/Thirdweb/Public/ThirdwebCommon.h index 7ae17a5..ffa584d 100644 --- a/Source/Thirdweb/Public/ThirdwebCommon.h +++ b/Source/Thirdweb/Public/ThirdwebCommon.h @@ -29,33 +29,26 @@ enum class EOTPVerificationFunctionResult : uint8 Failed }; -UENUM(BlueprintType, DisplayName="OAuth Provider") +UENUM(BlueprintType, DisplayName = "OAuth Provider") enum class EThirdwebOAuthProvider : uint8 { - Google UMETA(DisplayName="Google"), - Apple UMETA(DisplayName="Apple"), - Facebook UMETA(DisplayName="Facebook"), - Discord UMETA(DisplayName="Discord"), - Farcaster UMETA(DisplayName="Farcaster"), - Telegram UMETA(DisplayName="Telegram"), - Line UMETA(DisplayName="Line"), - X UMETA(DisplayName="X"), - Coinbase UMETA(DisplayName="Coinbase"), - Twitch UMETA(DisplayName="Twitch"), - Github UMETA(DisplayName="Github"), + Google UMETA(DisplayName = "Google"), + Apple UMETA(DisplayName = "Apple"), + Facebook UMETA(DisplayName = "Facebook"), + Discord UMETA(DisplayName = "Discord"), + Farcaster UMETA(DisplayName = "Farcaster"), + Telegram UMETA(DisplayName = "Telegram"), + Line UMETA(DisplayName = "Line"), + X UMETA(DisplayName = "X"), + Coinbase UMETA(DisplayName = "Coinbase"), + Twitch UMETA(DisplayName = "Twitch"), + Github UMETA(DisplayName = "Github"), None UMETA(Hidden) }; -UENUM() -enum class EThirdwebOAuthBrowserBackend : uint8 -{ - Internal UMETA(DisplayName="Internal"), - External UMETA(DisplayName="External"), -}; - -UENUM(BlueprintType, DisplayName="OTP Method") +UENUM(BlueprintType, DisplayName = "OTP Method") enum class EThirdwebOTPMethod : uint8 { - Email UMETA(DisplayName="Email"), - Phone UMETA(DisplayName="Phone"), + Email UMETA(DisplayName = "Email"), + Phone UMETA(DisplayName = "Phone"), }; \ No newline at end of file diff --git a/Source/Thirdweb/Public/ThirdwebRuntimeSettings.h b/Source/Thirdweb/Public/ThirdwebRuntimeSettings.h index 9ce1e6c..b53ffb9 100644 --- a/Source/Thirdweb/Public/ThirdwebRuntimeSettings.h +++ b/Source/Thirdweb/Public/ThirdwebRuntimeSettings.h @@ -6,14 +6,13 @@ #include "Engine/DeveloperSettings.h" #include "ThirdwebRuntimeSettings.generated.h" -enum class EThirdwebOAuthBrowserBackend : uint8; enum class EThirdwebOAuthProvider : uint8; enum class EThirdwebAuthenticationMethod : uint8; /** * This class acts as a configuration holder to manage various settings required for the runtime environment in the Thirdweb system. */ -UCLASS(Config=Engine, DefaultConfig, meta=(DisplayName="Thirdweb")) +UCLASS(Config = Engine, DefaultConfig, meta = (DisplayName = "Thirdweb")) class THIRDWEB_API UThirdwebRuntimeSettings : public UDeveloperSettings { GENERATED_BODY() @@ -22,98 +21,86 @@ class THIRDWEB_API UThirdwebRuntimeSettings : public UDeveloperSettings UThirdwebRuntimeSettings(); #if WITH_EDITOR - virtual void PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent) override; - virtual bool CanEditChange(const FProperty* InProperty) const override; + virtual void PostEditChangeProperty(struct FPropertyChangedEvent &PropertyChangedEvent) override; + virtual bool CanEditChange(const FProperty *InProperty) const override; #endif protected: /** Stores the client identifier. */ - UPROPERTY(Config, EditAnywhere, DisplayName="Client ID", Category=Global) + UPROPERTY(Config, EditAnywhere, DisplayName = "Client ID", Category = Global) FString ClientId; /** Stores the bundle identifier. */ - UPROPERTY(Config, EditAnywhere, DisplayName="Bundle ID", Category=Global) + UPROPERTY(Config, EditAnywhere, DisplayName = "Bundle ID", Category = Global) FString BundleId; /** Ecosystem Wallet Identifier tied to your Thirdweb Ecosystem account. Only relevant when using Ecosystem Wallets. e.g. `ecosystem.my-cool-game` */ - UPROPERTY(Config, EditAnywhere, DisplayName="Ecosystem ID", Category="Wallets|Ecosystem") + UPROPERTY(Config, EditAnywhere, DisplayName = "Ecosystem ID", Category = "Wallets|Ecosystem") FString EcosystemId; - + /** Ecosystem Wallet Partner ID - Needed if Allowlist-based Ecosystem */ - UPROPERTY(Config, EditAnywhere, DisplayName="Partner ID", Category="Wallets|Ecosystem") + UPROPERTY(Config, EditAnywhere, DisplayName = "Partner ID", Category = "Wallets|Ecosystem") FString PartnerId; /** Required if using custom auth methods via standard InApp wallets (Non-Ecosystem) */ - UPROPERTY(Config, EditAnywhere, DisplayName="Encrypton Key (Legacy)", Category="Wallets|Ecosystem|Advanced") + UPROPERTY(Config, EditAnywhere, DisplayName = "Encrypton Key (Legacy)", Category = "Wallets|Ecosystem|Advanced") FString EncryptionKey; - + /** Optional array of engine signers stored globally for convenience */ - UPROPERTY(Config, EditAnywhere, Category="Wallets|Smart") + UPROPERTY(Config, EditAnywhere, Category = "Wallets|Smart") TArray EngineSigners; /** Publicly accessible Base URL To your Engine instance. Needed for all Engine nodes */ - UPROPERTY(Config, EditAnywhere, DisplayName="Base URL", Category=Engine) + UPROPERTY(Config, EditAnywhere, DisplayName = "Base URL", Category = Engine) FString EngineBaseUrl; /** Access Token for Engine Authorization */ - UPROPERTY(Config, EditAnywhere, DisplayName="Access Token", meta=(ConfigHierarchyEditable), Category=Engine) + UPROPERTY(Config, EditAnywhere, DisplayName = "Access Token", meta = (ConfigHierarchyEditable), Category = Engine) FString EngineAccessToken; - + /** Opt in or out of connect analytics */ - UPROPERTY(Config, EditAnywhere, Category=Advanced) + UPROPERTY(Config, EditAnywhere, Category = Advanced) bool bSendAnalytics; /** Edit Condition for overriding Custom Application Schema */ - UPROPERTY(Config, EditAnywhere, DisplayName="Override App URI", meta=(InlineEditConditionToggle, ConfigHierarchyEditable), Category="Advanced|Wallets") + UPROPERTY(Config, EditAnywhere, DisplayName = "Override App URI", meta = (InlineEditConditionToggle, ConfigHierarchyEditable), Category = "Advanced|Wallets") bool bOverrideAppUri; - + /** Custom Application URI for oauth redirects. default is {bundleId}://{clientId} */ - UPROPERTY(Config, EditAnywhere, DisplayName="Custom App URI", meta=(EditCondition="bOverrideAppUri", ConfigHierarchyEditable), Category="Advanced|Wallets") + UPROPERTY(Config, EditAnywhere, DisplayName = "Custom App URI", meta = (EditCondition = "bOverrideAppUri", ConfigHierarchyEditable), Category = "Advanced|Wallets") FString CustomAppUri; /** Edit Condition for overriding the final page shown after auth is complete */ - UPROPERTY(Config, EditAnywhere, meta=(InlineEditConditionToggle, ConfigHierarchyEditable), Category="Advanced|Wallets") + UPROPERTY(Config, EditAnywhere, meta = (InlineEditConditionToggle, ConfigHierarchyEditable), Category = "Advanced|Wallets") bool bOverrideExternalAuthRedirectUri; - + /** Custom URI shown after external auth is complete */ - UPROPERTY(Config, EditAnywhere, DisplayName="Custom External Auth Redirect URI", meta=(EditCondition="bOverrideExternalAuthRedirectUri", ConfigHierarchyEditable), Category="Advanced|Wallets") + UPROPERTY(Config, EditAnywhere, DisplayName = "Custom External Auth Redirect URI", meta = (EditCondition = "bOverrideExternalAuthRedirectUri", ConfigHierarchyEditable), Category = "Advanced|Wallets") FString CustomExternalAuthRedirectUri; - - /** Edit Condition for overriding OAuth Browser Provider Backends */ - UPROPERTY(Config, EditAnywhere, meta=(InlineEditConditionToggle, ConfigHierarchyEditable), Category="Advanced|Wallets") - bool bOverrideOAuthBrowserProviderBackends; - - UPROPERTY(Config, EditAnywhere, meta=(EditCondition="bOverrideOAuthBrowserProviderBackends", ArraySizeEnum="EThirdwebOAuthProvider", ConfigHierarchyEditable), Category="Advanced|Wallets") - EThirdwebOAuthBrowserBackend OAuthBrowserProviderBackendOverrides[static_cast(EThirdwebOAuthProvider::None)]; - + private: - static const TArray ExternalOnlyProviders; - public: // UFUNCTION(CallInEditor, Category="Wallets|InApp") void GenerateEncryptionKey(); - UFUNCTION(BlueprintPure, Category="Thirdweb|Settings") + UFUNCTION(BlueprintPure, Category = "Thirdweb|Settings") static TArray GetEngineSigners(); /** Gets the first engine signer in the array, if any */ - UFUNCTION(BlueprintPure, Category="Thirdweb|Settings", meta=(ReturnDisplayName="Signer")) + UFUNCTION(BlueprintPure, Category = "Thirdweb|Settings", meta = (ReturnDisplayName = "Signer")) static FString GetEngineSigner(); /** Static accessor to get EncryptionKey */ - UFUNCTION(BlueprintPure, DisplayName="Get External Auth Redirect URI", Category="Thirdweb|Settings") + UFUNCTION(BlueprintPure, DisplayName = "Get External Auth Redirect URI", Category = "Thirdweb|Settings") static FString GetExternalAuthRedirectUri(); - + /** Static accessor to get EncryptionKey */ - UFUNCTION(BlueprintPure, Category="Thirdweb|Settings") + UFUNCTION(BlueprintPure, Category = "Thirdweb|Settings") static FString GetEncryptionKey(); - + /** Static accessor to retrieve the absolute path of the thirdweb InAppWallet platform */ static FString GetStorageDirectory(); - /** Static accessor to get the resolved backend of an OAuth provider */ - static bool IsExternalOAuthBackend(const EThirdwebOAuthProvider Provider); - /** Static accessor to get EcosystemId */ static FString GetEcosystemId(); @@ -121,35 +108,35 @@ class THIRDWEB_API UThirdwebRuntimeSettings : public UDeveloperSettings static FString GetPartnerId(); /** Static accessor to check EcosystemId validity */ - UFUNCTION(BlueprintPure, Category="Thirdweb|Settings") + UFUNCTION(BlueprintPure, Category = "Thirdweb|Settings") static bool IsEcosystem(); /** Static accessor to get ClientId */ static FString GetClientId(); - + /** Static accessor to get BundleId */ static FString GetBundleId(); - + /** Static accessor to check Analytics Opt-In status */ static bool AnalyticsEnabled(); /** Static accessor to get BaseEngineUrl */ static FString GetEngineBaseUrl(); - + /** Static accessor to get AccessToken */ static FString GetEngineAccessToken(); /** Static accessor for AppUri */ static FString GetAppUri(); - + /** Convenience Getter */ - UFUNCTION(BlueprintPure, DisplayName="Get Thirdweb Runtime Settings", meta=(ReturnDisplayName="Settings"), Category="Thirdweb|Settings") - static const UThirdwebRuntimeSettings* Get() { return GetDefault(); } + UFUNCTION(BlueprintPure, DisplayName = "Get Thirdweb Runtime Settings", meta = (ReturnDisplayName = "Settings"), Category = "Thirdweb|Settings") + static const UThirdwebRuntimeSettings *Get() { return GetDefault(); } protected: // UFUNCTION(CallInEditor, Category="Wallets|Smart") void FetchEngineSigners(); - + private: static const FString DefaultExternalAuthRedirectUri; };