Skip to content

Commit e5500bc

Browse files
Got alert popup showing and displaying the Branch SDK version
Got alert popup showing and displaying the Branch SDK version
1 parent 2b0c52f commit e5500bc

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

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

branchreactnativetestbed/components/BranchWrapper.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,15 @@ export default class BranchWrapper {
185185
branch.logout();
186186
};
187187

188+
validateSDKIntegration = async () => {
189+
const packageJson = require('../package.json');
190+
const sdkVersion = packageJson.dependencies['react-native-branch'];
191+
192+
Alert.alert('Branch Integration Validator',
193+
'Branch SDK Version: ' + sdkVersion,
194+
[{text: 'OK', onPress: () => console.log('OK Pressed')},]);
195+
};
196+
188197
viewFirstReferringParams = async () => {
189198
let params = await branch.getFirstReferringParams();
190199
this.createAlert('Install referring params', JSON.stringify(params));

src/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ interface Branch {
348348
setPreInstallCampaign: (campaign: string) => void;
349349
setPreInstallPartner: (partner: string) => void;
350350
setDMAParamsForEEA: (eeaRegion: boolean, adPersonalizationConsent: boolean, adUserDataUsageConsent: boolean) => void;
351+
validateSDKIntegration: () => void;
351352
}
352353
declare const branch: Branch;
353354
export default branch;

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ class Branch {
138138
);
139139
};
140140

141+
validateSDKIntegration = () => {};
142+
141143
/*** PreInstall Parameters ***/
142144
setPreInstallCampaign = (campaign) =>
143145
RNBranch.setPreinstallCampaign(campaign);

0 commit comments

Comments
 (0)