mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 12:44:42 +00:00
Workaround attachments used as inline images
This commit is contained in:
parent
c54e222319
commit
ae993fb15e
2 changed files with 4 additions and 7 deletions
|
@ -1486,8 +1486,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
db.attachment().liveAttachments(message.id).observe(cowner, new Observer<List<EntityAttachment>>() {
|
db.attachment().liveAttachments(message.id).observe(cowner, new Observer<List<EntityAttachment>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(@Nullable List<EntityAttachment> attachments) {
|
public void onChanged(@Nullable List<EntityAttachment> attachments) {
|
||||||
bindAttachments(message, attachments);
|
|
||||||
|
|
||||||
int inlineImages = 0;
|
int inlineImages = 0;
|
||||||
if (attachments != null)
|
if (attachments != null)
|
||||||
for (EntityAttachment attachment : attachments)
|
for (EntityAttachment attachment : attachments)
|
||||||
|
@ -1501,10 +1499,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
if (attachment.available && attachment.isInline() && attachment.isImage())
|
if (attachment.available && attachment.isInline() && attachment.isImage())
|
||||||
lastInlineImages++;
|
lastInlineImages++;
|
||||||
|
|
||||||
if (inlineImages != lastInlineImages)
|
if (inlineImages > lastInlineImages)
|
||||||
bindBody(message, false);
|
bindBody(message, false);
|
||||||
|
|
||||||
properties.setAttachments(message.id, attachments);
|
bindAttachments(message, attachments);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,6 @@ import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.mail.Part;
|
|
||||||
|
|
||||||
import static androidx.room.ForeignKey.CASCADE;
|
import static androidx.room.ForeignKey.CASCADE;
|
||||||
|
|
||||||
@Entity(
|
@Entity(
|
||||||
|
@ -99,7 +97,8 @@ public class EntityAttachment {
|
||||||
public String error;
|
public String error;
|
||||||
|
|
||||||
boolean isInline() {
|
boolean isInline() {
|
||||||
return ((Part.INLINE.equals(disposition) || TextUtils.isEmpty(name)) && cid != null);
|
// Gmail sends inline images as attachments with a name and cid
|
||||||
|
return (cid != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isImage() {
|
boolean isImage() {
|
||||||
|
|
Loading…
Reference in a new issue