Skip to content

Commit 33979fd

Browse files
Added foreground click use case
Added foreground click use case
1 parent 6acc83b commit 33979fd

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ void GenerateBranchLinks() {
146146
routingValue = customValueEditText.getText().toString();
147147
}
148148

149-
row1.InitializeRow(LinkingValidatorConstants.linkingValidatorRow1Title, LinkingValidatorConstants.infoButton1Copy, LinkingValidatorConstants.debugButton1Copy, routingKey, routingValue, "regularBranchLink", true);
150-
row2.InitializeRow(LinkingValidatorConstants.linkingValidatorRow2Title, LinkingValidatorConstants.infoButton2Copy, LinkingValidatorConstants.debugButton2Copy, routingKey, routingValue, "uriFallbackBranchLink", true, "$uri_redirect_mode", "2");
151-
row3.InitializeRow(LinkingValidatorConstants.linkingValidatorRow3Title, LinkingValidatorConstants.infoButton3Copy, LinkingValidatorConstants.debugButton3Copy, routingKey, routingValue, "webOnlyBranchLink", true, "$web_only", "true");
152-
row4.InitializeRow(LinkingValidatorConstants.linkingValidatorRow4Title, LinkingValidatorConstants.infoButton4Copy, LinkingValidatorConstants.debugButton4Copy, routingKey, "", "missingDataBranchLink", true);
153-
row5.InitializeRow(LinkingValidatorConstants.linkingValidatorRow5Title, LinkingValidatorConstants.infoButton5Copy, LinkingValidatorConstants.debugButton5Copy, routingKey, routingValue, "warmStartUseCase", false);
154-
row6.InitializeRow(LinkingValidatorConstants.linkingValidatorRow6Title, LinkingValidatorConstants.infoButton6Copy, LinkingValidatorConstants.debugButton6Copy, routingKey, routingValue, "foregroundClickUseCase", false);
149+
row1.InitializeRow(LinkingValidatorConstants.linkingValidatorRow1Title, LinkingValidatorConstants.infoButton1Copy, LinkingValidatorConstants.debugButton1Copy, routingKey, routingValue, "regularBranchLink", true, 0);
150+
row2.InitializeRow(LinkingValidatorConstants.linkingValidatorRow2Title, LinkingValidatorConstants.infoButton2Copy, LinkingValidatorConstants.debugButton2Copy, routingKey, routingValue, "uriFallbackBranchLink", true, 1, "$uri_redirect_mode", "2");
151+
row3.InitializeRow(LinkingValidatorConstants.linkingValidatorRow3Title, LinkingValidatorConstants.infoButton3Copy, LinkingValidatorConstants.debugButton3Copy, routingKey, routingValue, "webOnlyBranchLink", true, 2, "$web_only", "true");
152+
row4.InitializeRow(LinkingValidatorConstants.linkingValidatorRow4Title, LinkingValidatorConstants.infoButton4Copy, LinkingValidatorConstants.debugButton4Copy, routingKey, "", "missingDataBranchLink", true, 3);
153+
row5.InitializeRow(LinkingValidatorConstants.linkingValidatorRow5Title, LinkingValidatorConstants.infoButton5Copy, LinkingValidatorConstants.debugButton5Copy, routingKey, routingValue, "warmStartUseCase", false, 4);
154+
row6.InitializeRow(LinkingValidatorConstants.linkingValidatorRow6Title, LinkingValidatorConstants.infoButton6Copy, LinkingValidatorConstants.debugButton6Copy, routingKey, routingValue, "foregroundClickUseCase", false, 5);
155155
}
156156
}

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.app.AlertDialog;
55
import android.content.Context;
66
import android.content.ContextWrapper;
7+
import android.content.Intent;
78
import android.os.Build;
89
import android.util.AttributeSet;
910
import android.view.LayoutInflater;
@@ -46,7 +47,7 @@ public LinkingValidatorDialogRowItem(Context context, AttributeSet attrs, int de
4647
this.context = context;
4748
}
4849

49-
public void InitializeRow(String title, String infoText, String debugText, String routingKey, String routingValue, String canonicalIdentifier, boolean isSharableLink, String... params) {
50+
public void InitializeRow(String title, String infoText, String debugText, String routingKey, String routingValue, String canonicalIdentifier, boolean isSharableLink, int index, String... params) {
5051
View view = LayoutInflater.from(getContext()).inflate(R.layout.linking_validator_dialog_row_item, null);
5152
this.addView(view);
5253
titleText = view.findViewById(R.id.linkingValidatorRowTitleText);
@@ -84,7 +85,14 @@ public void InitializeRow(String title, String infoText, String debugText, Strin
8485
} else {
8586
actionButton.setText("Test");
8687

88+
if(index == 4) {
89+
//warm start use case
8790

91+
} else if(index == 5) {
92+
actionButton.setOnClickListener(view2 -> {
93+
HandleForegroundLinkClick();
94+
});
95+
}
8896
}
8997
}
9098

@@ -123,6 +131,16 @@ private void HandleDebugButtonClicked() {
123131
dialog.show();
124132
}
125133

134+
private void HandleForegroundLinkClick() {
135+
BranchUniversalObject buo = new BranchUniversalObject().setCanonicalIdentifier(canonicalIdentifier);
136+
LinkProperties lp = new LinkProperties();
137+
String branchLink = buo.getShortUrl(context, lp);
138+
Intent intent = new Intent(getContext(), getActivity(context).getClass());
139+
intent.putExtra("branch", branchLink);
140+
intent.putExtra("branch_force_new_session",true);
141+
getActivity(context).startActivity(intent);
142+
}
143+
126144
public Activity getActivity(Context context) {
127145
if (context == null) {
128146
return null;

0 commit comments

Comments
 (0)