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

Integration Validator 2.0 #1223

Merged
merged 20 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
fe16b68
Added a popup dialog displaying the Integration Validator results wit…
rob-gioia-branch Sep 27, 2024
9c1fa9e
Got deep link validator dialog showing
rob-gioia-branch Oct 9, 2024
e0a0ce0
Added spinner with the different choices of deep link keys used for r…
rob-gioia-branch Oct 9, 2024
0dfcb59
Next button loads the correct content for step 2 based on the user's …
rob-gioia-branch Oct 11, 2024
2cf8f00
Removed unneeded permissions
rob-gioia-branch Oct 25, 2024
effe1d5
Used IBranchLoggingCallbacks to retrieve the Branch logs
rob-gioia-branch Oct 25, 2024
bfb9f04
Added code to generate the various types of Branch links for testing
rob-gioia-branch Oct 25, 2024
4bfd315
Laid out the UI for step 3 of the modal (link & use case testing)
rob-gioia-branch Oct 25, 2024
8fc360a
Added constants and built out a deep link validator row class to enca…
rob-gioia-branch Oct 29, 2024
5a37852
Got the info buttons showing the relevant tooltips
rob-gioia-branch Oct 30, 2024
eb5c4ba
Added share button functionality
rob-gioia-branch Oct 31, 2024
56d9fe4
Added debug button functionality to show popup with how to fix deep l…
rob-gioia-branch Nov 1, 2024
6acc83b
Logic refactors so that each row uses uniform, modular code vs. hardc…
rob-gioia-branch Nov 1, 2024
33979fd
Added foreground click use case
rob-gioia-branch Nov 1, 2024
93296e6
Added warm start test case logic + some bugfixes
rob-gioia-branch Nov 1, 2024
5e1f9f6
Params bugfixes
rob-gioia-branch Nov 12, 2024
e7902da
Merge branch 'Deep-Link-Routing-Validator-2.0' into Integration-Valid…
rob-gioia-branch Nov 15, 2024
b96c9f3
Merged the Deep Linking Validator and the Integration Validator.
rob-gioia-branch Nov 15, 2024
ce0517d
Refactors based on Gabe's PR feedback (1 of 2)
rob-gioia-branch Nov 26, 2024
97d42f7
Refactors based on Gabe's PR feedback (2/2)
rob-gioia-branch Nov 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import io.branch.referral.util.LinkProperties;
import io.branch.referral.util.ProductCategory;
import io.branch.referral.util.ShareSheetStyle;
import io.branch.referral.validators.IntegrationValidator;

