Added option to check DBL for suspicious links

pull/203/head
M66B 3 years ago
parent 2444aad6c7
commit df90a94e7b

@ -127,6 +127,8 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
final Context context = getContext();
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean check_links_dbl = prefs.getBoolean("check_links_dbl", BuildConfig.PLAY_STORE_RELEASE);
boolean disconnect_links = prefs.getBoolean("disconnect_links", true);
// Preload web view
Helper.customTabsWarmup(context);
@ -403,7 +405,7 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
tvSuspicious.setVisibility(Helper.isSingleScript(host) ? View.GONE : View.VISIBLE);
}
if (BuildConfig.DEBUG &&
if (check_links_dbl &&
tvSuspicious.getVisibility() != View.VISIBLE) {
Bundle args = new Bundle();
args.putString("host", host);
@ -432,7 +434,6 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
host == null || thost == null || host.equalsIgnoreCase(thost)
? View.GONE : View.VISIBLE);
boolean disconnect_links = prefs.getBoolean("disconnect_links", true);
List<String> categories = null;
if (disconnect_links)
categories = DisconnectBlacklist.getCategories(uri.getHost());

@ -60,6 +60,7 @@ import java.text.SimpleDateFormat;
public class FragmentOptionsPrivacy extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
private SwitchCompat swConfirmLinks;
private SwitchCompat swCheckLinksDbl;
private SwitchCompat swBrowseLinks;
private SwitchCompat swConfirmImages;
private SwitchCompat swConfirmHtml;
@ -88,7 +89,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
private Group grpSafeBrowsing;
private final static String[] RESET_OPTIONS = new String[]{
"confirm_links", "browse_links", "confirm_images", "confirm_html",
"confirm_links", "check_links_dbl", "browse_links", "confirm_images", "confirm_html",
"disable_tracking", "hide_timezone",
"pin", "biometrics", "biometrics_timeout",
"client_id", "display_hidden", "incognito_keyboard", "secure",
@ -107,6 +108,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
// Get controls
swConfirmLinks = view.findViewById(R.id.swConfirmLinks);
swCheckLinksDbl = view.findViewById(R.id.swCheckLinksDbl);
swBrowseLinks = view.findViewById(R.id.swBrowseLinks);
swConfirmImages = view.findViewById(R.id.swConfirmImages);
swConfirmHtml = view.findViewById(R.id.swConfirmHtml);
@ -144,10 +146,18 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("confirm_links", checked).apply();
swCheckLinksDbl.setEnabled(checked);
swBrowseLinks.setEnabled(!checked);
}
});
swCheckLinksDbl.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("check_links_dbl", checked).apply();
}
});
swBrowseLinks.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -397,6 +407,8 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
swConfirmLinks.setChecked(prefs.getBoolean("confirm_links", true));
swCheckLinksDbl.setChecked(prefs.getBoolean("check_links_dbl", BuildConfig.PLAY_STORE_RELEASE));
swCheckLinksDbl.setEnabled(swConfirmLinks.isChecked());
swBrowseLinks.setChecked(prefs.getBoolean("browse_links", false));
swBrowseLinks.setEnabled(!swConfirmLinks.isChecked());
swConfirmImages.setChecked(prefs.getBoolean("confirm_images", true));

@ -88,6 +88,18 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swConfirmLinks" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swCheckLinksDbl"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_check_links_dbl"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvConfirmLinksHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swBrowseLinks"
android:layout_width="0dp"
@ -97,7 +109,7 @@
android:text="@string/title_advanced_browse_links"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvConfirmLinksHint"
app:layout_constraintTop_toBottomOf="@id/swCheckLinksDbl"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

@ -544,6 +544,7 @@
<string name="title_advanced_caption_smime" translatable="false">S/MIME</string>
<string name="title_advanced_confirm_links">Confirm opening links</string>
<string name="title_advanced_check_links_dbl">Check domain block lists for suspicious links</string>
<string name="title_advanced_browse_links">Delegate opening links to Android</string>
<string name="title_advanced_confirm_images">Confirm showing images</string>
<string name="title_advanced_confirm_html">Show reformatted messages by default</string>

Loading…
Cancel
Save