mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-28 11:46:31 +02:00
Added setting to disable extra privacy features
This commit is contained in:
@@ -84,7 +84,6 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
|
||||
private SwitchCompat swAddresses;
|
||||
private SwitchCompat swMonospaced;
|
||||
private SwitchCompat swHtml;
|
||||
private SwitchCompat swTracking;
|
||||
private SwitchCompat swImages;
|
||||
private SwitchCompat swActionbar;
|
||||
|
||||
@@ -106,6 +105,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
|
||||
private SwitchCompat swLight;
|
||||
private Button btnSound;
|
||||
|
||||
private SwitchCompat swParanoid;
|
||||
private SwitchCompat swEnglish;
|
||||
private SwitchCompat swUpdates;
|
||||
private SwitchCompat swDebug;
|
||||
@@ -124,11 +124,11 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
|
||||
"enabled", "schedule_start", "schedule_end",
|
||||
"metered", "download",
|
||||
"startup", "date", "threading", "avatars", "identicons", "name_email", "subject_italic", "flags", "preview",
|
||||
"addresses", "monospaced", "autohtml", "remove_tracking", "autoimages", "actionbar",
|
||||
"addresses", "monospaced", "autohtml", "autoimages", "actionbar",
|
||||
"pull", "swipenav", "autoexpand", "autoclose", "autonext", "collapse", "autoread", "automove",
|
||||
"autoresize", "sender", "autosend",
|
||||
"notify_preview", "search_local", "light", "sound",
|
||||
"updates", "debug",
|
||||
"paranoid", "updates", "debug",
|
||||
"first", "why", "last_update_check", "app_support", "message_swipe", "message_select", "folder_actions", "folder_sync",
|
||||
"edit_ref_confirmed", "show_html_confirmed", "show_images_confirmed", "print_html_confirmed", "show_organization", "style_toolbar"
|
||||
};
|
||||
@@ -163,7 +163,6 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
|
||||
swAddresses = view.findViewById(R.id.swAddresses);
|
||||
swMonospaced = view.findViewById(R.id.swMonospaced);
|
||||
swHtml = view.findViewById(R.id.swHtml);
|
||||
swTracking = view.findViewById(R.id.swTracking);
|
||||
swImages = view.findViewById(R.id.swImages);
|
||||
swActionbar = view.findViewById(R.id.swActionbar);
|
||||
|
||||
@@ -185,6 +184,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
|
||||
swLight = view.findViewById(R.id.swLight);
|
||||
btnSound = view.findViewById(R.id.btnSound);
|
||||
|
||||
swParanoid = view.findViewById(R.id.swParanoid);
|
||||
swEnglish = view.findViewById(R.id.swEnglish);
|
||||
swUpdates = view.findViewById(R.id.swUpdates);
|
||||
swDebug = view.findViewById(R.id.swDebug);
|
||||
@@ -251,6 +251,13 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
|
||||
}
|
||||
});
|
||||
|
||||
swParanoid.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("paranoid", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swEnglish.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
@@ -388,13 +395,6 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
|
||||
}
|
||||
});
|
||||
|
||||
swTracking.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("remove_tracking", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swImages.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
@@ -635,7 +635,6 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
|
||||
swAddresses.setChecked(prefs.getBoolean("addresses", true));
|
||||
swMonospaced.setChecked(prefs.getBoolean("monospaced", false));
|
||||
swHtml.setChecked(prefs.getBoolean("autohtml", false));
|
||||
swTracking.setChecked(prefs.getBoolean("remove_tracking", true));
|
||||
swImages.setChecked(prefs.getBoolean("autoimages", false));
|
||||
swActionbar.setChecked(prefs.getBoolean("actionbar", true));
|
||||
|
||||
@@ -657,6 +656,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
|
||||
swNotifyPreview.setEnabled(Helper.isPro(getContext()));
|
||||
swSearchLocal.setChecked(prefs.getBoolean("search_local", false));
|
||||
swLight.setChecked(prefs.getBoolean("light", false));
|
||||
swParanoid.setChecked(prefs.getBoolean("paranoid", true));
|
||||
swEnglish.setChecked(prefs.getBoolean("english", false));
|
||||
swUpdates.setChecked(prefs.getBoolean("updates", true));
|
||||
swUpdates.setVisibility(Helper.isPlayStoreInstall(getContext()) ? View.GONE : View.VISIBLE);
|
||||
|
||||
@@ -75,8 +75,8 @@ public class HtmlHelper {
|
||||
|
||||
static String removeTracking(Context context, String html) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean remove_tracking = prefs.getBoolean("remove_tracking", true);
|
||||
if (!remove_tracking)
|
||||
boolean paranoid = prefs.getBoolean("paranoid", true);
|
||||
if (!paranoid)
|
||||
return html;
|
||||
|
||||
Document document = Jsoup.parse(html);
|
||||
@@ -101,6 +101,9 @@ public class HtmlHelper {
|
||||
}
|
||||
|
||||
static String sanitize(Context context, String html, boolean showQuotes) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean paranoid = prefs.getBoolean("paranoid", true);
|
||||
|
||||
Document parsed = Jsoup.parse(html);
|
||||
Whitelist whitelist = Whitelist.relaxed()
|
||||
.addTags("hr", "abbr")
|
||||
@@ -190,7 +193,7 @@ public class HtmlHelper {
|
||||
String src = img.attr("src");
|
||||
String alt = img.attr("alt");
|
||||
String title = img.attr("title");
|
||||
boolean tracking = isTrackingPixel(img);
|
||||
boolean tracking = (paranoid && isTrackingPixel(img));
|
||||
|
||||
// Create image container
|
||||
Element div = document.createElement("div");
|
||||
@@ -225,26 +228,27 @@ public class HtmlHelper {
|
||||
|
||||
// Split parent link and linked image
|
||||
boolean linked = false;
|
||||
for (Element parent : img.parents())
|
||||
if ("a".equals(parent.tagName()) &&
|
||||
!TextUtils.isEmpty(parent.attr("href"))) {
|
||||
String text = parent.attr("title").trim();
|
||||
if (TextUtils.isEmpty(text))
|
||||
text = parent.attr("alt").trim();
|
||||
if (TextUtils.isEmpty(text))
|
||||
text = context.getString(R.string.title_hint_image_link);
|
||||
if (paranoid)
|
||||
for (Element parent : img.parents())
|
||||
if ("a".equals(parent.tagName()) &&
|
||||
!TextUtils.isEmpty(parent.attr("href"))) {
|
||||
String text = parent.attr("title").trim();
|
||||
if (TextUtils.isEmpty(text))
|
||||
text = parent.attr("alt").trim();
|
||||
if (TextUtils.isEmpty(text))
|
||||
text = context.getString(R.string.title_hint_image_link);
|
||||
|
||||
img.remove();
|
||||
parent.appendText(text);
|
||||
String outer = parent.outerHtml();
|
||||
img.remove();
|
||||
parent.appendText(text);
|
||||
String outer = parent.outerHtml();
|
||||
|
||||
parent.tagName("span");
|
||||
parent.html(outer);
|
||||
parent.appendChild(div);
|
||||
parent.tagName("span");
|
||||
parent.html(outer);
|
||||
parent.appendChild(div);
|
||||
|
||||
linked = true;
|
||||
break;
|
||||
}
|
||||
linked = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!linked) {
|
||||
img.tagName("div");
|
||||
|
||||
Reference in New Issue
Block a user