From e5500bc1075cfb3427e1530c49fb634f474e96de Mon Sep 17 00:00:00 2001 From: rob-gioia-branch Date: Wed, 2 Oct 2024 15:58:26 -0400 Subject: [PATCH] Got alert popup showing and displaying the Branch SDK version Got alert popup showing and displaying the Branch SDK version --- branchreactnativetestbed/App.tsx | 10 ++++++++++ branchreactnativetestbed/components/BranchWrapper.ts | 9 +++++++++ src/index.d.ts | 1 + src/index.js | 2 ++ 4 files changed, 22 insertions(+) diff --git a/branchreactnativetestbed/App.tsx b/branchreactnativetestbed/App.tsx index 0d19eb1b2..325fc7afd 100644 --- a/branchreactnativetestbed/App.tsx +++ b/branchreactnativetestbed/App.tsx @@ -47,6 +47,7 @@ class App extends React.Component { data: BranchButton[]; events: BranchButton[]; sections: BranchSection[]; + testing: BranchButton[]; constructor(props: any) { super(props); @@ -154,10 +155,19 @@ class App extends React.Component { }, ]; + 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 }, ]; } diff --git a/branchreactnativetestbed/components/BranchWrapper.ts b/branchreactnativetestbed/components/BranchWrapper.ts index c290ee0f5..4ca54dd75 100644 --- a/branchreactnativetestbed/components/BranchWrapper.ts +++ b/branchreactnativetestbed/components/BranchWrapper.ts @@ -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)); diff --git a/src/index.d.ts b/src/index.d.ts index bf290029f..047904280 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -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; diff --git a/src/index.js b/src/index.js index 438c399a2..02d789eb6 100644 --- a/src/index.js +++ b/src/index.js @@ -138,6 +138,8 @@ class Branch { ); }; + validateSDKIntegration = () => {}; + /*** PreInstall Parameters ***/ setPreInstallCampaign = (campaign) => RNBranch.setPreinstallCampaign(campaign);