Allow marking contacts as untrusted

This commit is contained in:
M66B 2019-07-14 10:38:01 +02:00
parent f3fff6b6e1
commit b66a34a785
2 changed files with 22 additions and 0 deletions

9
FAQ.md
View File

@ -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) * [(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) * [(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) * [(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) [I have another question.](#support)
@ -1942,7 +1943,15 @@ Reverted [commit](https://github.com/M66B/FairEmail/commit/2c80c25b8aa75af2287f4
<br /> <br />
<a name="faq116"></a>
**(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).
<br />
## Support ## Support

View File

@ -258,6 +258,19 @@ public class ContactInfo {
String lookupKey = cursor.getString(1); String lookupKey = cursor.getString(1);
String email = cursor.getString(2); 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); Uri uri = ContactsContract.Contacts.getLookupUri(contactId, lookupKey);
all.put(email, uri); all.put(email, uri);
} }