From 8a377e451fbcd786f839dc63aaa01cfb6a6a364e Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 15 Mar 2019 07:36:50 +0000 Subject: [PATCH] Fixed sent avatar --- app/src/main/java/eu/faircode/email/ServiceSend.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ServiceSend.java b/app/src/main/java/eu/faircode/email/ServiceSend.java index e7a7b6fa12..362ea11d6c 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSend.java +++ b/app/src/main/java/eu/faircode/email/ServiceSend.java @@ -26,6 +26,7 @@ import android.net.ConnectivityManager; import android.net.Network; import android.net.NetworkCapabilities; import android.net.NetworkRequest; +import android.net.Uri; import android.os.PowerManager; import android.text.TextUtils; @@ -366,20 +367,21 @@ public class ServiceSend extends LifecycleService { for (Address recipient : message.to) { String email = ((InternetAddress) recipient).getAddress(); String name = ((InternetAddress) recipient).getPersonal(); + Uri avatar = ContactInfo.getLookupUri(this, new Address[]{recipient}); EntityContact contact = db.contact().getContact(EntityContact.TYPE_TO, email); if (contact == null) { contact = new EntityContact(); contact.type = EntityContact.TYPE_TO; contact.email = email; contact.name = name; - contact.avatar = message.avatar; + contact.avatar = (avatar == null ? null : avatar.toString()); contact.times_contacted = 1; contact.last_contacted = time; contact.id = db.contact().insertContact(contact); Log.i("Inserted recipient contact=" + contact); } else { contact.name = name; - contact.avatar = message.avatar; + contact.avatar = (avatar == null ? null : avatar.toString()); contact.times_contacted++; contact.last_contacted = time; db.contact().updateContact(contact);