From d942560bf9cc6445497142856fb96e5979af563b Mon Sep 17 00:00:00 2001 From: rob-gioia-branch Date: Tue, 8 Oct 2024 14:11:17 -0400 Subject: [PATCH] Got the validator working for Android Got the validator working for Android --- android/build.gradle | 1 + .../src/main/java/io/branch/rnbranch/RNBranchModule.java | 6 ++++++ branchreactnativetestbed/components/BranchWrapper.ts | 4 ++++ src/index.d.ts | 1 + src/index.js | 4 ++++ 5 files changed, 16 insertions(+) diff --git a/android/build.gradle b/android/build.gradle index 14f75002a..6512159e1 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -48,4 +48,5 @@ dependencies { implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' implementation 'com.facebook.react:react-native:+' // From node_modules api 'io.branch.sdk.android:library:5.12.4' + implementation 'com.google.android.gms:play-services-base:18.5.0' } diff --git a/android/src/main/java/io/branch/rnbranch/RNBranchModule.java b/android/src/main/java/io/branch/rnbranch/RNBranchModule.java index e3bb4c8ad..212bc4179 100644 --- a/android/src/main/java/io/branch/rnbranch/RNBranchModule.java +++ b/android/src/main/java/io/branch/rnbranch/RNBranchModule.java @@ -26,6 +26,7 @@ import io.branch.referral.QRCode.BranchQRCode; import io.branch.referral.util.*; import io.branch.referral.Branch; +import io.branch.referral.validators.IntegrationValidator; import io.branch.indexing.*; import org.json.*; @@ -1251,4 +1252,9 @@ public void setDMAParamsForEEA(boolean eeaRegion, boolean adPersonalizationConse Branch branch = Branch.getInstance(); branch.setDMAParamsForEEA(eeaRegion, adPersonalizationConsent, adUserDataUsageConsent); } + + @ReactMethod + public void validateSDKIntegration() { + IntegrationValidator.validate(mActivity); + } } diff --git a/branchreactnativetestbed/components/BranchWrapper.ts b/branchreactnativetestbed/components/BranchWrapper.ts index c290ee0f5..03cbe6354 100644 --- a/branchreactnativetestbed/components/BranchWrapper.ts +++ b/branchreactnativetestbed/components/BranchWrapper.ts @@ -297,4 +297,8 @@ export default class BranchWrapper { 'This alert was dismissed by tapping outside of the alert dialog.', ), }); + + validateSDKIntegration = () => { + branch.validateSDKIntegration(); + }; } 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..9ac949991 100644 --- a/src/index.js +++ b/src/index.js @@ -164,6 +164,10 @@ class Branch { console.warn('setDMAParamsForEEA: Unable to set DMA params.'); } }; + + validateSDKIntegration = () => { + RNBranch.validateSDKIntegration(); + }; } const validateParam = (param, paramName) => {