mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Fixed missing contacts' avatars in chat room shortcuts
This commit is contained in:
parent
6280ed5f3d
commit
ea49d3a411
2 changed files with 26 additions and 18 deletions
|
|
@ -648,7 +648,15 @@ class ContactsManager @UiThread constructor() {
|
|||
|
||||
@WorkerThread
|
||||
fun Friend.getAvatarBitmap(): Bitmap? {
|
||||
return ImageUtils.getBitmap(coreContext.context, photo)
|
||||
try {
|
||||
return ImageUtils.getBitmap(
|
||||
coreContext.context,
|
||||
photo ?: getNativeContactPictureUri()?.toString()
|
||||
)
|
||||
} catch (numberFormatException: NumberFormatException) {
|
||||
// Expected for contacts created by Linphone
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class ShortcutUtils {
|
|||
continue
|
||||
}
|
||||
|
||||
if (count >= 5) {
|
||||
if (count >= 4) {
|
||||
Log.i("$TAG We already created [$count] shortcuts, stopping here")
|
||||
break
|
||||
}
|
||||
|
|
@ -113,28 +113,28 @@ class ShortcutUtils {
|
|||
ChatRoom.Capabilities.Basic.toInt()
|
||||
)
|
||||
) {
|
||||
val contact =
|
||||
coreContext.contactsManager.findContactByAddress(peerAddress)
|
||||
val person = contact?.getPerson()
|
||||
if (person != null) {
|
||||
personsList.add(person)
|
||||
}
|
||||
val avatarModel = coreContext.contactsManager.getContactAvatarModelForAddress(
|
||||
peerAddress
|
||||
)
|
||||
val contact = avatarModel.friend
|
||||
val person = contact.getPerson()
|
||||
personsList.add(person)
|
||||
|
||||
subject = contact?.name ?: LinphoneUtils.getDisplayName(peerAddress)
|
||||
person?.icon ?: AvatarGenerator(context).setInitials(
|
||||
subject = contact.name ?: LinphoneUtils.getDisplayName(peerAddress)
|
||||
person.icon ?: AvatarGenerator(context).setInitials(
|
||||
AppUtils.getInitials(subject)
|
||||
).buildIcon()
|
||||
} else if (chatRoom.hasCapability(ChatRoom.Capabilities.OneToOne.toInt()) && chatRoom.participants.isNotEmpty()) {
|
||||
val address = chatRoom.participants.first().address
|
||||
val contact =
|
||||
coreContext.contactsManager.findContactByAddress(address)
|
||||
val person = contact?.getPerson()
|
||||
if (person != null) {
|
||||
personsList.add(person)
|
||||
}
|
||||
val avatarModel = coreContext.contactsManager.getContactAvatarModelForAddress(
|
||||
address
|
||||
)
|
||||
val contact = avatarModel.friend
|
||||
val person = contact.getPerson()
|
||||
personsList.add(person)
|
||||
|
||||
subject = contact?.name ?: LinphoneUtils.getDisplayName(address)
|
||||
person?.icon ?: AvatarGenerator(context).setInitials(
|
||||
subject = contact.name ?: LinphoneUtils.getDisplayName(address)
|
||||
person.icon ?: AvatarGenerator(context).setInitials(
|
||||
AppUtils.getInitials(subject)
|
||||
).buildIcon()
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue