Added option to remove tracking parameters by default

pull/210/head
M66B 2 years ago
parent f309a1bb62
commit 9c0ee286fb

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

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

@ -100,6 +100,32 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swConfirmLinks" /> app:layout_constraintTop_toBottomOf="@id/swConfirmLinks" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSanitizeLinks"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_sanitize_links"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvConfirmLinksHint"
app:switchPadding="12dp" />
<TextView
android:id="@+id/tvSanitizeLinksHint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginEnd="48dp"
android:text="@string/title_advanced_sanitize_links_hint"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swSanitizeLinks" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swCheckLinksDbl" android:id="@+id/swCheckLinksDbl"
android:layout_width="0dp" android:layout_width="0dp"
@ -109,7 +135,7 @@
android:text="@string/title_advanced_check_links_dbl" android:text="@string/title_advanced_check_links_dbl"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvConfirmLinksHint" app:layout_constraintTop_toBottomOf="@id/tvSanitizeLinksHint"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
@ -350,12 +376,12 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableStart="@drawable/twotone_warning_24" android:drawableStart="@drawable/twotone_warning_24"
android:drawablePadding="6dp" android:drawablePadding="6dp"
app:drawableTint="?attr/colorWarning"
android:gravity="center" android:gravity="center"
android:text="@string/title_advanced_advanced" android:text="@string/title_advanced_advanced"
android:textAppearance="@style/TextAppearance.AppCompat.Large" android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="?attr/colorWarning" android:textColor="?attr/colorWarning"
android:textStyle="bold" android:textStyle="bold"
app:drawableTint="?attr/colorWarning"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />

@ -684,6 +684,8 @@
<string name="title_advanced_caption_smime" translatable="false">S/MIME</string> <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_confirm_links">Confirm opening links</string>
<string name="title_advanced_sanitize_links">Remove tracking parameters by default</string>
<string name="title_advanced_sanitize_links_hint">Only when confirming links</string>
<string name="title_advanced_check_links_dbl">Check domain block lists for suspicious links</string> <string name="title_advanced_check_links_dbl">Check domain block lists for suspicious links</string>
<string name="title_advanced_confirm_images">Show no images by default</string> <string name="title_advanced_confirm_images">Show no images by default</string>
<string name="title_advanced_ask_images">Confirm showing images</string> <string name="title_advanced_ask_images">Confirm showing images</string>

Loading…
Cancel
Save