Skip to content

Commit 02170e5

Browse files
Expose native layer Integration Validator (#1038)
* Fixed an Android build error by using @react-native/gradle-plugin in settings.gradle Fixed an Android build error by using @react-native/gradle-plugin in settings.gradle * Added a testing section to the App.tsx file with an "Validate SDK Integration" button in there Added a testing section to the App.tsx file with an "Validate SDK Integration" button in there * Got the validator working for Android Got the validator working for Android * Got the validator working for iOS Got the validator working for iOS * Updated packages-lock file (fixed build error) Updated packages-lock file (fixed build error) * Updated dependencies to fix build errors Updated dependencies to fix build errors * Removed dependency per Gabe's PR feedback and tested to ensure that it still worked without the dependency Removed dependency per Gabe's PR feedback and tested to ensure that it still worked without the dependency * Updates to the testbed app Updates to the testbed app
1 parent 9a4d358 commit 02170e5

File tree

12 files changed

+5941
-16995
lines changed

12 files changed

+5941
-16995
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import io.branch.referral.QRCode.BranchQRCode;
2727
import io.branch.referral.util.*;
2828
import io.branch.referral.Branch;
29+
import io.branch.referral.validators.IntegrationValidator;
2930
import io.branch.indexing.*;
3031

3132
import org.json.*;
@@ -1251,4 +1252,9 @@ public void setDMAParamsForEEA(boolean eeaRegion, boolean adPersonalizationConse
12511252
Branch branch = Branch.getInstance();
12521253
branch.setDMAParamsForEEA(eeaRegion, adPersonalizationConsent, adUserDataUsageConsent);
12531254
}
1255+
1256+
@ReactMethod
1257+
public void validateSDKIntegration() {
1258+
IntegrationValidator.validate(mActivity);
1259+
}
12541260
}

branchreactnativetestbed/App.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class App extends React.Component<any, MyState> {
4747
data: BranchButton[];
4848
events: BranchButton[];
4949
sections: BranchSection[];
50+
testing: BranchButton[];
5051

5152
constructor(props: any) {
5253
super(props);
@@ -154,10 +155,19 @@ class App extends React.Component<any, MyState> {
154155
},
155156
];
156157

158+
this.testing = [
159+
{
160+
text: 'Validate SDK Integration',
161+
onPress: this.branchWrapper.validateSDKIntegration.bind(this),
162+
image: require('./images/attach_money_FILL1_wght400_GRAD0_opsz48.png'),
163+
}
164+
];
165+
157166
this.sections = [
158167
{ sectionName: 'Linking', branchButtons: this.linking },
159168
{ sectionName: 'Data', branchButtons: this.data },
160169
{ sectionName: 'Events', branchButtons: this.events },
170+
{ sectionName: 'Testing', branchButtons: this.testing }
161171
];
162172
}
163173

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
rootProject.name = 'branchreactnativetestbed'
22
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
33
include ':app'
4-
includeBuild('../node_modules/@react-native/gradle-plugin')
4+
includeBuild('../node_modules/@react-native/gradle-plugin')

branchreactnativetestbed/components/BranchWrapper.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,4 +297,8 @@ export default class BranchWrapper {
297297
'This alert was dismissed by tapping outside of the alert dialog.',
298298
),
299299
});
300+
301+
validateSDKIntegration = () => {
302+
branch.validateSDKIntegration();
303+
};
300304
}

0 commit comments

Comments
 (0)