From 7588a7c1ecebf4a08752ed2ca739e449540958ed Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 24 Aug 2018 06:09:33 +0000 Subject: [PATCH] Fixed saving empty drafts --- .../java/eu/faircode/email/FragmentCompose.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index d5f41b781c..b7a11a46a1 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -898,7 +898,7 @@ public class FragmentCompose extends FragmentEx { draft.subject = subject; draft.received = new Date().getTime(); - body = "
" + body.replaceAll("\\r?\\n", "
") + "
"; + String pbody = "
" + body.replaceAll("\\r?\\n", "
") + "
"; // Check data if (action == R.id.action_send) { @@ -917,7 +917,7 @@ public class FragmentCompose extends FragmentEx { draft.ui_seen = true; draft.ui_hide = true; db.message().updateMessage(draft); - draft.write(context, body); + draft.write(context, pbody); EntityOperation.queue(db, draft, EntityOperation.SEEN, true); @@ -926,18 +926,19 @@ public class FragmentCompose extends FragmentEx { } else if (action == R.id.action_save) { if (ato == null && acc == null && abcc == null && - TextUtils.isEmpty(subject) && TextUtils.isEmpty(body) && + TextUtils.isEmpty(subject) && + TextUtils.isEmpty(body) && db.attachment().getAttachmentCount(draft.id) == 0) return null; db.message().updateMessage(draft); - draft.write(context, body); + draft.write(context, pbody); EntityOperation.queue(db, draft, EntityOperation.ADD); } else if (action == R.id.action_send) { db.message().updateMessage(draft); - draft.write(context, body); + draft.write(context, pbody); // Save message ID String msgid = draft.msgid; @@ -961,7 +962,7 @@ public class FragmentCompose extends FragmentEx { draft.msgid = msgid; draft.ui_hide = false; draft.id = db.message().insertMessage(draft); - draft.write(getContext(), body); + draft.write(getContext(), pbody); // Restore attachments for (EntityAttachment attachment : attachments) {