Added option to remove tracking parameters by default

This commit is contained in:
M66B
2022-11-11 13:06:12 +01:00
parent f309a1bb62
commit 9c0ee286fb
4 changed files with 46 additions and 3 deletions

View File

@@ -114,6 +114,7 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
final Context context = getContext();
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean sanitize_links = prefs.getBoolean("sanitize_links", false);
boolean check_links_dbl = prefs.getBoolean("check_links_dbl", BuildConfig.PLAY_STORE_RELEASE);
boolean disconnect_links = prefs.getBoolean("disconnect_links", true);
@@ -575,6 +576,8 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
tvDisconnectCategories.setVisibility(
categories == null || !BuildConfig.DEBUG ? View.GONE : View.VISIBLE);
cbSanitize.setChecked(sanitize_links);
cbNotAgain.setText(context.getString(R.string.title_no_ask_for_again, uri.getHost()));
cbNotAgain.setVisibility(
UriHelper.isSecure(uri) && !TextUtils.isEmpty(uri.getHost())

View File

@@ -66,6 +66,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
private View view;
private ImageButton ibHelp;
private SwitchCompat swConfirmLinks;
private SwitchCompat swSanitizeLinks;
private SwitchCompat swCheckLinksDbl;
private SwitchCompat swConfirmImages;
private SwitchCompat swAskImages;
@@ -107,7 +108,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
private final static int BIP39_WORDS = 6;
private final static String[] RESET_OPTIONS = new String[]{
"confirm_links", "check_links_dbl",
"confirm_links", "sanitize_links", "check_links_dbl",
"confirm_images", "ask_images", "html_always_images", "confirm_html", "ask_html",
"disable_tracking",
"pin", "biometrics", "biometrics_timeout", "autolock", "autolock_nav",
@@ -130,6 +131,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
ibHelp = view.findViewById(R.id.ibHelp);
swConfirmLinks = view.findViewById(R.id.swConfirmLinks);
swSanitizeLinks = view.findViewById(R.id.swSanitizeLinks);
swCheckLinksDbl = view.findViewById(R.id.swCheckLinksDbl);
swConfirmImages = view.findViewById(R.id.swConfirmImages);
swAskImages = view.findViewById(R.id.swAskImages);
@@ -191,10 +193,18 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
if (key.endsWith(".confirm_link"))
editor.remove(key);
editor.apply();
swSanitizeLinks.setEnabled(checked);
swCheckLinksDbl.setEnabled(checked);
}
});
swSanitizeLinks.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("sanitize_links", checked).apply();
}
});
swCheckLinksDbl.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -554,6 +564,8 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
swConfirmLinks.setChecked(prefs.getBoolean("confirm_links", true));
swSanitizeLinks.setChecked(prefs.getBoolean("sanitize_links", false));
swSanitizeLinks.setEnabled(swConfirmLinks.isChecked());
swCheckLinksDbl.setChecked(prefs.getBoolean("check_links_dbl", BuildConfig.PLAY_STORE_RELEASE));
swCheckLinksDbl.setEnabled(swConfirmLinks.isChecked());
swConfirmImages.setChecked(prefs.getBoolean("confirm_images", true));