|
|
|
@ -2084,6 +2084,18 @@ public class FragmentMessages extends FragmentBase {
|
|
|
|
|
EntityMessage message = db.message().getMessage(target.id);
|
|
|
|
|
if (message != null) {
|
|
|
|
|
Log.i("Move id=" + target.id + " target=" + target.folder.name);
|
|
|
|
|
|
|
|
|
|
// Cross account move: check if message downloaded
|
|
|
|
|
if (!target.folder.account.equals(message.account)) {
|
|
|
|
|
if (!message.content)
|
|
|
|
|
throw new IllegalArgumentException(getString(R.string.title_no_accross));
|
|
|
|
|
|
|
|
|
|
List<EntityAttachment> attachments = db.attachment().getAttachments(message.id);
|
|
|
|
|
for (EntityAttachment attachment : attachments)
|
|
|
|
|
if (!attachment.available)
|
|
|
|
|
throw new IllegalArgumentException(getString(R.string.title_no_accross));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EntityOperation.queue(context, db, message, EntityOperation.MOVE, target.folder.id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -2097,7 +2109,10 @@ public class FragmentMessages extends FragmentBase {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onException(Bundle args, Throwable ex) {
|
|
|
|
|
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
|
|
|
|
if (ex instanceof IllegalArgumentException)
|
|
|
|
|
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
|
|
|
|
|
else
|
|
|
|
|
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
|
|
|
|
}
|
|
|
|
|
}.execute(FragmentMessages.this, args, "messages:move");
|
|
|
|
|
}
|
|
|
|
|