Skip to content

Commit

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

6.12.2 Plugin Update
  • Loading branch information
andr-ggn authored Oct 17, 2023
2 parents e2397eb + f4b4d05 commit 9933769
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 16 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.10.1",
"VersionName": "6.12.2",
"FriendlyName": "AppsFlyerSDK",
"Description": "UE4/UE5 AppsFlyer Plugin",
"Category": "Misc",
Expand Down
6 changes: 5 additions & 1 deletion AppsFlyerSDK/Source/AppsFlyerSDK/AppsFlyerSDK.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,16 @@ public AppsFlyerSDK(ReadOnlyTargetRules Target) : base(Target)
"CFNetwork"
}
);

//UPL
string PluginPath = Utils.MakePathRelativeTo(ModuleDirectory, Target.RelativeEnginePath);
AdditionalPropertiesForReceipt.Add("IOSPlugin", Path.Combine(PluginPath, "AppsFlyer_UPL_IOS.xml"));
}
else if (Target.Platform == UnrealTargetPlatform.Android)
{
// Unreal Plugin Language
string PluginPath = Utils.MakePathRelativeTo(ModuleDirectory, Target.RelativeEnginePath);
AdditionalPropertiesForReceipt.Add("AndroidPlugin", System.IO.Path.Combine(PluginPath, "AppsFlyer_UPL.xml"));
AdditionalPropertiesForReceipt.Add("AndroidPlugin", System.IO.Path.Combine(PluginPath, "AppsFlyer_UPL_Android.xml"));
// JNI
PublicIncludePathModuleNames.Add("Launch");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
mavenCentral()
}
dependencies {
implementation 'com.android.installreferrer:installreferrer:1.0'
implementation 'com.appsflyer:af-android-sdk:6.9.1'
implementation 'com.android.installreferrer:installreferrer:2.1'
implementation 'com.appsflyer:af-android-sdk:6.12.2'
}
android {
compileOptions {
Expand Down Expand Up @@ -37,6 +37,10 @@
<insert>
import android.app.Application;
import com.appsflyer.*;
import com.appsflyer.internal.platform_extension.Plugin;
import com.appsflyer.internal.platform_extension.PluginInfo;
import java.util.HashMap;
import java.util.Map;
</insert>
</gameActivityImportAdditions>
<gameActivityClassAdditions>
Expand Down Expand Up @@ -70,6 +74,18 @@
public void afSetAdditionalData(Map&lt;String, Object&gt; customData) {
AppsFlyerLib.getInstance().setAdditionalData(customData);
}

public void afSetPluginInfo(String pluginVersion, String engineVersion) {


Map&lt;String, String&gt; additionalData = new HashMap&lt;String,String&gt;();
additionalData.put("engine_version", engineVersion);

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

}

</insert>
</gameActivityClassAdditions>
</root>
6 changes: 6 additions & 0 deletions AppsFlyerSDK/Source/AppsFlyerSDK/AppsFlyer_UPL_IOS.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<root xmlns:android="http://schemas.ios.com/res/ios">
<init>
<log text="iOS AppsFlyerSDK Init"/>
</init>
</root>
18 changes: 13 additions & 5 deletions AppsFlyerSDK/Source/AppsFlyerSDK/Private/AppsFlyerSDKBlueprint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "Android/AndroidApplication.h"
#elif PLATFORM_IOS
#import <AppsFlyerLib/AppsFlyerLib.h>
#import "UE4AFSDKDelegate.h"
#import "IOS/UE4AFSDKDelegate.h"
#include "IOSAppDelegate.h"
#import <objc/message.h>

Expand Down Expand Up @@ -151,10 +151,18 @@ void UAppsFlyerSDKBlueprint::configure()
const bool isDebug = defaultSettings->bIsDebug;
const bool isAutoStart = defaultSettings->bEnableAutoStart;
#if PLATFORM_ANDROID
if(isAutoStart){
JNIEnv* env = FAndroidApplication::GetJavaEnv();
jmethodID appsflyer =
FJavaWrapper::FindMethod(env, FJavaWrapper::GameActivityClassID, "afStart", "(Ljava/lang/String;Z)V", false);
JNIEnv* env = FAndroidApplication::GetJavaEnv();

jmethodID PluginMethodID = FJavaWrapper::FindMethod(env, FJavaWrapper::GameActivityClassID, "afSetPluginInfo", "(Ljava/lang/String;Ljava/lang/String;)V", false);
jstring jVersionName = env->NewStringUTF(TCHAR_TO_UTF8(*VersionName));
jstring jEngineVersion = env->NewStringUTF(TCHAR_TO_UTF8(*EngineVersion));
FJavaWrapper::CallVoidMethod(env, FJavaWrapper::GameActivityThis, PluginMethodID, jVersionName, jEngineVersion);
env->DeleteLocalRef(jVersionName);
env->DeleteLocalRef(jEngineVersion);

if (isAutoStart)
{
jmethodID appsflyer = FJavaWrapper::FindMethod(env, FJavaWrapper::GameActivityClassID, "afStart", "(Ljava/lang/String;Z)V", false);
jstring key = env->NewStringUTF(TCHAR_TO_UTF8(*defaultSettings->appsFlyerDevKey));

FJavaWrapper::CallVoidMethod(env, FJavaWrapper::GameActivityThis, appsflyer, key, isDebug);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// Copyright © 2019 Epic Games, Inc. All rights reserved.
//

#ifndef PLATFORM_IOS
#else
#if PLATFORM_IOS

#import <Foundation/Foundation.h>
Expand All @@ -26,4 +24,3 @@ NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_END

#endif
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
// Copyright © 2019 Epic Games, Inc. All rights reserved.
//

#ifndef PLATFORM_IOS
#else
#if PLATFORM_IOS

#import "UE4AFSDKDelegate.h"


@implementation UE4AFSDKDelegate

- (instancetype)init {
Expand Down Expand Up @@ -77,4 +74,3 @@ + (NSDictionary *)dictionaryByReplacingNullsWithStrings:(NSDictionary *)dict {
@end

#endif
#endif
Binary file not shown.

0 comments on commit 9933769

Please sign in to comment.