-
Notifications
You must be signed in to change notification settings - Fork 15
v1.3.0 #9
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
v1.3.0 #9
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a45dc36
expose clientId func
dirtycajunrice f90422f
Add World override for Game mode, format build.cs, and add EditorCust…
dirtycajunrice 2fd1688
expose wallet handle to external reflection
dirtycajunrice f5b49ce
* Add Custom Browser OAuth Example
dirtycajunrice 996b2e0
move analytics calls and rename platform
dirtycajunrice File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#include "ThirdwebInternal.h" | ||
|
||
#include "HttpModule.h" | ||
#include "ThirdwebRuntimeSettings.h" | ||
#include "ThirdwebUtils.h" | ||
|
||
#include "Dom/JsonObject.h" | ||
|
||
#include "Interfaces/IPluginManager.h" | ||
|
||
#include "Kismet/GameplayStatics.h" | ||
|
||
#include "Policies/CondensedJsonPrintPolicy.h" | ||
|
||
#include "Serialization/JsonSerializer.h" | ||
#include "Serialization/JsonWriter.h" | ||
|
||
FString FThirdwebAnalytics::JsonObjectToString(const TSharedPtr<FJsonObject>& JsonObject) | ||
{ | ||
FString Out; | ||
const TSharedRef<TJsonWriter<TCHAR, TCondensedJsonPrintPolicy<TCHAR>>> Writer = TJsonWriterFactory<TCHAR, TCondensedJsonPrintPolicy<TCHAR>>::Create(&Out); | ||
FJsonSerializer::Serialize(JsonObject.ToSharedRef(), Writer); | ||
return Out; | ||
} | ||
|
||
FString FThirdwebAnalytics::GetPluginVersion() | ||
{ | ||
if (const TSharedPtr<IPlugin> Plugin = IPluginManager::Get().FindPlugin(TEXT("Thirdweb")); Plugin.IsValid()) | ||
{ | ||
return Plugin->GetDescriptor().VersionName; | ||
} | ||
return "0.0.0"; | ||
} | ||
|
||
void FThirdwebAnalytics::SendConnectEvent(const FString& Wallet, const FString& Type) | ||
{ | ||
const UThirdwebRuntimeSettings* Settings = UThirdwebRuntimeSettings::Get(); | ||
if (!Settings->bSendAnalytics || (Settings->BundleID.IsEmpty() && Settings->ClientID.IsEmpty() && Settings->SecretKey.IsEmpty())) | ||
{ | ||
return; | ||
} | ||
FHttpModule& HttpModule = FHttpModule::Get(); | ||
const TSharedRef<IHttpRequest> Request = HttpModule.CreateRequest(); | ||
Request->SetVerb("POST"); | ||
Request->SetURL("https://c.thirdweb.com/event"); | ||
Request->SetHeader("Content-Type", "application/json"); | ||
Request->SetHeader("x-sdk-name", "UnrealEngineSDK"); | ||
Request->SetHeader("x-sdk-os", UGameplayStatics::GetPlatformName()); | ||
Request->SetHeader("x-sdk-platform", "unreal-engine"); | ||
Request->SetHeader("x-sdk-version", GetPluginVersion()); | ||
if (!Settings->SecretKey.IsEmpty()) | ||
{ | ||
Request->SetHeader("x-client-id", ThirdwebUtils::GetClientIdFromSecretKey(Settings->SecretKey)); | ||
} else | ||
{ | ||
Request->SetHeader("x-client-id", Settings->ClientID); | ||
Request->SetHeader("x-bundle-id", Settings->BundleID); | ||
} | ||
Request->SetTimeout(5.0f); | ||
|
||
TSharedPtr<FJsonObject> JsonObject = MakeShareable(new FJsonObject); | ||
JsonObject->SetStringField(TEXT("source"), TEXT("connectWallet")); | ||
JsonObject->SetStringField(TEXT("action"), TEXT("connect")); | ||
JsonObject->SetStringField(TEXT("walletAddress"), Wallet); | ||
JsonObject->SetStringField(TEXT("walletType"), Type); | ||
Request->SetContentAsString(JsonObjectToString(JsonObject)); | ||
Request->ProcessRequest(); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.