Skip to content

Commit 8fc360a

Browse files
Added constants and built out a deep link validator row class to encapsulate each row
Added constants and built out a deep link validator row class to encapsulate each row
1 parent 4bfd315 commit 8fc360a

File tree

6 files changed

+127
-190
lines changed

6 files changed

+127
-190
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ private void validateDeepLinkRouting(Context context) {
2424
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
2525
lp.copyFrom(Objects.requireNonNull(instance.linkingValidatorDialog.getWindow()).getAttributes());
2626
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
27-
lp.height = 1000;
27+
lp.height = 2000;
2828
instance.linkingValidatorDialog.show();
2929
instance.linkingValidatorDialog.getWindow().setAttributes(lp);
3030
}

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,25 @@ public class LinkingValidatorConstants {
99
public static final String step3ButtonText = "Done";
1010
public static final String canonicalUrlKey = "$canonical_url";
1111
public static final String deeplinkPathKey = "$deeplink_path";
12+
13+
public static final String linkingValidatorRow1Title = "Link using App Link";
14+
public static final String linkingValidatorRow2Title = "Link using URI scheme";
15+
public static final String linkingValidatorRow3Title = "Web-only link";
16+
public static final String linkingValidatorRow4Title = "Link with missing data";
17+
18+
public static final String infoButton1Copy = "Verifies that Universal Links / App Links are working correctly for your Branch domain";
19+
public static final String infoButton2Copy = "Verifies that URI schemes work correctly for your Branch domain";
20+
public static final String infoButton3Copy = "Verifies that web-only links are handled correctly to take you to the mobile web";
21+
public static final String infoButton4Copy = "Verifies that your app gracefully handles Branch links missing deep link data";
22+
public static final String infoButton5Copy = "Click the button to simulate a deep link click for the warm start use case";
23+
public static final String infoButton6Copy = "Click the button to simulate a deep link click for the foreground use case";
24+
25+
public static final String debugButton1Copy = "Ensure you’ve entered the correct SHA 256s on the dashboard and added your Branch domains to the Android Manifest";
26+
public static final String debugButton2Copy = "Ensure that you’ve added a unique Branch URI scheme to the dashboard and Android Manifest";
27+
public static final String debugButton3Copy = "Ensure that your code checks for $web-only in the link data, and if it is true routes the user to the mobile web";
28+
public static final String debugButton4Copy = "Ensure that your code gracefully handles missing or invalid deep link data like taking them to the home screen";
29+
public static final String debugButton5Copy = "Ensure that you are initializing Branch inside of onStart() and that the code is called anytime the app enters the foreground";
30+
public static final String debugButton6Copy = "Ensure that you are calling reInit() inside of onNewIntent() after checking if branch_force_new_session is true";
31+
32+
1233
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ private enum ROUTING_TYPE { CANONICAL_URL, DEEPLINK_PATH, CUSTOM }
3838
private String uriFallbackBranchLink; //Branch link with URI redirect mode of 2
3939
private String webOnlyBranchLink; //Web-only Branch link
4040
private String missingDeeplinkDataBranchLink; //Branch link with empty deep link data (to test graceful handling when data is missing)
41+
private LinkingValidatorDialogRowItem row1;
4142

4243
public LinkingValidatorDialog(final Context context) {
4344
super(context);
@@ -123,6 +124,8 @@ void LoadStep2Screen() {
123124

124125
void GenerateBranchLinks() {
125126
ctaButton.setText(LinkingValidatorConstants.step3ButtonText);
127+
row1 = findViewById(R.id.linkingValidatorRow1);
128+
row1.SetTitleText(LinkingValidatorConstants.linkingValidatorRow1Title);
126129

127130
customKeyEditText = findViewById(R.id.keyEditText);
128131
customValueEditText = findViewById(R.id.valueEditText);
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package io.branch.referral.validators;
2+
3+
import android.content.Context;
4+
import android.util.AttributeSet;
5+
import android.view.LayoutInflater;
6+
import android.view.View;
7+
import android.widget.LinearLayout;
8+
import android.widget.TextView;
9+
10+
import io.branch.referral.R;
11+
12+
public class LinkingValidatorDialogRowItem extends LinearLayout {
13+
14+
TextView titleText;
15+
16+
public LinkingValidatorDialogRowItem(Context context, AttributeSet attrs) {
17+
super(context, attrs);
18+
View view = LayoutInflater.from(getContext()).inflate(R.layout.linking_validator_dialog_row_item, null);
19+
this.addView(view);
20+
titleText = view.findViewById(R.id.linkingValidatorRowTitleText);
21+
}
22+
23+
public LinkingValidatorDialogRowItem(Context context, AttributeSet attrs, int defStyle) {
24+
super(context, attrs, defStyle);
25+
}
26+
27+
public void SetTitleText(String title) {
28+
titleText.setText(title);
29+
}
30+
}

Branch-SDK/src/main/res/layout/dialog_linking_validator.xml

Lines changed: 18 additions & 189 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
android:id="@+id/linkingValidatorDropdownMenu"
5050
android:layout_width="351dp"
5151
android:layout_height="50dp"
52-
android:visibility="gone"
52+
android:visibility="visible"
5353
app:layout_constraintBottom_toTopOf="@+id/linkingValidatorButton"
5454
app:layout_constraintEnd_toEndOf="parent"
5555
app:layout_constraintStart_toStartOf="parent"
@@ -63,7 +63,7 @@
6363
android:gravity="center"
6464
android:text="What key do you use for deep link routing?"
6565
android:textSize="20sp"
66-
android:visibility="gone"
66+
android:visibility="visible"
6767
app:layout_constraintEnd_toEndOf="parent"
6868
app:layout_constraintStart_toStartOf="parent"
6969
app:layout_constraintTop_toBottomOf="@+id/linkingValidatorHeader" />
@@ -75,7 +75,7 @@
7575
android:ems="10"
7676
android:hint="Enter a value"
7777
android:inputType="text"
78-
android:visibility="gone"
78+
android:visibility="visible"
7979
app:layout_constraintBottom_toTopOf="@+id/linkingValidatorButton"
8080
app:layout_constraintEnd_toEndOf="parent"
8181
app:layout_constraintStart_toStartOf="parent"
@@ -149,7 +149,8 @@
149149
app:layout_constraintBottom_toTopOf="@+id/linkingValidatorButton"
150150
app:layout_constraintEnd_toEndOf="parent"
151151
app:layout_constraintStart_toStartOf="parent"
152-
app:layout_constraintTop_toBottomOf="@+id/linkingValidatorHeader">
152+
app:layout_constraintTop_toBottomOf="@+id/linkingValidatorHeader"
153+
android:visibility="gone">
153154

154155
<TextView
155156
android:id="@+id/textView"
@@ -163,208 +164,36 @@
163164
android:layout_height="30dp"
164165
android:layout_weight="0.5" />
165166

166-
<LinearLayout
167-
android:layout_width="match_parent"
168-
android:layout_height="50dp"
169-
android:orientation="horizontal">
170-
171-
<TextView
172-
android:id="@+id/textView2"
173-
android:layout_width="0dp"
174-
android:layout_height="wrap_content"
175-
android:layout_weight="0.4"
176-
android:text="Primary deep linking"
177-
android:textSize="16sp" />
178-
179-
<Button
180-
android:id="@+id/button"
181-
android:layout_width="0dp"
182-
android:layout_height="match_parent"
183-
android:layout_weight="0.15"
184-
android:text="Info"
185-
android:textSize="10sp" />
186-
187-
<Button
188-
android:id="@+id/button2"
189-
android:layout_width="0dp"
190-
android:layout_height="match_parent"
191-
android:layout_weight="0.15"
192-
android:text="Copy"
193-
android:textSize="10sp" />
194-
195-
<Button
196-
android:id="@+id/button3"
197-
android:layout_width="0dp"
198-
android:layout_height="match_parent"
199-
android:layout_weight="0.15"
200-
android:text="Share"
201-
android:textSize="10sp" />
202-
203-
<Button
204-
android:id="@+id/button4"
205-
android:layout_width="0dp"
206-
android:layout_height="match_parent"
207-
android:layout_weight="0.15"
208-
android:text="Debug"
209-
android:textSize="10sp" />
210-
211-
</LinearLayout>
167+
<include
168+
android:id="@+id/linkingValidatorRow1"
169+
layout="@layout/linking_validator_dialog_row_item" />
212170

213171
<Space
214172
android:layout_width="0dp"
215173
android:layout_height="10dp"
216174
android:layout_weight="0.5" />
217175

218-
<LinearLayout
219-
android:layout_width="match_parent"
220-
android:layout_height="50dp"
221-
android:orientation="horizontal">
222-
223-
<TextView
224-
android:id="@+id/textView3"
225-
android:layout_width="0dp"
226-
android:layout_height="wrap_content"
227-
android:layout_weight="0.4"
228-
android:text="Fallback deep linking"
229-
android:textSize="16sp" />
230-
231-
<Button
232-
android:id="@+id/button5"
233-
android:layout_width="0dp"
234-
android:layout_height="match_parent"
235-
android:layout_weight="0.15"
236-
android:text="Info"
237-
android:textSize="10sp" />
238-
239-
<Button
240-
android:id="@+id/button6"
241-
android:layout_width="0dp"
242-
android:layout_height="match_parent"
243-
android:layout_weight="0.15"
244-
android:text="Copy"
245-
android:textSize="10sp" />
246-
247-
<Button
248-
android:id="@+id/button7"
249-
android:layout_width="0dp"
250-
android:layout_height="match_parent"
251-
android:layout_weight="0.15"
252-
android:text="Share"
253-
android:textSize="10sp" />
254-
255-
<Button
256-
android:id="@+id/button8"
257-
android:layout_width="0dp"
258-
android:layout_height="match_parent"
259-
android:layout_weight="0.15"
260-
android:text="Debug"
261-
android:textSize="10sp" />
262-
263-
</LinearLayout>
176+
<include
177+
android:id="@+id/linkingValidatorRow2"
178+
layout="@layout/linking_validator_dialog_row_item" />
264179

265180
<Space
266181
android:layout_width="0dp"
267182
android:layout_height="10dp"
268183
android:layout_weight="0.5" />
269184

270-
<LinearLayout
271-
android:layout_width="match_parent"
272-
android:layout_height="50dp"
273-
android:orientation="horizontal">
274-
275-
<TextView
276-
android:id="@+id/textView4"
277-
android:layout_width="0dp"
278-
android:layout_height="wrap_content"
279-
android:layout_weight="0.4"
280-
android:text="Web-Only Link"
281-
android:textSize="16sp" />
282-
283-
<Button
284-
android:id="@+id/button9"
285-
android:layout_width="0dp"
286-
android:layout_height="match_parent"
287-
android:layout_weight="0.15"
288-
android:text="Info"
289-
android:textSize="10sp" />
290-
291-
<Button
292-
android:id="@+id/button10"
293-
android:layout_width="0dp"
294-
android:layout_height="match_parent"
295-
android:layout_weight="0.15"
296-
android:text="Copy"
297-
android:textSize="10sp" />
298-
299-
<Button
300-
android:id="@+id/button11"
301-
android:layout_width="0dp"
302-
android:layout_height="match_parent"
303-
android:layout_weight="0.15"
304-
android:text="Share"
305-
android:textSize="10sp" />
306-
307-
<Button
308-
android:id="@+id/button12"
309-
android:layout_width="0dp"
310-
android:layout_height="match_parent"
311-
android:layout_weight="0.15"
312-
android:text="Debug"
313-
android:textSize="10sp" />
314-
315-
</LinearLayout>
185+
<include
186+
android:id="@+id/linkingValidatorRow3"
187+
layout="@layout/linking_validator_dialog_row_item" />
316188

317189
<Space
318190
android:layout_width="0dp"
319191
android:layout_height="10dp"
320192
android:layout_weight="0.5" />
321193

322-
<LinearLayout
323-
android:layout_width="match_parent"
324-
android:layout_height="50dp"
325-
android:orientation="horizontal">
326-
327-
<TextView
328-
android:id="@+id/textView5"
329-
android:layout_width="0dp"
330-
android:layout_height="wrap_content"
331-
android:layout_weight="0.4"
332-
android:text="Missing link data"
333-
android:textSize="16sp" />
334-
335-
<Button
336-
android:id="@+id/button13"
337-
android:layout_width="0dp"
338-
android:layout_height="match_parent"
339-
android:layout_weight="0.15"
340-
android:text="Info"
341-
android:textSize="10sp" />
342-
343-
<Button
344-
android:id="@+id/button14"
345-
android:layout_width="0dp"
346-
android:layout_height="match_parent"
347-
android:layout_weight="0.15"
348-
android:text="Copy"
349-
android:textSize="10sp" />
350-
351-
<Button
352-
android:id="@+id/button15"
353-
android:layout_width="0dp"
354-
android:layout_height="match_parent"
355-
android:layout_weight="0.15"
356-
android:text="Share"
357-
android:textSize="10sp" />
358-
359-
<Button
360-
android:id="@+id/button16"
361-
android:layout_width="0dp"
362-
android:layout_height="match_parent"
363-
android:layout_weight="0.15"
364-
android:text="Debug"
365-
android:textSize="10sp" />
366-
367-
</LinearLayout>
194+
<include
195+
android:id="@+id/linkingValidatorRow4"
196+
layout="@layout/linking_validator_dialog_row_item" />
368197

369198
<Space
370199
android:layout_width="0dp"
@@ -442,7 +271,7 @@
442271
android:layout_width="0dp"
443272
android:layout_height="wrap_content"
444273
android:layout_weight="0.4"
445-
android:text="Warm Start"
274+
android:text="Foreground click"
446275
android:textSize="16sp" />
447276

448277
<Button

0 commit comments

Comments
 (0)