fix #419, properly handle the contact photo at local contacts
This commit is contained in:
parent
f28ea80e93
commit
b52872cf1a
1 changed files with 7 additions and 1 deletions
|
@ -117,6 +117,12 @@ class LocalContactsHelper(val context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun convertContactToLocalContact(contact: Contact): LocalContact {
|
private fun convertContactToLocalContact(contact: Contact): LocalContact {
|
||||||
|
val photoByteArray = if (contact.photoUri.isNotEmpty()) {
|
||||||
|
getPhotoByteArray(contact.photoUri)
|
||||||
|
} else {
|
||||||
|
contact.photo?.getByteArray()
|
||||||
|
}
|
||||||
|
|
||||||
return getEmptyLocalContact().apply {
|
return getEmptyLocalContact().apply {
|
||||||
id = if (contact.id == 0) null else contact.id
|
id = if (contact.id == 0) null else contact.id
|
||||||
prefix = contact.prefix
|
prefix = contact.prefix
|
||||||
|
@ -125,7 +131,7 @@ class LocalContactsHelper(val context: Context) {
|
||||||
surname = contact.surname
|
surname = contact.surname
|
||||||
suffix = contact.suffix
|
suffix = contact.suffix
|
||||||
nickname = contact.nickname
|
nickname = contact.nickname
|
||||||
photo = getPhotoByteArray(contact.photoUri)
|
photo = photoByteArray
|
||||||
phoneNumbers = contact.phoneNumbers
|
phoneNumbers = contact.phoneNumbers
|
||||||
emails = contact.emails
|
emails = contact.emails
|
||||||
events = contact.events
|
events = contact.events
|
||||||
|
|
Loading…
Reference in a new issue