Skip to content

Commit

Permalink
Expose native layer Integration Validator (#1038)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
rob-gioia-branch authored Dec 13, 2024
1 parent 9a4d358 commit 02170e5
Show file tree
Hide file tree
Showing 12 changed files with 5,941 additions and 16,995 deletions.
6 changes: 6 additions & 0 deletions android/src/main/java/io/branch/rnbranch/RNBranchModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down Expand Up @@ -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);
}
}
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
2 changes: 1 addition & 1 deletion branchreactnativetestbed/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rootProject.name = 'branchreactnativetestbed'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')
includeBuild('../node_modules/@react-native/gradle-plugin')
4 changes: 4 additions & 0 deletions branchreactnativetestbed/components/BranchWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,8 @@ export default class BranchWrapper {
'This alert was dismissed by tapping outside of the alert dialog.',
),
});

validateSDKIntegration = () => {
branch.validateSDKIntegration();
};
}
Loading

0 comments on commit 02170e5

Please sign in to comment.