From 2e41c704e5557da24df9a9dd7232110b91e50371 Mon Sep 17 00:00:00 2001 From: Amit Date: Mon, 28 Dec 2020 08:05:00 +0200 Subject: [PATCH 1/6] update iOS and Android SDK to 6.1.3 --- android/build.gradle | 2 +- ios/AppsFlyerDeepLinkObserver.h | 29 +++++++++++++++++++++++++++++ ios/AppsFlyerLib.h | 12 +++++++++++- podspec-regular-template.txt | 2 +- podspec-strict-template.txt | 2 +- react-native-appsflyer.podspec | 2 +- 6 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 ios/AppsFlyerDeepLinkObserver.h diff --git a/android/build.gradle b/android/build.gradle index f2fe87a9..5a6ae5db 100755 --- a/android/build.gradle +++ b/android/build.gradle @@ -46,5 +46,5 @@ repositories { dependencies { implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}" implementation "com.android.installreferrer:installreferrer:${safeExtGet('installReferrerVersion', '2.1')}" - implementation "com.appsflyer:af-android-sdk:${safeExtGet('appsflyerVersion', '6.1.0')}" + implementation "com.appsflyer:af-android-sdk:${safeExtGet('appsflyerVersion', '6.1.3')}" } diff --git a/ios/AppsFlyerDeepLinkObserver.h b/ios/AppsFlyerDeepLinkObserver.h new file mode 100644 index 00000000..395a6d45 --- /dev/null +++ b/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/ios/AppsFlyerLib.h b/ios/AppsFlyerLib.h index 60572408..8a4c602a 100644 --- a/ios/AppsFlyerLib.h +++ b/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/podspec-regular-template.txt b/podspec-regular-template.txt index e3040692..502e7d2c 100644 --- a/podspec-regular-template.txt +++ b/podspec-regular-template.txt @@ -14,5 +14,5 @@ Pod::Spec.new do |s| s.platform = :ios, "8.0" s.static_framework = true s.dependency 'React' - s.dependency 'AppsFlyerFramework', '6.1.1' + s.dependency 'AppsFlyerFramework', '6.1.3' end diff --git a/podspec-strict-template.txt b/podspec-strict-template.txt index dfc10c27..be4f38c1 100644 --- a/podspec-strict-template.txt +++ b/podspec-strict-template.txt @@ -14,6 +14,6 @@ Pod::Spec.new do |s| s.platform = :ios, "8.0" s.static_framework = true s.dependency 'React' - s.dependency 'AppsFlyerFramework/Strict', '6.1.1' + s.dependency 'AppsFlyerFramework/Strict', '6.1.3' s.xcconfig = {'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) AFSDK_NO_IDFA=1' } end diff --git a/react-native-appsflyer.podspec b/react-native-appsflyer.podspec index cea09026..c576e2d6 100644 --- a/react-native-appsflyer.podspec +++ b/react-native-appsflyer.podspec @@ -14,5 +14,5 @@ Pod::Spec.new do |s| s.platform = :ios, "8.0" s.static_framework = true s.dependency 'React' - s.dependency 'AppsFlyerFramework', ' 6.1.1' + s.dependency 'AppsFlyerFramework', ' 6.1.3' end From 3a77a33fbb08db0e6aed53aa681d55acc96f4e8d Mon Sep 17 00:00:00 2001 From: Amit Date: Mon, 28 Dec 2020 14:17:00 +0200 Subject: [PATCH 2/6] setHost API --- .../com/appsflyer/reactnative/RNAppsFlyerModule.java | 5 +++++ index.d.ts | 1 + index.js | 9 +++++++++ ios/RNAppsFlyer.m | 4 ++++ 4 files changed, 19 insertions(+) diff --git a/android/src/main/java/com/appsflyer/reactnative/RNAppsFlyerModule.java b/android/src/main/java/com/appsflyer/reactnative/RNAppsFlyerModule.java index d45afc87..419ce844 100755 --- a/android/src/main/java/com/appsflyer/reactnative/RNAppsFlyerModule.java +++ b/android/src/main/java/com/appsflyer/reactnative/RNAppsFlyerModule.java @@ -677,4 +677,9 @@ public void onValidateInAppFailure(String error) { public void sendPushNotificationData(ReadableMap pushPayload) { AppsFlyerLib.getInstance().sendPushNotificationData(getCurrentActivity()); } + + @ReactMethod + public void setHost(String hostPrefix, String hostName) { + AppsFlyerLib.getInstance().setHost(hostPrefix, hostName); + } } diff --git a/index.d.ts b/index.d.ts index e4aedca0..7769221c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -88,6 +88,7 @@ declare module "react-native-appsflyer" { validateAndLogInAppPurchase(purchaseInfo: InAppPurchase, successC, errorC): Response updateServerUninstallToken(token: string, successC?: SuccessCB): void sendPushNotificationData(pushPayload: object): void + setHost(hostPrefix: string, hostName: string, success?: SuccessCB): void /** * For iOS Only diff --git a/index.js b/index.js index a97c2d91..e1cba5e9 100755 --- a/index.js +++ b/index.js @@ -527,6 +527,15 @@ appsFlyer.sendPushNotificationData = (pushPayload) => { RNAppsFlyer.sendPushNotificationData(pushPayload); } +/** + * Set a custom host + * @param hostPrefix + * @param hostName + */ +appsFlyer.setHost = (hostPrefix, hostName) => { + RNAppsFlyer.setHost(hostPrefix, hostName); +} + function AFParseJSONException(_message, _data) { this.message = _message; diff --git a/ios/RNAppsFlyer.m b/ios/RNAppsFlyer.m index cf69fe83..4ff4246d 100755 --- a/ios/RNAppsFlyer.m +++ b/ios/RNAppsFlyer.m @@ -526,4 +526,8 @@ -(void) reportOnSuccess:(NSString *)data type:(NSString*) type { [[AppsFlyerLib shared] handlePushNotification:pushPayload]; } +RCT_EXPORT_METHOD(setHost: (NSString*)hostPrefix hostName: (NSString*)hostName) { + [[AppsFlyerLib shared] setHost:hostName withHostPrefix:hostPrefix]; +} + @end From 94130a32606d60c364c9c7aa8ce825dd90735057 Mon Sep 17 00:00:00 2001 From: Amit Date: Mon, 28 Dec 2020 15:53:49 +0200 Subject: [PATCH 3/6] add addPushNotificationDeepLinkPath API --- .../reactnative/RNAppsFlyerModule.java | 17 +++++++++++++++++ index.d.ts | 1 + index.js | 10 ++++++++++ ios/RNAppsFlyer.m | 6 ++++++ 4 files changed, 34 insertions(+) diff --git a/android/src/main/java/com/appsflyer/reactnative/RNAppsFlyerModule.java b/android/src/main/java/com/appsflyer/reactnative/RNAppsFlyerModule.java index 419ce844..23405fb2 100755 --- a/android/src/main/java/com/appsflyer/reactnative/RNAppsFlyerModule.java +++ b/android/src/main/java/com/appsflyer/reactnative/RNAppsFlyerModule.java @@ -682,4 +682,21 @@ public void sendPushNotificationData(ReadableMap pushPayload) { public void setHost(String hostPrefix, String hostName) { AppsFlyerLib.getInstance().setHost(hostPrefix, hostName); } + + @ReactMethod + public void addPushNotificationDeepLinkPath(ReadableArray path, Callback successCallback, Callback errorCallback) { + if (path.size() <= 0) { + errorCallback.invoke(EMPTY_OR_CORRUPTED_LIST); + return; + } + ArrayList pathList = path.toArrayList(); + try { + String[] params = pathList.toArray(new String[pathList.size()]); + AppsFlyerLib.getInstance().addPushNotificationDeepLinkPath(params); + successCallback.invoke(SUCCESS); + } catch (Exception e) { + e.printStackTrace(); + errorCallback.invoke(e); + } + } } diff --git a/index.d.ts b/index.d.ts index 7769221c..211c669c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -89,6 +89,7 @@ declare module "react-native-appsflyer" { updateServerUninstallToken(token: string, successC?: SuccessCB): void sendPushNotificationData(pushPayload: object): void setHost(hostPrefix: string, hostName: string, success?: SuccessCB): void + addPushNotificationDeepLinkPath(path: string[], successC: SuccessCB, errorC: ErrorCB): void /** * For iOS Only diff --git a/index.js b/index.js index e1cba5e9..056c224d 100755 --- a/index.js +++ b/index.js @@ -536,6 +536,16 @@ appsFlyer.setHost = (hostPrefix, hostName) => { RNAppsFlyer.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 + * @param successC: success callback + * @param errorC: error callback + */ +appsFlyer.addPushNotificationDeepLinkPath = (path, successC, errorC) => { + RNAppsFlyer.addPushNotificationDeepLinkPath(path, successC, errorC); +} function AFParseJSONException(_message, _data) { this.message = _message; diff --git a/ios/RNAppsFlyer.m b/ios/RNAppsFlyer.m index 4ff4246d..d04d8fab 100755 --- a/ios/RNAppsFlyer.m +++ b/ios/RNAppsFlyer.m @@ -530,4 +530,10 @@ -(void) reportOnSuccess:(NSString *)data type:(NSString*) type { [[AppsFlyerLib shared] setHost:hostName withHostPrefix:hostPrefix]; } +RCT_EXPORT_METHOD(addPushNotificationDeepLinkPath: (NSArray*)path successCallback :(RCTResponseSenderBlock)successCallback + errorCallback:(RCTResponseErrorBlock)errorCallback) { + [[AppsFlyerLib shared] addPushNotificationDeepLinkPath: path]; + successCallback(@[SUCCESS]); +} + @end From 5accb7b6033aed1e4b28ad5a6f110750a331632d Mon Sep 17 00:00:00 2001 From: Amit Date: Mon, 28 Dec 2020 16:23:08 +0200 Subject: [PATCH 4/6] update readme, changelog, package.json, DOCS --- CHANGELOG.md | 6 ++++++ Docs/API.md | 37 +++++++++++++++++++++++++++++++++++++ Docs/Guides.md | 6 +++--- README.md | 5 +++-- package.json | 2 +- 5 files changed, 50 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c303dd1e..e8394572 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,10 @@ # Versions +## 6.1.30 +- Android SDK 6.1.3 +- iOS SDK 6.1.3 +- setHost API +- addPushNotificationDeepLinkPath API + ## 6.1.20 - Unified deep linking diff --git a/Docs/API.md b/Docs/API.md index 9a835e6e..45949823 100755 --- a/Docs/API.md +++ b/Docs/API.md @@ -29,6 +29,8 @@ - [disableAdvertisingIdentifier](#disableAdvertisingIdentifier) - [validateAndLogInAppPurchase](#validateAndLogInAppPurchase) - [sendPushNotificationData](#sendPushNotificationData) +- [setHost](#setHost) +- [addPushNotificationDeepLinkPath](#addPushNotificationDeepLinkPath) --- @@ -817,3 +819,38 @@ const pushPayload = { }; appsFlyer.sendPushNotificationData(pushPayload); ``` +--- + +##### **`setHost(hostPrefix, hostName)`** + +Set a custom host + +| parameter | type | description | +| ----------|----------|------------------| +| hostPrefix | string | the host prefix | +| hostName | string | the host name | + + +*Example:* + +```javascript +appsFlyer.setHost('foo', 'bar.appsflyer.com'); +``` +--- + +##### **`addPushNotificationDeepLinkPath(path, successC, errorC)`** +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 + +| parameter | type | description | +| ----------|----------|------------------| +| path | strings array | the host prefix | +| successC | function | success callback | +| errorC | function | error callback | + + +*Example:* + +```javascript +appsFlyer.addPushNotificationDeepLinkPath(["deeply", "nested", "deep_link"]); +``` diff --git a/Docs/Guides.md b/Docs/Guides.md index a1e6b9f1..19b764f2 100755 --- a/Docs/Guides.md +++ b/Docs/Guides.md @@ -48,11 +48,11 @@ Since users may or may not have the mobile app installed, there are 3 types of d 1. Deferred Deep Linking - Serving personalized content to new or former users, directly after the installation. 2. Direct Deep Linking - Directly serving personalized content to existing users, which already have the mobile app installed. 3. Unified deep linking - Unified deep linking sends new and existing users to a specific in-app activity as soon as the app is opened.
-For more info please check out the [OneLink™ Deep Linking Guide](https://support.appsflyer.com/hc/en-us/articles/208874366-OneLink-Deep-Linking-Guide#Intro). +For more info please check out the [OneLink™ Deep Linking Guide](https://dev.appsflyer.com/docs/initial-setup-for-deep-linking-and-deferred-deep-linking). ###
1. Deferred Deep Linking (Get Conversion Data) -Check out the deferred deep linking guide from the AppFlyer knowledge base [here](https://support.appsflyer.com/hc/en-us/articles/207032096-Accessing-AppsFlyer-Attribution-Conversion-Data-from-the-SDK-Deferred-Deeplinking-#Introduction). +Check out the deferred deep linking guide from the AppFlyer knowledge base [here](https://dev.appsflyer.com/docs/deferred-deep-linking-new-users-to-specific-content-inside-your-app). Code Sample to handle the conversion data: @@ -88,7 +88,7 @@ The `appsFlyer.onInstallConversionData` returns function to unregister this eve ### 2. Direct Deep Linking -When a deep link is clicked on the device the AppsFlyer SDK will return the link in the [onAppOpenAttribution](https://support.appsflyer.com/hc/en-us/articles/208874366-OneLink-Deep-Linking-Guide#deep-linking-data-the-onappopenattribution-method-) method. +When a deep link is clicked on the device the AppsFlyer SDK will return the link in the [onAppOpenAttribution](https://dev.appsflyer.com/docs/deep-linking-existing-app-users-to-specific-content) method. ```javascript var onAppOpenAttributionCanceller = appsFlyer.onAppOpenAttribution((res) => { diff --git a/README.md b/README.md index 3b3c2ac6..78ea778e 100755 --- a/README.md +++ b/README.md @@ -22,8 +22,8 @@ ### 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 @@ -37,6 +37,7 @@ We have renamed the following APIs: | trackCrossPromotionImpression | logCrossPromotionImpression | | trackAndOpenStore | logCrossPromotionAndOpenStore | | setDeviceTrackingDisabled | anonymizeUser | +| AppsFlyerTracker | AppsFlyerLib | And removed the following ones: diff --git a/package.json b/package.json index 097a3961..9ed825d4 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-appsflyer", - "version": "6.1.20", + "version": "6.1.30", "description": "React Native Appsflyer plugin", "main": "index.js", "scripts": { From dc443ddfbb3dc680b224e0576c7054ee530245a0 Mon Sep 17 00:00:00 2001 From: Amit Date: Mon, 28 Dec 2020 16:31:56 +0200 Subject: [PATCH 5/6] typo --- Docs/API.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Docs/API.md b/Docs/API.md index 45949823..f6ebb005 100755 --- a/Docs/API.md +++ b/Docs/API.md @@ -840,11 +840,12 @@ appsFlyer.setHost('foo', 'bar.appsflyer.com'); ##### **`addPushNotificationDeepLinkPath(path, successC, errorC)`** 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 +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
+❗Important❗ `addPushNotificationDeepLinkPath` must be called before calling `initSDK` | parameter | type | description | | ----------|----------|------------------| -| path | strings array | the host prefix | +| path | strings array | the desired path separated into an array | | successC | function | success callback | | errorC | function | error callback | From 87da1ee6fd0a4f8b1dbf76ebc7c9deecf4e8cb2a Mon Sep 17 00:00:00 2001 From: Amit Date: Wed, 30 Dec 2020 08:30:05 +0200 Subject: [PATCH 6/6] add callback to setHost --- Docs/API.md | 7 ++++--- .../java/com/appsflyer/reactnative/RNAppsFlyerModule.java | 3 ++- index.d.ts | 2 +- index.js | 5 +++-- ios/RNAppsFlyer.m | 3 ++- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Docs/API.md b/Docs/API.md index f6ebb005..01ea10c7 100755 --- a/Docs/API.md +++ b/Docs/API.md @@ -821,7 +821,7 @@ const pushPayload = { ``` --- -#####
**`setHost(hostPrefix, hostName)`** +##### **`setHost(hostPrefix, hostName, successC)`** Set a custom host @@ -829,12 +829,13 @@ Set a custom host | ----------|----------|------------------| | hostPrefix | string | the host prefix | | hostName | string | the host name | +| successC | function | success callback | *Example:* ```javascript -appsFlyer.setHost('foo', 'bar.appsflyer.com'); +appsFlyer.setHost('foo', 'bar.appsflyer.com', res => console.log(res)); ``` --- @@ -853,5 +854,5 @@ for more information: https://support.appsflyer.com/hc/en-us/articles/207032126- *Example:* ```javascript -appsFlyer.addPushNotificationDeepLinkPath(["deeply", "nested", "deep_link"]); +appsFlyer.addPushNotificationDeepLinkPath(["deeply", "nested", "deep_link"], res => console.log(res), error => console.log(error)); ``` diff --git a/android/src/main/java/com/appsflyer/reactnative/RNAppsFlyerModule.java b/android/src/main/java/com/appsflyer/reactnative/RNAppsFlyerModule.java index 23405fb2..2355f1d1 100755 --- a/android/src/main/java/com/appsflyer/reactnative/RNAppsFlyerModule.java +++ b/android/src/main/java/com/appsflyer/reactnative/RNAppsFlyerModule.java @@ -679,8 +679,9 @@ public void sendPushNotificationData(ReadableMap pushPayload) { } @ReactMethod - public void setHost(String hostPrefix, String hostName) { + public void setHost(String hostPrefix, String hostName, Callback successCallback) { AppsFlyerLib.getInstance().setHost(hostPrefix, hostName); + successCallback.invoke(SUCCESS); } @ReactMethod diff --git a/index.d.ts b/index.d.ts index 211c669c..7a5772ab 100644 --- a/index.d.ts +++ b/index.d.ts @@ -88,7 +88,7 @@ declare module "react-native-appsflyer" { validateAndLogInAppPurchase(purchaseInfo: InAppPurchase, successC, errorC): Response updateServerUninstallToken(token: string, successC?: SuccessCB): void sendPushNotificationData(pushPayload: object): void - setHost(hostPrefix: string, hostName: string, success?: SuccessCB): void + setHost(hostPrefix: string, hostName: string, success: SuccessCB): void addPushNotificationDeepLinkPath(path: string[], successC: SuccessCB, errorC: ErrorCB): void /** diff --git a/index.js b/index.js index 056c224d..18fe508c 100755 --- a/index.js +++ b/index.js @@ -531,9 +531,10 @@ appsFlyer.sendPushNotificationData = (pushPayload) => { * Set a custom host * @param hostPrefix * @param hostName + * @param successC: success callback */ -appsFlyer.setHost = (hostPrefix, hostName) => { - RNAppsFlyer.setHost(hostPrefix, hostName); +appsFlyer.setHost = (hostPrefix, hostName, successC) => { + RNAppsFlyer.setHost(hostPrefix, hostName, successC); } /** diff --git a/ios/RNAppsFlyer.m b/ios/RNAppsFlyer.m index d04d8fab..494a3390 100755 --- a/ios/RNAppsFlyer.m +++ b/ios/RNAppsFlyer.m @@ -526,8 +526,9 @@ -(void) reportOnSuccess:(NSString *)data type:(NSString*) type { [[AppsFlyerLib shared] handlePushNotification:pushPayload]; } -RCT_EXPORT_METHOD(setHost: (NSString*)hostPrefix hostName: (NSString*)hostName) { +RCT_EXPORT_METHOD(setHost: (NSString*)hostPrefix hostName: (NSString*)hostName successCallback :(RCTResponseSenderBlock)successCallback) { [[AppsFlyerLib shared] setHost:hostName withHostPrefix:hostPrefix]; + successCallback(@[SUCCESS]); } RCT_EXPORT_METHOD(addPushNotificationDeepLinkPath: (NSArray*)path successCallback :(RCTResponseSenderBlock)successCallback