Skip to content

Commit 3a00471

Browse files
Android Integration Validator failing when multiple URI scheme present in the manifest file. (#1258)
fix: Android Integration Validator failing when multiple URI scheme present in the manifest file. Looping all the uri scheme present in the manifest file and checking if dashboard uri scheme is present Co-authored-by: pa1pal <[email protected]>
1 parent 6dfbf81 commit 3a00471

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Branch-SDK/src/main/java/io/branch/referral/validators/URISchemeCheck.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public URISchemeCheck(BranchIntegrationModel integrationModel, JSONObject branch
3737
@Override
3838
public boolean RunTests(Context context) {
3939
String branchAppUriScheme = branchAppConfig.optString("android_uri_scheme").substring(0, branchAppConfig.optString("android_uri_scheme").length() - 3);
40-
String dashboardUriScheme = String.valueOf(integrationModel.deeplinkUriScheme.keys().next());
40+
String dashboardUriScheme = checkBranchKey(integrationModel.deeplinkUriScheme.keys(), branchAppUriScheme);
4141
boolean isUriSchemeProperlySetOnDashboard = !TextUtils.isEmpty(branchAppUriScheme);
4242
boolean isUriSchemeIntentProperlySetup = checkIfIntentAddedForURIScheme(branchAppConfig.optString("android_uri_scheme")) && integrationModel.appSettingsAvailable;
4343
boolean doUriSchemesMatch = branchAppUriScheme.trim().equals(dashboardUriScheme.trim());
@@ -58,6 +58,17 @@ else if(!doUriSchemesMatch) {
5858
return doUriSchemesMatch && isUriSchemeProperlySetOnDashboard && isUriSchemeIntentProperlySetup;
5959
}
6060

61+
private String checkBranchKey(Iterator<String> keys, String branchAppUriScheme) {
62+
String targetKey = branchAppUriScheme.replace("://", "");
63+
while (keys.hasNext()) {
64+
String key = keys.next();
65+
if (targetKey.equals(key)) {
66+
return key;
67+
}
68+
}
69+
return "";
70+
}
71+
6172
@Override
6273
public String GetOutput(Context context, boolean didTestSucceed) {
6374
didTestSucceed = RunTests(context);

0 commit comments

Comments
 (0)