Restored compose logic

pull/31/merge
M66B 6 years ago
parent 9b61405891
commit a981e6fe08

@ -872,9 +872,14 @@ public class FragmentCompose extends FragmentEx {
String subject = args.getString("subject"); String subject = args.getString("subject");
String body = args.getString("body"); String body = args.getString("body");
// Get draft & selected identity EntityMessage draft;
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
EntityMessage draft = db.message().getMessage(id); try {
db.beginTransaction();
// Get draft & selected identity
draft = db.message().getMessage(id);
EntityIdentity identity = db.identity().getIdentity(iid); EntityIdentity identity = db.identity().getIdentity(iid);
// Draft deleted by server // Draft deleted by server
@ -900,9 +905,6 @@ public class FragmentCompose extends FragmentEx {
String pbody = "<pre>" + body.replaceAll("\\r?\\n", "<br />") + "</pre>"; String pbody = "<pre>" + body.replaceAll("\\r?\\n", "<br />") + "</pre>";
try {
db.beginTransaction();
// Execute action // Execute action
if (action == R.id.action_trash) { if (action == R.id.action_trash) {
draft.ui_seen = true; draft.ui_seen = true;
@ -932,13 +934,11 @@ public class FragmentCompose extends FragmentEx {
draft.write(context, pbody); draft.write(context, pbody);
// Check data // Check data
if (action == R.id.action_send) {
if (draft.identity == null) if (draft.identity == null)
throw new IllegalArgumentException(context.getString(R.string.title_from_missing)); throw new IllegalArgumentException(context.getString(R.string.title_from_missing));
if (draft.to == null && draft.cc == null && draft.bcc == null) if (draft.to == null && draft.cc == null && draft.bcc == null)
throw new IllegalArgumentException(context.getString(R.string.title_to_missing)); throw new IllegalArgumentException(context.getString(R.string.title_to_missing));
}
// Save message ID // Save message ID
String msgid = draft.msgid; String msgid = draft.msgid;

Loading…
Cancel
Save