0
0
mirror of https://github.com/TrianguloY/UrlChecker.git synced 2024-09-19 20:02:16 +02:00

show referrer on the debug module

solves #248
This commit is contained in:
TrianguloY 2023-06-23 22:27:15 +02:00
parent bb4c02136f
commit e981fcff66
2 changed files with 27 additions and 7 deletions

View File

@ -1,5 +1,7 @@
package com.trianguloy.urlchecker.modules.list;
import static java.util.Objects.requireNonNullElse;
import android.view.View;
import android.widget.TextView;
@ -11,6 +13,7 @@ import com.trianguloy.urlchecker.modules.AModuleData;
import com.trianguloy.urlchecker.modules.AModuleDialog;
import com.trianguloy.urlchecker.services.CustomTabs;
import com.trianguloy.urlchecker.url.UrlData;
import com.trianguloy.urlchecker.utilities.AndroidUtils;
import java.util.List;
@ -51,8 +54,12 @@ public class DebugModule extends AModuleData {
class DebugDialog extends AModuleDialog {
public static final String SEPARATOR = "";
private TextView textView;
// cached
private String intentUri;
private String referrer;
public DebugDialog(MainDialog dialog) {
super(dialog);
@ -69,17 +76,30 @@ class DebugDialog extends AModuleDialog {
// cached
intentUri = getActivity().getIntent().toUri(0);
referrer = requireNonNullElse(AndroidUtils.getReferrer(getActivity()), "null");
}
@Override
public void onDisplayUrl(UrlData urlData) {
textView.setText(String.join("\n\n", List.of(
// show activity uri
// data to display
textView.setText(String.join("\n", List.of(
"Intent:",
intentUri,
// show current url data
SEPARATOR,
"UrlData:",
urlData.toString(),
// show global data
getGlobalData().toString()
SEPARATOR,
"GlobalData:",
getGlobalData().toString(),
SEPARATOR,
"Referrer:",
referrer
)));
}
}

View File

@ -209,9 +209,9 @@ Note: if you edit the patterns, new built-in patterns from app updates will not
<string name="mD_name">Debug/Marker module</string>
<string name="mD_desc">"If you reorder the modules, new ones added in future updates will be placed above this one.
If you enable this it will display the received intent as uri, useful for developers.
If you enable this it will display some internal debug data (like original intent uri), useful for developers.
Tap on Intent or UrlData to copy to the clipboard. Hold to copy everything."</string>
You can hold to select text."</string>
<string name="mD_ctabs">Show debug messages from the custom tabs service</string>
<!-- -->
<string name="mHist_name">History</string>