Skip to content

Commit

Permalink
Added foreground click use case
Browse files Browse the repository at this point in the history
Added foreground click use case
  • Loading branch information
rob-gioia-branch committed Nov 1, 2024
1 parent 6acc83b commit 33979fd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
});
}
}
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 33979fd

Please sign in to comment.