diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 32e46ce770..d1af42f8f9 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -2197,6 +2197,7 @@ public class FragmentCompose extends FragmentBase { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); boolean plain_only = prefs.getBoolean("plain_only", false); + boolean sign_default = prefs.getBoolean("sign_default", false); boolean encrypt_default = prefs.getBoolean("encrypt_default", false); boolean receipt_default = prefs.getBoolean("receipt_default", false); @@ -2233,6 +2234,8 @@ public class FragmentCompose extends FragmentBase { data.draft.plain_only = true; if (encrypt_default) data.draft.encrypt = EntityMessage.PGP_SIGNENCRYPT; + else if (sign_default) + data.draft.encrypt = EntityMessage.PGP_SIGNONLY; if (receipt_default) data.draft.receipt_request = true; diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java b/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java index 9c673570e3..1fce40cff8 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java @@ -61,6 +61,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer private SwitchCompat swDisableTracking; private SwitchCompat swDisplayHidden; private Spinner spOpenPgp; + private SwitchCompat swSign; private SwitchCompat swEncrypt; private SwitchCompat swAutoDecrypt; private SwitchCompat swSecure; @@ -72,7 +73,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer private final static String[] RESET_OPTIONS = new String[]{ "disable_tracking", "display_hidden", - "openpgp_provider", "encrypt_default", "auto_decrypt", + "openpgp_provider", "sign_default", "encrypt_default", "auto_decrypt", "secure", "biometrics", "pin", "biometrics_timeout" }; @@ -90,6 +91,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer swDisableTracking = view.findViewById(R.id.swDisableTracking); swDisplayHidden = view.findViewById(R.id.swDisplayHidden); spOpenPgp = view.findViewById(R.id.spOpenPgp); + swSign = view.findViewById(R.id.swSign); swEncrypt = view.findViewById(R.id.swEncrypt); swAutoDecrypt = view.findViewById(R.id.swAutoDecrypt); swSecure = view.findViewById(R.id.swSecure); @@ -140,10 +142,18 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer } }); + swSign.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("sign_default", checked).apply(); + } + }); + swEncrypt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { prefs.edit().putBoolean("encrypt_default", checked).apply(); + swSign.setEnabled(!checked); } }); @@ -265,7 +275,9 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer break; } + swSign.setChecked(prefs.getBoolean("sign_default", false)); swEncrypt.setChecked(prefs.getBoolean("encrypt_default", false)); + swSign.setEnabled(!swEncrypt.isChecked()); swAutoDecrypt.setChecked(prefs.getBoolean("auto_decrypt", 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 9cbb4e4668..f88bdae824 100644 --- a/app/src/main/res/layout/fragment_options_privacy.xml +++ b/app/src/main/res/layout/fragment_options_privacy.xml @@ -80,15 +80,26 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tvOpenPgp" /> + + Automatically recognize and disable tracking images Display hidden message texts OpenPGP provider + Sign by default + Encrypt by default Automatically decrypt messages Hide from recent apps screen and prevent taking screenshots Biometric authentication timeout @@ -412,7 +414,6 @@ Allow editing sender address Regex to match edited addresses Reply to address - Encrypt by default Request delivery/read receipt by default In case of \'invalid greeting\', \'requires valid address\' or a similar error, try to change this setting Optional