diff --git a/README.md b/README.md
index 3c7a7395..1946d917 100755
--- a/README.md
+++ b/README.md
@@ -36,8 +36,8 @@ You can read more [here](https://support.appsflyer.com/hc/en-us/articles/2070320
### This plugin is built for
-- iOS AppsFlyerSDK **v6.1.1**
-- Android AppsFlyerSDK **v6.1.0**
+- iOS AppsFlyerSDK **v6.1.3**
+- Android AppsFlyerSDK **v6.1.3**
### ❗v6 Breaking Changes
@@ -145,7 +145,32 @@ Check out our Sample-App **Let's cook!** [here](https://github.com/AppsFlyerSDK
So the latest version that can work with Ionic-Native for now is **5.4.30**
In case you are using Ionic framework, you have 2 options:
-### 1 - Using Ionic native plugin
+### 1. Using the `window` object directly
+Install the cordova plugin:
+```
+$ ionic cordova plugin add cordova-plugin-appsflyer-sdk
+```
+In your main ts file, declare a window variable:
+```javascript
+declare var window;
+```
+Now you can use the AppsFlyer plugin directly from cordova:
+```javascript
+import {Component} from '@angular/core';
+import {Platform} from '@ionic/angular';
+
+declare var window;
+...
+export class HomePage {
+ constructor(public platform: Platform) {
+ this.platform.ready().then(() => {
+ window.plugins.appsFlyer.initSdk(options, success, error);
+ });
+ }
+}
+```
+
+### 2 - Using Ionic native plugin
#### Ionic 4
run this commands:
**With Cordova**:
@@ -199,28 +224,4 @@ And finally in your main ts file:
```
import { Appsflyer } from '@ionic-native/appsflyer';
```
-### 2. Using the `window` object directly
-Install the cordova plugin:
-```
-$ ionic cordova plugin add cordova-plugin-appsflyer-sdk
-```
-In your main ts file, declare a window variable:
-```javascript
-declare var window;
-```
-Now you can use the AppsFlyer plugin directly from cordova:
-```javascript
-import {Component} from '@angular/core';
-import {Platform} from '@ionic/angular';
-
-declare var window;
-...
-export class HomePage {
- constructor(public platform: Platform) {
- this.platform.ready().then(() => {
- window.plugins.appsFlyer.initSdk(options, success, error);
- });
- }
-}
-```
Check out the full [API](/docs/API.md) for more information
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index f48980eb..98fd9ce2 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -1,4 +1,16 @@
# Release Notes
+### 6.1.30
+Release date **January 11, 2021**
+Release type: Major / **Minor** / Hotfix
+
+**Overview and Highlights:**
+
+- iOS SDK 6.1.3
+- Android SDK 6.1.3
+- setHost api
+- addPushNotificationDeepLinkPath api
+- get in-App events callbacks from sdk
+
### 6.1.20
Release date **December 16, 2020**
Release type: Major / **Minor** / Hotfix
diff --git a/docs/API.md b/docs/API.md
index 683a0cb8..f6248e9e 100755
--- a/docs/API.md
+++ b/docs/API.md
@@ -38,7 +38,9 @@ The list of available methods for this plugin is described below.
| [`setOneLinkCustomDomains`](#setOneLinkCustomDomains) | `(domains, function success, function error)` | Set Onelink custom/branded domains |
| [`enableFacebookDeferredApplinks`](#enableFacebookDeferredApplinks) | `(boolean isEnabled)` | support deferred deep linking from Facebook Ads |
| [`setUserEmails`](#setUserEmails) | `(emails, function success)` | Set user emails for FB Advanced Matching |
-| [`setPhoneNumber`](#setPhoneNumber) | `(String phoneNumber, function successr)` | Set phone number for FB Advanced Matching |
+| [`setPhoneNumber`](#setPhoneNumber) | `(String phoneNumber, function success)` | Set phone number for FB Advanced Matching |
+| [`setHost`](#setHost) | `(String hostPrefix, String hostName)` | Set custom host prefix and host name |
+| [`addPushNotificationDeepLinkPath`](#addPushNotificationDeepLinkPath) | `(path)` | configure push notification deep link resolution |
---
@@ -99,8 +101,8 @@ to track ROI (Return on Investment) and LTV (Lifetime Value).
| ----------- |-----------------------------|--------------|
| `eventName` | `String` | custom event name, is presented in your dashboard. See the Event list [HERE](https://github.com/AppsFlyerSDK/cordova-plugin-appsflyer-sdk/blob/master/src/ios/AppsFlyerTracker.h) |
| `eventValue` | `Object` | event details |
-| `onSuccess` | `(message: string)=>void` | event details |
-| `onError` | `(message: string)=>void` | event details |
+| `onSuccess` | `function` | triggered when the event was sent successfully. returns the event's name. can be Null |
+| `onError` | `function` | triggered when an error occurred. returns an error message. can be Null |
*Example:*
@@ -121,6 +123,8 @@ var eventValues = {
};
window.plugins.appsFlyer.logEvent(eventName, eventValues, successTrackEvent, failureTrackEvent);
+//OR
+window.plugins.appsFlyer.logEvent(eventName, eventValues, null, null);
```
---
@@ -569,6 +573,39 @@ window.plugins.appsFlyer.setPhoneNumber(phoneNumber, successC);
| `phoneNumber` | `String` | String phone number |
| `successC` | `function` | will trigger if the number was sent successfully |
+---
+##### **`setHost(String hostPrefix, String hostName): void`**
+Set custom host prefix and host name
+
+*Example:*
+
+```javascript
+let prefix = "another"
+let name = "host"
+window.plugins.appsFlyer.setHost(prefix, name);
+```
+
+| parameter | type | description |
+| ----------- |-----------------------------|--------------|
+| `hostPrefix` | `String` | host prefix |
+| `hostName` | `String` | host name |
+
+---
+##### **`addPushNotificationDeepLinkPath(path): void`**
+The addPushNotificationDeepLinkPath method provides app owners with a flexible interface for configuring how deep links are extracted from push notification payloads. for more information: [here](https://support.appsflyer.com/hc/en-us/articles/207032126-Android-SDK-integration-for-developers#core-apis-65-configure-push-notification-deep-link-resolution)
+❗Important❗ addPushNotificationDeepLinkPath must be called before calling initSDK
+
+*Example:*
+
+```javascript
+let path = ["go", "to", "this", "path"]
+window.plugins.appsFlyer.addPushNotificationDeepLinkPath(path);
+```
+
+| parameter | type | description |
+| ----------- |-----------------------------|--------------|
+| `path` | `String[]` | strings array of the path |
+
---
### Deep linking Tracking
diff --git a/docs/RELEASENOTES.md b/docs/RELEASENOTES.md
index 0150eb8e..f86120e7 100755
--- a/docs/RELEASENOTES.md
+++ b/docs/RELEASENOTES.md
@@ -1,4 +1,16 @@
# Release Notes
+### 6.1.30
+Release date **January 11, 2021**
+Release type: Major / **Minor** / Hotfix
+
+**Overview and Highlights:**
+
+- iOS SDK 6.1.3
+- Android SDK 6.1.3
+- setHost api
+- addPushNotificationDeepLinkPath api
+- get in-App events callbacks from sdk
+
### 6.1.20
Release date **December 16, 2020**
Release type: Major / **Minor** / Hotfix
diff --git a/package.json b/package.json
index 48e0ddae..7b1dc6cf 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-appsflyer-sdk",
- "version": "6.1.20",
+ "version": "6.1.30",
"description": "Cordova AppsFlyer SDK Plugin",
"cordova": {
"id": "cordova-plugin-appsflyer-sdk",
diff --git a/plugin.xml b/plugin.xml
index 27acd9dc..aecf6b0a 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -21,7 +21,7 @@
+ version="6.1.30">
AppsFlyer
Cordova Plugin AppsFlyer
Apache 2.0
@@ -89,7 +89,7 @@
-
+
diff --git a/src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java b/src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java
index 9e07fbce..ee906230 100644
--- a/src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java
+++ b/src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java
@@ -3,6 +3,7 @@
import android.net.Uri;
import java.util.ArrayList;
+import java.util.EmptyStackException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -112,6 +113,10 @@ public boolean execute(final String action, JSONArray args, CallbackContext call
return setPhoneNumber(args, callbackContext);
} else if ("setUserEmails".equals(action)) {
return setUserEmails(args, callbackContext);
+ } else if ("setHost".equals(action)) {
+ return setHost(args);
+ } else if ("addPushNotificationDeepLinkPath".equals(action)) {
+ return addPushNotificationDeepLinkPath(args);
}
return false;
@@ -373,8 +378,17 @@ private boolean logEvent(JSONArray parameters, final CallbackContext callbackCon
}
Context c = this.cordova.getActivity().getApplicationContext();
- AppsFlyerLib.getInstance().logEvent(c, eventName, eventValues);
- callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, eventName));
+ AppsFlyerLib.getInstance().logEvent(c, eventName, eventValues, callbackContext == null ? null : new AppsFlyerRequestListener() {
+ @Override
+ public void onSuccess() {
+ callbackContext.success(eventName);
+ }
+
+ @Override
+ public void onError(int i, String s) {
+ callbackContext.error(s);
+ }
+ });
return true;
}
@@ -890,6 +904,7 @@ private boolean setOneLinkCustomDomains(JSONArray parameters, CallbackContext ca
* use this api If you need deep linking data from Facebook, deferred deep linking, Dynamic Product Ads, or reasons that
* unrelated to attribution such as authentication, ad monetization, social sharing, user invites, etc.
* More information here: https://support.appsflyer.com/hc/en-us/articles/207033826-Facebook-Ads-setup-guide#integration
+ *
* @param args: boolean value
* @return
*/
@@ -907,7 +922,8 @@ private boolean enableFacebookDeferredApplinks(JSONArray args) {
/**
* Facebook Advanced Matching
- * @param args: Strings array of emails
+ *
+ * @param args: Strings array of emails
* @param callbackContext: success functions
* @return
*/
@@ -926,7 +942,8 @@ private boolean setUserEmails(JSONArray args, CallbackContext callbackContext) {
/**
* Facebook Advanced Matching
- * @param args: phone number
+ *
+ * @param args: phone number
* @param callbackContext
* @return
*/
@@ -942,6 +959,36 @@ private boolean setPhoneNumber(JSONArray args, CallbackContext callbackContext)
return true;
}
+ /**
+ * set custom host prefix and host name
+ *
+ * @param args: host prefix and host name
+ * @return
+ */
+ private boolean setHost(JSONArray args) {
+ try {
+ String prefix = args.getString(0);
+ String name = args.getString(1);
+ AppsFlyerLib.getInstance().setHost(prefix, name);
+ Log.d("AppsFlyer", prefix + "." + name);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return true;
+ }
+
+ private boolean addPushNotificationDeepLinkPath(JSONArray args) {
+ try {
+ String pathStr = args.getString(0);
+ String[] path = stringToArray(pathStr);
+ AppsFlyerLib.getInstance().addPushNotificationDeepLinkPath(path);
+ Log.d("AppsFlyer", path.toString());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return true;
+ }
+
/**
* takes string representation of a string array and converts it to an array. use this method because old version of cordova cannot pass an array to native.
* newer versions can, but can break flow to older users
@@ -953,7 +1000,6 @@ private String[] stringToArray(String str) {
String[] realArr = null;
str = str.substring(1, str.length() - 1);
str = str.replaceAll(" ", "");
-
realArr = str.split("[ ,]");
for (String el : realArr) {
el = el.substring(1, el.length() - 1);
diff --git a/src/android/cordovaAF.gradle b/src/android/cordovaAF.gradle
index 3b9d69ab..ade4e06c 100644
--- a/src/android/cordovaAF.gradle
+++ b/src/android/cordovaAF.gradle
@@ -4,6 +4,6 @@ repositories {
dependencies {
implementation 'com.android.installreferrer:installreferrer:2.1'
- implementation 'com.appsflyer:af-android-sdk:6.1.0@aar'
+ implementation 'com.appsflyer:af-android-sdk:6.1.3@aar'
}
diff --git a/src/ios/AppsFlyerDeepLinkObserver.h b/src/ios/AppsFlyerDeepLinkObserver.h
new file mode 100644
index 00000000..395a6d45
--- /dev/null
+++ b/src/ios/AppsFlyerDeepLinkObserver.h
@@ -0,0 +1,29 @@
+//
+// AFSDKDeepLinkObserver.h
+// AppsFlyerLib
+//
+// Created by Andrii Hahan on 09.09.2020.
+//
+
+#import
+
+@class AppsFlyerDeepLinkResult;
+
+NS_SWIFT_NAME(DeepLinkObserverDelegate)
+@protocol AppsFlyerDeepLinkObserverDelegate
+
+@optional
+- (void)didResolveDeepLink:(AppsFlyerDeepLinkResult *_Nonnull)result;
+
+@end
+
+NS_ASSUME_NONNULL_BEGIN
+NS_SWIFT_NAME(DeepLinkObserver)
+@interface AppsFlyerDeepLinkObserver : NSObject
+
+@property(weak, nonatomic) id delegate;
+@property NSTimeInterval timeoutInterval;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/src/ios/AppsFlyerLib.h b/src/ios/AppsFlyerLib.h
index 60572408..8a4c602a 100644
--- a/src/ios/AppsFlyerLib.h
+++ b/src/ios/AppsFlyerLib.h
@@ -2,7 +2,7 @@
// AppsFlyerLib.h
// AppsFlyerLib
//
-// AppsFlyer iOS SDK 6.1.1 (33)
+// AppsFlyer iOS SDK 6.1.3 (43)
// Copyright (c) 2012-2020 AppsFlyer Ltd. All rights reserved.
//
@@ -298,6 +298,8 @@ NS_SWIFT_NAME(waitForATTUserAuthorization(timeoutInterval:));
*/
@property(atomic) BOOL disableCollectASA;
+@property(nonatomic) BOOL disableAppleAdsAttribution;
+
/**
AppsFlyer delegate. See `AppsFlyerLibDelegate`
*/
@@ -615,6 +617,14 @@ NS_SWIFT_NAME(logEvent(name:values:completionHandler:));
parameters:(NSDictionary *)parameters
NS_SWIFT_NAME(appendParametersToDeeplinkURL(contains:parameters:));
+/**
+ Adds array of keys, which are used to compose key path
+ to resolve deeplink from push notification payload `userInfo`.
+
+ @param deepLinkPath an array of strings which contains keys to search for deeplink in payload.
+ */
+- (void)addPushNotificationDeepLinkPath:(NSArray *)deepLinkPath;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/src/ios/AppsFlyerPlugin.m b/src/ios/AppsFlyerPlugin.m
index b8fd1372..78610684 100755
--- a/src/ios/AppsFlyerPlugin.m
+++ b/src/ios/AppsFlyerPlugin.m
@@ -234,12 +234,18 @@ - (void)logEvent:(CDVInvokedUrlCommand*)command {
return;
}
- [[AppsFlyerLib shared] logEvent:eventName withValues:eventValues];
-
- CDVPluginResult *pluginResult = [ CDVPluginResult resultWithStatus: CDVCommandStatus_OK
- messageAsString:eventName
- ];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ [[AppsFlyerLib shared] logEventWithEventName:eventName eventValues:eventValues completionHandler:^(NSDictionary * _Nullable dictionary, NSError * _Nullable error) {
+ if(error != nil){
+ CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString: [error localizedDescription]];
+ [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
+ return;
+ }else{
+ CDVPluginResult *pluginResult = [ CDVPluginResult resultWithStatus: CDVCommandStatus_OK
+ messageAsString:eventName
+ ];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }
+ }];
}
/**
@@ -740,6 +746,24 @@ - (void)setUseReceiptValidationSandbox:(CDVInvokedUrlCommand*)command {
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
+- (void)setHost:(CDVInvokedUrlCommand*)command {
+ NSString* prefix = [command.arguments objectAtIndex:0];
+ NSString* name = [command.arguments objectAtIndex:1];
+ [[AppsFlyerLib shared] setHost:name withHostPrefix:prefix];
+ NSLog(@"[DEBUG] AppsFlyer: %@.%@",prefix, name);
+
+}
+
+- (void)addPushNotificationDeepLinkPath:(CDVInvokedUrlCommand*)command {
+ NSArray* path = command.arguments;
+ if (path.count == 0) {
+ return;
+ }
+ [[AppsFlyerLib shared] addPushNotificationDeepLinkPath:path];
+ NSLog(@"[DEBUG] AppsFlyer: %@", path);
+
+}
+
@end
diff --git a/www/appsflyer.js b/www/appsflyer.js
index beaaffa4..12cba2ce 100644
--- a/www/appsflyer.js
+++ b/www/appsflyer.js
@@ -302,5 +302,23 @@ if (!window.CustomEvent) {
AppsFlyer.prototype.setUserEmails = function (userEmails, successC) {
exec(successC, null, 'AppsFlyerPlugin', 'setUserEmails', [userEmails]);
};
+
+ /**
+ * Set a custom host
+ * @param hostPrefix
+ * @param hostName
+ */
+ AppsFlyer.prototype.setHost = function (hostPrefix, hostName) {
+ exec(null, null, 'AppsFlyerPlugin', 'setHost', [hostPrefix, hostName]);
+ };
+
+ /**
+ * The addPushNotificationDeepLinkPath method provides app owners with a flexible interface for configuring how deep links are extracted from push notification payloads.
+ * for more information: https://support.appsflyer.com/hc/en-us/articles/207032126-Android-SDK-integration-for-developers#core-apis-65-configure-push-notification-deep-link-resolution
+ * @param path: an array of string that represents the path
+ */
+ AppsFlyer.prototype.addPushNotificationDeepLinkPath = function (path) {
+ exec(null, null, 'AppsFlyerPlugin', 'addPushNotificationDeepLinkPath', [path]);
+ };
module.exports = new AppsFlyer();
})(window);