Skip to content

Commit 1698239

Browse files
update-to-6.1.30
update to 6.1.30
2 parents 1529baf + e6e8fd8 commit 1698239

File tree

12 files changed

+235
-46
lines changed

12 files changed

+235
-46
lines changed

README.md

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ You can read more [here](https://support.appsflyer.com/hc/en-us/articles/2070320
3636

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

39-
- iOS AppsFlyerSDK **v6.1.1**
40-
- Android AppsFlyerSDK **v6.1.0**
39+
- iOS AppsFlyerSDK **v6.1.3**
40+
- Android AppsFlyerSDK **v6.1.3**
4141

4242
### <a id="breakingChanges"> ❗v6 Breaking Changes
4343

@@ -145,7 +145,32 @@ Check out our Sample-App **Let's cook!** [here](https://github.com/AppsFlyerSDK
145145
So the latest version that can work with Ionic-Native for now is **5.4.30**<br>
146146

147147
In case you are using Ionic framework, you have 2 options:
148-
### 1 - Using Ionic native plugin
148+
### 1. Using the `window` object directly
149+
Install the cordova plugin:
150+
```
151+
$ ionic cordova plugin add cordova-plugin-appsflyer-sdk
152+
```
153+
In your main ts file, declare a window variable:
154+
```javascript
155+
declare var window;
156+
```
157+
Now you can use the AppsFlyer plugin directly from cordova:
158+
```javascript
159+
import {Component} from '@angular/core';
160+
import {Platform} from '@ionic/angular';
161+
162+
declare var window;
163+
...
164+
export class HomePage {
165+
constructor(public platform: Platform) {
166+
this.platform.ready().then(() => {
167+
window.plugins.appsFlyer.initSdk(options, success, error);
168+
});
169+
}
170+
}
171+
```
172+
173+
### 2 - Using Ionic native plugin
149174
#### Ionic 4
150175
run this commands:
151176
**With Cordova**:
@@ -199,28 +224,4 @@ And finally in your main ts file:
199224
```
200225
import { Appsflyer } from '@ionic-native/appsflyer';
201226
```
202-
### 2. Using the `window` object directly
203-
Install the cordova plugin:
204-
```
205-
$ ionic cordova plugin add cordova-plugin-appsflyer-sdk
206-
```
207-
In your main ts file, declare a window variable:
208-
```javascript
209-
declare var window;
210-
```
211-
Now you can use the AppsFlyer plugin directly from cordova:
212-
```javascript
213-
import {Component} from '@angular/core';
214-
import {Platform} from '@ionic/angular';
215-
216-
declare var window;
217-
...
218-
export class HomePage {
219-
constructor(public platform: Platform) {
220-
this.platform.ready().then(() => {
221-
window.plugins.appsFlyer.initSdk(options, success, error);
222-
});
223-
}
224-
}
225-
```
226227
Check out the full [API](/docs/API.md) for more information

RELEASENOTES.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
# Release Notes
2+
### 6.1.30
3+
Release date **January 11, 2021**
4+
Release type: Major / **Minor** / Hotfix
5+
6+
**Overview and Highlights:**
7+
8+
- iOS SDK 6.1.3
9+
- Android SDK 6.1.3
10+
- setHost api
11+
- addPushNotificationDeepLinkPath api
12+
- get in-App events callbacks from sdk
13+
214
### 6.1.20
315
Release date **December 16, 2020**
416
Release type: Major / **Minor** / Hotfix

docs/API.md

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ The list of available methods for this plugin is described below.
3838
| [`setOneLinkCustomDomains`](#setOneLinkCustomDomains) | `(domains, function success, function error)` | Set Onelink custom/branded domains |
3939
| [`enableFacebookDeferredApplinks`](#enableFacebookDeferredApplinks) | `(boolean isEnabled)` | support deferred deep linking from Facebook Ads |
4040
| [`setUserEmails`](#setUserEmails) | `(emails, function success)` | Set user emails for FB Advanced Matching |
41-
| [`setPhoneNumber`](#setPhoneNumber) | `(String phoneNumber, function successr)` | Set phone number for FB Advanced Matching |
41+
| [`setPhoneNumber`](#setPhoneNumber) | `(String phoneNumber, function success)` | Set phone number for FB Advanced Matching |
42+
| [`setHost`](#setHost) | `(String hostPrefix, String hostName)` | Set custom host prefix and host name |
43+
| [`addPushNotificationDeepLinkPath`](#addPushNotificationDeepLinkPath) | `(path)` | configure push notification deep link resolution |
4244

4345

4446
---
@@ -99,8 +101,8 @@ to track ROI (Return on Investment) and LTV (Lifetime Value).
99101
| ----------- |-----------------------------|--------------|
100102
| `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) |
101103
| `eventValue` | `Object` | event details |
102-
| `onSuccess` | `(message: string)=>void` | event details |
103-
| `onError` | `(message: string)=>void` | event details |
104+
| `onSuccess` | `function` | triggered when the event was sent successfully. returns the event's name. can be Null |
105+
| `onError` | `function` | triggered when an error occurred. returns an error message. can be Null |
104106

105107
*Example:*
106108

@@ -121,6 +123,8 @@ var eventValues = {
121123
};
122124

123125
window.plugins.appsFlyer.logEvent(eventName, eventValues, successTrackEvent, failureTrackEvent);
126+
//OR
127+
window.plugins.appsFlyer.logEvent(eventName, eventValues, null, null);
124128
```
125129
---
126130

@@ -569,6 +573,39 @@ window.plugins.appsFlyer.setPhoneNumber(phoneNumber, successC);
569573
| `phoneNumber` | `String` | String phone number |
570574
| `successC` | `function` | will trigger if the number was sent successfully |
571575

576+
---
577+
##### <a id="setHost"> **`setHost(String hostPrefix, String hostName): void`**
578+
Set custom host prefix and host name<br>
579+
580+
*Example:*
581+
582+
```javascript
583+
let prefix = "another"
584+
let name = "host"
585+
window.plugins.appsFlyer.setHost(prefix, name);
586+
```
587+
588+
| parameter | type | description |
589+
| ----------- |-----------------------------|--------------|
590+
| `hostPrefix` | `String` | host prefix |
591+
| `hostName` | `String` | host name |
592+
593+
---
594+
##### <a id="addPushNotificationDeepLinkPath"> **`addPushNotificationDeepLinkPath(path): void`**
595+
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)
596+
❗Important❗ addPushNotificationDeepLinkPath must be called before calling initSDK
597+
598+
*Example:*
599+
600+
```javascript
601+
let path = ["go", "to", "this", "path"]
602+
window.plugins.appsFlyer.addPushNotificationDeepLinkPath(path);
603+
```
604+
605+
| parameter | type | description |
606+
| ----------- |-----------------------------|--------------|
607+
| `path` | `String[]` | strings array of the path |
608+
572609
---
573610

574611
### <a id="deep-linking-tracking"> Deep linking Tracking

docs/RELEASENOTES.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
# Release Notes
2+
### 6.1.30
3+
Release date **January 11, 2021**
4+
Release type: Major / **Minor** / Hotfix
5+
6+
**Overview and Highlights:**
7+
8+
- iOS SDK 6.1.3
9+
- Android SDK 6.1.3
10+
- setHost api
11+
- addPushNotificationDeepLinkPath api
12+
- get in-App events callbacks from sdk
13+
214
### 6.1.20
315
Release date **December 16, 2020**
416
Release type: Major / **Minor** / Hotfix

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cordova-plugin-appsflyer-sdk",
3-
"version": "6.1.20",
3+
"version": "6.1.30",
44
"description": "Cordova AppsFlyer SDK Plugin",
55
"cordova": {
66
"id": "cordova-plugin-appsflyer-sdk",

plugin.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
2222
xmlns:android="http://schemas.android.com/apk/res/android"
2323
id="cordova-plugin-appsflyer-sdk"
24-
version="6.1.20">
24+
version="6.1.30">
2525
<name>AppsFlyer</name>
2626
<description>Cordova Plugin AppsFlyer</description>
2727
<license>Apache 2.0</license>
@@ -89,7 +89,7 @@
8989
<config>
9090
</config>
9191
<pods use-frameworks="true">
92-
<pod name="AppsFlyerFramework" spec="6.1.1"/>
92+
<pod name="AppsFlyerFramework" spec="6.1.3"/>
9393
</pods>
9494
</podspec>
9595
</platform>

src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.net.Uri;
44

55
import java.util.ArrayList;
6+
import java.util.EmptyStackException;
67
import java.util.HashMap;
78
import java.util.Iterator;
89
import java.util.Map;
@@ -112,6 +113,10 @@ public boolean execute(final String action, JSONArray args, CallbackContext call
112113
return setPhoneNumber(args, callbackContext);
113114
} else if ("setUserEmails".equals(action)) {
114115
return setUserEmails(args, callbackContext);
116+
} else if ("setHost".equals(action)) {
117+
return setHost(args);
118+
} else if ("addPushNotificationDeepLinkPath".equals(action)) {
119+
return addPushNotificationDeepLinkPath(args);
115120
}
116121

117122
return false;
@@ -373,8 +378,17 @@ private boolean logEvent(JSONArray parameters, final CallbackContext callbackCon
373378
}
374379

375380
Context c = this.cordova.getActivity().getApplicationContext();
376-
AppsFlyerLib.getInstance().logEvent(c, eventName, eventValues);
377-
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, eventName));
381+
AppsFlyerLib.getInstance().logEvent(c, eventName, eventValues, callbackContext == null ? null : new AppsFlyerRequestListener() {
382+
@Override
383+
public void onSuccess() {
384+
callbackContext.success(eventName);
385+
}
386+
387+
@Override
388+
public void onError(int i, String s) {
389+
callbackContext.error(s);
390+
}
391+
});
378392

379393
return true;
380394
}
@@ -890,6 +904,7 @@ private boolean setOneLinkCustomDomains(JSONArray parameters, CallbackContext ca
890904
* use this api If you need deep linking data from Facebook, deferred deep linking, Dynamic Product Ads, or reasons that
891905
* unrelated to attribution such as authentication, ad monetization, social sharing, user invites, etc.
892906
* More information here: https://support.appsflyer.com/hc/en-us/articles/207033826-Facebook-Ads-setup-guide#integration
907+
*
893908
* @param args: boolean value
894909
* @return
895910
*/
@@ -907,7 +922,8 @@ private boolean enableFacebookDeferredApplinks(JSONArray args) {
907922

908923
/**
909924
* Facebook Advanced Matching
910-
* @param args: Strings array of emails
925+
*
926+
* @param args: Strings array of emails
911927
* @param callbackContext: success functions
912928
* @return
913929
*/
@@ -926,7 +942,8 @@ private boolean setUserEmails(JSONArray args, CallbackContext callbackContext) {
926942

927943
/**
928944
* Facebook Advanced Matching
929-
* @param args: phone number
945+
*
946+
* @param args: phone number
930947
* @param callbackContext
931948
* @return
932949
*/
@@ -942,6 +959,36 @@ private boolean setPhoneNumber(JSONArray args, CallbackContext callbackContext)
942959
return true;
943960
}
944961

962+
/**
963+
* set custom host prefix and host name
964+
*
965+
* @param args: host prefix and host name
966+
* @return
967+
*/
968+
private boolean setHost(JSONArray args) {
969+
try {
970+
String prefix = args.getString(0);
971+
String name = args.getString(1);
972+
AppsFlyerLib.getInstance().setHost(prefix, name);
973+
Log.d("AppsFlyer", prefix + "." + name);
974+
} catch (Exception e) {
975+
e.printStackTrace();
976+
}
977+
return true;
978+
}
979+
980+
private boolean addPushNotificationDeepLinkPath(JSONArray args) {
981+
try {
982+
String pathStr = args.getString(0);
983+
String[] path = stringToArray(pathStr);
984+
AppsFlyerLib.getInstance().addPushNotificationDeepLinkPath(path);
985+
Log.d("AppsFlyer", path.toString());
986+
} catch (Exception e) {
987+
e.printStackTrace();
988+
}
989+
return true;
990+
}
991+
945992
/**
946993
* 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.
947994
* newer versions can, but can break flow to older users
@@ -953,7 +1000,6 @@ private String[] stringToArray(String str) {
9531000
String[] realArr = null;
9541001
str = str.substring(1, str.length() - 1);
9551002
str = str.replaceAll(" ", "");
956-
9571003
realArr = str.split("[ ,]");
9581004
for (String el : realArr) {
9591005
el = el.substring(1, el.length() - 1);

src/android/cordovaAF.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ repositories {
44

55
dependencies {
66
implementation 'com.android.installreferrer:installreferrer:2.1'
7-
implementation 'com.appsflyer:af-android-sdk:6.1.0@aar'
7+
implementation 'com.appsflyer:af-android-sdk:6.1.3@aar'
88

99
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//
2+
// AFSDKDeepLinkObserver.h
3+
// AppsFlyerLib
4+
//
5+
// Created by Andrii Hahan on 09.09.2020.
6+
//
7+
8+
#import <Foundation/Foundation.h>
9+
10+
@class AppsFlyerDeepLinkResult;
11+
12+
NS_SWIFT_NAME(DeepLinkObserverDelegate)
13+
@protocol AppsFlyerDeepLinkObserverDelegate <NSObject>
14+
15+
@optional
16+
- (void)didResolveDeepLink:(AppsFlyerDeepLinkResult *_Nonnull)result;
17+
18+
@end
19+
20+
NS_ASSUME_NONNULL_BEGIN
21+
NS_SWIFT_NAME(DeepLinkObserver)
22+
@interface AppsFlyerDeepLinkObserver : NSObject
23+
24+
@property(weak, nonatomic) id<AppsFlyerDeepLinkObserverDelegate> delegate;
25+
@property NSTimeInterval timeoutInterval;
26+
27+
@end
28+
29+
NS_ASSUME_NONNULL_END

src/ios/AppsFlyerLib.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// AppsFlyerLib.h
33
// AppsFlyerLib
44
//
5-
// AppsFlyer iOS SDK 6.1.1 (33)
5+
// AppsFlyer iOS SDK 6.1.3 (43)
66
// Copyright (c) 2012-2020 AppsFlyer Ltd. All rights reserved.
77
//
88

@@ -298,6 +298,8 @@ NS_SWIFT_NAME(waitForATTUserAuthorization(timeoutInterval:));
298298
*/
299299
@property(atomic) BOOL disableCollectASA;
300300

301+
@property(nonatomic) BOOL disableAppleAdsAttribution;
302+
301303
/**
302304
AppsFlyer delegate. See `AppsFlyerLibDelegate`
303305
*/
@@ -615,6 +617,14 @@ NS_SWIFT_NAME(logEvent(name:values:completionHandler:));
615617
parameters:(NSDictionary<NSString *, NSString*> *)parameters
616618
NS_SWIFT_NAME(appendParametersToDeeplinkURL(contains:parameters:));
617619

620+
/**
621+
Adds array of keys, which are used to compose key path
622+
to resolve deeplink from push notification payload `userInfo`.
623+
624+
@param deepLinkPath an array of strings which contains keys to search for deeplink in payload.
625+
*/
626+
- (void)addPushNotificationDeepLinkPath:(NSArray<NSString *> *)deepLinkPath;
627+
618628
@end
619629

620630
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)