Show embedded images after confirmation only

pull/146/head
M66B 6 years ago
parent 3fe2a6d357
commit d501240851

@ -353,15 +353,15 @@ Yes, you can translate the texts of FairEmail in your own language [here](https:
Registration is free. Registration is free.
<a name="faq27"></a> <a name="faq27"></a>
**(27) Why are images shown without tapping 'Show images' ?** **(27) ~~Why are images shown without tapping 'Show images' ?~~**
There are two types of images: ~~There are two types of images:~~
* Images embedded into a message * ~~Images embedded into a message~~
* Images stored on a remote server * ~~Images stored on a remote server~~
Embedded images, also visible as an attachment, are always shown, but images stored on a remote server need to be downloaded by tapping *Show images*. ~~Embedded images, also visible as an attachment, are always shown, but images stored on a remote server need to be downloaded by tapping *Show images*.~~
Note that downloading images from a remote server can be used to record you did see a message, which you likely don't want if the message is spam or malicious. ~~Note that downloading images from a remote server can be used to record you did see a message, which you likely don't want if the message is spam or malicious.~~
<a name="faq28"></a> <a name="faq28"></a>
**(28) How can I manage status bar notifications?** **(28) How can I manage status bar notifications?**

@ -726,29 +726,30 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
float scale = context.getResources().getDisplayMetrics().density; float scale = context.getResources().getDisplayMetrics().density;
int px = (int) (48 * scale + 0.5f); int px = (int) (48 * scale + 0.5f);
if (source != null && source.startsWith("cid")) { if (properties.showImages(message.id)) {
String[] cids = source.split(":"); // Embedded images
if (cids.length > 1) { if (source != null && source.startsWith("cid")) {
String cid = "<" + cids[1] + ">"; String[] cids = source.split(":");
EntityAttachment attachment = DB.getInstance(context).attachment().getAttachment(message.id, cid); if (cids.length > 1) {
if (attachment == null || !attachment.available) { String cid = "<" + cids[1] + ">";
Drawable d = context.getResources().getDrawable(R.drawable.baseline_warning_24, context.getTheme()); EntityAttachment attachment = DB.getInstance(context).attachment().getAttachment(message.id, cid);
d.setBounds(0, 0, px, px); if (attachment == null || !attachment.available) {
return d; Drawable d = context.getResources().getDrawable(R.drawable.baseline_warning_24, context.getTheme());
} else {
File file = EntityAttachment.getFile(context, attachment.id);
Drawable d = Drawable.createFromPath(file.getAbsolutePath());
if (d == null) {
d = context.getResources().getDrawable(R.drawable.baseline_warning_24, context.getTheme());
d.setBounds(0, 0, px, px); d.setBounds(0, 0, px, px);
} else return d;
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight()); } else {
return d; File file = EntityAttachment.getFile(context, attachment.id);
Drawable d = Drawable.createFromPath(file.getAbsolutePath());
if (d == null) {
d = context.getResources().getDrawable(R.drawable.baseline_warning_24, context.getTheme());
d.setBounds(0, 0, px, px);
} else
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
return d;
}
} }
} }
}
if (properties.showImages(message.id)) {
// Get cache folder // Get cache folder
File dir = new File(context.getCacheDir(), "images"); File dir = new File(context.getCacheDir(), "images");
dir.mkdir(); dir.mkdir();

Loading…
Cancel
Save