From 2ebb5edbf34a4067df73ec63d2e46be12a5881df Mon Sep 17 00:00:00 2001 From: Vitaly Sokolov Date: Mon, 31 Aug 2020 12:57:02 +0300 Subject: [PATCH 1/4] Update SDK to 5.4.3, add new APIs, update install_referrer --- CHANGELOG.md | 10 ++++++++++ Docs/API.md | 31 +++++++++++++++++++++++++++++++ README.md | 4 ++-- android/build.gradle | 4 ++-- index.d.ts | 2 ++ index.js | 16 ++++++++++++++++ ios/RNAppsFlyer.m | 8 ++++++++ package.json | 2 +- react-native-appsflyer.podspec | 2 +- 9 files changed, 73 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16eb4cb8..44fea514 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Versions +## 5.4.40 +- Android SDK v5.4.3 +- iOS SDK v5.4.4 +- Install Referrer v1.1.2 + +_New APIs:_ + +- disableAdvertiserIdentifier +- disableCollectASA + ## 5.4.1 - Android and iOS SDK 5.4.1 - iOS lifecycle now handled natively and not from _handleAppStateChange diff --git a/Docs/API.md b/Docs/API.md index 5500ef5f..948e940e 100755 --- a/Docs/API.md +++ b/Docs/API.md @@ -26,6 +26,8 @@ - [performOnAppAttribution](#performOnAppAttribution) - [setSharingFilterForAllPartners](#setSharingFilterForAllPartners) - [setSharingFilter](#setSharingFilter) +- [disableCollectASA](#disableCollectASA) +- [disableAdvertiserIdentifier](#disableAdvertiserIdentifier) --- @@ -720,3 +722,32 @@ Used by advertisers to exclude **specified** networks/integrated partners from g }) ``` --- + +##### **`disableCollectASA(callback)`** + +(iOS only) + +Disables Apple Search Ads collecting + +*Example:* + +```javascript + +appsFlyer.disableCollectASA(); +``` + +--- + +##### **`disableAdvertiserIdentifier(callback)`** + +(iOS only) + +Disables IDFA collecting + +*Example:* + +```javascript +appsFlyer.disableAdvertiserIdentifier(); +``` + +--- \ No newline at end of file diff --git a/README.md b/README.md index 5d45199d..4e50e275 100755 --- a/README.md +++ b/README.md @@ -19,8 +19,8 @@ ### This plugin is built for -- iOS AppsFlyerSDK **v5.4.1** -- Android AppsFlyerSDK **v5.4.1** +- iOS AppsFlyerSDK **v5.4.4** +- Android AppsFlyerSDK **v5.4.3** ## 📲 Adding the SDK to your project diff --git a/android/build.gradle b/android/build.gradle index 68e4856a..fc75b40d 100755 --- a/android/build.gradle +++ b/android/build.gradle @@ -29,6 +29,6 @@ repositories { dependencies { implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}" - implementation "com.android.installreferrer:installreferrer:${safeExtGet('installReferrerVersion', '1.0')}" - implementation "com.appsflyer:af-android-sdk:${safeExtGet('appsflyerVersion', '5.4.1')}" + implementation "com.android.installreferrer:installreferrer:${safeExtGet('installReferrerVersion', '2.1')}" + implementation "com.appsflyer:af-android-sdk:${safeExtGet('appsflyerVersion', '5.4.3')}" } diff --git a/index.d.ts b/index.d.ts index d04b009e..4667c2ef 100644 --- a/index.d.ts +++ b/index.d.ts @@ -75,6 +75,8 @@ declare module "react-native-appsflyer" { * */ trackAppLaunch(): void trackLocation(longitude: number, latitude: number, callback: SuccessCB): void + disableAdvertiserIdentifier():void + disableCollectASA():void /** * For Android Only diff --git a/index.js b/index.js index c8f8cab3..e5b46e07 100755 --- a/index.js +++ b/index.js @@ -374,6 +374,22 @@ appsFlyer.setSharingFilter = (partners, successC, errorC) => { return RNAppsFlyer.setSharingFilter(partners, successC, errorC); } +/** + * Disables IDFA collecting + * iOS only + */ +appsFlyer.disableAdvertiserIdentifier = () => { + return RNAppsFlyer.disableAdvertiserIdentifier(); +} + +/** + * Disables Apple Search Ads collecting + * iOS only + */ +appsFlyer.disableCollectASA = () => { + return RNAppsFlyer.disableCollectASA(); +} + function AFParseJSONException(_message, _data) { this.message = _message; this.data = _data; diff --git a/ios/RNAppsFlyer.m b/ios/RNAppsFlyer.m index 72736bd0..4f04abef 100755 --- a/ios/RNAppsFlyer.m +++ b/ios/RNAppsFlyer.m @@ -447,4 +447,12 @@ -(void) reportOnSuccess:(NSString *)data type:(NSString*) type { successCallback(@[SUCCESS]); } +RCT_EXPORT_METHOD(disableAdvertiserIdentifier) { + [[AppsFlyerTracker sharedTracker] disableAppleAdSupportTracking]; +} + +RCT_EXPORT_METHOD(disableCollectASA) { + [[AppsFlyerTracker sharedTracker] disableIAdTracking]; +} + @end diff --git a/package.json b/package.json index 914024b3..e160aca4 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-appsflyer", - "version": "5.4.1", + "version": "5.4.40", "description": "React Native Appsflyer plugin", "main": "index.js", "scripts": { diff --git a/react-native-appsflyer.podspec b/react-native-appsflyer.podspec index e45b3de2..0bd865a6 100644 --- a/react-native-appsflyer.podspec +++ b/react-native-appsflyer.podspec @@ -13,6 +13,6 @@ Pod::Spec.new do |s| s.source_files = 'ios/**/*.{h,m}' s.platform = :ios, "8.0" s.static_framework = true - s.dependency 'AppsFlyerFramework', '~> 5.4.1' + s.dependency 'AppsFlyerFramework', '~> 5.4.4' s.dependency 'React' end From f17aceaa4cd078b92a9bbfcf77ddf0e3c4a12563 Mon Sep 17 00:00:00 2001 From: Vitaly Sokolov Date: Wed, 2 Sep 2020 10:47:43 +0300 Subject: [PATCH 2/4] Update docs, add boolean argument to new APIs --- Docs/API.md | 29 ++++++++++++++++++++++++----- index.d.ts | 4 ++-- index.js | 9 +++++---- ios/RNAppsFlyer.m | 8 ++++---- 4 files changed, 35 insertions(+), 15 deletions(-) diff --git a/Docs/API.md b/Docs/API.md index 948e940e..354a1417 100755 --- a/Docs/API.md +++ b/Docs/API.md @@ -1,7 +1,7 @@ # API - - [initSdk](#initSdk) +- [appId](#appId) - [onInstallConversionData](#onInstallConversionData) - [onAppOpenAttribution](#onAppOpenAttribution) - [trackEvent](#trackEvent) @@ -78,6 +78,17 @@ try { var res = await appsFlyer.initSdk(options); } catch (err) {} ``` +--- + +##### **`appId`** + +AppsFlyer app ID property populated from `options` passed in the `initSdk` function. Can be used to read appId back later in the app + +*Example:* + +```javascript +var appId = appsFlyer.appId; +``` --- ##### **`onInstallConversionData(callback) : function:unregister`** @@ -723,31 +734,39 @@ Used by advertisers to exclude **specified** networks/integrated partners from g ``` --- -##### **`disableCollectASA(callback)`** +##### **`disableCollectASA(shouldDisable)`** (iOS only) Disables Apple Search Ads collecting +| parameter | type | description | +| ---------- |----------|------------------ | +| shouldDisable | boolean | Flag to disable/enable Apple Search Ads data collection | + *Example:* ```javascript -appsFlyer.disableCollectASA(); +appsFlyer.disableCollectASA(true); ``` --- -##### **`disableAdvertiserIdentifier(callback)`** +##### **`disableAdvertiserIdentifier(shouldDisable)`** (iOS only) Disables IDFA collecting +| parameter | type | description | +| ---------- |----------|------------------ | +| shouldDisable | boolean | Flag to disable/enable IDFA collection | + *Example:* ```javascript -appsFlyer.disableAdvertiserIdentifier(); +appsFlyer.disableAdvertiserIdentifier(true); ``` --- \ No newline at end of file diff --git a/index.d.ts b/index.d.ts index 4667c2ef..de71a37e 100644 --- a/index.d.ts +++ b/index.d.ts @@ -75,8 +75,8 @@ declare module "react-native-appsflyer" { * */ trackAppLaunch(): void trackLocation(longitude: number, latitude: number, callback: SuccessCB): void - disableAdvertiserIdentifier():void - disableCollectASA():void + disableAdvertiserIdentifier(shouldDisable: boolean):void + disableCollectASA(shouldDisable: boolean):void /** * For Android Only diff --git a/index.js b/index.js index e5b46e07..1223aa61 100755 --- a/index.js +++ b/index.js @@ -15,6 +15,7 @@ function initSdkPromise(options): Promise { } function initSdk(options, success, error): Promise { + appsFlyer.appId = options.appId; options.onInstallConversionDataListener = eventsMap["onInstallConversionData"] ? true : false; @@ -378,16 +379,16 @@ appsFlyer.setSharingFilter = (partners, successC, errorC) => { * Disables IDFA collecting * iOS only */ -appsFlyer.disableAdvertiserIdentifier = () => { - return RNAppsFlyer.disableAdvertiserIdentifier(); +appsFlyer.disableAdvertiserIdentifier = (shouldDisable) => { + return RNAppsFlyer.disableAdvertiserIdentifier(shouldDisable); } /** * Disables Apple Search Ads collecting * iOS only */ -appsFlyer.disableCollectASA = () => { - return RNAppsFlyer.disableCollectASA(); +appsFlyer.disableCollectASA = (shouldDisable) => { + return RNAppsFlyer.disableCollectASA(shouldDisable); } function AFParseJSONException(_message, _data) { diff --git a/ios/RNAppsFlyer.m b/ios/RNAppsFlyer.m index 4f04abef..b71203da 100755 --- a/ios/RNAppsFlyer.m +++ b/ios/RNAppsFlyer.m @@ -447,12 +447,12 @@ -(void) reportOnSuccess:(NSString *)data type:(NSString*) type { successCallback(@[SUCCESS]); } -RCT_EXPORT_METHOD(disableAdvertiserIdentifier) { - [[AppsFlyerTracker sharedTracker] disableAppleAdSupportTracking]; +RCT_EXPORT_METHOD(disableAdvertiserIdentifier:(BOOL)shouldDisable { + [AppsFlyerTracker sharedTracker].disableAppleAdSupportTracking = shouldDisable; } -RCT_EXPORT_METHOD(disableCollectASA) { - [[AppsFlyerTracker sharedTracker] disableIAdTracking]; +RCT_EXPORT_METHOD(disableCollectASA: (BOOL)shouldDisable) { + [AppsFlyerTracker sharedTracker].disableIAdTracking = shouldDisable; } @end From 35826beea3945ef199c43e7c3a5547dc27d9fbb6 Mon Sep 17 00:00:00 2001 From: Vitaly Sokolov Date: Wed, 2 Sep 2020 10:57:16 +0300 Subject: [PATCH 3/4] Update JSDoc --- index.js | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 1223aa61..a64b3e3e 100755 --- a/index.js +++ b/index.js @@ -363,21 +363,44 @@ appsFlyer.setResolveDeepLinkURLs = (urls, successC, errorC) => { return RNAppsFlyer.setResolveDeepLinkURLs(urls, successC, errorC); }; +/** + * This function allows developers to manually re-trigger onAppOpenAttribution with a specific link (URI or URL), + * without recording a new re-engagement. + * This method may be required if the app needs to redirect users based on the given link, + * or resolve the AppsFlyer short URL while staying in the foreground/opened. This might be needed because + * regular onAppOpenAttribution callback is only called if the app was opened with the deep link. + * @param urlString String representing the URL that needs to be resolved/returned in the onAppOpenAttribution callback + * @param callback Result callback + */ appsFlyer.performOnAppAttribution = (urlString, callback) => { return RNAppsFlyer.performOnAppAttribution(urlString, callback); } +/** + * Used by advertisers to exclude **all** networks/integrated partners from getting data. + * Learn more - https://support.appsflyer.com/hc/en-us/articles/207032126#additional-apis-exclude-partners-from-getting-data + */ + appsFlyer.setSharingFilterForAllPartners = () => { return RNAppsFlyer.setSharingFilterForAllPartners(); } +/** + * Used by advertisers to exclude specified networks/integrated partners from getting data. + * Learn more - https://support.appsflyer.com/hc/en-us/articles/207032126#additional-apis-exclude-partners-from-getting-data + * @param partners Comma separated array of partners that need to be excluded + * @param successC Success callback + * @param errorC Error callback + */ + appsFlyer.setSharingFilter = (partners, successC, errorC) => { return RNAppsFlyer.setSharingFilter(partners, successC, errorC); } /** * Disables IDFA collecting - * iOS only + * @param shouldDisable Flag to disable/enable IDFA collection + * @platform iOS only */ appsFlyer.disableAdvertiserIdentifier = (shouldDisable) => { return RNAppsFlyer.disableAdvertiserIdentifier(shouldDisable); @@ -385,7 +408,8 @@ appsFlyer.disableAdvertiserIdentifier = (shouldDisable) => { /** * Disables Apple Search Ads collecting - * iOS only + * @param shouldDisable Flag to disable/enable Apple Search Ads data collection + * @platform iOS only */ appsFlyer.disableCollectASA = (shouldDisable) => { return RNAppsFlyer.disableCollectASA(shouldDisable); From e575fc88b3eee272402ed95ed8e285eabab0038c Mon Sep 17 00:00:00 2001 From: Vitaly Sokolov Date: Wed, 2 Sep 2020 11:10:10 +0300 Subject: [PATCH 4/4] typo fix --- ios/RNAppsFlyer.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/RNAppsFlyer.m b/ios/RNAppsFlyer.m index b71203da..186b6785 100755 --- a/ios/RNAppsFlyer.m +++ b/ios/RNAppsFlyer.m @@ -447,7 +447,7 @@ -(void) reportOnSuccess:(NSString *)data type:(NSString*) type { successCallback(@[SUCCESS]); } -RCT_EXPORT_METHOD(disableAdvertiserIdentifier:(BOOL)shouldDisable { +RCT_EXPORT_METHOD(disableAdvertiserIdentifier:(BOOL)shouldDisable) { [AppsFlyerTracker sharedTracker].disableAppleAdSupportTracking = shouldDisable; }