mirror of https://github.com/M66B/FairEmail.git
Fixed local contacts avatars
This commit is contained in:
parent
84450e105c
commit
8d86db2d8e
|
@ -1234,20 +1234,21 @@ class Core {
|
||||||
for (Address reply : replies) {
|
for (Address reply : replies) {
|
||||||
String email = ((InternetAddress) reply).getAddress();
|
String email = ((InternetAddress) reply).getAddress();
|
||||||
String name = ((InternetAddress) reply).getPersonal();
|
String name = ((InternetAddress) reply).getPersonal();
|
||||||
|
Uri avatar = ContactInfo.getLookupUri(context, new Address[]{reply});
|
||||||
EntityContact contact = db.contact().getContact(EntityContact.TYPE_FROM, email);
|
EntityContact contact = db.contact().getContact(EntityContact.TYPE_FROM, email);
|
||||||
if (contact == null) {
|
if (contact == null) {
|
||||||
contact = new EntityContact();
|
contact = new EntityContact();
|
||||||
contact.type = EntityContact.TYPE_FROM;
|
contact.type = EntityContact.TYPE_FROM;
|
||||||
contact.email = email;
|
contact.email = email;
|
||||||
contact.name = name;
|
contact.name = name;
|
||||||
contact.avatar = message.avatar;
|
contact.avatar = (avatar == null ? null : avatar.toString());
|
||||||
contact.times_contacted = 1;
|
contact.times_contacted = 1;
|
||||||
contact.last_contacted = message.received;
|
contact.last_contacted = message.received;
|
||||||
contact.id = db.contact().insertContact(contact);
|
contact.id = db.contact().insertContact(contact);
|
||||||
Log.i("Inserted sender contact=" + contact);
|
Log.i("Inserted sender contact=" + contact);
|
||||||
} else {
|
} else {
|
||||||
contact.name = name;
|
contact.name = name;
|
||||||
contact.avatar = message.avatar;
|
contact.avatar = (avatar == null ? null : avatar.toString());
|
||||||
contact.times_contacted++;
|
contact.times_contacted++;
|
||||||
contact.last_contacted = message.received;
|
contact.last_contacted = message.received;
|
||||||
db.contact().updateContact(contact);
|
db.contact().updateContact(contact);
|
||||||
|
|
Loading…
Reference in New Issue