From b66a34a78564e22f3cec0bf5b597ecc3ceb5a428 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 14 Jul 2019 10:38:01 +0200 Subject: [PATCH] Allow marking contacts as untrusted --- FAQ.md | 9 +++++++++ .../main/java/eu/faircode/email/ContactInfo.java | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/FAQ.md b/FAQ.md index 853395942d..46e94f9ff1 100644 --- a/FAQ.md +++ b/FAQ.md @@ -191,6 +191,7 @@ FairEmail follows all the best practices for an email client as decribed in [thi * [(113) How does biometric authentication work?](#user-content-faq113) * [(114) Can you add an import for the settings of other email apps?](#user-content-faq114) * [(115) Can you add email address chips?](#user-content-faq114) +* [(116) How can I show images in messages from trusted senders by default?](#user-content-faq116) [I have another question.](#support) @@ -1942,7 +1943,15 @@ Reverted [commit](https://github.com/M66B/FairEmail/commit/2c80c25b8aa75af2287f4
+ +**(116) How can I show images in messages from trusted senders by default?** +You can show images in messages from trusted senders by default by enabled the display setting *Automatically show images for known contacts*. + +People in the Android contacts list are considered to be known and trusted, +unless the contact relation is set to '*Untrusted*' (case insensitive; the relation type, for example parent, child, friend, etc does not matter). + +
## Support diff --git a/app/src/main/java/eu/faircode/email/ContactInfo.java b/app/src/main/java/eu/faircode/email/ContactInfo.java index 7af15a99fa..0b5d2935a1 100644 --- a/app/src/main/java/eu/faircode/email/ContactInfo.java +++ b/app/src/main/java/eu/faircode/email/ContactInfo.java @@ -258,6 +258,19 @@ public class ContactInfo { String lookupKey = cursor.getString(1); String email = cursor.getString(2); + Cursor relation = resolver.query( + ContactsContract.Data.CONTENT_URI, + new String[]{ContactsContract.CommonDataKinds.Relation.NAME}, + ContactsContract.Data.MIMETYPE + " = '" + ContactsContract.CommonDataKinds.Relation.CONTENT_ITEM_TYPE + "'" + + " AND " + ContactsContract.CommonDataKinds.Relation.NAME + " = 'UNTRUSTED' COLLATE NOCASE" + + " AND " + ContactsContract.CommonDataKinds.Relation.CONTACT_ID + " = ?", + new String[]{Long.toString(contactId)}, + null); + if (relation != null && relation.moveToNext()) { + Log.i("Contact email=" + email + " relation=" + relation.getString(0)); + continue; + } + Uri uri = ContactsContract.Contacts.getLookupUri(contactId, lookupKey); all.put(email, uri); }