|
|
@ -817,19 +817,26 @@ 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");
|
|
|
|
|
|
|
|
|
|
|
|
EntityMessage draft;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get draft & selected identity
|
|
|
|
// Get draft & selected identity
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
try {
|
|
|
|
EntityMessage draft = db.message().getMessage(id);
|
|
|
|
db.beginTransaction();
|
|
|
|
EntityIdentity identity = db.identity().getIdentity(iid);
|
|
|
|
|
|
|
|
|
|
|
|
draft = db.message().getMessage(id);
|
|
|
|
// Draft deleted by server
|
|
|
|
EntityIdentity identity = db.identity().getIdentity(iid);
|
|
|
|
if (draft == null)
|
|
|
|
|
|
|
|
throw new MessageRemovedException("Draft for action was deleted");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Check data
|
|
|
|
|
|
|
|
if (action == R.id.action_send) {
|
|
|
|
|
|
|
|
if (draft.identity == null)
|
|
|
|
|
|
|
|
throw new IllegalArgumentException(context.getString(R.string.title_from_missing));
|
|
|
|
|
|
|
|
|
|
|
|
// Draft deleted by server
|
|
|
|
if (draft.to == null && draft.cc == null && draft.bcc == null)
|
|
|
|
if (draft == null)
|
|
|
|
throw new IllegalArgumentException(context.getString(R.string.title_to_missing));
|
|
|
|
throw new MessageRemovedException("Draft for action was deleted");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
db.beginTransaction();
|
|
|
|
|
|
|
|
|
|
|
|
Log.i(Helper.TAG, "Load action id=" + draft.id + " action=" + action);
|
|
|
|
Log.i(Helper.TAG, "Load action id=" + draft.id + " action=" + action);
|
|
|
|
|
|
|
|
|
|
|
@ -877,13 +884,6 @@ public class FragmentCompose extends FragmentEx {
|
|
|
|
db.message().updateMessage(draft);
|
|
|
|
db.message().updateMessage(draft);
|
|
|
|
draft.write(context, body);
|
|
|
|
draft.write(context, body);
|
|
|
|
|
|
|
|
|
|
|
|
// Check data
|
|
|
|
|
|
|
|
if (draft.identity == null)
|
|
|
|
|
|
|
|
throw new IllegalArgumentException(context.getString(R.string.title_from_missing));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (draft.to == null && draft.cc == null && draft.bcc == null)
|
|
|
|
|
|
|
|
throw new IllegalArgumentException(context.getString(R.string.title_to_missing));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Save message ID
|
|
|
|
// Save message ID
|
|
|
|
String msgid = draft.msgid;
|
|
|
|
String msgid = draft.msgid;
|
|
|
|
|
|
|
|
|
|
|
|