From 5b86f026822f6366cd698ae9f6e4d15b0ceaed1a Mon Sep 17 00:00:00 2001 From: Paz Lavi Date: Tue, 16 Nov 2021 12:18:54 +0200 Subject: [PATCH 1/5] Add email encryption --- src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java b/src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java index ff021efc..c4b17ec9 100644 --- a/src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java +++ b/src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java @@ -1001,7 +1001,7 @@ private boolean setUserEmails(JSONArray args, CallbackContext callbackContext) { callbackContext.error(FAILURE); return true; } - AppsFlyerLib.getInstance().setUserEmails(emails); + AppsFlyerLib.getInstance().setUserEmails(AppsFlyerProperties.EmailsCryptType.SHA256, emails); callbackContext.success(SUCCESS); } catch (Exception e) { e.printStackTrace(); From f5c52138e3575b7dcf4f7e0736e42d45779bb70a Mon Sep 17 00:00:00 2001 From: Paz Lavi Date: Wed, 17 Nov 2021 14:17:56 +0200 Subject: [PATCH 2/5] run setUserEmails on a thread --- .../cordova/plugin/AppsFlyerPlugin.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java b/src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java index c4b17ec9..fd6179ec 100644 --- a/src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java +++ b/src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java @@ -995,18 +995,18 @@ private boolean enableFacebookDeferredApplinks(JSONArray args) { * @return */ private boolean setUserEmails(JSONArray args, CallbackContext callbackContext) { - try { - String[] emails = convertToStringArray(args); - if (emails == null || emails.length == 0) { - callbackContext.error(FAILURE); - return true; + cordova.getThreadPool().execute(() -> { + try { + String[] emails = convertToStringArray(args); + if (emails == null || emails.length == 0) { + callbackContext.error(FAILURE); + } + AppsFlyerLib.getInstance().setUserEmails(AppsFlyerProperties.EmailsCryptType.SHA256, emails); + callbackContext.success(SUCCESS); + } catch (Exception e) { + e.printStackTrace(); } - AppsFlyerLib.getInstance().setUserEmails(AppsFlyerProperties.EmailsCryptType.SHA256, emails); - callbackContext.success(SUCCESS); - } catch (Exception e) { - e.printStackTrace(); - } - + }); return true; } From d8c395a7e0e24ad9bfd40e4727f6612d2a6f3a0c Mon Sep 17 00:00:00 2001 From: Paz Lavi Date: Wed, 17 Nov 2021 14:24:54 +0200 Subject: [PATCH 3/5] Add `setPartnerData` API --- .../appsflyer/cordova/plugin/AppsFlyerPlugin.java | 15 +++++++++++++++ src/ios/AppsFlyerPlugin.m | 6 ++++++ www/appsflyer.js | 9 +++++++++ 3 files changed, 30 insertions(+) diff --git a/src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java b/src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java index fd6179ec..3bb48a98 100644 --- a/src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java +++ b/src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java @@ -158,6 +158,8 @@ public boolean execute(final String action, JSONArray args, CallbackContext call return setDisableAdvertisingIdentifier(args, callbackContext); } else if ("setAdditionalData".equals(action)) { return setAdditionalData(args); + } else if ("setPartnerData".equals(action)) { + return setPartnerData(args); } return false; @@ -1091,6 +1093,19 @@ private boolean setAdditionalData(JSONArray args) { return true; } + private boolean setPartnerData(JSONArray args) { + cordova.getThreadPool().execute(() -> { + try { + String partnerId = args.getString(0); + Map data = toObjectMap(args.getJSONObject(1)); + AppsFlyerLib.getInstance().setPartnerData(partnerId, data); + } catch (JSONException 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 diff --git a/src/ios/AppsFlyerPlugin.m b/src/ios/AppsFlyerPlugin.m index 5731a5e0..d127c37d 100755 --- a/src/ios/AppsFlyerPlugin.m +++ b/src/ios/AppsFlyerPlugin.m @@ -861,4 +861,10 @@ - (void)setAdditionalData:(CDVInvokedUrlCommand*)command{ [[AppsFlyerLib shared] setAdditionalData:additionalData]; } +- (void)setPartnerData:(CDVInvokedUrlCommand*)command{ + NSString *partnerId = (NSString*)[command.arguments objectAtIndex: 0]; + NSDictionary *data = (NSDictionary*)[command.arguments objectAtIndex: 1]; + [[AppsFlyerLib shared] setPartnerDataWithPartnerId:partnerId partnerInfo:data]; +} + @end diff --git a/www/appsflyer.js b/www/appsflyer.js index 0154e7db..a61e1a06 100644 --- a/www/appsflyer.js +++ b/www/appsflyer.js @@ -361,7 +361,16 @@ if (!window.CustomEvent) { */ AppsFlyer.prototype.setAdditionalData = function (additionalData){ exec(null, null, 'AppsFlyerPlugin', 'setAdditionalData', [additionalData]); + }; + /** + * The setPartnerData API allows sending custom data for partner integration purposes. + * Typically it is used to integrate on the SDK level with several external partner platforms + * @param partnerId - ID of the partner (usually suffixed with "_int") + * @param data - Customer data, depends on the integration configuration with the specific partner + */ + AppsFlyer.prototype.setPartnerData = function (partnerId, data){ + exec(null, null, 'AppsFlyerPlugin', 'setPartnerData', [partnerId, data]); }; module.exports = new AppsFlyer(); From 2cf13abc873567654a069c128abfdfbf5060ad31 Mon Sep 17 00:00:00 2001 From: Paz Lavi Date: Wed, 17 Nov 2021 14:35:48 +0200 Subject: [PATCH 4/5] add return on failure --- src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java b/src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java index 3bb48a98..714304ef 100644 --- a/src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java +++ b/src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java @@ -1002,6 +1002,7 @@ private boolean setUserEmails(JSONArray args, CallbackContext callbackContext) { String[] emails = convertToStringArray(args); if (emails == null || emails.length == 0) { callbackContext.error(FAILURE); + return; } AppsFlyerLib.getInstance().setUserEmails(AppsFlyerProperties.EmailsCryptType.SHA256, emails); callbackContext.success(SUCCESS); From 6b7ea404fb3906d9a3f79cb54948acd48b25ef6f Mon Sep 17 00:00:00 2001 From: Paz Lavi Date: Mon, 13 Dec 2021 14:35:42 +0200 Subject: [PATCH 5/5] update SDK to iOS 6.4.4 and Android 6.4.3 --- README.md | 4 ++-- RELEASENOTES.md | 10 ++++++++++ docs/API.md | 19 ++++++++++++++++++- docs/Guides.md | 20 ++++++++++---------- package.json | 2 +- plugin.xml | 2 +- src/android/cordovaAF.gradle | 2 +- 7 files changed, 43 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index d0d502ef..0faea4e0 100755 --- a/README.md +++ b/README.md @@ -41,8 +41,8 @@ You can read more [here](https://support.appsflyer.com/hc/en-us/articles/2070320 ### This plugin is built for -- iOS AppsFlyerSDK **v6.4.0** -- Android AppsFlyerSDK **v6.4.0** +- iOS AppsFlyerSDK **v6.4.4** +- Android AppsFlyerSDK **v6.4.3** ### ❗v6 Breaking Changes diff --git a/RELEASENOTES.md b/RELEASENOTES.md index be158200..1077d972 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -1,4 +1,14 @@ # Release Notes +### 6.4.4 +Release date: *2021-Dec-14* + +**Overview and Highlights:** + +- Cordova >> Android >> setUserEmails with no encryption available +- Cordova >> Add setPartnerData API +- Cordova >> Update iOS SDK to v6.4.4 +- Cordova >> Update Android SDK to v6.4.3 + ### 6.4.0 Release date: *2021-Sep-14* diff --git a/docs/API.md b/docs/API.md index 036cd7e6..c17e6fa0 100755 --- a/docs/API.md +++ b/docs/API.md @@ -47,6 +47,8 @@ The list of available methods for this plugin is described below. | [`disableSKAD`](#disableSKAD) | `(boolean disableSkad)` | disable or enable SKAD | | [`setCurrentDeviceLanguage`](#setCurrentDeviceLanguage) | `(string language)` | Set the language of the device. | | [`setAdditionalData`](#setAdditionalData) | `(Object additionalData)` | Allows you to add custom data to events sent from the SDK. | +| [`setPartnerData`](#setPartnerData) | `(partnerId, data)` | Allows sending custom data for partner integration purposes. | + --- @@ -680,7 +682,7 @@ appsFlyer.setCurrentDeviceLanguage('en'); | `language` | `string` | Set the language of the device. | --- -##### **`setAdditionalData(language): void`** +##### **`setAdditionalData(additionalData): void`** The setAdditionalData API allows you to add custom data to events sent from the SDK.
Typically it is used to integrate on the SDK level with several external partner platforms. @@ -697,6 +699,21 @@ appsFlyer.setAdditionalData({"aa":"cc", | ----------- |-----------------------------|--------------| | `additionalData` | `Object` | Set the language of the device. | +--- +#####
**`setPartnerData(partnerId, data): void`** +Allows sending custom data for partner integration purposes. + +*Example:* + +```javascript +appsFlyer.setPartnerData("af_int", {apps: "Flyer", cuid: "123abc"}); +``` + +| parameter | type | description | +| ----------- |-----------------------------|--------------| +| `partnerId` | `String` | ID of the partner (usually suffixed with "_int"). | +| `data` | `Object` | Customer data, depends on the integration configuration with the specific partner. | + --- ### Deep linking Tracking diff --git a/docs/Guides.md b/docs/Guides.md index ee4828c3..ec6e72e2 100755 --- a/docs/Guides.md +++ b/docs/Guides.md @@ -47,20 +47,20 @@ window.plugins.appsFlyer.initSdk(options, onSuccess, onError); ## Set plugin for IOS 14 -1. Add ```#import ``` in your ```AppDelegate.m``` file
-2. Add the ATT pop-up for IDFA collection. your ```AppDelegate.m``` should look like this: +1. Add ```#import ``` in your ```Classes/MainViewController.m``` file
+2. Add the ATT pop-up for IDFA collection. your ```MainViewController.m``` should look like this: ```javascript --(BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions -{ - self.viewController = [[MainViewController alloc] init]; - if (@available(iOS 14, *)) { - [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) { - //If you want to do something with the pop-up - }]; +- (void)viewDidLoad { + [super viewDidLoad]; + [self.launchView setAlpha:1]; + + if @available(iOS 14, *) { + [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) { + NSLog(@"Status: %lu", (unsigned long)status); + }]; } - return [super application:application didFinishLaunchingWithOptions:launchOptions]; } ``` diff --git a/package.json b/package.json index b9a22a82..dcd50fde 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-plugin-appsflyer-sdk", - "version": "6.4.0", + "version": "6.4.4", "description": "Cordova AppsFlyer SDK Plugin", "cordova": { "id": "cordova-plugin-appsflyer-sdk", diff --git a/plugin.xml b/plugin.xml index 52c4f330..36fe13ba 100644 --- a/plugin.xml +++ b/plugin.xml @@ -92,7 +92,7 @@ - + diff --git a/src/android/cordovaAF.gradle b/src/android/cordovaAF.gradle index b9dc6b77..1aa65bca 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.4.0@aar' + implementation 'com.appsflyer:af-android-sdk:6.4.3@aar' implementation 'com.android.support:support-annotations:28.0.0' }