Fixed issue in contacts list if some share the same SIP address(es)

This commit is contained in:
Sylvain Berfini 2024-07-08 13:18:47 +02:00
parent f94b57d304
commit 5289dc4824

View file

@ -206,6 +206,14 @@ class ContactsManager @UiThread constructor() {
@WorkerThread
fun contactRemoved(friend: Friend) {
val refKey = friend.refKey.orEmpty()
if (refKey.isNotEmpty() && knownContactsAvatarsMap.keys.contains(refKey)) {
Log.d("$TAG Found RefKey [$refKey] in knownContactsAvatarsMap, removing it")
val oldModel = knownContactsAvatarsMap[refKey]
oldModel?.destroy()
knownContactsAvatarsMap.remove(refKey)
}
for (sipAddress in friend.addresses) {
val sipUri = sipAddress.asStringUriOnly()
if (knownContactsAvatarsMap.keys.contains(sipUri)) {
@ -387,7 +395,7 @@ class ContactsManager @UiThread constructor() {
"$TAG Looking for avatar model for friend [${friend.name}] using SIP URI [${address.asStringUriOnly()}]"
)
val key = LinphoneUtils.getAddressAsCleanStringUriOnly(address)
val key = friend.refKey ?: LinphoneUtils.getAddressAsCleanStringUriOnly(address)
val foundInMap = getAvatarModelFromCache(key)
if (foundInMap != null) {
Log.d("$TAG Found avatar model in map using SIP URI [$key]")