diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index cb239a2715..b4b8bce7df 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -2055,47 +2055,10 @@ public class AdapterMessage extends RecyclerView.Adapter() { - @Override - protected Boolean onExecute(Context context, Bundle args) { - long id = args.getLong("id"); - - DB db = DB.getInstance(context); - List attachments = db.attachment().getAttachments(id); - for (EntityAttachment attachment : attachments) - if (!attachment.available) - return false; - return true; - } - - @Override - protected void onExecuted(Bundle args, Boolean available) { - final Intent forward = new Intent(context, ActivityCompose.class) - .putExtra("action", "forward") - .putExtra("reference", data.message.id); - if (available) - context.startActivity(forward); - else - new DialogBuilderLifecycle(context, owner) - .setMessage(R.string.title_attachment_unavailable) - .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - context.startActivity(forward); - } - }) - .setNegativeButton(android.R.string.cancel, null) - .show(); - } - - @Override - protected void onException(Bundle args, Throwable ex) { - Helper.unexpectedError(context, owner, ex); - } - }.execute(context, owner, args, "message:forward"); + Intent forward = new Intent(context, ActivityCompose.class) + .putExtra("action", "forward") + .putExtra("reference", data.message.id); + context.startActivity(forward); } private void onMenuUnseen(final ActionData data) { @@ -2947,48 +2910,10 @@ public class AdapterMessage extends RecyclerView.Adapter() { - @Override - protected Boolean onExecute(Context context, Bundle args) { - long id = args.getLong("id"); - - DB db = DB.getInstance(context); - List attachments = db.attachment().getAttachments(id); - for (EntityAttachment attachment : attachments) - if (!attachment.available && attachment.isInline() && attachment.isImage()) - return false; - return true; - } - - @Override - protected void onExecuted(Bundle args, Boolean available) { - final Intent reply = new Intent(context, ActivityCompose.class) - .putExtra("action", args.getString("action")) - .putExtra("reference", data.message.id); - if (available) - context.startActivity(reply); - else - new DialogBuilderLifecycle(context, owner) - .setMessage(R.string.title_image_unavailable) - .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - context.startActivity(reply); - } - }) - .setNegativeButton(android.R.string.cancel, null) - .show(); - } - - @Override - protected void onException(Bundle args, Throwable ex) { - Helper.unexpectedError(context, owner, ex); - } - }.execute(context, owner, args, "message:reply"); + Intent reply = new Intent(context, ActivityCompose.class) + .putExtra("action", action) + .putExtra("reference", data.message.id); + context.startActivity(reply); } private void onMenuAnswer(final ActionData data) { diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 16d95528a9..64c05f96c2 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -2158,18 +2158,21 @@ public class FragmentCompose extends FragmentBase { int sequence = 0; List attachments = db.attachment().getAttachments(ref.id); for (EntityAttachment attachment : attachments) - if (attachment.available && - attachment.encryption == null && - ("forward".equals(action) || attachment.isInline())) { - File source = attachment.getFile(context); - - attachment.id = null; - attachment.message = draft.id; - attachment.sequence = ++sequence; - attachment.id = db.attachment().insertAttachment(attachment); - - File target = attachment.getFile(context); - Helper.copy(source, target); + if (attachment.encryption == null && + ("forward".equals(action) || + (attachment.isInline() && attachment.isImage()))) { + if (attachment.available) { + File source = attachment.getFile(context); + + attachment.id = null; + attachment.message = draft.id; + attachment.sequence = ++sequence; + attachment.id = db.attachment().insertAttachment(attachment); + + File target = attachment.getFile(context); + Helper.copy(source, target); + } else + args.putBoolean("incomplete", true); } } @@ -2221,6 +2224,9 @@ public class FragmentCompose extends FragmentBase { plain_only = (draft.plain_only != null && draft.plain_only); getActivity().invalidateOptionsMenu(); + if (args.getBoolean("incomplete")) + Snackbar.make(view, R.string.title_attachments_incomplete, Snackbar.LENGTH_LONG).show(); + new SimpleTask>() { @Override protected List onExecute(Context context, Bundle args) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7050ca0919..649d5c1e39 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -421,8 +421,7 @@ Raw message saved Attachment saved Attachments saved - Some attachments are not downloaded and will not be added, continue? - Some images are not downloaded and will not be added, continue? + Some attachments or images were not downloaded and could not be added Delete message permanently? Delete reply template permanently? Delete rule permanently?