Prevent enabling encryption when not available

pull/216/head
M66B 3 months ago
parent 7598ba4b7f
commit 4e7e299d85

@ -1560,6 +1560,16 @@ public class FragmentCompose extends FragmentBase {
draft.ui_encrypt = null; draft.ui_encrypt = null;
} }
if (!PgpHelper.isOpenKeychainInstalled(context) &&
(EntityMessage.PGP_SIGNONLY.equals(draft.ui_encrypt) ||
EntityMessage.PGP_SIGNENCRYPT.equals(draft.ui_encrypt)))
draft.ui_encrypt = null;
if (!ActivityBilling.isPro(context) &&
(EntityMessage.SMIME_SIGNONLY.equals(draft.ui_encrypt) ||
EntityMessage.SMIME_SIGNENCRYPT.equals(draft.ui_encrypt)))
draft.ui_encrypt = null;
db.message().setMessageUiEncrypt(draft.id, draft.ui_encrypt); db.message().setMessageUiEncrypt(draft.id, draft.ui_encrypt);
db.message().setMessageSensitivity(draft.id, identity.sensitivity < 1 ? null : identity.sensitivity); db.message().setMessageSensitivity(draft.id, identity.sensitivity < 1 ? null : identity.sensitivity);
@ -5670,16 +5680,22 @@ public class FragmentCompose extends FragmentBase {
data.draft.plain_only = 1; data.draft.plain_only = 1;
if (encrypt_default || selected.encrypt_default) if (encrypt_default || selected.encrypt_default)
if (selected.encrypt == 0) if (selected.encrypt == 0) {
if (PgpHelper.isOpenKeychainInstalled(context))
data.draft.ui_encrypt = EntityMessage.PGP_SIGNENCRYPT; data.draft.ui_encrypt = EntityMessage.PGP_SIGNENCRYPT;
else } else {
if (ActivityBilling.isPro(context))
data.draft.ui_encrypt = EntityMessage.SMIME_SIGNENCRYPT; data.draft.ui_encrypt = EntityMessage.SMIME_SIGNENCRYPT;
}
else if (sign_default || selected.sign_default) else if (sign_default || selected.sign_default)
if (selected.encrypt == 0) if (selected.encrypt == 0) {
if (PgpHelper.isOpenKeychainInstalled(context))
data.draft.ui_encrypt = EntityMessage.PGP_SIGNONLY; data.draft.ui_encrypt = EntityMessage.PGP_SIGNONLY;
else } else {
if (ActivityBilling.isPro(context))
data.draft.ui_encrypt = EntityMessage.SMIME_SIGNONLY; data.draft.ui_encrypt = EntityMessage.SMIME_SIGNONLY;
} }
}
if (receipt_default) if (receipt_default)
data.draft.receipt_request = true; data.draft.receipt_request = true;

Loading…
Cancel
Save