Skip to content
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

Merge releases/6.x.x/6.15.x/6.15.0-rc1 into main #135

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@

### <a id="plugin-build-for"> This plugin is built for

- Android AppsFlyer SDK **6.14.0**
- iOS AppsFlyer SDK **6.14.3**
- Android AppsFlyer SDK **6.15.0**
- iOS AppsFlyer SDK **6.15.0**

## <a id="breaking-changes-6-15-0"> ❗❗ Breaking changes when updating to v6.15.0 ❗❗
Starting from v6.15.0, this plugin works only with Capacitor 6. </br>
If you are still interested in using Capacitor 5, please follow the instructions [here](/docs/Installation.md#cap5) to install the latest version that supports Capacitor 5.

## <a id="breaking-changes-6-12-1"> ❗❗ Breaking changes when updating to v6.12.1 ❗❗
Starting from v6.12.1, this plugin works only with Capacitor 5. </br>
If you are still interested in using Capacitor 4, please follow the instructions [here](/docs/Installation.md#cap4) to install the latest version that supports Capacitor 4.



## <a id="breaking-changes"> ❗❗ Breaking changes when updating to v6.9.2 ❗❗
Starting from v6.9.2, this plugin works only with Capacitor 4. </br>
If you are still interested in using Capacitor 3, please follow the instructions [here](/docs/Installation.md#cap3) to install the latest version that supports Capacitor 3.
Expand Down
8 changes: 4 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ ext {
}

buildscript {
ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.8.20'
ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.9.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.0.0'
classpath 'com.android.tools.build:gradle:8.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'org.codehaus.groovy:groovy-json:3.0.9'
}
Expand All @@ -116,10 +116,10 @@ apply plugin: 'kotlin-android'

android {
namespace "capacitor.plugin.appsflyer.sdk"
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
defaultConfig {
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
versionCode Integer.parseInt(plugin_build_version)
versionName "$plugin_version"
buildConfigField "int", "VERSION_CODE", plugin_build_version
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,8 @@ const val AF_MANUAL_START = "manualStart"
const val AF_IS_SUBJECTED_TO_GDPR = "isUserSubjectToGDPR"
const val AF_CONSENT_FOR_DATA_USAGE = "hasConsentForDataUsage"
const val AF_CONSENT_FOR_ADS_PERSONALIZATION = "hasConsentForAdsPersonalization"
const val AF_MONETIZATION_NETWORK = "monetizationNetwork"
const val AF_CURRENCY_ISO4217_CODE = "currencyIso4217Code"
const val AF_REVENUE = "revenue"
const val AF_MEDIATION_NETWORK = "mediationNetwork"

Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,36 @@ class AppsFlyerPlugin : Plugin() {
call.resolve()
}

@PluginMethod(returnType = PluginMethod.RETURN_NONE)
fun logAdRevenue(call: PluginCall) {
val adRevenueDataJson = call.data ?: return call.reject("adRevenueData is missing, the data mandatory to use this API.")

// Parse the fields from the adRevenueDataJson object
val monetizationNetwork = adRevenueDataJson.getString(AF_MONETIZATION_NETWORK) ?: return call.reject("monetizationNetwork is missing")
val currencyIso4217Code = adRevenueDataJson.getString(AF_CURRENCY_ISO4217_CODE) ?: return call.reject("currencyIso4217Code is missing")
val revenue = adRevenueDataJson.getDouble(AF_REVENUE)
if (revenue.isNaN()) {
return call.reject("revenue is missing or not a number")
}
val additionalParams = AFHelpers.jsonToMap(adRevenueDataJson.getJSObject(AF_ADDITIONAL_PARAMETERS)) // can be nullable

// Convert the mediationNetwork string to the MediationNetwork enum
val mediationNetworkValue = adRevenueDataJson.getString(AF_MEDIATION_NETWORK) ?: return call.reject("mediationNetwork is missing")
val mediationNetwork = MediationNetwork.entries.find { it.value == mediationNetworkValue } ?: return call.reject("Invalid mediation network")

// Create the AFAdRevenueData object
val adRevenueData = AFAdRevenueData(
monetizationNetwork = monetizationNetwork,
mediationNetwork = mediationNetwork,
currencyIso4217Code = currencyIso4217Code,
revenue = revenue
)

AppsFlyerLib.getInstance().logAdRevenue(adRevenueData, additionalParams)

call.resolve()
}

private fun getDeepLinkListener(): DeepLinkListener {
return DeepLinkListener {
if (udl == true) {
Expand Down
64 changes: 64 additions & 0 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ The list of available methods for this plugin is described below.
* [`startSDK`](#startSDK) - Since 6.13.0
* [`enableTCFDataCollection`](#enableTCFDataCollection) - Since 6.13.0
* [`setConsentData`](#setConsentData) - Since 6.13.0
* [`logAdRevenue`](#logAdRevenue) - Since 6.15.0



Expand Down Expand Up @@ -980,6 +981,40 @@ If *GDPR applies* apply to the user perform the following:
```
*Please take a look how to properly setConsentData Manualy in [Set Consent For DMA Compliance](/docs/DMA.md#)*

--------------------

### logAdRevenue
```typescript
logAdRevenue(data: AFAdRevenueData): Promise<void>
```

Use this method to log your ad revenue.</br>
By attributing ad revenue, app owners gain the complete view of user LTV and campaign ROI.
Ad revenue is generated by displaying ads on rewarded videos, offer walls, interstitials, and banners in an app.

| Param | Type |
| ------------- | ------------------------------------------------------- |
| **`data`** | <code><a href="#AFAdRevenueData">AFAdRevenueData</a></code> |

**Returns:** <code>Promise</code>

**Usage Example:**
```typescript
const myAdditionalParams = {
spong: 'bob',
doctor: 'who'
};

const data: AFAdRevenueData = {
monetizationNetwork: "MoneyMoneyMoney",
mediationNetwork: MediationNetwork.IRONSOURCE,
currencyIso4217Code: "USD",
revenue: 200.0,
additionalParameters: myAdditionalParams
};

AppsFlyer.logAdRevenue(data);
```

## Interfaces

Expand Down Expand Up @@ -1286,6 +1321,16 @@ If *GDPR applies* apply to the user perform the following:
| **`hasConsentForDataUsage`** | <code>boolean</code>|
| **`hasConsentForAdsPersonalization`** | <code>boolean</code>|

#### AFAdRevenueData

| Prop | Type |
| ----------------- | ----------------------------------------------- |
| **`monetizationNetwork`** | <code>string</code>|
| **`mediationNetwork`** | <code><a href="#MediationNetwork">MediationNetwork</a></code>|
| **`currencyIso4217Code`** | <code>string</code>|
| **`revenue`** | <code>number</code>|
| **`additionalParameters?`** | <code><a href="#stringmap">StringMap</a></code>|

## Enums


Expand All @@ -1300,5 +1345,24 @@ If *GDPR applies* apply to the user perform the following:
| **`CONVERSION_CALLBACK`** | <code>'conversion_callback'</code> |
| **`OAOA_CALLBACK`** | <code>'oaoa_callback'</code> |
| **`UDL_CALLBACK`** | <code>'udl_callback'</code> |

#### MediationNetwork

| Members | Value |
| ----------------------------- | -------------------------------------- |
| **`IRONSOURCE`** | <code>'ironsource'</code> |
| **`APPLOVIN_MAX`** | <code>'applovinmax'</code> |
| **`GOOGLE_ADMOB`** | <code>'googleadmob'</code> |
| **`FYBER`** | <code>'fyber'</code> |
| **`APPODEAL`** | <code>'appodeal'</code> |
| **`ADMOST`** | <code>'Admost'</code> |
| **`TOPON`** | <code>'Topon'</code> |
| **`TRADPLUS`** | <code>'Tradplus'</code> |
| **`YANDEX`** | <code>'Yandex'</code> |
| **`CHARTBOOST`** | <code>'chartboost'</code> |
| **`UNITY`** | <code>'Unity'</code> |
| **`TOPON_PTE`** | <code>'toponpte'</code> |
| **`CUSTOM_MEDIATION`** | <code>'customMediation'</code> |
| **`DIRECT_MONETIZATION_NETWORK`** | <code>'directMonetizationNetwork'</code> |

</docgen-api>
2 changes: 1 addition & 1 deletion docs/Guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,4 +385,4 @@ You only need to add the referrer dependency, the SDK takes care of the rest:
[Huawei Install Referrer](https://dev.appsflyer.com/hc/docs/install-android-sdk#huawei-install-referrer)<br>
[Xiaomi GetApps store referrer](https://dev.appsflyer.com/hc/docs/install-android-sdk#xiaomi-getapps-store-referrer)<br>

**Note:** Satring plugin version 6.14.3, Huawei referrer is collected in a different way than it used to be, please follow the new instructions provided [here.](https://dev.appsflyer.com/hc/docs/install-android-sdk#huawei-install-referrer)
**Note:** Starting plugin version 6.14.3, Huawei referrer is collected in a different way than it used to be, please follow the new instructions provided [here.](https://dev.appsflyer.com/hc/docs/install-android-sdk#huawei-install-referrer)
13 changes: 13 additions & 0 deletions docs/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ The plugin available via npm. To install the plugin, please run the following co
npm install appsflyer-capacitor-plugin
npx cap sync
```

## <a id="cap5"> Capacitor 5 - Latest Version
The latest version that supports Capacitor 5 uses the following SDK versions:
- Android AppsFlyer SDK **6.14.0**
- iOS AppsFlyer SDK **6.14.3**

The plugin available via npm under the tag `latest-5`. To install the plugin, please run the following commands in your project root directory.

```bash
npm install appsflyer-capacitor-plugin@latest-5
npx cap sync
```

## <a id="cap4"> Capacitor 4 - Latest Version
The latest version that supports Capacitor 4 uses the following SDK versions:
- Android AppsFlyer SDK **6.10.3️**
Expand Down
Loading
Loading