From 4db1afe2c95f6b7269935b76a03142263e1dd2f8 Mon Sep 17 00:00:00 2001 From: Nipun Singh <88689850+nsingh-branch@users.noreply.github.com> Date: Thu, 29 Feb 2024 17:36:31 -0800 Subject: [PATCH] [SDK-2249] Expose the setDMAParamsForEEA method (#957) * Added setDMAParamsForEEA * Updated native SDKs * Removed setDebug * Update react-native-branch.podspec * Update index.js --- ChangeLog.md | 1053 +++++++++-------- android/build.gradle | 2 +- .../io/branch/rnbranch/RNBranchModule.java | 14 +- docs/setDebug.md | 45 - ios/RNBranch.h | 1 - ios/RNBranch.m | 10 +- react-native-branch.podspec | 2 +- src/index.d.ts | 1 + src/index.js | 173 ++- 9 files changed, 687 insertions(+), 614 deletions(-) delete mode 100644 docs/setDebug.md diff --git a/ChangeLog.md b/ChangeLog.md index 84f5f4c2b..1fbecc10f 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -17,219 +17,248 @@ - Update minimum iOS version to 12.0 2023-10-03 Version 5.9.2 - - Update Android SDK to 5.7.1 to include gclid bug fix. + +- Update Android SDK to 5.7.1 to include gclid bug fix. 2023-10-02 Version 5.9.1 - - Update Android SDK to 5.7.0 - - Update iOS SDK 2.2.1 - - Removed deprecated code related to v1/events. + +- Update Android SDK to 5.7.0 +- Update iOS SDK 2.2.1 +- Removed deprecated code related to v1/events. 2023-06-26 Version 5.9.0 - - Update Android SDK to 5.5.0 - - Update iOS SDK 2.2.0 - - Removed deprecated iOS method, delayInitToCheckForSearchAds() - + +- Update Android SDK to 5.5.0 +- Update iOS SDK 2.2.0 +- Removed deprecated iOS method, delayInitToCheckForSearchAds() + 2023-03-29 - - To address a race condition where apps don't receive Branch params on cold starts, an opt in fix will defer loading the native iOS/Android layer until signaled - by this plugin in `subscribe()`. - This can be enabled by creating a `branch.json` file with the contents: - ```js - { - "deferInitForPluginRuntime": true - } - ``` - Android: Place this file in your src/main/assets folder - iOS: Add this file through Xcode, File -> Add Files to "YourProject.xcodeproj" - and add to Copy Bundle Resources for each target that inits the Branch SDK. - - Update Android SDK to 5.3.0 - - Update iOS SDK 2.1.0 - It may be necessary to clear out pod cache and reinstall - - Fixes the typing of `isTrackingDisabled` to return `Promise` + +- To address a race condition where apps don't receive Branch params on cold starts, an opt in fix will defer loading the native iOS/Android layer until signaled + by this plugin in `subscribe()`. + This can be enabled by creating a `branch.json` file with the contents: + ```js + { + "deferInitForPluginRuntime": true + } + ``` + Android: Place this file in your src/main/assets folder + iOS: Add this file through Xcode, File -> Add Files to "YourProject.xcodeproj" + and add to Copy Bundle Resources for each target that inits the Branch SDK. +- Update Android SDK to 5.3.0 +- Update iOS SDK 2.1.0 + It may be necessary to clear out pod cache and reinstall +- Fixes the typing of `isTrackingDisabled` to return `Promise` 2023-01-23 Version 5.7.0 - - Update Android SDK to 5.2.7 - - Update iOS SDK to 1.45.2 - - Fix ~creation_source type - Thanks @vincent-paing - - Add export for success and error event - Thanks @vincent-paing + +- Update Android SDK to 5.2.7 +- Update iOS SDK to 1.45.2 +- Fix ~creation_source type - Thanks @vincent-paing +- Add export for success and error event - Thanks @vincent-paing 2022-10-13 Version 5.6.2 - - Fixed bug with returning LATD on iOS - - Fixed bug with setIdentityAsync on Android + +- Fixed bug with returning LATD on iOS +- Fixed bug with setIdentityAsync on Android 2022-10-03 Version 5.6.1 - - Update Android SDK to 5.2.5 + +- Update Android SDK to 5.2.5 2022-09-30 Version 5.6.0 - - Update Android SDK to 5.2.4 - - Update iOS SDK to 1.43.2 - - Fix BranchUniversalObject showShareSheet return type definition (thanks romanlitvin) - - Change customData type definition to String String dictionary (thanks vincent-paing!) - - Fixed clearPartnerParameters call (thanks danilobuerger!) - - Add callback to setIdentity in new function `setIdentityAsync` + +- Update Android SDK to 5.2.4 +- Update iOS SDK to 1.43.2 +- Fix BranchUniversalObject showShareSheet return type definition (thanks romanlitvin) +- Change customData type definition to String String dictionary (thanks vincent-paing!) +- Fixed clearPartnerParameters call (thanks danilobuerger!) +- Add callback to setIdentity in new function `setIdentityAsync` 2022-07-20 Version 5.5.0 - - Branch QR code creation support added. - ```js - getBranchQRCode: ( - settings: BranchQRCodeSettings, - branchUniversalObject: BranchUniversalObjectOptions, - linkProperties: BranchLinkProperties, - controlParams: BranchLinkControlParams, - ) => Promise; - ``` - - Support for preinstall analytics. - ```js - setPreInstallCampaign = (campaign) => RNBranch.setPreinstallCampaign(campaign) - setPreInstallPartner = (partner) => RNBranch.setPreinstallPartner(partner) - ``` - - Update react-native to 0.63.0 - - Update Android SDK to 5.2.0 - - Update iOS SDK to 1.43.1 + +- Branch QR code creation support added. + ```js + getBranchQRCode: ( + settings: BranchQRCodeSettings, + branchUniversalObject: BranchUniversalObjectOptions, + linkProperties: BranchLinkProperties, + controlParams: BranchLinkControlParams, + ) => Promise; + ``` +- Support for preinstall analytics. + ```js + setPreInstallCampaign = (campaign) => + RNBranch.setPreinstallCampaign(campaign); + setPreInstallPartner = (partner) => RNBranch.setPreinstallPartner(partner); + ``` +- Update react-native to 0.63.0 +- Update Android SDK to 5.2.0 +- Update iOS SDK to 1.43.1 2022-06-06 Version 5.4.1 - - Update Android SDK to 5.1.5 - - Update iOS SDK to 1.42.0 + +- Update Android SDK to 5.1.5 +- Update iOS SDK to 1.42.0 2022-02-10 Version 5.4.0 - - Fix type definition of createBranchUniversalObject (Thanks v-fernandez!) - - Update Android SDK to 5.1.0 - - Update iOS SDK to 1.41.0 - - Update other dependencies to latest non-breaking + +- Fix type definition of createBranchUniversalObject (Thanks v-fernandez!) +- Update Android SDK to 5.1.0 +- Update iOS SDK to 1.41.0 +- Update other dependencies to latest non-breaking 2022-01-31 Version 5.3.1 - - Null checks for listeners. Thanks ilyagru! - - Depend on React-Core instead of React. Thanks radko93! - - Use @ReactModule annotation. Thanks janicduplessis! + +- Null checks for listeners. Thanks ilyagru! +- Depend on React-Core instead of React. Thanks radko93! +- Use @ReactModule annotation. Thanks janicduplessis! 2022-01-25 Version 5.3.0 - - Swift support. Thanks giautm! - - Expose iOS method handleATTAuthorizationStatus. Thanks adkenyon! - - Remove jcenter repository. Thanks yash221b! - - Fix removeListener deprecate warning. Thanks addingama! + +- Swift support. Thanks giautm! +- Expose iOS method handleATTAuthorizationStatus. Thanks adkenyon! +- Remove jcenter repository. Thanks yash221b! +- Fix removeListener deprecate warning. Thanks addingama! 2021-10-29 Version 5.2.1 - - Update iOS SDK to 1.40.2 + +- Update iOS SDK to 1.40.2 2021-10-27 Version 5.2.0 - - Update iOS SDK to 1.40.1 - - Update Android SDK to 5.0.14 + +- Update iOS SDK to 1.40.1 +- Update Android SDK to 5.0.14 2021-10-01 Version 5.1.0 - - Update Androd SDK to 5.0.13 - - Removes credit related APIs. Feature has been deprecated and the supporting services will be shutdown. + +- Update Androd SDK to 5.0.13 +- Removes credit related APIs. Feature has been deprecated and the supporting services will be shutdown. 2021-08-16 Version 5.0.4 - - Update iOS SDK to 1.39.4 - - Adds support to check the pasteboard for deferred deeplink data. Add `checkPasteboardOnInstall` to `branch.json`. The feature is optional and disabled by default. - - Update Android SDK to 5.0.9 +- Update iOS SDK to 1.39.4 +- Adds support to check the pasteboard for deferred deeplink data. Add `checkPasteboardOnInstall` to `branch.json`. The feature is optional and disabled by default. -2021-04-29 Version 5.0.3 - - Update Android SDK to 5.0.8 +- Update Android SDK to 5.0.9 -2021-04-16 Version 5.0.2 - - Requires react-native >= 0.60 +2021-04-29 Version 5.0.3 - - Update iOS SDK to 1.39.2 - - Update Android SDK to 5.0.7 +- Update Android SDK to 5.0.8 - - Adds addFacebookPartnerParameter method. See FB documentation on partner parameters for details. - ```js - branch.addFacebookPartnerParameter('em', '11234e56af071e9c79927651156bd7a10bca8ac34672aba121056e2698ee7088') - ``` +2021-04-16 Version 5.0.2 - - Adds clearPartnerParameter method - ```js - branch.clearPartnerParameters() - ``` +- Requires react-native >= 0.60 + +- Update iOS SDK to 1.39.2 +- Update Android SDK to 5.0.7 + +- Adds addFacebookPartnerParameter method. See FB documentation on partner parameters for details. + + ```js + branch.addFacebookPartnerParameter( + "em", + "11234e56af071e9c79927651156bd7a10bca8ac34672aba121056e2698ee7088" + ); + ``` + +- Adds clearPartnerParameter method + + ```js + branch.clearPartnerParameters(); + ``` + +- Adds typescript. Thanks runtrizapps! +- Adds enableLogging to the RNBranch class. Thanks jkadamczyk! +- Fix issue with Android LATD. Thanks mauryakk15! + +2021-02-04 Version 5.0.1 + +- Requires react-native >= 0.60 +- Adds lastAttributedTouchData method. + ```js + const attributionWindow = 365; + branch.lastAttributedTouchData(attributionWindow, (latData) => { + // latData is an Object + }); + ``` + See https://help.branch.io/developers-hub/docs/retrieving-branchs-last-attributed-touch-data + for further details. + +2020-08-27 Version 5.0.0 + +- Requires react-native >= 0.60 +- This release includes Branch native SDKs Android 5.0.3 and iOS 0.35.0. +- Added RNBranchModule.onNewIntent for Android. This replaces calling + `setIntent` and `RNBranchModule.reInitSession`. + ```java + @Override public void onNewIntent(Intent intent) { + super.onNewIntent(intent); + RNBranchModule.onNewIntent(intent); + } + ``` +- Added `cachedInitialEvent` Boolean parameter to `onOpenStart` callback. +- Improved support of in-app linking via `branch.openURL()`. The `newActivity` + option for Android was removed. +- There is a known issue with in-app linking on Android. When opening a link + within an app via `branch.openURL()`, there is no `onOpenStart` callback + and no `uri` parameter in the `onOpenComplete` callback. This will be + addressed in the next release. +- Rebuilt `testbed_simple`, `webview_example` and `browser_example` with + RN 0.62.2. + +2020-07-23 Version 5.0.0-rc.1 + +- Requires react-native >= 0.60 +- This release includes Branch native SDKs Android 5.0.1 and iOS 0.34.0. +- The `onOpenStart` function is now called for Universal Links on iOS when + launched from a link, and the `uri` parameter is populated in the + `onOpenComplete` callback in this case. +- The return value of `branch.subscribe()` did not work as an unsubscribe + function. This has been fixed. +- Add support for all standard v2 events. +- Add support for an `alias` property in Branch v2 events (also known as + Customer Event Alias). + +2020-04-10 Version 5.0.0-beta.1 + +- For use with react-native >= 0.60 +- This release includes Branch native SDKs Android 5.0.0 and iOS 0.32.0. +- The `branch.subscribe` callback now passes a third named parameter, `uri`, + which is the URI/URL that originally launched the app. In some cases this + may be `null` (e.g. deferred deep links). Consult the `~referring_link`, + `+url` or `+non_branch_link` parameter in those cases. +- You can now be notified when Branch is about to open a link using two + separate callbacks, `onOpenStart` and `onOpenComplete`. The + `onOpenComplete` callback is identical with the single callback passed to + `branch.subscribe`. + + ```js + import branch from "react-native-branch"; + + branch.subscribe({ + onOpenStart: ({ uri }) => { + console.log("Branch will open " + uri); + }, + onOpenComplete: ({ error, params, uri }) => { + if (error) { + console.log("Error from Branch opening " + uri + ": " + error); + return; + } - - Adds typescript. Thanks runtrizapps! - - Adds enableLogging to the RNBranch class. Thanks jkadamczyk! - - Fix issue with Android LATD. Thanks mauryakk15! - -2021-02-04 Version 5.0.1 - - Requires react-native >= 0.60 - - Adds lastAttributedTouchData method. - ```js - const attributionWindow = 365; - branch.lastAttributedTouchData(attributionWindow, latData => { - // latData is an Object - }); - ``` - See https://help.branch.io/developers-hub/docs/retrieving-branchs-last-attributed-touch-data - for further details. - -2020-08-27 Version 5.0.0 - - Requires react-native >= 0.60 - - This release includes Branch native SDKs Android 5.0.3 and iOS 0.35.0. - - Added RNBranchModule.onNewIntent for Android. This replaces calling - `setIntent` and `RNBranchModule.reInitSession`. - ```java - @Override public void onNewIntent(Intent intent) { - super.onNewIntent(intent); - RNBranchModule.onNewIntent(intent); - } - ``` - - Added `cachedInitialEvent` Boolean parameter to `onOpenStart` callback. - - Improved support of in-app linking via `branch.openURL()`. The `newActivity` - option for Android was removed. - - There is a known issue with in-app linking on Android. When opening a link - within an app via `branch.openURL()`, there is no `onOpenStart` callback - and no `uri` parameter in the `onOpenComplete` callback. This will be - addressed in the next release. - - Rebuilt `testbed_simple`, `webview_example` and `browser_example` with - RN 0.62.2. - -2020-07-23 Version 5.0.0-rc.1 - - Requires react-native >= 0.60 - - This release includes Branch native SDKs Android 5.0.1 and iOS 0.34.0. - - The `onOpenStart` function is now called for Universal Links on iOS when - launched from a link, and the `uri` parameter is populated in the - `onOpenComplete` callback in this case. - - The return value of `branch.subscribe()` did not work as an unsubscribe - function. This has been fixed. - - Add support for all standard v2 events. - - Add support for an `alias` property in Branch v2 events (also known as - Customer Event Alias). - -2020-04-10 Version 5.0.0-beta.1 - - For use with react-native >= 0.60 - - This release includes Branch native SDKs Android 5.0.0 and iOS 0.32.0. - - The `branch.subscribe` callback now passes a third named parameter, `uri`, - which is the URI/URL that originally launched the app. In some cases this - may be `null` (e.g. deferred deep links). Consult the `~referring_link`, - `+url` or `+non_branch_link` parameter in those cases. - - You can now be notified when Branch is about to open a link using two - separate callbacks, `onOpenStart` and `onOpenComplete`. The - `onOpenComplete` callback is identical with the single callback passed to - `branch.subscribe`. - - ```js - import branch from 'react-native-branch' - - branch.subscribe({ - onOpenStart: ({uri}) => { - console.log('Branch will open ' + uri) - }, - onOpenComplete: ({error, params, uri}) => { - if (error) { - console.log('Error from Branch opening ' + uri + ': ' + error) - return - } - - console.log('Branch opened ' + uri) - // handle params - }, - }) - ``` + console.log("Branch opened " + uri); + // handle params + }, + }); + ``` - ### Updating from an earlier version: +### Updating from an earlier version: - #### iOS +#### iOS - In the AppDelegate, use the following methods: +In the AppDelegate, use the following methods: - ##### Obj-C +##### Obj-C ```Obj-C - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(nonnull NSDictionary *)options { @@ -241,7 +270,7 @@ } ``` - ##### Swift +##### Swift ```Swift func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { @@ -253,360 +282,398 @@ } ``` -2020-04-10 Version 3.2.1 - - For use with react-native < 0.60 - - This release includes Branch native SDKs Android 5.0.0 and iOS 0.32.0. - -2020-03-11 Version 4.4.0 - - For use with react-native >= 0.60 - - This release includes Branch native SDKs Android 4.3.2 and iOS 0.31.3. - - Introduced an enableFacebookLinkCheck Boolean parameter in branch.json. - This results in calling enableFacebookAppLinkCheck() on Android and - registerFacebookDeepLinkingClass: on iOS for use with react-native-fbsdk. - Advanced users: You can still call these methods in native code as before - if your use case dictates. - -2020-03-11 Version 3.2.0 - - For use with react-native < 0.60 - - This release includes Branch native SDKs Android 4.3.2 and iOS 0.31.3. - - Fixed a crash due to NPE on Android experienced by some users. Now an error should be properly reported. - - Introduced an enableFacebookLinkCheck Boolean parameter in branch.json. - This results in calling enableFacebookAppLinkCheck() on Android and - registerFacebookDeepLinkingClass: on iOS for use with react-native-fbsdk. - Advanced users: You can still call these methods in native code as before - if your use case dictates. - -2020-02-27 Version 3.1.2 - - This release, for React Native < 0.60, updates native SDK support to Android 4.3.2 and iOS 0.31.3. - -2020-02-13 Version 4.3.0 - - Requires RN >= 0.60 - - Uses native Branch SDKs 4.3.2 (Android), 0.31.x (iOS). - - SDK-802 accept PR to expose setMetadata at the JS layer - - SDK-714 add plugin identifier - - Addresses several github issues. - -2019-09-30 Version 4.2.1 - - Missed version update in iOS RNBranch.m - -2019-09-27 Version 4.2.0 - - Update Android Branch SDK to 4.1.0 - - Update iOS Branch SDK to 0.29.0 - - Expose Android reInit session for foreground links - -2019-07-25 Version 3.1.1 - - Requires RN < 0.60 - - Fix a runtime iOS issue in 3.1.0 - - Uses native Branch SDKs 3.2.0 (Android), 0.27.1 (iOS). - -2019-07-25 Version 4.1.0 - - Requires RN >= 0.60 - - Added optional argument to getLatestReferringParams to allow deferring - promise resolution. - - Uses native Branch SDKs 3.2.0 (Android), 0.27.1 (iOS). - -2019-07-25 Version 3.1.0 - - Requires RN < 0.60 - - Added optional argument to getLatestReferringParams to allow deferring - promise resolution. - - Fix clicked_branch_link false positive (#466) from @sjchmiela. - - Uses native Branch SDKs 3.2.0 (Android), 0.27.1 (iOS). - -2019-07-16 Version 4.0.0 - - Full support for React Native 0.60, AndroidX and autolinking - - Fix clicked_branch_link false positive (#466) from @sjchmiela. - - Uses native Branch SDKs 3.2.0 (Android), 0.27.1 (iOS). - -2019-05-22 Version 3.0.1 - * Added Carthage/Build/iOS to Framework Search Paths for Carthage support. - * Uses native Branch SDKs 3.2.0 (Android), 0.27.0 (iOS). - -2019-04-30 Version 3.0.0 - * Changed `implementation` to `api` in build.gradle. This exposes the native - Branch SDK to native code and avoids the need to import - `io.branch.sdk.android:library` in the `app/build.gradle`, which - introduces the potential for conflicts. The `app/build.gradle` import - via `implementation 'io.branch.sdk.android:library:3.1.2'` - is no longer necessary and should be removed. - * Uses native Branch SDKs 3.1.2 (Android), 0.27.0 (iOS). - -2019-04-19 Version 3.0.0-rc.1 - * Removed docs folder from distro. - * Updated to iOS SDK 0.26.0, Android 3.1.1. - * Removed Branch-SDK & react-native-branch-segment podspecs. Removed Branch - iOS SDK source code from distribution in favor of using CocoaPods. - * Renamed cached_initial_event parameter +rn_cached_initial_event. - * Updated all examples to RN 0.59.6, React 16.8.6. - * NPM is not currently supported (#433). package-lock.json removed from all - examples. NPM removed from instructions in docs. - - **Updating to 3.0.0** - - If using the `cached_initial_event` parameter, change it to - `+rn_cached_initial_event`. - - \[Android] Add `implementation 'io.branch.sdk.android:library:3.+'` to `app/build.gradle`. - - \[Android] Change the call to `Branch.getAutoInstance` in `Application.onCreate` to - `RNBranchModule.getAutoInstance`. - - \[iOS] Add version 0.26.0 of the Branch pod to your Podfile: - - **Pure RN app with react-native link** - - If you already have a Podfile, add `pod 'Branch', '0.26.0'`. Then run - `pod install`. - - If you don't have a Podfile, add one to your `ios` subdirectory using - these contents: - - ``` - platform :ios, "9.0" - use_frameworks! - pod "Branch", "0.26.0" - target "MyApp" - ``` - - Change `MyApp` to the name of your application target. Install CocoaPods - if necessary: https://guides.cocoapods.org/using/getting-started.html#installation. - Run `pod install` in the ios subdirectory. Note that this creates a workspace called - `MyApp.xcworkspace` in the same directory. From now on, open the workspace, - not the project. - - Note that if your local podspec repo is quite old, you may need to update - it to get the current version of the Branch SDK. Do this by running - `pod install --repo-update` or by running `pod repo update` before - `pod install`. - - **Native iOS app with the react-native-branch pod** - - Remove `pod 'Branch-SDK'` from your Podfile. Run `pod install`. - -2019-03-27 Version 2.3.5 - * Remove docs folder from distro. - * Updated to iOS SDK 0.26.0. - -2019-03-05 Version 3.0.0-beta.3 - * Added react-native-branch-segment.podspec for use with the Segment integration. - -2019-02-22 Version 3.0.0-beta.2 - * Remove weak reference from BranchUniversalReferralInitListener (#372) - * Check for null params (#364) - * Support for setting Branch keys in branch.json - -2019-02-22 Version 2.3.4 - * Remove weak reference from BranchUniversalReferralInitListener (#372) - * Check for null params (#364) - -2019-01-28 Version 3.0.0-beta.1 - * Remove native Branch Android jar from repo and distro. - -2018-07-25 Version 2.3.3 - * Updated to iOS SDK 0.25.1 and Android SDK 2.19.0. - -2018-07-20 Version 2.3.2 - * Updated to iOS SDK 0.24.1 and Android SDK 2.17.1. - * V2 event support updates. - * Link data read updates. - * Node dependency updates. - -2018-04-14 Version 2.2.5 - * `setRequestMetadata` support to RNBranch module. - * Fixed custom event issues on iOS and Android #317. - * Fixed async `subscribe` call issue #322. - * Fixed `getLatestReferringParams` release issue #282. - * Updated to iOS SDK 0.22.5 and Android SDK 2.15.0. - * Includes native SDKs 0.22.5 (iOS), 2.15.0 (Android). - -2018-01-09 Version 2.2.4 - * Updated to Android SDK 2.14.4. - * Includes native SDKs 0.22.4 (iOS), 2.14.4 (Android). - -2018-01-04 Version 2.2.3 - * Updated to iOS SDK 0.22.4 to fix backward compatibility issues with metadata. #311 - * Includes native SDKs 0.22.4 (iOS), 2.14.3 (Android). - -2017-12-22 Version 2.2.2 - * Get rid of unnecessary version check for iOS 8 (#309) - * Some corrections to handling of Branch Universal Object content metadata. - * Includes native SDKs 0.21.16 (iOS), 2.14.3 (Android). - -2017-12-14 Version 2.2.1 - * Fixes certain BUO content metadata field mappings: productCategory, addressPostalCode, ratingAverage - * Includes native SDKs 0.21.14 (iOS), 2.14.2 (Android). - -2017-12-11 Version 2.2.0 - * Adds BranchEvent class - * Adds new Branch Universal Object API - * Added requiresMainQueueSetup as required by v0.49+ of RN via @UrbanChrisy (#299) - * Fix incorrect event type when error = null via @wildseansy (#285) - * Includes native SDKs 0.21.14 (iOS), 2.14.2 (Android). - -2017-10-17 Version 2.1.1 - * Fix for +non_branch_link issue on Android (#216). - * Suppress some warnings with Xcode 9. - * Added a troubleshooting section to the README. - * Includes native SDKs 0.19.5 (iOS), 2.12.2 (Android). - -2017-10-02 Version 2.1.0 - * Added an openURL method for programmatic deep linking from anywhere in an app (e.g., a QR reader). - * Allow loading rewards from different buckets via an optional argument to loadRewards(). - * Return RNBranch::Error::DuplicateResourceError in case of an existing alias. - * Further rework of the README. - * Introduced a tutorial app. - * Includes native SDKs 0.19.5 (iOS), 2.12.1 (Android). - -2017-08-30 Version 2.0.0 - * Added sendCommerceEvent method. - * Complete rewrite of the README. - * Removed the peerDependency on `react`. - * Includes native SDKs 0.17.10 (iOS), 2.12.0 (Android). - -2017-08-21 Version 2.0.0-rc.2 - * Fixed automation bug that generated an RNBranch.xcodeproj that failed with `react-native link`. - * Regenerated RNBranch.xcodeproj to fix `react-native link` bug (#239). - * Includes native SDKs 0.17.9 (iOS), 2.11.1 (Android). - -2017-08-17 Version 2.0.0-rc.1 - * (Internal) Native SDK updates are now automated. - * Includes native SDKs 0.17.9 (iOS), 2.11.1 (Android). - -2017-08-04 Version 2.0.0-beta.8 - * Support for RN >= 0.47 (#231). - * Added support for platform-specific branch.json. - * Includes native SDKs 0.16.2 (iOS), 2.10.3 (Android). - -2017-06-19 Version 2.0.0-beta.7 - * This release adds support for an optional `branch.json` configuration file. See https://rnbranch.app.link/branch-json for details. - * Deprecated `[RNBranch handleDeepLink:]`. See https://rnbranch.app.link/version-2#ios-api-changes for details. - * Includes native SDKs 0.15.3 (iOS), 2.9.0 (Android). - -2017-05-30 Version 2.0.0-beta.6 - - * This release adds some native wrapper methods to simplify certain native code changes that cannot - be supported in JS. - * Includes native SDKs 0.15.3 (iOS), 2.8.0 (Android). - -2017-05-19 Version 2.0.0-beta.5 - - * This release disables the unsupportable `setDebug()` method and provides new native methods to - take its place. See https://rnbranch.app.link/hGj7E61EhD for details. - * Removed the filter in the native layers that was passing null `params` to the `branch.subscribe` callback. - Now `params` will never be null in the callback. Non-Branch links are - available using the `+non_branch_link` parameter, like the rest of Branch's SDKs. See in particular the - webview_example for updated usage. The `uri` parameter still exists, and its behavior is largely unchanged, but - it should now be considered deprecated and will be removed in a future release. - * Includes native SDKs 0.14.12 (iOS), 2.8.0 (Android). - -2017-05-10 Version 2.0.0-beta.4 - - * This release restores the React dependency to the react-native-branch podspec for full - Swift support. - * Improvements to webview_example_native_ios to take advantage of full Swift support. - * Includes native SDKs 0.14.12 (iOS), 2.6.1 (Android). - -2017-04-26 Version 2.0.0-beta.3 - - * This release fixes an Android crash introduced in 2.0.0-beta.2. (#187) - * Includes native SDKs 0.14.12 (iOS), 2.6.1 (Android). - -2017-04-24 Version 2.0.0-beta.2 - - * Implemented an RCTEventEmitter in iOS. - * Rebuilt JS link caching to address #79. - * Corrected link property mappings on Android (thanks to @jchesne for the PR). - * Includes native SDKs 0.14.12 (iOS), 2.6.1 (Android). - * Added missing AddToCartEvent, listed in the docs. - * Export event constants from the native layer for better consistency. - * Support for routing links in native Android apps that include RN components. - * Added/improved example applications. The master branch includes five examples for 2.0.0: - - testbed_simple - - testbed_native_ios - - testbed_native_android - - webview_example - - webview_native_ios +2020-04-10 Version 3.2.1 + +- For use with react-native < 0.60 +- This release includes Branch native SDKs Android 5.0.0 and iOS 0.32.0. + +2020-03-11 Version 4.4.0 + +- For use with react-native >= 0.60 +- This release includes Branch native SDKs Android 4.3.2 and iOS 0.31.3. +- Introduced an enableFacebookLinkCheck Boolean parameter in branch.json. + This results in calling enableFacebookAppLinkCheck() on Android and + registerFacebookDeepLinkingClass: on iOS for use with react-native-fbsdk. + Advanced users: You can still call these methods in native code as before + if your use case dictates. + +2020-03-11 Version 3.2.0 + +- For use with react-native < 0.60 +- This release includes Branch native SDKs Android 4.3.2 and iOS 0.31.3. +- Fixed a crash due to NPE on Android experienced by some users. Now an error should be properly reported. +- Introduced an enableFacebookLinkCheck Boolean parameter in branch.json. + This results in calling enableFacebookAppLinkCheck() on Android and + registerFacebookDeepLinkingClass: on iOS for use with react-native-fbsdk. + Advanced users: You can still call these methods in native code as before + if your use case dictates. + +2020-02-27 Version 3.1.2 + +- This release, for React Native < 0.60, updates native SDK support to Android 4.3.2 and iOS 0.31.3. + +2020-02-13 Version 4.3.0 + +- Requires RN >= 0.60 +- Uses native Branch SDKs 4.3.2 (Android), 0.31.x (iOS). +- SDK-802 accept PR to expose setMetadata at the JS layer +- SDK-714 add plugin identifier +- Addresses several github issues. + +2019-09-30 Version 4.2.1 + +- Missed version update in iOS RNBranch.m + +2019-09-27 Version 4.2.0 + +- Update Android Branch SDK to 4.1.0 +- Update iOS Branch SDK to 0.29.0 +- Expose Android reInit session for foreground links + +2019-07-25 Version 3.1.1 + +- Requires RN < 0.60 +- Fix a runtime iOS issue in 3.1.0 +- Uses native Branch SDKs 3.2.0 (Android), 0.27.1 (iOS). + +2019-07-25 Version 4.1.0 + +- Requires RN >= 0.60 +- Added optional argument to getLatestReferringParams to allow deferring + promise resolution. +- Uses native Branch SDKs 3.2.0 (Android), 0.27.1 (iOS). + +2019-07-25 Version 3.1.0 + +- Requires RN < 0.60 +- Added optional argument to getLatestReferringParams to allow deferring + promise resolution. +- Fix clicked_branch_link false positive (#466) from @sjchmiela. +- Uses native Branch SDKs 3.2.0 (Android), 0.27.1 (iOS). + +2019-07-16 Version 4.0.0 + +- Full support for React Native 0.60, AndroidX and autolinking +- Fix clicked_branch_link false positive (#466) from @sjchmiela. +- Uses native Branch SDKs 3.2.0 (Android), 0.27.1 (iOS). + +2019-05-22 Version 3.0.1 + +- Added Carthage/Build/iOS to Framework Search Paths for Carthage support. +- Uses native Branch SDKs 3.2.0 (Android), 0.27.0 (iOS). + +2019-04-30 Version 3.0.0 + +- Changed `implementation` to `api` in build.gradle. This exposes the native + Branch SDK to native code and avoids the need to import + `io.branch.sdk.android:library` in the `app/build.gradle`, which + introduces the potential for conflicts. The `app/build.gradle` import + via `implementation 'io.branch.sdk.android:library:3.1.2'` + is no longer necessary and should be removed. +- Uses native Branch SDKs 3.1.2 (Android), 0.27.0 (iOS). + +2019-04-19 Version 3.0.0-rc.1 + +- Removed docs folder from distro. +- Updated to iOS SDK 0.26.0, Android 3.1.1. +- Removed Branch-SDK & react-native-branch-segment podspecs. Removed Branch + iOS SDK source code from distribution in favor of using CocoaPods. +- Renamed cached_initial_event parameter +rn_cached_initial_event. +- Updated all examples to RN 0.59.6, React 16.8.6. +- NPM is not currently supported (#433). package-lock.json removed from all + examples. NPM removed from instructions in docs. + + **Updating to 3.0.0** + + - If using the `cached_initial_event` parameter, change it to + `+rn_cached_initial_event`. + - \[Android] Add `implementation 'io.branch.sdk.android:library:3.+'` to `app/build.gradle`. + - \[Android] Change the call to `Branch.getAutoInstance` in `Application.onCreate` to + `RNBranchModule.getAutoInstance`. + - \[iOS] Add version 0.26.0 of the Branch pod to your Podfile: + + **Pure RN app with react-native link** + + - If you already have a Podfile, add `pod 'Branch', '0.26.0'`. Then run + `pod install`. + - If you don't have a Podfile, add one to your `ios` subdirectory using + these contents: + + ``` + platform :ios, "9.0" + use_frameworks! + pod "Branch", "0.26.0" + target "MyApp" + ``` + + Change `MyApp` to the name of your application target. Install CocoaPods + if necessary: https://guides.cocoapods.org/using/getting-started.html#installation. + Run `pod install` in the ios subdirectory. Note that this creates a workspace called + `MyApp.xcworkspace` in the same directory. From now on, open the workspace, + not the project. + + - Note that if your local podspec repo is quite old, you may need to update + it to get the current version of the Branch SDK. Do this by running + `pod install --repo-update` or by running `pod repo update` before + `pod install`. + + **Native iOS app with the react-native-branch pod** + + - Remove `pod 'Branch-SDK'` from your Podfile. Run `pod install`. + +2019-03-27 Version 2.3.5 + +- Remove docs folder from distro. +- Updated to iOS SDK 0.26.0. + +2019-03-05 Version 3.0.0-beta.3 + +- Added react-native-branch-segment.podspec for use with the Segment integration. + +2019-02-22 Version 3.0.0-beta.2 + +- Remove weak reference from BranchUniversalReferralInitListener (#372) +- Check for null params (#364) +- Support for setting Branch keys in branch.json + +2019-02-22 Version 2.3.4 + +- Remove weak reference from BranchUniversalReferralInitListener (#372) +- Check for null params (#364) + +2019-01-28 Version 3.0.0-beta.1 + +- Remove native Branch Android jar from repo and distro. + +2018-07-25 Version 2.3.3 + +- Updated to iOS SDK 0.25.1 and Android SDK 2.19.0. + +2018-07-20 Version 2.3.2 + +- Updated to iOS SDK 0.24.1 and Android SDK 2.17.1. +- V2 event support updates. +- Link data read updates. +- Node dependency updates. + +2018-04-14 Version 2.2.5 + +- `setRequestMetadata` support to RNBranch module. +- Fixed custom event issues on iOS and Android #317. +- Fixed async `subscribe` call issue #322. +- Fixed `getLatestReferringParams` release issue #282. +- Updated to iOS SDK 0.22.5 and Android SDK 2.15.0. +- Includes native SDKs 0.22.5 (iOS), 2.15.0 (Android). + +2018-01-09 Version 2.2.4 + +- Updated to Android SDK 2.14.4. +- Includes native SDKs 0.22.4 (iOS), 2.14.4 (Android). + +2018-01-04 Version 2.2.3 + +- Updated to iOS SDK 0.22.4 to fix backward compatibility issues with metadata. #311 +- Includes native SDKs 0.22.4 (iOS), 2.14.3 (Android). + +2017-12-22 Version 2.2.2 + +- Get rid of unnecessary version check for iOS 8 (#309) +- Some corrections to handling of Branch Universal Object content metadata. +- Includes native SDKs 0.21.16 (iOS), 2.14.3 (Android). + +2017-12-14 Version 2.2.1 + +- Fixes certain BUO content metadata field mappings: productCategory, addressPostalCode, ratingAverage +- Includes native SDKs 0.21.14 (iOS), 2.14.2 (Android). + +2017-12-11 Version 2.2.0 + +- Adds BranchEvent class +- Adds new Branch Universal Object API +- Added requiresMainQueueSetup as required by v0.49+ of RN via @UrbanChrisy (#299) +- Fix incorrect event type when error = null via @wildseansy (#285) +- Includes native SDKs 0.21.14 (iOS), 2.14.2 (Android). + +2017-10-17 Version 2.1.1 + +- Fix for +non_branch_link issue on Android (#216). +- Suppress some warnings with Xcode 9. +- Added a troubleshooting section to the README. +- Includes native SDKs 0.19.5 (iOS), 2.12.2 (Android). + +2017-10-02 Version 2.1.0 + +- Added an openURL method for programmatic deep linking from anywhere in an app (e.g., a QR reader). +- Allow loading rewards from different buckets via an optional argument to loadRewards(). +- Return RNBranch::Error::DuplicateResourceError in case of an existing alias. +- Further rework of the README. +- Introduced a tutorial app. +- Includes native SDKs 0.19.5 (iOS), 2.12.1 (Android). + +2017-08-30 Version 2.0.0 + +- Added sendCommerceEvent method. +- Complete rewrite of the README. +- Removed the peerDependency on `react`. +- Includes native SDKs 0.17.10 (iOS), 2.12.0 (Android). + +2017-08-21 Version 2.0.0-rc.2 + +- Fixed automation bug that generated an RNBranch.xcodeproj that failed with `react-native link`. +- Regenerated RNBranch.xcodeproj to fix `react-native link` bug (#239). +- Includes native SDKs 0.17.9 (iOS), 2.11.1 (Android). + +2017-08-17 Version 2.0.0-rc.1 + +- (Internal) Native SDK updates are now automated. +- Includes native SDKs 0.17.9 (iOS), 2.11.1 (Android). + +2017-08-04 Version 2.0.0-beta.8 + +- Support for RN >= 0.47 (#231). +- Added support for platform-specific branch.json. +- Includes native SDKs 0.16.2 (iOS), 2.10.3 (Android). + +2017-06-19 Version 2.0.0-beta.7 + +- This release adds support for an optional `branch.json` configuration file. See https://rnbranch.app.link/branch-json for details. +- Deprecated `[RNBranch handleDeepLink:]`. See https://rnbranch.app.link/version-2#ios-api-changes for details. +- Includes native SDKs 0.15.3 (iOS), 2.9.0 (Android). + +2017-05-30 Version 2.0.0-beta.6 + +- This release adds some native wrapper methods to simplify certain native code changes that cannot + be supported in JS. +- Includes native SDKs 0.15.3 (iOS), 2.8.0 (Android). + +2017-05-19 Version 2.0.0-beta.5 + +- This release disables the unsupportable `setDebug()` method and provides new native methods to + take its place. See https://rnbranch.app.link/hGj7E61EhD for details. +- Removed the filter in the native layers that was passing null `params` to the `branch.subscribe` callback. + Now `params` will never be null in the callback. Non-Branch links are + available using the `+non_branch_link` parameter, like the rest of Branch's SDKs. See in particular the + webview_example for updated usage. The `uri` parameter still exists, and its behavior is largely unchanged, but + it should now be considered deprecated and will be removed in a future release. +- Includes native SDKs 0.14.12 (iOS), 2.8.0 (Android). + +2017-05-10 Version 2.0.0-beta.4 + +- This release restores the React dependency to the react-native-branch podspec for full + Swift support. +- Improvements to webview_example_native_ios to take advantage of full Swift support. +- Includes native SDKs 0.14.12 (iOS), 2.6.1 (Android). + +2017-04-26 Version 2.0.0-beta.3 + +- This release fixes an Android crash introduced in 2.0.0-beta.2. (#187) +- Includes native SDKs 0.14.12 (iOS), 2.6.1 (Android). + +2017-04-24 Version 2.0.0-beta.2 + +- Implemented an RCTEventEmitter in iOS. +- Rebuilt JS link caching to address #79. +- Corrected link property mappings on Android (thanks to @jchesne for the PR). +- Includes native SDKs 0.14.12 (iOS), 2.6.1 (Android). +- Added missing AddToCartEvent, listed in the docs. +- Export event constants from the native layer for better consistency. +- Support for routing links in native Android apps that include RN components. +- Added/improved example applications. The master branch includes five examples for 2.0.0: + - testbed_simple + - testbed_native_ios + - testbed_native_android + - webview_example + - webview_native_ios As well as the two legacy examples testbed_carthage and testbed_cocoapods for 1.1. The webview_example and webview_example_native_ios apps are complete, practical examples of content-sharing apps that route links and follow Branch's best practices. All examples are fully set up for the bnctestbed.app.link domain. - * All 2.0 examples now include support for both the test and live Branch keys. All Android - examples will use the test key in Debug builds and the live key in Release builds. This - is also true for testbed_simple and webview_example. testbed_native_ios and - webview_example_native_ios use custom build configurations and schemes to differentiate - the live and test environments (this approach is only possible when using CocoaPods on iOS; - it is easily arranged using productFlavors on Android and very similar to the existing - setup). - * Added an experimental Fastlane plugin to set up example apps for iOS without using Xcode - to make it easy to run them on a device and test link routing. - * Greatly expanded CI and unit testing, including native unit tests, for improved stability. +- All 2.0 examples now include support for both the test and live Branch keys. All Android + examples will use the test key in Debug builds and the live key in Release builds. This + is also true for testbed_simple and webview_example. testbed_native_ios and + webview_example_native_ios use custom build configurations and schemes to differentiate + the live and test environments (this approach is only possible when using CocoaPods on iOS; + it is easily arranged using productFlavors on Android and very similar to the existing + setup). +- Added an experimental Fastlane plugin to set up example apps for iOS without using Xcode + to make it easy to run them on a device and test link routing. +- Greatly expanded CI and unit testing, including native unit tests, for improved stability. -2017-03-23 Version 2.0.0-beta.1 +2017-03-23 Version 2.0.0-beta.1 - * Reduce the number of manual steps required to get started. - * Remove any need for CocoaPods, Carthage or manual iOS SDK installation in a React Native app. - * Pin to specific versions of the native SDKs to avoid issues arising from version mismatches. - * Fully support integration of react-native-branch in a React Native component within a native - app that also uses the native Branch SDK. - * Includes native SDKS 0.13.5 (iOS), 2.5.9 (Android) +- Reduce the number of manual steps required to get started. +- Remove any need for CocoaPods, Carthage or manual iOS SDK installation in a React Native app. +- Pin to specific versions of the native SDKs to avoid issues arising from version mismatches. +- Fully support integration of react-native-branch in a React Native component within a native + app that also uses the native Branch SDK. +- Includes native SDKS 0.13.5 (iOS), 2.5.9 (Android) - See [Release 2.0.0](https://github.com/BranchMetrics/react-native-branch-deep-linking/blob/master/docs/Release-2.0.0.md) for more details. +See [Release 2.0.0](https://github.com/BranchMetrics/react-native-branch-deep-linking/blob/master/docs/Release-2.0.0.md) for more details. -2017-03-21 Version 1.1.1 +2017-03-21 Version 1.1.1 - * Decrease buildToolsVersion to 23.0.1 in build.gradle - * Fixed broken Carthage build (#128) - * Updated README to reflect async createBranchUniversalObject method. +- Decrease buildToolsVersion to 23.0.1 in build.gradle +- Fixed broken Carthage build (#128) +- Updated README to reflect async createBranchUniversalObject method. -2017-03-21 Version 0.9.7 +2017-03-21 Version 0.9.7 - * Decrease buildToolsVersion to 23.0.1 in build.gradle +- Decrease buildToolsVersion to 23.0.1 in build.gradle -2017-03-16 Version 1.1.0 +2017-03-16 Version 1.1.0 - * This release introduces a userCompletedAction() method on the Branch Universal Object. The registerView() method +- This release introduces a userCompletedAction() method on the Branch Universal Object. The registerView() method is deprecated in favor of userCompletedAction(RegisterViewEvent). - * The createBranchUniversalObject() method now allocates native resources supporting the BUO. These are eventually +- The createBranchUniversalObject() method now allocates native resources supporting the BUO. These are eventually cleaned up when unused for some time. An optional release() method is also provided to ensure they are released immediately, e.g. when componentWillUnmount() is called. - * Corrected a react-native version limitation in the build.gradle to ensure the version from node_modules is used. - * The native iOS dependencies for the testbed apps were updated to 0.13.5. +- Corrected a react-native version limitation in the build.gradle to ensure the version from node_modules is used. +- The native iOS dependencies for the testbed apps were updated to 0.13.5. -2017-03-16 Version 0.9.6 +2017-03-16 Version 0.9.6 - * Corrected a react-native version limitation in the build.gradle to ensure the version from node_modules is used. +- Corrected a react-native version limitation in the build.gradle to ensure the version from node_modules is used. -2017-02-24 Version 1.0.5 +2017-02-24 Version 1.0.5 - * Improved support for manual installation of Branch SDK - * Fix for non-Branch links with Universal Links on iOS +- Improved support for manual installation of Branch SDK +- Fix for non-Branch links with Universal Links on iOS -2017-02-24 Version 0.9.5 +2017-02-24 Version 0.9.5 - * Improved support for manual installation of Branch SDK - * Fix for non-Branch links with Universal Links on iOS +- Improved support for manual installation of Branch SDK +- Fix for non-Branch links with Universal Links on iOS -2017-02-15 Version 1.0.4 +2017-02-15 Version 1.0.4 - * Reduced iOS deploy target from 9.2 to 8.0. +- Reduced iOS deploy target from 9.2 to 8.0. -2017-02-15 Version 0.9.3 +2017-02-15 Version 0.9.3 - * Reduced iOS deploy target from 9.2 to 8.0. +- Reduced iOS deploy target from 9.2 to 8.0. -2017-02-06 Version 1.0.2 +2017-02-06 Version 1.0.2 - * Corrected peerDependencies - * Fixed [an issue](https://github.com/BranchMetrics/react-native-branch-deep-linking/pull/93) that prevented App Store submission +- Corrected peerDependencies +- Fixed [an issue](https://github.com/BranchMetrics/react-native-branch-deep-linking/pull/93) that prevented App Store submission -2017-02-06 Version 0.9.2 +2017-02-06 Version 0.9.2 - * Corrected peerDependencies +- Corrected peerDependencies -2017-01-31 Version 1.0.1 +2017-01-31 Version 1.0.1 - * Fixed unsubscribe bug (#73) - * Support all parameters of Branch Universal Object and link properties +- Fixed unsubscribe bug (#73) +- Support all parameters of Branch Universal Object and link properties -2017-01-31 Version 0.9.1 +2017-01-31 Version 0.9.1 - * Fixed unsubscribe bug (#73) - * Full support for Carthage - * Support all parameters of Branch Universal Object and link properties +- Fixed unsubscribe bug (#73) +- Full support for Carthage +- Support all parameters of Branch Universal Object and link properties -2017-01-13 Version 1.0.0 +2017-01-13 Version 1.0.0 - * Support for react-native 0.40.0 - * Configuration changes to support various toolchains - * Full support for Carthage +- Support for react-native 0.40.0 +- Configuration changes to support various toolchains +- Full support for Carthage diff --git a/android/build.gradle b/android/build.gradle index 2b38e65a5..ba5e1d73a 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -47,5 +47,5 @@ def safeExtGet(prop, fallback) { dependencies { implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' implementation 'com.facebook.react:react-native:+' // From node_modules - api 'io.branch.sdk.android:library:5.7.1' + api 'io.branch.sdk.android:library:5.9.0' } diff --git a/android/src/main/java/io/branch/rnbranch/RNBranchModule.java b/android/src/main/java/io/branch/rnbranch/RNBranchModule.java index 1e0a87c0b..e3bb4c8ad 100644 --- a/android/src/main/java/io/branch/rnbranch/RNBranchModule.java +++ b/android/src/main/java/io/branch/rnbranch/RNBranchModule.java @@ -257,14 +257,6 @@ private static void notifyJSOfInitSessionStart(Context context, Uri uri) { LocalBroadcastManager.getInstance(context).sendBroadcast(broadcastIntent); } - /** - * @deprecated setDebug is deprecated and all functionality has been disabled. If you wish to enable - * logging, please invoke enableLogging. If you wish to simulate installs, please Test Devices - * (https://help.branch.io/using-branch/docs/adding-test-devices) - */ - @Deprecated - public static void setDebug() { } - public static void enableLogging() { Branch.enableLogging(); } @@ -1253,4 +1245,10 @@ private static WritableArray convertJsonToArray(JSONArray jsonArray) throws JSON } return array; } + + @ReactMethod + public void setDMAParamsForEEA(boolean eeaRegion, boolean adPersonalizationConsent, boolean adUserDataUsageConsent) { + Branch branch = Branch.getInstance(); + branch.setDMAParamsForEEA(eeaRegion, adPersonalizationConsent, adUserDataUsageConsent); + } } diff --git a/docs/setDebug.md b/docs/setDebug.md deleted file mode 100644 index ed24f838b..000000000 --- a/docs/setDebug.md +++ /dev/null @@ -1,45 +0,0 @@ -The `setDebug` method exists in the underlying native SDKs and the documentation -for the react-native-branch SDK. Unfortunately, it is not possible to -implement it in JavaScript immediately because the native methods must be called -before initializing the native SDKs. Currently, the native SDKs are initialized -before the JavaScript loads. By the time a React Native app calls `setDebug`, -it is too late to call it. This is likely to change in a future release. - -For now, it is necessary to make the call directly in native code on both -platforms. - -As of 2.0.0-beta.7, it is also possible to call `setDebug` using the `debugMode` -parameter in the `branch.json` configuration file. See -https://rnbranch.app.link/branch-json for details. - -#### iOS - -##### Objective-C - -In AppDelegate.m, before calling `[RNBranch initSessionWithLaunchOptions:isReferrable:]`, -call `[RNBranch setDebug]`. - -```Obj-C -[RNBranch setDebug]; -[RNBranch initSessionWithLaunchOptions:launchOptions isReferrable:YES]; -``` - -##### Swift - -In AppDelegate.swift, before calling `RNBranch.initSession(launchOptions:, isReferrable:)`, -call `RNBranch.setDebug()`. - -```Swift -RNBranch.setDebug() -RNBranch.initSession(launchOptions: launchOptions, isReferrable: true) -``` - -#### Android - -In your Activity source file, e.g. MainActivity.java, before calling `RNBranch.initSession()`, -call `RNBranch.setDebug()`: - -```Java -RNBranchModule.setDebug(); -RNBranchModule.initSession(getIntent().getData(), this); -``` diff --git a/ios/RNBranch.h b/ios/RNBranch.h index 4a404f41f..db419066f 100644 --- a/ios/RNBranch.h +++ b/ios/RNBranch.h @@ -28,7 +28,6 @@ extern NSString * _Nonnull const RNBranchLinkOpenedNotificationLinkPropertiesKey + (void)useTestInstance; + (void)deferInitializationForJSLoad; -+ (void)setDebug; + (void)enableLogging; @end diff --git a/ios/RNBranch.m b/ios/RNBranch.m index f681d2974..9dfdb9dd6 100644 --- a/ios/RNBranch.m +++ b/ios/RNBranch.m @@ -109,11 +109,6 @@ + (BOOL)requiresMainQueueSetup { #pragma mark - Class methods -+ (void)setDebug -{ - [self.branch setDebug]; -} - + (void)enableLogging { [self.branch enableLogging]; @@ -744,4 +739,9 @@ - (CGFloat) colorComponentFrom: (NSString *) string start: (NSUInteger) start le return hexComponent / 255.0; } +#pragma mark setDMAParamsForEEA +RCT_EXPORT_METHOD(setDMAParamsForEEA:(BOOL)eeaRegion AdPersonalizationConsent:(BOOL)adPersonalizationConsent AdUserDataUsageConsent:(BOOL)adUserDataUsageConsent) { + [Branch setDMAParamsForEEA:eeaRegion AdPersonalizationConsent:adPersonalizationConsent AdUserDataUsageConsent:adUserDataUsageConsent]; +} + @end diff --git a/react-native-branch.podspec b/react-native-branch.podspec index 377b4348d..058f660d9 100644 --- a/react-native-branch.podspec +++ b/react-native-branch.podspec @@ -22,7 +22,7 @@ Pod::Spec.new do |s| s.source_files = [ "ios/*.h", "ios/*.m"] s.compiler_flags = %[-DRNBRANCH_VERSION=@\\"#{s.version}\\"] s.header_dir = 'RNBranch' # also sets generated module name - s.dependency 'BranchSDK', '3.0.0' + s.dependency 'BranchSDK', '3.2.0' s.dependency 'React-Core' # to ensure the correct build order # Swift/Objective-C compatibility diff --git a/src/index.d.ts b/src/index.d.ts index 094b74512..bf290029f 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -347,6 +347,7 @@ interface Branch { ) => Promise; setPreInstallCampaign: (campaign: string) => void; setPreInstallPartner: (partner: string) => void; + setDMAParamsForEEA: (eeaRegion: boolean, adPersonalizationConsent: boolean, adUserDataUsageConsent: boolean) => void; } declare const branch: Branch; export default branch; diff --git a/src/index.js b/src/index.js index 8f7314667..835a59432 100644 --- a/src/index.js +++ b/src/index.js @@ -1,13 +1,13 @@ -import { NativeModules, Platform } from 'react-native' +import { NativeModules, Platform } from "react-native"; -const { RNBranch } = NativeModules +const { RNBranch } = NativeModules; -import createBranchUniversalObject from './branchUniversalObject' -import BranchEvent from './BranchEvent' -import BranchSubscriber from './BranchSubscriber' +import createBranchUniversalObject from "./branchUniversalObject"; +import BranchEvent from "./BranchEvent"; +import BranchSubscriber from "./BranchSubscriber"; -const packageFile = require('./../package.json') -export const VERSION = packageFile.version +const packageFile = require("./../package.json"); +export const VERSION = packageFile.version; class Branch { key = null; @@ -15,13 +15,13 @@ class Branch { _debug = false; constructor(options = {}) { - if (options.debug) this._debug = true + if (options.debug) this._debug = true; - console.info('Initializing react-native-branch v. ' + VERSION) + console.info("Initializing react-native-branch v. " + VERSION); } subscribe(options) { - if (typeof options === 'function') { + if (typeof options === "function") { /* * Support for legacy API, passing a single callback function: * branch.subscribe(({params, error, uri}) => { ... }). This is @@ -29,101 +29,154 @@ class Branch { */ options = { onOpenComplete: options, - } + }; } /* * You can specify checkCachedEvents in the subscribe options to control * this per subscriber. */ - if (!('checkCachedEvents' in options)) { - options.checkCachedEvents = this._checkCachedEvents + if (!("checkCachedEvents" in options)) { + options.checkCachedEvents = this._checkCachedEvents; } - this._checkCachedEvents = false + this._checkCachedEvents = false; - const subscriber = new BranchSubscriber(options) - subscriber.subscribe() + const subscriber = new BranchSubscriber(options); + subscriber.subscribe(); - return () => subscriber.unsubscribe() + return () => subscriber.unsubscribe(); } skipCachedEvents() { /*** Sets to ignore cached events. ***/ - this._checkCachedEvents = false + this._checkCachedEvents = false; } /*** Tracking related methods ***/ - disableTracking = (disable) => RNBranch.disableTracking(disable) - isTrackingDisabled = RNBranch.isTrackingDisabled + disableTracking = (disable) => RNBranch.disableTracking(disable); + isTrackingDisabled = RNBranch.isTrackingDisabled; /*** RNBranch singleton methods ***/ - setDebug = () => { throw 'setDebug() is not supported in the RN SDK. For other solutions, please see https://rnbranch.app.link/setDebug' } - getLatestReferringParams = (synchronous = false) => RNBranch.getLatestReferringParams(synchronous) - getFirstReferringParams = RNBranch.getFirstReferringParams - lastAttributedTouchData = (attributionWindow = {}) => RNBranch.lastAttributedTouchData(attributionWindow) - setIdentity = (identity) => RNBranch.setIdentity(identity) - setIdentityAsync = (identity) => RNBranch.setIdentityAsync(identity) + getLatestReferringParams = (synchronous = false) => + RNBranch.getLatestReferringParams(synchronous); + getFirstReferringParams = RNBranch.getFirstReferringParams; + lastAttributedTouchData = (attributionWindow = {}) => + RNBranch.lastAttributedTouchData(attributionWindow); + setIdentity = (identity) => RNBranch.setIdentity(identity); + setIdentityAsync = (identity) => RNBranch.setIdentityAsync(identity); setRequestMetadata = (key, value) => { - console.info('[Branch] setRequestMetadata has limitations when called from JS. Some network calls are made prior to the JS layer being available, those calls will not have the metadata.') - return RNBranch.setRequestMetadataKey(key, value) - } + console.info( + "[Branch] setRequestMetadata has limitations when called from JS. Some network calls are made prior to the JS layer being available, those calls will not have the metadata." + ); + return RNBranch.setRequestMetadataKey(key, value); + }; addFacebookPartnerParameter = (name, value) => { - console.info('[Branch] addFacebookPartnerParameter has limitations when called from JS. Some network calls are made prior to the JS layer being available, those calls will not have the partner parameters.') - return RNBranch.addFacebookPartnerParameter(name, value) - } + console.info( + "[Branch] addFacebookPartnerParameter has limitations when called from JS. Some network calls are made prior to the JS layer being available, those calls will not have the partner parameters." + ); + return RNBranch.addFacebookPartnerParameter(name, value); + }; addSnapPartnerParameter = (name, value) => { - console.info('[Branch] addSnapPartnerParameter has limitations when called from JS. Some network calls are made prior to the JS layer being available, those calls will not have the partner parameters.') - return RNBranch.addSnapPartnerParameter(name, value) - } - clearPartnerParameters = RNBranch.clearPartnerParameters - logout = RNBranch.logout - getShortUrl = RNBranch.getShortUrl + console.info( + "[Branch] addSnapPartnerParameter has limitations when called from JS. Some network calls are made prior to the JS layer being available, those calls will not have the partner parameters." + ); + return RNBranch.addSnapPartnerParameter(name, value); + }; + clearPartnerParameters = RNBranch.clearPartnerParameters; + logout = RNBranch.logout; + getShortUrl = RNBranch.getShortUrl; openURL = (url, options = {}) => { return Platform.select({ android: () => RNBranch.openURL(url, options), - ios: () => RNBranch.openURL(url) - })() - } + ios: () => RNBranch.openURL(url), + })(); + }; handleATTAuthorizationStatus = (ATTAuthorizationStatus) => { - if (Platform.OS != 'ios') return; - let normalizedAttAuthorizationStatus = -1 + if (Platform.OS != "ios") return; + let normalizedAttAuthorizationStatus = -1; - switch(ATTAuthorizationStatus) { - case 'authorized': + switch (ATTAuthorizationStatus) { + case "authorized": normalizedAttAuthorizationStatus = 3; break; - case 'denied': + case "denied": normalizedAttAuthorizationStatus = 2; break; - case 'undetermined': + case "undetermined": normalizedAttAuthorizationStatus = 0; break; - case 'restricted': + case "restricted": normalizedAttAuthorizationStatus = 1; break; } if (normalizedAttAuthorizationStatus < 0) { - console.info('[Branch] handleATTAuthorizationStatus received an unrecognized value. Value must be one of; authorized, denied, undetermined, or restricted') + console.info( + "[Branch] handleATTAuthorizationStatus received an unrecognized value. Value must be one of; authorized, denied, undetermined, or restricted" + ); return; } - RNBranch.handleATTAuthorizationStatus(normalizedAttAuthorizationStatus) - } + RNBranch.handleATTAuthorizationStatus(normalizedAttAuthorizationStatus); + }; /*** BranchUniversalObject ***/ - createBranchUniversalObject = createBranchUniversalObject + createBranchUniversalObject = createBranchUniversalObject; /*** BranchQRCode ***/ - getBranchQRCode = (qrCodeSettings = {}, branchUniversalObject = {}, linkProperties = {}, controlParams = {}) => { - return RNBranch.getBranchQRCode(qrCodeSettings, branchUniversalObject, linkProperties, controlParams); - } + getBranchQRCode = ( + qrCodeSettings = {}, + branchUniversalObject = {}, + linkProperties = {}, + controlParams = {} + ) => { + return RNBranch.getBranchQRCode( + qrCodeSettings, + branchUniversalObject, + linkProperties, + controlParams + ); + }; /*** PreInstall Parameters ***/ - setPreInstallCampaign = (campaign) => RNBranch.setPreinstallCampaign(campaign) - setPreInstallPartner = (partner) => RNBranch.setPreinstallPartner(partner) - + setPreInstallCampaign = (campaign) => + RNBranch.setPreinstallCampaign(campaign); + setPreInstallPartner = (partner) => RNBranch.setPreinstallPartner(partner); + + /*** DMA Consent Params ***/ + setDMAParamsForEEA = ( + eeaRegion, + adPersonalizationConsent, + adUserDataUsageConsent + ) => { + const isValid = + validateParam(eeaRegion, "eeaRegion") && + validateParam(adPersonalizationConsent, "adPersonalizationConsent") && + validateParam(adUserDataUsageConsent, "adUserDataUsageConsent"); + + if (isValid) { + RNBranch.setDMAParamsForEEA( + eeaRegion, + adPersonalizationConsent, + adUserDataUsageConsent + ); + } else { + console.warn("setDMAParamsForEEA: Unable to set DMA params."); + } + }; } -export { Branch, BranchEvent, BranchSubscriber } -export default new Branch() +const validateParam = (param, paramName) => { + if (param === true || param === false) { + return true; + } else { + console.warn( + `setDMAParamsForEEA: ${paramName} must be boolean, but got ${param}` + ); + + return false; + } +}; + +export { Branch, BranchEvent, BranchSubscriber }; +export default new Branch();