Skip to content

Commit

Permalink
6.0.33
Browse files Browse the repository at this point in the history
6.0.33
  • Loading branch information
amit-kremer93 committed Oct 18, 2020
2 parents 7aedfed + d57116d commit 9471bf9
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Versions

## 6.0.33
- Send Push Notification API
- Fix TypeScript types for initSdk and logEvent

## 6.0.31
- In-App purchase validation
- Add parameters type check to public api
Expand Down
29 changes: 29 additions & 0 deletions Docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- [disableCollectASA](#disableCollectASA)
- [disableAdvertisingIdentifier](#disableAdvertisingIdentifier)
- [validateAndLogInAppPurchase](#validateAndLogInAppPurchase)
- [sendPushNotificationData](#sendPushNotificationData)

---

Expand Down Expand Up @@ -780,3 +781,31 @@ if (Platform.OS == 'android') {
}
appsFlyer.validateAndLogInAppPurchase(info, res => console.log(res), err => console.log(err));
```
##### <a id="sendPushNotificationData"> **`sendPushNotificationData(pushPayload): void`**
Push-notification campaigns are used to create fast re-engagements with existing users.
AppsFlyer supplies an open-for-all solution, that enables measuring the success of push-notification campaigns, for both iOS and Android platforms.<br>
Learn more - https://support.appsflyer.com/hc/en-us/articles/207364076-Measuring-Push-Notification-Re-Engagement-Campaigns
| parameter | type | description |
| ---------- |----------|------------------ |
| pushPayload | json | push notification payload |
*Example:*
```javascript
const pushPayload = {
af:{
c:"test_campaign",
is_retargeting:true,
pid:"push_provider_int",
},
aps:{
alert:"Get 5000 Coins",
badge:"37",
sound:"default"
}
};
appsFlyer.sendPushNotificationData(pushPayload);
```
Original file line number Diff line number Diff line change
Expand Up @@ -634,4 +634,9 @@ public void onValidateInAppFailure(String error) {
}
});
}

@ReactMethod
public void sendPushNotificationData(ReadableMap pushPayload) {
AppsFlyerLib.getInstance().sendPushNotificationData(getCurrentActivity());
}
}
11 changes: 7 additions & 4 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ declare module "react-native-appsflyer" {
emailsCryptType: AF_EMAIL_CRYPT_TYPE | 0 | 3;
}

export interface GenerateInviteLinkParams { channel: string;
export interface GenerateInviteLinkParams {
channel: string;
campaign?: string;
customerID?: string;
userParams?: object;
Expand All @@ -61,9 +62,10 @@ declare module "react-native-appsflyer" {
onInstallConversionData(callback: (data: ConversionData) => any): () => void;
onInstallConversionFailure(callback: (data: ConversionData) => any): () => void;
onAppOpenAttribution(callback: (data: any) => any): () => void;

initSdk(options: InitSDKOptions, successC?: SuccessCB, errorC?: ErrorCB): Response<string>
logEvent(eventName: string, eventValues: object, successC?: SuccessCB, errorC?: ErrorCB): Response<string>
initSdk(options: InitSDKOptions): Promise<string>;
initSdk(options: InitSDKOptions, successC: SuccessCB, errorC: ErrorCB): void;
logEvent(eventName: string, eventValues: object): Promise<string>;
logEvent(eventName: string, eventValues: object, successC: SuccessCB, errorC: ErrorCB): void;
setUserEmails(options: SetEmailsOptions, successC: SuccessCB, errorC: ErrorCB): void
setAdditionalData(additionalData: object, successC?: SuccessCB): void
getAppsFlyerUID(callback: (error: Error, uid: string) => any): void
Expand All @@ -83,6 +85,7 @@ declare module "react-native-appsflyer" {
logLocation(longitude: number, latitude: number, successC?: SuccessCB): void
validateAndLogInAppPurchase(purchaseInfo: InAppPurchase, successC, errorC): Response<string>
updateServerUninstallToken(token: string, successC?: SuccessCB): void
sendPushNotificationData(pushPayload: object): void

/**
* For iOS Only
Expand Down
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,17 @@ appsFlyer.setUseReceiptValidationSandbox = (isSandbox) => {
RNAppsFlyer.setUseReceiptValidationSandbox(isSandbox);
}

/**
*
*Push-notification campaigns are used to create fast re-engagements with existing users.
*AppsFlyer supplies an open-for-all solution, that enables measuring the success of push-notification campaigns, for both iOS and Android platforms.
* Learn more - https://support.appsflyer.com/hc/en-us/articles/207364076-Measuring-Push-Notification-Re-Engagement-Campaigns
* @param pushPayload
*/
appsFlyer.sendPushNotificationData = (pushPayload) => {
RNAppsFlyer.sendPushNotificationData(pushPayload);
}


function AFParseJSONException(_message, _data) {
this.message = _message;
Expand Down
5 changes: 5 additions & 0 deletions ios/RNAppsFlyer.m
Original file line number Diff line number Diff line change
Expand Up @@ -486,4 +486,9 @@ -(void) reportOnSuccess:(NSString *)data type:(NSString*) type {
}

}

RCT_EXPORT_METHOD(sendPushNotificationData: (NSDictionary*)pushPayload) {
[[AppsFlyerLib shared] handlePushNotification:pushPayload];
}

@end
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-appsflyer",
"version": "6.0.31",
"version": "6.0.33",
"description": "React Native Appsflyer plugin",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 9471bf9

Please sign in to comment.