mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-04 06:20:26 +00:00
Added option to send NIL ID
This commit is contained in:
parent
f3780c0f82
commit
3547a3570c
4 changed files with 47 additions and 3 deletions
|
@ -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<String, String> id = new LinkedHashMap<>();
|
||||
id.put("name", context.getString(R.string.app_name));
|
||||
id.put("version", BuildConfig.VERSION_NAME);
|
||||
Map<String, String> sid = istore.id(id);
|
||||
|
||||
Map<String, String> sid = istore.id(client_id ? id : null);
|
||||
if (sid != null) {
|
||||
Map<String, String> crumb = new HashMap<>();
|
||||
for (String key : sid.keySet()) {
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -273,6 +273,30 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swClientId"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_client_id"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvAdvanced"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
android:id="@+id/tvClientId"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:text="FairEmail 1.2345"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textStyle="italic"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swClientId" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swDisplayHidden"
|
||||
android:layout_width="0dp"
|
||||
|
@ -281,7 +305,7 @@
|
|||
android:text="@string/title_advanced_display_hidden"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvAdvanced"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvClientId"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
|
|
|
@ -504,6 +504,7 @@
|
|||
<string name="title_advanced_confirm_html">Show reformatted messages by default</string>
|
||||
<string name="title_advanced_tracking">Attempt to recognize and disable tracking images</string>
|
||||
<string name="title_advanced_hide_timezone">Send messages without timezone data</string>
|
||||
<string name="title_advanced_client_id">Send app name and version to email server</string>
|
||||
<string name="title_advanced_display_hidden">Display hidden message texts</string>
|
||||
<string name="title_advanced_incognito_keyboard">Use incognito keyboard (Android 8+)</string>
|
||||
<string name="title_advanced_secure">Hide from recent apps screen and prevent taking screenshots</string>
|
||||
|
|
Loading…
Reference in a new issue