1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-30 19:56:10 +00:00

Refactoring

This commit is contained in:
M66B 2022-03-04 14:23:50 +01:00
parent 5b6febf254
commit d575122bdb
2 changed files with 5 additions and 6 deletions

View file

@ -297,8 +297,6 @@ public class FragmentCompose extends FragmentBase {
private long[] pgpKeyIds;
private long pgpSignKeyId;
private static final long MAX_PGP_BIND_DELAY = 250; // milliseconds
private static final int REDUCED_IMAGE_SIZE = 1440; // pixels
private static final int REDUCED_IMAGE_QUALITY = 90; // percent
// http://regex.info/blog/lightroom-goodies/jpeg-quality
@ -4610,7 +4608,7 @@ public class FragmentCompose extends FragmentBase {
EntityMessage.PGP_SIGNENCRYPT.equals(ref.ui_encrypt)) {
if (Helper.isOpenKeychainInstalled(context) &&
selected.sign_key != null &&
PgpHelper.hasPgpKey(context, recipients, MAX_PGP_BIND_DELAY))
PgpHelper.hasPgpKey(context, recipients))
data.draft.ui_encrypt = ref.ui_encrypt;
} else if (EntityMessage.SMIME_SIGNONLY.equals(ref.ui_encrypt) ||
EntityMessage.SMIME_SIGNENCRYPT.equals(ref.ui_encrypt)) {
@ -5846,7 +5844,7 @@ public class FragmentCompose extends FragmentBase {
EntityMessage.DSN_NONE.equals(draft.dsn)) &&
(draft.ui_encrypt == null ||
EntityMessage.ENCRYPT_NONE.equals(draft.ui_encrypt))) {
args.putBoolean("remind_pgp", PgpHelper.hasPgpKey(context, recipients, MAX_PGP_BIND_DELAY));
args.putBoolean("remind_pgp", PgpHelper.hasPgpKey(context, recipients));
args.putBoolean("remind_smime", SmimeHelper.hasSmimeKey(context, recipients));
}

View file

@ -43,6 +43,7 @@ import javax.mail.internet.InternetAddress;
public class PgpHelper {
private static final long CONNECT_TIMEOUT = 5000L;
private static final long KEY_TIMEOUT = 250L;
static Intent execute(Context context, Intent data, InputStream is, OutputStream os) {
return execute(context, data, is, os, CONNECT_TIMEOUT);
@ -68,10 +69,10 @@ public class PgpHelper {
}
static boolean hasPgpKey(Context context, List<Address> recipients) {
return hasPgpKey(context, recipients, CONNECT_TIMEOUT);
return hasPgpKey(context, recipients, KEY_TIMEOUT); // milliseconds
}
static boolean hasPgpKey(Context context, List<Address> recipients, long timeout) {
private static boolean hasPgpKey(Context context, List<Address> recipients, long timeout) {
if (recipients == null || recipients.size() == 0)
return false;