From 5d92e40d9ae4ef0048c8f82ebbd925142bb551b1 Mon Sep 17 00:00:00 2001 From: Yermek Garifullanov Date: Fri, 13 Dec 2024 15:20:23 +1300 Subject: [PATCH] chore: isolated source code for ue5 --- .../Immutable/Transak/TransakWebBrowser.cpp | 19 ++++++++++++++++--- .../Immutable/Transak/TransakWebBrowser.h | 7 ++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Source/Immutable/Private/Immutable/Transak/TransakWebBrowser.cpp b/Source/Immutable/Private/Immutable/Transak/TransakWebBrowser.cpp index 7d6d64d..3f417d8 100644 --- a/Source/Immutable/Private/Immutable/Transak/TransakWebBrowser.cpp +++ b/Source/Immutable/Private/Immutable/Transak/TransakWebBrowser.cpp @@ -3,6 +3,7 @@ #include "PlatformHttp.h" #include "Immutable/ImmutableUtilities.h" #include "Immutable/TransakConfig.h" +#include "Immutable/Misc/ImtblLogging.h" #define LOCTEXT_NAMESPACE "Immutable" @@ -35,8 +36,8 @@ TSharedRef UTransakWebBrowser::RebuildWidget() WebBrowserWidget = SNew(SWebBrowser) .InitialURL(TEXT("about:blank")) .ShowControls(false) - .SupportsTransparency(bSupportsTransparency) - .OnUrlChanged(BIND_UOBJECT_DELEGATE(FOnTextChanged, OnUrlChanged)) + .SupportsTransparency(false) + .OnUrlChanged(BIND_UOBJECT_DELEGATE(FOnTextChanged, HandleOnUrlChanged)) .OnBeforePopup(BIND_UOBJECT_DELEGATE(FOnBeforePopupDelegate, HandleOnBeforePopup)) .OnConsoleMessage(BIND_UOBJECT_DELEGATE(FOnConsoleMessageDelegate, HandleOnConsoleMessage)); return WebBrowserWidget.ToSharedRef(); @@ -46,7 +47,8 @@ TSharedRef UTransakWebBrowser::RebuildWidget() } } -void UTransakWebBrowser::OnUrlChanged(const FText& Text) +#if (ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 1) +void UTransakWebBrowser::HandleOnUrlChanged(const FText& Text) { if (Text.EqualToCaseIgnored(FText::FromString(TEXT("about:blank")))) { @@ -55,6 +57,17 @@ void UTransakWebBrowser::OnUrlChanged(const FText& Text) } } +void UTransakWebBrowser::HandleOnConsoleMessage(const FString& Message, const FString& Source, int32 Line, EWebBrowserConsoleLogSeverity Severity) +{ + IMTBL_LOG("Transak Web Browser console message: %s, Source: %s, Line: %d", *Message, *Source, Line); +} + +bool UTransakWebBrowser::HandleOnBeforePopup(FString URL, FString Frame) +{ + return false; +} +#endif + void UTransakWebBrowser::Load(const FString& WalletAddress, const FString& Email, const FString& ProductsAvailed, const FString& ScreenTitle) { if (!WebBrowserWidget.IsValid()) diff --git a/Source/Immutable/Public/Immutable/Transak/TransakWebBrowser.h b/Source/Immutable/Public/Immutable/Transak/TransakWebBrowser.h index c4dbedc..7dcdb30 100644 --- a/Source/Immutable/Public/Immutable/Transak/TransakWebBrowser.h +++ b/Source/Immutable/Public/Immutable/Transak/TransakWebBrowser.h @@ -33,7 +33,12 @@ class IMMUTABLE_API UTransakWebBrowser : public UWidget private: FString ComputePath(const FString& WalletAddress, const FString& Email, const FString& ProductsAvailed, const FString& ScreenTitle); - void OnUrlChanged(const FText& Text); + +#if (ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 1) + void HandleOnConsoleMessage(const FString& Message, const FString& Source, int32 Line, EWebBrowserConsoleLogSeverity Severity); + void HandleOnUrlChanged(const FText& Text); + bool HandleOnBeforePopup(FString URL, FString Frame); +#endif protected: #if (ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 1)