public class MainActivity extends Activity {
private EditText txtShortUrl;
Expand Down Expand Up @@ -660,7 +661,7 @@ protected void onStart() {
// Please look for "BranchSDK_Doctor" in the logcat to see the results.
// IMP : Do not make this call in your production app

//IntegrationValidator.validate(MainActivity.this);
IntegrationValidator.validate(MainActivity.this);
}


Expand Down
1 change: 1 addition & 0 deletions Branch-SDK/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("androidx.annotation:annotation:1.4.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")

// --- optional dependencies -----
// Please note that the Branch SDK does not require any of the below optional dependencies to operate.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package io.branch.referral.validators;

import static io.branch.referral.validators.IntegrationValidatorConstants.alternateDomainsMoreInfoDocsLink;

import android.content.Context;
import android.text.TextUtils;

import org.json.JSONObject;

public class AlternateDomainsCheck extends IntegrationValidatorCheck {
String name = "Alt Domains";
String errorMessage = "Could not find intent filter to support alternate link domain. Please add intent filter for handling alternate link domain in your Android Manifest file";
String moreInfoLink = alternateDomainsMoreInfoDocsLink;
BranchIntegrationModel integrationModel;
JSONObject branchAppConfig;

public AlternateDomainsCheck(BranchIntegrationModel integrationModel, JSONObject branchAppConfig) {
super.name = name;
super.errorMessage = errorMessage;
super.moreInfoLink = moreInfoLink;
this.integrationModel = integrationModel;
this.branchAppConfig = branchAppConfig;
}

@Override
public boolean RunTests(Context context) {
String alternateAppLinkDomain = branchAppConfig.optString("alternate_short_url_domain");
return TextUtils.isEmpty(alternateAppLinkDomain) || checkIfIntentAddedForLinkDomain(alternateAppLinkDomain);
}

@Override
public String GetOutput(Context context, boolean didTestSucceed) {
didTestSucceed = RunTests(context);
return super.GetOutput(context, didTestSucceed);
}

private boolean checkIfIntentAddedForLinkDomain(String domainName) {
boolean foundIntentFilterMatchingDomainName = false;
if (!TextUtils.isEmpty(domainName)) {
for (String host : integrationModel.applinkScheme) {
if (domainName.equals(host)) {
foundIntentFilterMatchingDomainName = true;
break;
}
}
}
return foundIntentFilterMatchingDomainName;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package io.branch.referral.validators;

import static io.branch.referral.validators.IntegrationValidatorConstants.appLinksMoreInfoDocsLink;

import android.content.Context;
import android.text.TextUtils;

import org.json.JSONObject;

public class AppLinksCheck extends IntegrationValidatorCheck {

String name = "App Links";
String errorMessage = "Could not find any App Link hosts to support Android AppLinks. Please add intent filter for handling AppLinks in your Android Manifest file";
String moreInfoLink = appLinksMoreInfoDocsLink;
BranchIntegrationModel integrationModel;
JSONObject branchAppConfig;

public AppLinksCheck(BranchIntegrationModel integrationModel, JSONObject branchAppConfig) {
super.name = name;
super.errorMessage = errorMessage;
super.moreInfoLink = moreInfoLink;
this.integrationModel = integrationModel;
this.branchAppConfig = branchAppConfig;
}

@Override
public boolean RunTests(Context context) {
String defAppLinkDomain = branchAppConfig.optString("default_short_url_domain");
return !integrationModel.applinkScheme.isEmpty() && !TextUtils.isEmpty(defAppLinkDomain) && checkIfIntentAddedForLinkDomain(defAppLinkDomain);
}

@Override
public String GetOutput(Context context, boolean didTestSucceed) {
didTestSucceed = RunTests(context);
return super.GetOutput(context, didTestSucceed);
}

private boolean checkIfIntentAddedForLinkDomain(String domainName) {
boolean foundIntentFilterMatchingDomainName = false;
if (!TextUtils.isEmpty(domainName) && integrationModel.applinkScheme != null) {
for (String host : integrationModel.applinkScheme) {
if (domainName.equals(host)) {
foundIntentFilterMatchingDomainName = true;
break;
}
}
}
return foundIntentFilterMatchingDomainName;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package io.branch.referral.validators;

import static io.branch.referral.validators.IntegrationValidatorConstants.branchInstanceCreationMoreInfoDocsLink;

import android.content.Context;

import io.branch.referral.Branch;

public class BranchInstanceCreationValidatorCheck extends IntegrationValidatorCheck {

String name = "Branch instance";
String errorMessage = "Branch is not initialised from your Application class. Please add `Branch.getAutoInstance(this);` to your Application#onCreate() method.";
String moreInfoLink = branchInstanceCreationMoreInfoDocsLink;

public BranchInstanceCreationValidatorCheck() {
super.name = name;
super.errorMessage = errorMessage;
super.moreInfoLink = moreInfoLink;
}

@Override
public boolean RunTests(Context context) {
return Branch.getInstance() != null;
}

@Override
public String GetOutput(Context context, boolean didTestSucceed) {
didTestSucceed = RunTests(context);
return super.GetOutput(context, didTestSucceed);
}

@Override
public String GetMoreInfoLink() {
return moreInfoLink;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package io.branch.referral.validators;

import static io.branch.referral.validators.IntegrationValidatorConstants.branchKeysMoreInfoDocsLink;

import android.content.Context;
import android.text.TextUtils;

import io.branch.referral.BranchUtil;

public class BranchKeysValidatorCheck extends IntegrationValidatorCheck {

String name = "Branch Keys";
String errorMessage = "Unable to read Branch keys from your application. Did you forget to add Branch keys in your application?.";
String moreInfoLink = branchKeysMoreInfoDocsLink;

public BranchKeysValidatorCheck() {
super.name = name;
super.errorMessage = errorMessage;
super.moreInfoLink = moreInfoLink;
}

@Override
public boolean RunTests(Context context) {
return !TextUtils.isEmpty(BranchUtil.readBranchKey(context));
}

@Override
public String GetOutput(Context context, boolean didTestSucceed) {
didTestSucceed = RunTests(context);
return super.GetOutput(context, didTestSucceed);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package io.branch.referral.validators;

import static io.branch.referral.validators.IntegrationValidatorConstants.customDomainMoreInfoDocsLink;

import android.content.Context;
import android.text.TextUtils;

import org.json.JSONObject;

public class CustomDomainCheck extends IntegrationValidatorCheck {

String name = "Custom Domain";
String errorMessage = "Could not find intent filter to support Branch default link domain. Please add intent filter for handling custom link domain in your Android Manifest file";
String moreInfoLink = customDomainMoreInfoDocsLink;
BranchIntegrationModel integrationModel;
JSONObject branchAppConfig;

public CustomDomainCheck(BranchIntegrationModel integrationModel, JSONObject branchAppConfig) {
super.name = name;
super.errorMessage = errorMessage;
super.moreInfoLink = moreInfoLink;
this.integrationModel = integrationModel;
this.branchAppConfig = branchAppConfig;
}

@Override
public boolean RunTests(Context context) {
String customDomain = branchAppConfig.optString("short_url_domain");
return TextUtils.isEmpty(customDomain) || checkIfIntentAddedForLinkDomain(customDomain);
}

@Override
public String GetOutput(Context context, boolean didTestSucceed) {
didTestSucceed = RunTests(context);
return super.GetOutput(context, didTestSucceed);
}

private boolean checkIfIntentAddedForLinkDomain(String domainName) {
boolean foundIntentFilterMatchingDomainName = false;
if (!TextUtils.isEmpty(domainName)) {
for (String host : integrationModel.applinkScheme) {
if (domainName.equals(host)) {
foundIntentFilterMatchingDomainName = true;
break;
}
}
}
return foundIntentFilterMatchingDomainName;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package io.branch.referral.validators;

import static io.branch.referral.validators.IntegrationValidatorConstants.defaultDomainsMoreInfoDocsLink;

import android.content.Context;
import android.text.TextUtils;

import org.json.JSONObject;

public class DefaultDomainsCheck extends IntegrationValidatorCheck {

String name = "Default Domains";
String errorMessage = "Could not find any App Link hosts to support Android AppLinks. Please add intent filter for handling AppLinks in your Android Manifest file";
String moreInfoLink = defaultDomainsMoreInfoDocsLink;
BranchIntegrationModel integrationModel;
JSONObject branchAppConfig;

public DefaultDomainsCheck(BranchIntegrationModel integrationModel, JSONObject branchAppConfig) {
super.name = name;
super.errorMessage = errorMessage;
super.moreInfoLink = moreInfoLink;
this.integrationModel = integrationModel;
this.branchAppConfig = branchAppConfig;
}

@Override
public boolean RunTests(Context context) {
String defAppLinkDomain = branchAppConfig.optString("default_short_url_domain");
return TextUtils.isEmpty(defAppLinkDomain) || checkIfIntentAddedForLinkDomain(defAppLinkDomain);
}

@Override
public String GetOutput(Context context, boolean didTestSucceed) {
didTestSucceed = RunTests(context);
return super.GetOutput(context, didTestSucceed);
}

private boolean checkIfIntentAddedForLinkDomain(String domainName) {
boolean foundIntentFilterMatchingDomainName = false;
if (!TextUtils.isEmpty(domainName)) {
for (String host : integrationModel.applinkScheme) {
if (domainName.equals(host)) {
foundIntentFilterMatchingDomainName = true;
break;
}
}
}
return foundIntentFilterMatchingDomainName;
}
}
Loading
Loading