Skip to content

Commit 499ec7b

Browse files
Expose CPP Method (#1063)
* expose cpp method * update testbed
1 parent 02170e5 commit 499ec7b

File tree

15 files changed

+684
-22209
lines changed

15 files changed

+684
-22209
lines changed

ChangeLog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2025-02-07 Version 6.5.0
2+
- Update iOS SDK to 3.9.0
3+
- Update Android SDK to 5.15.1
4+
- Exposed new method `setConsumerProtectionAttributionLevel` to set CPP level
5+
16
2024-10-29 Version 6.4.0
27
- Update iOS SDK to 3.6.5
38
- Update Android SDK to 5.13.0

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ def safeExtGet(prop, fallback) {
4747
dependencies {
4848
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
4949
implementation 'com.facebook.react:react-native:+' // From node_modules
50-
api 'io.branch.sdk.android:library:5.12.4'
50+
api 'io.branch.sdk.android:library:5.15.1'
5151
}

android/src/main/java/io/branch/rnbranch/RNBranchModule.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,6 +1253,32 @@ public void setDMAParamsForEEA(boolean eeaRegion, boolean adPersonalizationConse
12531253
branch.setDMAParamsForEEA(eeaRegion, adPersonalizationConsent, adUserDataUsageConsent);
12541254
}
12551255

1256+
@ReactMethod
1257+
public void setConsumerProtectionAttributionLevel(String level) {
1258+
Branch branch = Branch.getInstance();
1259+
Defines.BranchAttributionLevel attributionLevel;
1260+
1261+
switch (level) {
1262+
case "FULL":
1263+
attributionLevel = Defines.BranchAttributionLevel.FULL;
1264+
break;
1265+
case "REDUCED":
1266+
attributionLevel = Defines.BranchAttributionLevel.REDUCED;
1267+
break;
1268+
case "MINIMAL":
1269+
attributionLevel = Defines.BranchAttributionLevel.MINIMAL;
1270+
break;
1271+
case "NONE":
1272+
attributionLevel = Defines.BranchAttributionLevel.NONE;
1273+
break;
1274+
default:
1275+
Log.w(REACT_CLASS, "Invalid attribution level: " + level);
1276+
return;
1277+
}
1278+
1279+
branch.setConsumerProtectionAttributionLevel(attributionLevel);
1280+
}
1281+
12561282
@ReactMethod
12571283
public void validateSDKIntegration() {
12581284
IntegrationValidator.validate(mActivity);

branchreactnativetestbed/App.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ class App extends React.Component<any, MyState> {
103103
onPress: this.branchWrapper.viewLatestReferringParams.bind(this),
104104
image: require('./images/bolt_FILL0_wght400_GRAD0_opsz48.png'),
105105
},
106+
{
107+
text: 'Set Attribution Level',
108+
onPress: () => this.branchWrapper.setConsumerProtectionAttributionLevel('REDUCED'),
109+
image: require('./images/person_FILL1_wght400_GRAD0_opsz48.png'),
110+
},
106111
{
107112
text: 'Set User ID',
108113
onPress: () => this.branchWrapper.setUserIdAsync('rntest'),

branchreactnativetestbed/components/BranchWrapper.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,12 @@ export default class BranchWrapper {
209209
});
210210
};
211211

212+
setConsumerProtectionAttributionLevel = (level: 'FULL' | 'REDUCED' | 'MINIMAL' | 'NONE') => {
213+
console.log('BranchWrapper setConsumerProtectionAttributionLevel ' + level);
214+
branch.setConsumerProtectionAttributionLevel(level);
215+
this.createAlert('Attribution Level Set', `Level set to: ${level}`);
216+
};
217+
212218
toggleTracking = async () => {
213219
let trackingDisabled = await branch.isTrackingDisabled();
214220

0 commit comments

Comments
 (0)