mirror of https://github.com/M66B/FairEmail.git
Refactoring
This commit is contained in:
parent
f73de9f5df
commit
46b69f1c09
|
@ -29,6 +29,7 @@ import android.text.TextUtils;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
import androidx.room.ColumnInfo;
|
||||||
import androidx.room.Entity;
|
import androidx.room.Entity;
|
||||||
import androidx.room.ForeignKey;
|
import androidx.room.ForeignKey;
|
||||||
import androidx.room.Index;
|
import androidx.room.Index;
|
||||||
|
@ -101,6 +102,9 @@ public class EntityMessage implements Serializable {
|
||||||
static final Integer PRIORITIY_NORMAL = 1;
|
static final Integer PRIORITIY_NORMAL = 1;
|
||||||
static final Integer PRIORITIY_HIGH = 2;
|
static final Integer PRIORITIY_HIGH = 2;
|
||||||
|
|
||||||
|
static final Integer DSN_NONE = 0;
|
||||||
|
static final Integer DSN_RECEIPT = 1;
|
||||||
|
|
||||||
static final Long SWIPE_ACTION_ASK = -1L;
|
static final Long SWIPE_ACTION_ASK = -1L;
|
||||||
static final Long SWIPE_ACTION_SEEN = -2L;
|
static final Long SWIPE_ACTION_SEEN = -2L;
|
||||||
static final Long SWIPE_ACTION_SNOOZE = -3L;
|
static final Long SWIPE_ACTION_SNOOZE = -3L;
|
||||||
|
@ -132,7 +136,8 @@ public class EntityMessage implements Serializable {
|
||||||
public Integer priority;
|
public Integer priority;
|
||||||
public Integer importance;
|
public Integer importance;
|
||||||
public Boolean auto_submitted;
|
public Boolean auto_submitted;
|
||||||
public Boolean receipt; // is receipt
|
@ColumnInfo(name = "receipt")
|
||||||
|
public Integer dsn;
|
||||||
public Boolean receipt_request;
|
public Boolean receipt_request;
|
||||||
public Address[] receipt_to;
|
public Address[] receipt_to;
|
||||||
public Boolean dkim;
|
public Boolean dkim;
|
||||||
|
@ -481,7 +486,7 @@ public class EntityMessage implements Serializable {
|
||||||
Objects.equals(this.wasforwardedfrom, other.wasforwardedfrom) &&
|
Objects.equals(this.wasforwardedfrom, other.wasforwardedfrom) &&
|
||||||
Objects.equals(this.thread, other.thread) &&
|
Objects.equals(this.thread, other.thread) &&
|
||||||
Objects.equals(this.priority, other.priority) &&
|
Objects.equals(this.priority, other.priority) &&
|
||||||
Objects.equals(this.receipt, other.receipt) &&
|
Objects.equals(this.dsn, other.dsn) &&
|
||||||
Objects.equals(this.receipt_request, other.receipt_request) &&
|
Objects.equals(this.receipt_request, other.receipt_request) &&
|
||||||
MessageHelper.equal(this.receipt_to, other.receipt_to) &&
|
MessageHelper.equal(this.receipt_to, other.receipt_to) &&
|
||||||
Objects.equals(this.dkim, other.dkim) &&
|
Objects.equals(this.dkim, other.dkim) &&
|
||||||
|
|
|
@ -3668,7 +3668,7 @@ public class FragmentCompose extends FragmentBase {
|
||||||
if ("reply_all".equals(action))
|
if ("reply_all".equals(action))
|
||||||
data.draft.cc = ref.getAllRecipients(data.identities, ref.account);
|
data.draft.cc = ref.getAllRecipients(data.identities, ref.account);
|
||||||
else if ("receipt".equals(action)) {
|
else if ("receipt".equals(action)) {
|
||||||
data.draft.receipt = true;
|
data.draft.dsn = EntityMessage.DSN_RECEIPT;
|
||||||
data.draft.receipt_request = false;
|
data.draft.receipt_request = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5931,8 +5931,12 @@ public class FragmentCompose extends FragmentBase {
|
||||||
cbPlainOnly.setChecked(draft.plain_only != null && draft.plain_only);
|
cbPlainOnly.setChecked(draft.plain_only != null && draft.plain_only);
|
||||||
cbReceipt.setChecked(draft.receipt_request != null && draft.receipt_request);
|
cbReceipt.setChecked(draft.receipt_request != null && draft.receipt_request);
|
||||||
|
|
||||||
cbPlainOnly.setVisibility(draft.receipt != null && draft.receipt ? View.GONE : View.VISIBLE);
|
cbPlainOnly.setVisibility(
|
||||||
cbReceipt.setVisibility(draft.receipt != null && draft.receipt ? View.GONE : View.VISIBLE);
|
draft.dsn != null && !EntityMessage.DSN_NONE.equals(draft.dsn)
|
||||||
|
? View.GONE : View.VISIBLE);
|
||||||
|
cbReceipt.setVisibility(
|
||||||
|
draft.dsn != null && !EntityMessage.DSN_NONE.equals(draft.dsn)
|
||||||
|
? View.GONE : View.VISIBLE);
|
||||||
|
|
||||||
int encrypt = (draft.ui_encrypt == null ? EntityMessage.ENCRYPT_NONE : draft.ui_encrypt);
|
int encrypt = (draft.ui_encrypt == null ? EntityMessage.ENCRYPT_NONE : draft.ui_encrypt);
|
||||||
for (int i = 0; i < encryptValues.length; i++)
|
for (int i = 0; i < encryptValues.length; i++)
|
||||||
|
@ -5941,7 +5945,9 @@ public class FragmentCompose extends FragmentBase {
|
||||||
spEncrypt.setSelection(i);
|
spEncrypt.setSelection(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
spEncrypt.setVisibility(draft.receipt != null && draft.receipt ? View.GONE : View.VISIBLE);
|
spEncrypt.setVisibility(
|
||||||
|
draft.dsn != null && !EntityMessage.DSN_NONE.equals(draft.dsn)
|
||||||
|
? View.GONE : View.VISIBLE);
|
||||||
|
|
||||||
int priority = (draft.priority == null ? 1 : draft.priority);
|
int priority = (draft.priority == null ? 1 : draft.priority);
|
||||||
spPriority.setTag(priority);
|
spPriority.setTag(priority);
|
||||||
|
|
|
@ -539,7 +539,7 @@ public class MessageHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void build(Context context, EntityMessage message, List<EntityAttachment> attachments, EntityIdentity identity, boolean send, MimeMessage imessage) throws IOException, MessagingException {
|
static void build(Context context, EntityMessage message, List<EntityAttachment> attachments, EntityIdentity identity, boolean send, MimeMessage imessage) throws IOException, MessagingException {
|
||||||
if (message.receipt != null && message.receipt) {
|
if (EntityMessage.DSN_RECEIPT.equals(message.dsn)) {
|
||||||
// https://www.ietf.org/rfc/rfc3798.txt
|
// https://www.ietf.org/rfc/rfc3798.txt
|
||||||
Multipart report = new MimeMultipart("report; report-type=disposition-notification");
|
Multipart report = new MimeMultipart("report; report-type=disposition-notification");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue