From 3547a3570c663cb0c3d8f01c2744262ba3884615 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 13 Jun 2021 17:48:17 +0200 Subject: [PATCH] Added option to send NIL ID --- .../java/eu/faircode/email/EmailService.java | 6 ++++- .../email/FragmentOptionsPrivacy.java | 17 +++++++++++- .../res/layout/fragment_options_privacy.xml | 26 ++++++++++++++++++- app/src/main/res/values/strings.xml | 1 + 4 files changed, 47 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EmailService.java b/app/src/main/java/eu/faircode/email/EmailService.java index e130cb61de..d4a96b4e6a 100644 --- a/app/src/main/java/eu/faircode/email/EmailService.java +++ b/app/src/main/java/eu/faircode/email/EmailService.java @@ -609,10 +609,14 @@ public class EmailService implements AutoCloseable { IMAPStore istore = (IMAPStore) getStore(); if (istore.hasCapability("ID")) try { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + boolean client_id = prefs.getBoolean("client_id", true); + Map id = new LinkedHashMap<>(); id.put("name", context.getString(R.string.app_name)); id.put("version", BuildConfig.VERSION_NAME); - Map sid = istore.id(id); + + Map sid = istore.id(client_id ? id : null); if (sid != null) { Map crumb = new HashMap<>(); for (String key : sid.keySet()) { diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java b/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java index 42378636d2..640ca2d06f 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java @@ -69,6 +69,8 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer private Button btnPin; private Button btnBiometrics; private Spinner spBiometricsTimeout; + private SwitchCompat swClientId; + private TextView tvClientId; private SwitchCompat swDisplayHidden; private SwitchCompat swIncognitoKeyboard; private ImageButton ibIncognitoKeyboard; @@ -90,7 +92,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer "confirm_links", "browse_links", "confirm_images", "confirm_html", "disable_tracking", "hide_timezone", "pin", "biometrics", "biometrics_timeout", - "display_hidden", "incognito_keyboard", "secure", + "client_id", "display_hidden", "incognito_keyboard", "secure", "generic_ua", "safe_browsing", "disconnect_auto_update", "disconnect_links", "disconnect_images" }; @@ -114,6 +116,8 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer btnPin = view.findViewById(R.id.btnPin); btnBiometrics = view.findViewById(R.id.btnBiometrics); spBiometricsTimeout = view.findViewById(R.id.spBiometricsTimeout); + swClientId = view.findViewById(R.id.swClientId); + tvClientId = view.findViewById(R.id.tvClientId); swDisplayHidden = view.findViewById(R.id.swDisplayHidden); swIncognitoKeyboard = view.findViewById(R.id.swIncognitoKeyboard); ibIncognitoKeyboard = view.findViewById(R.id.ibIncognitoKeyboard); @@ -232,6 +236,14 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer } }); + swClientId.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("client_id", checked).apply(); + ServiceSynchronize.reload(compoundButton.getContext(), null, false, "id"); + } + }); + swDisplayHidden.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -354,6 +366,8 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer : R.color.lightColorBackground_cards)); } + tvClientId.setText(getString(R.string.app_name) + " " + BuildConfig.VERSION_NAME); + PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this); return view; @@ -415,6 +429,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer break; } + swClientId.setChecked(prefs.getBoolean("client_id", true)); swDisplayHidden.setChecked(prefs.getBoolean("display_hidden", false)); swIncognitoKeyboard.setChecked(prefs.getBoolean("incognito_keyboard", false)); swSecure.setChecked(prefs.getBoolean("secure", false)); diff --git a/app/src/main/res/layout/fragment_options_privacy.xml b/app/src/main/res/layout/fragment_options_privacy.xml index 06e46155f8..5509ef68ad 100644 --- a/app/src/main/res/layout/fragment_options_privacy.xml +++ b/app/src/main/res/layout/fragment_options_privacy.xml @@ -273,6 +273,30 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> + + + + Show reformatted messages by default Attempt to recognize and disable tracking images Send messages without timezone data + Send app name and version to email server Display hidden message texts Use incognito keyboard (Android 8+) Hide from recent apps screen and prevent taking screenshots