-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a popup dialog displaying the Integration Validator results wit…
…h options to view more details and export the logs Added a popup dialog displaying the Integration Validator results with options to view more details and export the logs
- Loading branch information
1 parent
f7f7a20
commit fe16b68
Showing
18 changed files
with
896 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:versionCode="1" | ||
android:versionName="1.0" > | ||
<uses-permission android:name="android.permission.READ_LOGS" | ||
tools:ignore="ProtectedPermissions" /> | ||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | ||
</manifest> |
47 changes: 47 additions & 0 deletions
47
Branch-SDK/src/main/java/io/branch/referral/validators/AlternateDomainsCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package io.branch.referral.validators; | ||
|
||
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 = "<a href=\"https://help.branch.io/developers-hub/docs/android-basic-integration#:~:text=The%20%2Dalternate.app.link%20domain%20associated%20with%20your%20app\">More info</a>"; | ||
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; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
Branch-SDK/src/main/java/io/branch/referral/validators/AppLinksCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package io.branch.referral.validators; | ||
|
||
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 = "<a href=\"https://help.branch.io/developers-hub/docs/android-basic-integration#:~:text=%3C!%2D%2D%20Branch%20App%20Links%20%2D%20Live,%3C/intent%2Dfilter%3E\">More info</a>"; | ||
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; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...SDK/src/main/java/io/branch/referral/validators/BranchInstanceCreationValidatorCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package io.branch.referral.validators; | ||
|
||
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 = "<a href=\"https://help.branch.io/developers-hub/docs/android-basic-integration#:~:text=Branch.getAutoInstance(this)\">More info</a>"; | ||
|
||
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; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
Branch-SDK/src/main/java/io/branch/referral/validators/BranchKeysValidatorCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package io.branch.referral.validators; | ||
|
||
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 = "<a href=\"https://help.branch.io/developers-hub/docs/android-basic-integration#:~:text=%3C!%2D%2D%20REPLACE%20%60BranchKey%60%20with,%22key_test_XXX%22%20/%3E\">More info</a>"; | ||
|
||
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); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
Branch-SDK/src/main/java/io/branch/referral/validators/CustomDomainCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package io.branch.referral.validators; | ||
|
||
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 = "<a href=\"https://help.branch.io/developers-hub/docs/android-basic-integration#section-configure-app\">More info</a>"; | ||
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; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
Branch-SDK/src/main/java/io/branch/referral/validators/DefaultDomainsCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package io.branch.referral.validators; | ||
|
||
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 = "<a href=\"https://help.branch.io/developers-hub/docs/android-basic-integration#4-configure-app:~:text=%3C!%2D%2D%20Branch%20App%20Links%20%2D%20Live,%3C/intent%2Dfilter%3E\">More info</a>"; | ||
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; | ||
} | ||
} |
Oops, something went wrong.