Skip to content

Commit

Permalink
Merge pull request #101 from AppsFlyerSDK/releases/6.x.x/6.12.x/6.12.…
Browse files Browse the repository at this point in the history
…1-rc1

Merge releases/6.x.x/6.12.x/6.12.1-rc1 into main
  • Loading branch information
pazlavi authored Jul 31, 2023
2 parents d7aa149 + e9fe129 commit 5ab0709
Show file tree
Hide file tree
Showing 16 changed files with 98 additions and 71 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-apps-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'

- name: Setup Node.js
uses: actions/setup-node@v3
Expand All @@ -39,7 +39,7 @@ jobs:
gradle wrapper
echo "ls: $(ls)"
chmod +x ./gradlew
./gradlew wrapper --gradle-version 7.6.1
./gradlew wrapper --gradle-version 8.0.2
./gradlew clean assembleRelease
# Build-Capacitor-ios:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-to-QA.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ jobs:
chmod +x .github/workflows/scripts/releaseNotesGenerator.sh
.github/workflows/scripts/releaseNotesGenerator.sh $JIRA_TOKEN "$JIRA_FIXED_VERSION"
CHANGES=$(cat "$JIRA_FIXED_VERSION-releasenotes".txt)
curl -X POST -H 'Content-type: application/json' --data '{"jira_fixed_version": "'"${{env.JIRA_FIXED_VERSION}}"'", "deploy_type": "QA", "install_tag": "QA", "git_branch": "'"$RELEASE_BRANCH_NAME"'", "changes_and_fixes": "'"$CHANGES"'", "plugin_version": "'"${{env.PLUGIN_VERSION}}"'", "android_dependency": "'"$ANDROID_SDK_VERSION"'", "ios_dependency": "'"$IOS_SDK_VERSION"'"}' "$SLACK_TOKEN"
curl -X POST -H 'Content-type: application/json' --data '{"jira_fixed_version": "'"$JIRA_FIXED_VERSION"'", "deploy_type": "QA", "install_tag": "QA", "git_branch": "'"$RELEASE_BRANCH_NAME"'", "changes_and_fixes": "'"$CHANGES"'", "plugin_version": "'"${{env.PLUGIN_VERSION}}"'", "android_dependency": "'"$ANDROID_SDK_VERSION"'", "ios_dependency": "'"$IOS_SDK_VERSION"'"}' "$SLACK_TOKEN"
2 changes: 1 addition & 1 deletion .github/workflows/release-Production-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ jobs:
chmod +x .github/workflows/scripts/releaseNotesGenerator.sh
.github/workflows/scripts/releaseNotesGenerator.sh $JIRA_TOKEN "$JIRA_FIXED_VERSION"
CHANGES=$(cat "$JIRA_FIXED_VERSION-releasenotes".txt)
curl -X POST -H 'Content-type: application/json' --data '{"jira_fixed_version": "'"${{env.JIRA_FIXED_VERSION}}"'", "deploy_type": "Production", "install_tag": "latest", "git_branch": "'"$RELEASE_BRANCH_NAME"'", "changes_and_fixes": "'"$CHANGES"'", "plugin_version": "'"${{env.PLUGIN_VERSION}}"'", "android_dependency": "'"$ANDROID_SDK_VERSION"'", "ios_dependency": "'"$IOS_SDK_VERSION"'"}' "$SLACK_TOKEN"
curl -X POST -H 'Content-type: application/json' --data '{"jira_fixed_version": "'"$JIRA_FIXED_VERSION"'", "deploy_type": "Production", "install_tag": "latest", "git_branch": "'"$RELEASE_BRANCH_NAME"'", "changes_and_fixes": "'"$CHANGES"'", "plugin_version": "'"${{env.PLUGIN_VERSION}}"'", "android_dependency": "'"$ANDROID_SDK_VERSION"'", "ios_dependency": "'"$IOS_SDK_VERSION"'"}' "$SLACK_TOKEN"
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# node files
dist
node_modules

examples/CapacitorReact/android
examples/CapacitorReact/ios
examples/CapacitorReact/node_modules
examples/CapacitorReact/package-lock.json
# iOS files
Pods
Podfile.lock
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 6.12.1
Release date: *2023-07-31*

- Capacitor >> Update version to Capacitor v5

## 6.10.3
Release date: *2023-05-01*

Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@

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

