Skip to content

Commit

Permalink
Got alert popup showing and displaying the Branch SDK version
Browse files Browse the repository at this point in the history
Got alert popup showing and displaying the Branch SDK version
  • Loading branch information
rob-gioia-branch committed Oct 2, 2024
1 parent 2b0c52f commit e5500bc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions branchreactnativetestbed/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class App extends React.Component<any, MyState> {
data: BranchButton[];
events: BranchButton[];
sections: BranchSection[];
testing: BranchButton[];

constructor(props: any) {
super(props);
Expand Down Expand Up @@ -154,10 +155,19 @@ class App extends React.Component<any, MyState> {
},
];

this.testing = [
{
text: 'Validate SDK Integration',
onPress: this.branchWrapper.validateSDKIntegration.bind(this),
image: require('./images/attach_money_FILL1_wght400_GRAD0_opsz48.png'),
}
];

this.sections = [
{ sectionName: 'Linking', branchButtons: this.linking },
{ sectionName: 'Data', branchButtons: this.data },
{ sectionName: 'Events', branchButtons: this.events },
{ sectionName: 'Testing', branchButtons: this.testing },
];
}

Expand Down
9 changes: 9 additions & 0 deletions branchreactnativetestbed/components/BranchWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,15 @@ export default class BranchWrapper {
branch.logout();
};

validateSDKIntegration = async () => {
const packageJson = require('../package.json');
const sdkVersion = packageJson.dependencies['react-native-branch'];

Alert.alert('Branch Integration Validator',
'Branch SDK Version: ' + sdkVersion,
[{text: 'OK', onPress: () => console.log('OK Pressed')},]);
};

viewFirstReferringParams = async () => {
let params = await branch.getFirstReferringParams();
this.createAlert('Install referring params', JSON.stringify(params));
Expand Down
1 change: 1 addition & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ interface Branch {
setPreInstallCampaign: (campaign: string) => void;
setPreInstallPartner: (partner: string) => void;
setDMAParamsForEEA: (eeaRegion: boolean, adPersonalizationConsent: boolean, adUserDataUsageConsent: boolean) => void;
validateSDKIntegration: () => void;
}
declare const branch: Branch;
export default branch;
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ class Branch {
);
};

validateSDKIntegration = () => {};

/*** PreInstall Parameters ***/
setPreInstallCampaign = (campaign) =>
RNBranch.setPreinstallCampaign(campaign);
Expand Down

0 comments on commit e5500bc

Please sign in to comment.