Integrates tracking disabling feature for GDPR compliance
MODIFY
android/src/main/java/io/branch/rnbranch/RNBranchModule.java
android/src/main/java/io/branch/rnbranch/RNBranchModule.java
@@ -295,6 +295,18 @@ public class RNBranchModule extends ReactContextBaseJavaModule {
return REACT_MODULE_NAME;
}
+ @ReactMethod
+ public void disableTracking(boolean disable) {
+ Branch branch = Branch.getInstance();
+ branch.disableTracking(disable);
+ }
+
+ @ReactMethod
+ public void isTrackingDisabled(Promise promise) {
+ Branch branch = Branch.getInstance();
+ promise.resolve(branch.isTrackingDisabled());
+ }
+
@ReactMethod
public void createUniversalObject(ReadableMap universalObjectMap, Promise promise) {
String ident = UUID.randomUUID().toString();

MODIFY
ios/RNBranch.m
ios/RNBranch.m
@@ -276,6 +276,21 @@ RCT_EXPORT_MODULE();
#pragma mark - Methods exported to React Native
+#pragma mark disableTracking
+RCT_EXPORT_METHOD(
+ disableTracking:(BOOL)disable
+ ) {
+ [Branch setTrackingDisabled: disable];
+}
+
+#pragma mark isTrackingDisabled
+RCT_EXPORT_METHOD(
+ isTrackingDisabled:(RCTPromiseResolveBlock)resolve
+ rejecter:(__unused RCTPromiseRejectBlock)reject
+ ) {
+ resolve([Branch trackingDisabled] ? @YES : @NO);
+}
+
#pragma mark redeemInitSessionResult
RCT_EXPORT_METHOD(
redeemInitSessionResult:(RCTPromiseResolveBlock)resolve

MODIFY
src/index.js
src/index.js
@@ -95,6 +95,10 @@ class Branch {
this.nativeEventEmitter.removeListener(RNBranch.INIT_SESSION_ERROR, listener)
}
+ /*** Tracking related methods ***/
+ 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 = RNBranch.getLatestReferringParams

Integrates tracking disabling feature for GDPR compliance