Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose native layer Integration Validator #1038

Merged
merged 9 commits into from
Dec 13, 2024
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();
};
}
13,353 changes: 4,533 additions & 8,820 deletions branchreactnativetestbed/package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions branchreactnativetestbed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
},
"dependencies": {
"react": "18.2.0",
"react-native": "0.72.5",
"react-native-branch": "6.3.0"
"react-native": "^0.72.17",
"react-native-branch": "^6.3.0"
},
"devDependencies": {
"@babel/core": "^7.20.0",
Expand Down
6 changes: 6 additions & 0 deletions ios/RNBranch.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#import "RNBranchAgingDictionary.h"
#import "RNBranchEventEmitter.h"
#import <BranchSDK/NSError+Branch.h>
#import "Branch+Validator.h"

NSString * const RNBranchLinkOpenedNotification = @"RNBranchLinkOpenedNotification";
NSString * const RNBranchLinkOpenedNotificationErrorKey = @"error";
Expand Down Expand Up @@ -744,4 +745,9 @@ - (CGFloat) colorComponentFrom: (NSString *) string start: (NSUInteger) start le
[Branch setDMAParamsForEEA:eeaRegion AdPersonalizationConsent:adPersonalizationConsent AdUserDataUsageConsent:adUserDataUsageConsent];
}

#pragma mark validateSDKIntegration
RCT_EXPORT_METHOD(validateSDKIntegration) {
[[Branch getInstance] validateSDKIntegration];
}

@end
Loading
Loading