Skip to content

Commit 8f066e2

Browse files
authored
Merge pull request #578 from AppsFlyerSDK/releases/6.x.x/6.15.x/6.15.1-rc1
Releases/6.x.x/6.15.x/6.15.1 rc1
2 parents d8b0801 + a1d466e commit 8f066e2

File tree

25 files changed

+406
-42
lines changed

25 files changed

+406
-42
lines changed

.github/workflows/build-apps-workflow.yml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,27 @@ on:
55

66
jobs:
77
Build-RN-android:
8-
runs-on: ubuntu-latest
9-
steps:
10-
- uses: actions/checkout@v3
11-
- name: install react-native-appsflyer on an Android app
12-
run: |
13-
cd demos/appsflyer-react-native-app
14-
yarn install
15-
yarn add ../../ --save
16-
- name: Build apk
17-
run: |
18-
cd demos/appsflyer-react-native-app/android
19-
chmod +x ./gradlew
20-
./gradlew assembleRelease
21-
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
12+
- name: Set up JDK 17
13+
uses: actions/setup-java@v2
14+
with:
15+
java-version: '17'
16+
distribution: 'adopt'
17+
18+
- name: install react-native-appsflyer on an Android app
19+
run: |
20+
cd demos/appsflyer-react-native-app
21+
yarn install
22+
yarn add ../../ --save
23+
24+
- name: Build apk
25+
run: |
26+
cd demos/appsflyer-react-native-app/android
27+
chmod +x ./gradlew
28+
./gradlew assembleRelease
2229
# Build-RN-ios:
2330
# runs-on: macos-latest
2431
# steps:
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
ios_sdk_version=$(cat react-native-appsflyer.podspec | grep '\'AppsFlyerFramework\' | grep -Eo '[0-9].[0-9]+.[0-9]+')
4-
android_sdk_version=$(cat android/build.gradle | grep 'com.appsflyer:af-android-sdk' | grep -Eo '[0-9].[0-9]+.[0-9]+')
5-
sed -i -e -r "s/Android AppsFlyer SDK \*\*v[0-9].[0-9]+.[0-9]+\*\*/Android AppsFlyer SDK \*\*v$android_sdk_version\*\*/g" README.md
6-
sed -i -e -r "s/iOS AppsFlyer SDK \*\*v[0-9].[0-9]+.[0-9]+\*\*/iOS AppsFlyer SDK \*\*v$ios_sdk_version\*\*/g" README.md
3+
ios_sdk_version=$(cat react-native-appsflyer.podspec | grep '\'AppsFlyerFramework\' | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')
4+
android_sdk_version=$(cat android/build.gradle | grep 'com.appsflyer:af-android-sdk' | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')
5+
sed -i -r "s/Android AppsFlyer SDK \*\*v[0-9]+\.[0-9]+\.[0-9]+\*\*/Android AppsFlyer SDK \*\*v$android_sdk_version\*\*/g" README.md
6+
sed -i -r "s/iOS AppsFlyer SDK \*\*v[0-9]+\.[0-9]+\.[0-9]+\*\*/iOS AppsFlyer SDK \*\*v$ios_sdk_version\*\*/g" README.md

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,5 @@ demos/appsflyer-expo-app/android
6565
demos/appsflyer-expo-app/.expo
6666
demos/appsflyer-expo-app/node_modules
6767
demos/appsflyer-expo-app/yarn.lock
68+
69+
demos/appsflyer-react-native-app/ios/AppsFlyerExample.xcodeproj/project.pbxproj

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 6.15.1
2+
Release date: *2024-09-15*
3+
4+
- React Native >> Update Plugin to v6.15.1
5+
- React native plugin >> UDL failed deferred deep linking
6+
17
## 6.14.3
28
Release date: *2024-04-28*
39

Docs/RN_API.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ The list of available methods for this plugin is described below.
3737
- [disableAdvertisingIdentifier](#disableAdvertisingIdentifier)
3838
- [enableTCFDataCollection](#enableTCFDataCollection)
3939
- [setConsentData](#setConsentData)
40+
- [logAdRevenue](#logAdRevenue)
4041
- [Android Only APIs](#android-only-apis)
4142
- [setCollectAndroidID](#setcollectandroidid)
4243
- [setCollectIMEI](#setcollectimei)
@@ -797,6 +798,45 @@ let GDPRUser = AppsFlyerConsent.forGDPRUser(true, false);
797798
appsFlyer.setConsentData(nonGDPRUser /**or**/ GDPRUser);
798799
```
799800

801+
### logAdRevenue - Since 6.15.1
802+
`logAdRevenue(data: AFAdRevenueData): void`
803+
804+
Use this method to log your ad revenue.</br>
805+
By attributing ad revenue, app owners gain the complete view of user LTV and campaign ROI.
806+
Ad revenue is generated by displaying ads on rewarded videos, offer walls, interstitials, and banners in an app.
807+
808+
#### Parameters
809+
810+
| Param | Type |
811+
| -------------- | ---------------------------------------------------------- |
812+
| **`data`** | `AFAdRevenueData` |
813+
814+
#### Usage Example for React Native:
815+
816+
```javascript
817+
const adRevenueData = {
818+
monetizationNetwork: 'AF-AdNetwork',
819+
mediationNetwork: MEDIATION_NETWORK.IRONSOURCE,
820+
currencyIso4217Code: 'USD',
821+
revenue: 1.23,
822+
additionalParameters: {
823+
customParam1: 'value1',
824+
customParam2: 'value2',
825+
}
826+
};
827+
828+
appsFlyer.logAdRevenue(adRevenueData);
829+
```
830+
831+
Here's how you use `appsFlyer.logAdRevenue` within a React Native app:
832+
833+
1. Prepare the `adRevenueData` object as shown, including any additional parameters you wish to track along with the ad revenue event.
834+
2. Call the `appsFlyer.logAdRevenue` method with the `adRevenueData` object.
835+
836+
By passing all the required fields in `AFAdRevenueData`, you help ensure accurate tracking within the AppsFlyer platform. This enables you to analyze your ad revenue alongside other user acquisition data to optimize your app's overall monetization strategy.
837+
838+
**Note:** The `additionalParameters` object is optional. You can add any additional data you want to log with the ad revenue event in this object. This can be useful for detailed analytics or specific event tracking later on. Make sure that the custom parameters follow the data types and structures specified by AppsFlyer in their documentation.
839+
800840
## Android Only APIs
801841

802842
### setCollectAndroidID

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717

1818
## <a id="breaking-changes"> ❗❗ Breaking changes when updating to v6.x.x❗❗
1919

20+
- From version `6.15.1`, upgraded to targetSDKVersion 34, Java 17, and Gradle 8.7 in [AppsFlyer Android SDK v6.15.1](https://support.appsflyer.com/hc/en-us/articles/115001256006-AppsFlyer-Android-SDK-release-notes).
21+
22+
- From version `6.15.1`, iOS Minimum deployment target is set to 12.0.
23+
2024
- From version `6.3.0`, we use `xcframework` for iOS platform. Then you need to use cocoapods version >= 1.10
2125

2226
- From version `6.2.30`, `logCrossPromotionAndOpenStore` api will register as `af_cross_promotion` instead of `af_app_invites` in your dashboard.<br>

android/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ buildscript {
1212
}
1313

1414
dependencies {
15-
classpath 'com.android.tools.build:gradle:4.0.0'
15+
classpath 'com.android.tools.build:gradle:7.2.2'
1616
}
1717
}
1818

1919

2020
apply plugin: 'com.android.library'
2121

2222
android {
23-
compileSdkVersion safeExtGet('compileSdkVersion', 28)
24-
buildToolsVersion safeExtGet('buildToolsVersion', '29.0.2')
23+
compileSdkVersion safeExtGet('compileSdkVersion', 34)
24+
buildToolsVersion safeExtGet('buildToolsVersion', '34.0.0')
2525

2626
defaultConfig {
2727
minSdkVersion safeExtGet('minSdkVersion', 16)
28-
targetSdkVersion safeExtGet('targetSdkVersion', 28)
28+
targetSdkVersion safeExtGet('targetSdkVersion', 34)
2929
versionCode 1
3030
versionName "1.0"
3131
ndk {
@@ -54,5 +54,5 @@ repositories {
5454
dependencies {
5555
implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
5656
implementation "com.android.installreferrer:installreferrer:${safeExtGet('installReferrerVersion', '2.1')}"
57-
api "com.appsflyer:af-android-sdk:${safeExtGet('appsflyerVersion', '6.14.0')}"
57+
api "com.appsflyer:af-android-sdk:${safeExtGet('appsflyerVersion', '6.15.1')}"
5858
}

android/src/main/java/com/appsflyer/reactnative/RNAppsFlyerConstants.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
public class RNAppsFlyerConstants {
88

9-
final static String PLUGIN_VERSION = "6.14.3";
9+
final static String PLUGIN_VERSION = "6.15.1";
1010
final static String NO_DEVKEY_FOUND = "No 'devKey' found or its empty";
1111
final static String UNKNOWN_ERROR = "AF Unknown Error";
1212
final static String SUCCESS = "Success";
@@ -52,5 +52,11 @@ public class RNAppsFlyerConstants {
5252
final static String VALIDATE_SUCCESS = "In-App Purchase Validation success";
5353
final static String VALIDATE_FAILED = "In-App Purchase Validation failed with error: ";
5454

55+
final static String MONETIZATION_NETWORK = "monetizationNetwork";
56+
final static String CURRENCY_ISO4217_CODE = "currencyIso4217Code";
57+
final static String AF_REVENUE = "revenue";
58+
final static String AF_MEDIATION_NETWORK = "mediationNetwork";
59+
final static String AF_ADDITIONAL_PARAMETERS = "additionalParameters";
60+
5561
}
5662

android/src/main/java/com/appsflyer/reactnative/RNAppsFlyerModule.java

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import com.facebook.react.bridge.ReactContextBaseJavaModule;
3232
import com.facebook.react.bridge.ReactMethod;
3333
import com.facebook.react.bridge.ReadableMap;
34+
import com.facebook.react.bridge.ReadableType;
3435
import com.facebook.react.bridge.ReadableArray;
3536
import com.facebook.react.modules.core.DeviceEventManagerModule;
3637

@@ -362,6 +363,59 @@ public void onError(int i, @NonNull String s) {
362363
}
363364
}
364365

366+
@ReactMethod
367+
public void logAdRevenue(ReadableMap adRevenueDictionary) {
368+
if (adRevenueDictionary == null || !adRevenueDictionary.keySetIterator().hasNextKey()) {
369+
Log.d("AppsFlyer", "adRevenueData is missing, the data is mandatory to use this API.");
370+
return;
371+
}
372+
373+
String monetizationNetwork = adRevenueDictionary.getString(MONETIZATION_NETWORK);
374+
if (monetizationNetwork == null) {
375+
Log.d("AppsFlyer", "monetizationNetwork is missing");
376+
return;
377+
}
378+
379+
String currencyIso4217Code = adRevenueDictionary.getString(CURRENCY_ISO4217_CODE);
380+
if (currencyIso4217Code == null) {
381+
Log.d("AppsFlyer", "currencyIso4217Code is missing");
382+
return;
383+
}
384+
385+
if (!adRevenueDictionary.hasKey(AF_REVENUE) || adRevenueDictionary.getType(AF_REVENUE) != ReadableType.Number) {
386+
Log.d("AppsFlyer", "revenue is missing or not a number");
387+
return;
388+
}
389+
double revenue = adRevenueDictionary.getDouble(AF_REVENUE);
390+
391+
ReadableMap additionalParameters = null;
392+
if (adRevenueDictionary.hasKey(AF_ADDITIONAL_PARAMETERS) && adRevenueDictionary.getType(AF_ADDITIONAL_PARAMETERS) == ReadableType.Map) {
393+
additionalParameters = adRevenueDictionary.getMap(AF_ADDITIONAL_PARAMETERS);
394+
}
395+
396+
String mediationNetworkValue = adRevenueDictionary.getString(AF_MEDIATION_NETWORK);
397+
if (mediationNetworkValue == null || mediationNetworkValue.isEmpty()) {
398+
Log.d("AppsFlyer", "mediationNetwork is missing");
399+
return;
400+
}
401+
402+
MediationNetwork mediationNetwork = MediationNetwork.valueOf(mediationNetworkValue.toUpperCase());
403+
if (mediationNetwork == null) {
404+
Log.d("AppsFlyer", "Invalid mediation network");
405+
return;
406+
}
407+
408+
AFAdRevenueData adRevenueData = new AFAdRevenueData(
409+
monetizationNetwork,
410+
mediationNetwork,
411+
currencyIso4217Code,
412+
revenue
413+
);
414+
415+
// Log the ad revenue to the AppsFlyer SDK
416+
AppsFlyerLib.getInstance().logAdRevenue(adRevenueData, RNUtil.toMap(additionalParameters));
417+
}
418+
365419
@ReactMethod
366420
public void getAppsFlyerUID(Callback callback) {
367421
String appId = AppsFlyerLib.getInstance().getAppsFlyerUID(getReactApplicationContext());

demos/appsflyer-react-native-app/android/app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ dependencies {
182182
implementation fileTree(dir: "libs", include: ["*.jar"])
183183
//noinspection GradleDynamicVersion
184184
implementation "com.facebook.react:react-native:+" // From node_modules
185+
implementation 'org.jetbrains:annotations:16.0.2'
185186

186187
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
187188

0 commit comments

Comments
 (0)