Skip to content

Commit

Permalink
6.1.30
Browse files Browse the repository at this point in the history
6.1.30
  • Loading branch information
amit-kremer93 authored Jan 11, 2021
2 parents 1529baf + 1698239 commit 71b1027
Show file tree
Hide file tree
Showing 12 changed files with 235 additions and 46 deletions.
55 changes: 28 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ You can read more [here](https://support.appsflyer.com/hc/en-us/articles/2070320

### <a id="plugin-build-for"> 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**

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

Expand Down Expand Up @@ -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**<br>

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**:
Expand Down Expand Up @@ -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
12 changes: 12 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
43 changes: 40 additions & 3 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |


---
Expand Down Expand Up @@ -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:*

Expand All @@ -121,6 +123,8 @@ var eventValues = {
};

window.plugins.appsFlyer.logEvent(eventName, eventValues, successTrackEvent, failureTrackEvent);
//OR
window.plugins.appsFlyer.logEvent(eventName, eventValues, null, null);
```
---

Expand Down Expand Up @@ -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 |

---
##### <a id="setHost"> **`setHost(String hostPrefix, String hostName): void`**
Set custom host prefix and host name<br>

*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 |

---
##### <a id="addPushNotificationDeepLinkPath"> **`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 |

---

### <a id="deep-linking-tracking"> Deep linking Tracking
Expand Down
12 changes: 12 additions & 0 deletions docs/RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-plugin-appsflyer-sdk"
version="6.1.20">
version="6.1.30">
<name>AppsFlyer</name>
<description>Cordova Plugin AppsFlyer</description>
<license>Apache 2.0</license>
Expand Down Expand Up @@ -89,7 +89,7 @@
<config>
</config>
<pods use-frameworks="true">
<pod name="AppsFlyerFramework" spec="6.1.1"/>
<pod name="AppsFlyerFramework" spec="6.1.3"/>
</pods>
</podspec>
</platform>
Expand Down
56 changes: 51 additions & 5 deletions src/android/com/appsflyer/cordova/plugin/AppsFlyerPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
*/
Expand All @@ -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
*/
Expand All @@ -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
*/
Expand All @@ -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
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/android/cordovaAF.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'

}
29 changes: 29 additions & 0 deletions src/ios/AppsFlyerDeepLinkObserver.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// AFSDKDeepLinkObserver.h
// AppsFlyerLib
//
// Created by Andrii Hahan on 09.09.2020.
//

#import <Foundation/Foundation.h>

@class AppsFlyerDeepLinkResult;

NS_SWIFT_NAME(DeepLinkObserverDelegate)
@protocol AppsFlyerDeepLinkObserverDelegate <NSObject>

@optional
- (void)didResolveDeepLink:(AppsFlyerDeepLinkResult *_Nonnull)result;

@end

NS_ASSUME_NONNULL_BEGIN
NS_SWIFT_NAME(DeepLinkObserver)
@interface AppsFlyerDeepLinkObserver : NSObject

@property(weak, nonatomic) id<AppsFlyerDeepLinkObserverDelegate> delegate;
@property NSTimeInterval timeoutInterval;

@end

NS_ASSUME_NONNULL_END
12 changes: 11 additions & 1 deletion src/ios/AppsFlyerLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//

Expand Down Expand Up @@ -298,6 +298,8 @@ NS_SWIFT_NAME(waitForATTUserAuthorization(timeoutInterval:));
*/
@property(atomic) BOOL disableCollectASA;

@property(nonatomic) BOOL disableAppleAdsAttribution;

/**
AppsFlyer delegate. See `AppsFlyerLibDelegate`
*/
Expand Down Expand Up @@ -615,6 +617,14 @@ NS_SWIFT_NAME(logEvent(name:values:completionHandler:));
parameters:(NSDictionary<NSString *, NSString*> *)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<NSString *> *)deepLinkPath;

@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit 71b1027

Please sign in to comment.