diff --git a/Branch-SDK/src/main/java/io/branch/referral/validators/LinkingValidatorDialog.java b/Branch-SDK/src/main/java/io/branch/referral/validators/LinkingValidatorDialog.java index 81bc1b90..05732283 100644 --- a/Branch-SDK/src/main/java/io/branch/referral/validators/LinkingValidatorDialog.java +++ b/Branch-SDK/src/main/java/io/branch/referral/validators/LinkingValidatorDialog.java @@ -146,11 +146,11 @@ void GenerateBranchLinks() { routingValue = customValueEditText.getText().toString(); } - row1.InitializeRow(LinkingValidatorConstants.linkingValidatorRow1Title, LinkingValidatorConstants.infoButton1Copy, LinkingValidatorConstants.debugButton1Copy, routingKey, routingValue, "regularBranchLink", true); - row2.InitializeRow(LinkingValidatorConstants.linkingValidatorRow2Title, LinkingValidatorConstants.infoButton2Copy, LinkingValidatorConstants.debugButton2Copy, routingKey, routingValue, "uriFallbackBranchLink", true, "$uri_redirect_mode", "2"); - row3.InitializeRow(LinkingValidatorConstants.linkingValidatorRow3Title, LinkingValidatorConstants.infoButton3Copy, LinkingValidatorConstants.debugButton3Copy, routingKey, routingValue, "webOnlyBranchLink", true, "$web_only", "true"); - row4.InitializeRow(LinkingValidatorConstants.linkingValidatorRow4Title, LinkingValidatorConstants.infoButton4Copy, LinkingValidatorConstants.debugButton4Copy, routingKey, "", "missingDataBranchLink", true); - row5.InitializeRow(LinkingValidatorConstants.linkingValidatorRow5Title, LinkingValidatorConstants.infoButton5Copy, LinkingValidatorConstants.debugButton5Copy, routingKey, routingValue, "warmStartUseCase", false); - row6.InitializeRow(LinkingValidatorConstants.linkingValidatorRow6Title, LinkingValidatorConstants.infoButton6Copy, LinkingValidatorConstants.debugButton6Copy, routingKey, routingValue, "foregroundClickUseCase", false); + row1.InitializeRow(LinkingValidatorConstants.linkingValidatorRow1Title, LinkingValidatorConstants.infoButton1Copy, LinkingValidatorConstants.debugButton1Copy, routingKey, routingValue, "regularBranchLink", true, 0); + row2.InitializeRow(LinkingValidatorConstants.linkingValidatorRow2Title, LinkingValidatorConstants.infoButton2Copy, LinkingValidatorConstants.debugButton2Copy, routingKey, routingValue, "uriFallbackBranchLink", true, 1, "$uri_redirect_mode", "2"); + row3.InitializeRow(LinkingValidatorConstants.linkingValidatorRow3Title, LinkingValidatorConstants.infoButton3Copy, LinkingValidatorConstants.debugButton3Copy, routingKey, routingValue, "webOnlyBranchLink", true, 2, "$web_only", "true"); + row4.InitializeRow(LinkingValidatorConstants.linkingValidatorRow4Title, LinkingValidatorConstants.infoButton4Copy, LinkingValidatorConstants.debugButton4Copy, routingKey, "", "missingDataBranchLink", true, 3); + row5.InitializeRow(LinkingValidatorConstants.linkingValidatorRow5Title, LinkingValidatorConstants.infoButton5Copy, LinkingValidatorConstants.debugButton5Copy, routingKey, routingValue, "warmStartUseCase", false, 4); + row6.InitializeRow(LinkingValidatorConstants.linkingValidatorRow6Title, LinkingValidatorConstants.infoButton6Copy, LinkingValidatorConstants.debugButton6Copy, routingKey, routingValue, "foregroundClickUseCase", false, 5); } } diff --git a/Branch-SDK/src/main/java/io/branch/referral/validators/LinkingValidatorDialogRowItem.java b/Branch-SDK/src/main/java/io/branch/referral/validators/LinkingValidatorDialogRowItem.java index 47d3f148..77668058 100644 --- a/Branch-SDK/src/main/java/io/branch/referral/validators/LinkingValidatorDialogRowItem.java +++ b/Branch-SDK/src/main/java/io/branch/referral/validators/LinkingValidatorDialogRowItem.java @@ -4,6 +4,7 @@ import android.app.AlertDialog; import android.content.Context; import android.content.ContextWrapper; +import android.content.Intent; import android.os.Build; import android.util.AttributeSet; import android.view.LayoutInflater; @@ -46,7 +47,7 @@ public LinkingValidatorDialogRowItem(Context context, AttributeSet attrs, int de this.context = context; } - public void InitializeRow(String title, String infoText, String debugText, String routingKey, String routingValue, String canonicalIdentifier, boolean isSharableLink, String... params) { + public void InitializeRow(String title, String infoText, String debugText, String routingKey, String routingValue, String canonicalIdentifier, boolean isSharableLink, int index, String... params) { View view = LayoutInflater.from(getContext()).inflate(R.layout.linking_validator_dialog_row_item, null); this.addView(view); titleText = view.findViewById(R.id.linkingValidatorRowTitleText); @@ -84,7 +85,14 @@ public void InitializeRow(String title, String infoText, String debugText, Strin } else { actionButton.setText("Test"); + if(index == 4) { + //warm start use case + } else if(index == 5) { + actionButton.setOnClickListener(view2 -> { + HandleForegroundLinkClick(); + }); + } } } @@ -123,6 +131,16 @@ private void HandleDebugButtonClicked() { dialog.show(); } + private void HandleForegroundLinkClick() { + BranchUniversalObject buo = new BranchUniversalObject().setCanonicalIdentifier(canonicalIdentifier); + LinkProperties lp = new LinkProperties(); + String branchLink = buo.getShortUrl(context, lp); + Intent intent = new Intent(getContext(), getActivity(context).getClass()); + intent.putExtra("branch", branchLink); + intent.putExtra("branch_force_new_session",true); + getActivity(context).startActivity(intent); + } + public Activity getActivity(Context context) { if (context == null) { return null;