Skip to content

Commit

Permalink
Merge pull request #39 from AppsFlyerSDK/dev/DELIVERY-54544/6.13.0-pl…
Browse files Browse the repository at this point in the history
…ugin-update

6.13.0 Plugin Update. Added DMA Feature
  • Loading branch information
andr-ggn authored Apr 3, 2024
2 parents ea3153c + 18b60d4 commit a53687b
Show file tree
Hide file tree
Showing 15 changed files with 85 additions and 7 deletions.
2 changes: 1 addition & 1 deletion AppsFlyerSDK/AppsFlyerSDK.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 2,
"VersionName": "6.12.2",
"VersionName": "6.13.0",
"FriendlyName": "AppsFlyerSDK",
"Description": "UE4/UE5 AppsFlyer Plugin",
"Category": "Misc",
Expand Down
18 changes: 15 additions & 3 deletions AppsFlyerSDK/Source/AppsFlyerSDK/AppsFlyer_UPL_Android.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}
dependencies {
implementation 'com.android.installreferrer:installreferrer:2.1'
implementation 'com.appsflyer:af-android-sdk:6.12.2'
implementation 'com.appsflyer:af-android-sdk:6.13.0'
}
android {
compileOptions {
Expand Down Expand Up @@ -77,15 +77,27 @@

public void afSetPluginInfo(String pluginVersion, String engineVersion) {


Map<String, String> additionalData = new HashMap<String,String>();
additionalData.put("engine_version", engineVersion);

PluginInfo pluginInfo = new PluginInfo(Plugin.UNREAL, pluginVersion, additionalData);
AppsFlyerLib.getInstance().setPluginInfo(pluginInfo);

}

public void afEnableTCFDataCollection(boolean isTCFDataCollectionEnabled) {
AppsFlyerLib.getInstance().enableTCFDataCollection(isTCFDataCollectionEnabled);
}

public void afSetConsentData(boolean isGDPR, boolean hasConsentForDataUsage, boolean hasConsentForAdsPersonalization) {
AppsFlyerConsent consent;
if (isGDPR == true) {
consent = AppsFlyerConsent.forGDPRUser(hasConsentForDataUsage, hasConsentForAdsPersonalization);
} else {
consent = AppsFlyerConsent.forNonGDPRUser();
}

AppsFlyerLib.getInstance().setConsentData(consent);
}
</insert>
</gameActivityClassAdditions>
</root>
43 changes: 43 additions & 0 deletions AppsFlyerSDK/Source/AppsFlyerSDK/Private/AppsFlyerSDKBlueprint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// Core
#include "Misc/EngineVersion.h"


#if PLATFORM_ANDROID
#include "Android/AndroidJNI.h"
#include "Android/AndroidApplication.h"
Expand Down Expand Up @@ -150,6 +151,8 @@ void UAppsFlyerSDKBlueprint::configure()
const UAppsFlyerSDKSettings *defaultSettings = GetDefault<UAppsFlyerSDKSettings>();
const bool isDebug = defaultSettings->bIsDebug;
const bool isAutoStart = defaultSettings->bEnableAutoStart;
const bool isTCFDataCollectionEnabled = defaultSettings->bEnableTCFDataCollection;

#if PLATFORM_ANDROID
JNIEnv* env = FAndroidApplication::GetJavaEnv();

Expand All @@ -168,6 +171,13 @@ void UAppsFlyerSDKBlueprint::configure()
FJavaWrapper::CallVoidMethod(env, FJavaWrapper::GameActivityThis, appsflyer, key, isDebug);
}

if (isTCFDataCollectionEnabled)
{
jmethodID UPLMethod = FJavaWrapper::FindMethod(env, FJavaWrapper::GameActivityClassID, "afEnableTCFDataCollection", "(Z)V", false);
FJavaWrapper::CallVoidMethod(env, FJavaWrapper::GameActivityThis, UPLMethod, true);
}


#elif PLATFORM_IOS
dispatch_async(dispatch_get_main_queue(), ^ {
if ((!defaultSettings->appsFlyerDevKeyIOS.IsEmpty() || !defaultSettings->appsFlyerDevKey.IsEmpty()) && !defaultSettings->appleAppID.IsEmpty()) {
Expand All @@ -189,6 +199,10 @@ void UAppsFlyerSDKBlueprint::configure()
[AppsFlyerLib shared].currencyCode = currencyCode;
}

if (isTCFDataCollectionEnabled) {
[[AppsFlyerLib shared] enableTCFDataCollection:YES];
}

FIOSCoreDelegates::OnOpenURL.AddStatic(&OnOpenURL);
UE4AFSDKDelegate *delegate = [[UE4AFSDKDelegate alloc] init];
delegate.onConversionDataSuccess = onConversionDataSuccess;
Expand Down Expand Up @@ -389,3 +403,32 @@ void UAppsFlyerSDKBlueprint::setAdditionalData(TMap <FString, FString> customDat
return;
#endif
}

void UAppsFlyerSDKBlueprint::SetConsentForNonGDPRUser()
{
#if PLATFORM_ANDROID
JNIEnv* env = FAndroidApplication::GetJavaEnv();
jmethodID UPLMethod1 = FJavaWrapper::FindMethod(env, FJavaWrapper::GameActivityClassID, "afSetConsentData", "(ZZZ)V", false);
FJavaWrapper::CallVoidMethod(env, FJavaWrapper::GameActivityThis, UPLMethod1, false, false, false);
#elif PLATFORM_IOS
AppsFlyerConsent *consent = [[AppsFlyerConsent alloc] initNonGDPRUser];
[[AppsFlyerLib shared] setConsentData:consent];
#else
return;
#endif
}

void UAppsFlyerSDKBlueprint::SetConsentForGDPRUser(bool hasConsentForDataUsage, bool hasConsentForAdsPersonalization)
{
#if PLATFORM_ANDROID
JNIEnv* env = FAndroidApplication::GetJavaEnv();
jmethodID UPLMethod = FJavaWrapper::FindMethod(env, FJavaWrapper::GameActivityClassID, "afSetConsentData", "(ZZZ)V", false);
FJavaWrapper::CallVoidMethod(env, FJavaWrapper::GameActivityThis, UPLMethod, true, hasConsentForDataUsage, hasConsentForAdsPersonalization);
#elif PLATFORM_IOS
AppsFlyerConsent *consent = [[AppsFlyerConsent alloc] initForGDPRUserWithHasConsentForDataUsage:hasConsentForDataUsage
hasConsentForAdsPersonalization:hasConsentForAdsPersonalization];
[[AppsFlyerLib shared] setConsentData:consent];
#else
return;
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ UAppsFlyerSDKSettings::UAppsFlyerSDKSettings(const FObjectInitializer& ObjectIni
, currencyCode("")
, bDisableSKAdNetwork(false)
, bEnableAutoStart(true)
, bEnableTCFDataCollection(false)
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,9 @@ class APPSFLYERSDK_API UAppsFlyerSDKBlueprint : public UBlueprintFunctionLibrary
UFUNCTION(BlueprintCallable, Category = AppsFlyerSDK, DisplayName = "AppsFlyerSDK add custom data to events in the payload")
static void setAdditionalData(TMap <FString, FString> customData);

UFUNCTION(BlueprintCallable, Category = AppsFlyerSDK, DisplayName = "AppsFlyerConsent For *Non GDPR* User")
static void SetConsentForNonGDPRUser();

UFUNCTION(BlueprintCallable, Category = AppsFlyerSDK, DisplayName = "AppsFlyerConsent For *GDPR* User")
static void SetConsentForGDPRUser(bool hasConsentForDataUsage, bool hasConsentForAdsPersonalization);
};
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,7 @@ class UAppsFlyerSDKSettings : public UObject
// Enable AppsFlyerSDK automatic start
UPROPERTY(Config, EditAnywhere, config, Category = "AppsFlyer", meta = (DisplayName = "Automatically start the AppsFlyer SDK"))
bool bEnableAutoStart;

UPROPERTY(Config, EditAnywhere, config, Category = "AppsFlyer", meta = (DisplayName = "Instruct the SDK to collect the TCF data from the device"))
bool bEnableTCFDataCollection;
};
Binary file not shown.
1 change: 1 addition & 0 deletions Demo/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# Visual Studio 2015 user specific files
.vs/

Expand Down
11 changes: 10 additions & 1 deletion UE_5.1_Demo/Demo/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,13 @@ Plugins/*/Intermediate/*
./AppsFlyerSDK/Intermediate/*

# Cache files for the editor to use
DerivedDataCache/*
DerivedDataCache/*

/Saved
/Demo (IOS).xcworkspace
/Content
/DerivedDataCache
/Demo (Mac).xcworkspace
/.vscode
/Intermediate
/Plugins/AppsFlyerSDK/Intermediate
4 changes: 4 additions & 0 deletions UE_5.1_Demo/Demo/Config/DefaultEngine.ini
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,8 @@ ManualIPAddress=
appsFlyerDevKey=LYPnLsdJuSwjgAQ2GTZehc
appleAppID=1217828636
bIsDebug=True
bEnableTCFDataCollection=True

[/Script/MacTargetPlatform.XcodeProjectSettings]
CodeSigningTeam=6UQAD4B3U2

Binary file modified UE_5.1_Demo/Demo/Content/AFLevel1.umap
Binary file not shown.
Binary file modified UE_5.1_Demo/Demo/Content/StarterContent/Audio/Collapse01.uasset
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion UE_5.1_Demo/Demo/Demo.uproject
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"FileVersion": 3,
"EngineAssociation": "{89CF005C-2E45-EE90-3C62-39B910725CF3}",
"EngineAssociation": "5.3",
"Category": "",
"Description": "",
"Modules": [
Expand Down
2 changes: 1 addition & 1 deletion UE_5.1_Demo/Demo/Plugins/AppsFlyerSDK

0 comments on commit a53687b

Please sign in to comment.