- Android AppsFlyer SDK **6.10.3**
- iOS AppsFlyer SDK **6.10.1**
- Android AppsFlyer SDK **6.12.1**
- iOS AppsFlyer SDK **6.12.1**

## <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>
Expand Down
22 changes: 13 additions & 9 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ def getPluginBuildVersionFromNpm() {

ext {
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
af_sdk_version = getSDKVersionFromNpm()
plugin_version = getVersionFromNpm()
plugin_build_version = getPluginBuildVersionFromNpm()
}

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

android {
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
namespace "capacitor.plugin.appsflyer.sdk"
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
defaultConfig {
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
versionCode Integer.parseInt(plugin_build_version)
versionName "$plugin_version"
buildConfigField "int", "VERSION_CODE", plugin_build_version
Expand All @@ -71,8 +72,11 @@ android {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
buildFeatures {
buildConfig = true
}
}

Expand Down
3 changes: 1 addition & 2 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ org.gradle.jvmargs=-Xmx1536m
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

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-7.4.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="capacitor.plugin.appsflyer.sdk">
>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
Expand Down
30 changes: 14 additions & 16 deletions android/src/main/java/capacitor/plugin/appsflyer/sdk/AFHelpers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,28 @@ package capacitor.plugin.appsflyer.sdk
import android.os.Bundle
import android.util.Log
import com.getcapacitor.JSObject
import com.getcapacitor.PluginCall
import org.json.JSONException
import java.util.HashMap

object AFHelpers {

fun jsonToMap(json: JSObject?): Map<String, Any>? {
var newMap: MutableMap<String, Any>? = null
json?.run {
newMap = HashMap()
val iterator: Iterator<*> = keys()
while (iterator.hasNext()) {
val key = iterator.next() as String
newMap!![key] = get(key)
}
newMap = HashMap()
val iterator: Iterator<*> = keys()
while (iterator.hasNext()) {
val key = iterator.next() as String
newMap!![key] = get(key)
}
}
return newMap
}


fun jsonToStringMap(json: JSObject?): Map<String, String>? {
var newMap: MutableMap<String, String>? = null
json?.run {
newMap = HashMap()
newMap = HashMap()
try {
val iterator: Iterator<*> = keys()
while (iterator.hasNext()) {
Expand All @@ -45,14 +43,14 @@ object AFHelpers {

fun jsonToBundle(json: JSObject?): Bundle? {
val bundle = Bundle()
json?.run {
val iterator: Iterator<*> = keys()
while (iterator.hasNext()) {
val key = iterator.next() as String
val value =get(key) as String
bundle.putString(key,value )
}
json?.run {
val iterator: Iterator<*> = keys()
while (iterator.hasNext()) {
val key = iterator.next() as String
val value = get(key) as String
bundle.putString(key, value)
}
}
return bundle
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.appsflyer.deeplink.DeepLinkListener
import com.appsflyer.deeplink.DeepLinkResult
import com.appsflyer.internal.platform_extension.PluginInfo
import com.appsflyer.share.CrossPromotionHelper
import com.appsflyer.share.LinkGenerator
import com.appsflyer.share.ShareInviteHelper
import com.getcapacitor.JSObject
import com.getcapacitor.Plugin
Expand Down Expand Up @@ -245,7 +246,7 @@ class AppsFlyerPlugin : Plugin() {
}
}

@PluginMethod()
@PluginMethod
fun getAppsFlyerUID(call: PluginCall) {
val id = AppsFlyerLib.getInstance().getAppsFlyerUID(context)
val obj = JSObject().apply {
Expand All @@ -268,7 +269,7 @@ class AppsFlyerPlugin : Plugin() {
} ?: run { call.reject("Missing boolean value disable") }
}

@PluginMethod()
@PluginMethod
fun stop(call: PluginCall) {
val shouldStop = call.getBoolean(AF_STOP)
AppsFlyerLib.getInstance().apply {
Expand All @@ -283,7 +284,7 @@ class AppsFlyerPlugin : Plugin() {
}
}

@PluginMethod()
@PluginMethod
fun disableSKAdNetwork(call: PluginCall) {
call.unavailable()
}
Expand All @@ -296,7 +297,7 @@ class AppsFlyerPlugin : Plugin() {
} ?: run { call.reject("Missing boolean value shouldDisable") }
}

@PluginMethod()
@PluginMethod
fun disableCollectASA(call: PluginCall) {
call.unavailable()
}
Expand All @@ -313,7 +314,7 @@ class AppsFlyerPlugin : Plugin() {
}
}

@PluginMethod()
@PluginMethod
fun generateInviteLink(call: PluginCall) {

val linkGenerator = ShareInviteHelper.generateInviteUrl(context).apply {
Expand All @@ -328,7 +329,7 @@ class AppsFlyerPlugin : Plugin() {

}

val listener = object : CreateOneLinkHttpTask.ResponseListener {
val listener = object : LinkGenerator.ResponseListener {
override fun onResponse(s: String?) {
val obj = JSObject().apply {
put(AF_LINK_READY, s)
Expand Down Expand Up @@ -388,7 +389,7 @@ class AppsFlyerPlugin : Plugin() {
}
}

@PluginMethod()
@PluginMethod
fun getSdkVersion(call: PluginCall) {
val v = AppsFlyerLib.getInstance().sdkVersion
val obj = JSObject().apply {
Expand All @@ -397,7 +398,7 @@ class AppsFlyerPlugin : Plugin() {
call.resolve(obj)
}

@PluginMethod()
@PluginMethod
fun enableFacebookDeferredApplinks(call: PluginCall) {
val b = call.getBoolean(AF_FB)
if (b != null) {
Expand All @@ -412,7 +413,7 @@ class AppsFlyerPlugin : Plugin() {
}
}

@PluginMethod()
@PluginMethod
fun sendPushNotificationData(call: PluginCall) {
val json = call.getObject(AF_PUSH_PAYLOAD)
val i = activity.intent
Expand All @@ -424,7 +425,7 @@ class AppsFlyerPlugin : Plugin() {

}

@PluginMethod()
@PluginMethod
fun logCrossPromoteImpression(call: PluginCall) {
val appID =
call.getString(AF_APP_ID) ?: return call.reject("cannot extract the appID value")
Expand All @@ -445,7 +446,7 @@ class AppsFlyerPlugin : Plugin() {

}

@PluginMethod()
@PluginMethod
fun setUserEmails(call: PluginCall) {
val emails = call.getArray(AF_EMAILS)?.run {
toList<String>().toTypedArray()
Expand All @@ -466,7 +467,7 @@ class AppsFlyerPlugin : Plugin() {

}

@PluginMethod()
@PluginMethod
fun logLocation(call: PluginCall) {
val longitude =
call.getDouble(AF_LONGITUDE) ?: return call.reject("cannot extract the longitude value")
Expand All @@ -479,7 +480,7 @@ class AppsFlyerPlugin : Plugin() {

}

@PluginMethod()
@PluginMethod
fun setPhoneNumber(call: PluginCall) {
val phone = call.getString(AF_PHONE) ?: return call.reject("cannot extract the phone value")
AppsFlyerLib.getInstance().setPhoneNumber(phone)
Expand All @@ -489,7 +490,7 @@ class AppsFlyerPlugin : Plugin() {

}

@PluginMethod()
@PluginMethod
fun setPartnerData(call: PluginCall) {
val data = AFHelpers.jsonToMap(call.getObject(AF_DATA))
?: return call.reject("cannot extract the data value")
Expand All @@ -503,7 +504,7 @@ class AppsFlyerPlugin : Plugin() {

}

@PluginMethod()
@PluginMethod
fun logInvite(call: PluginCall) {
val data = AFHelpers.jsonToStringMap(call.getObject(AF_EVENT_PARAMETERS))
?: return call.reject("cannot extract the eventParameters value")
Expand Down Expand Up @@ -579,9 +580,7 @@ class AppsFlyerPlugin : Plugin() {
put("error", s)

}

notifyListeners(OAOA_CALLBACK, res)

}
}
}
Expand Down
12 changes: 12 additions & 0 deletions docs/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ The plugin available via npm. To install the plugin, please run the following co
npm install appsflyer-capacitor-plugin
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️**
- iOS AppsFlyer SDK **6.10.1️**

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

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


## <a id="cap3"> Capacitor 3 - Latest Version
The latest version that supports Capacitor 3 uses the following SDK versions:
Expand Down
Loading

0 comments on commit 5ab0709

Please sign in to comment.