Fixed contacts list issue when creating a chat room or a conference

This commit is contained in:
Sylvain Berfini 2022-04-20 16:12:41 +02:00
parent a1f9b95432
commit d1d4ce558a

View file

@ -59,13 +59,20 @@ class ContactSelectionData(private val searchResult: SearchResult) : ContactData
} }
private fun searchMatchingContact() { private fun searchMatchingContact() {
val address = searchResult.address val friend = searchResult.friend
if (address != null) { if (friend != null) {
contact.value = coreContext.contactsManager.findContactByAddress(address) contact.value = friend
displayName.value = searchResult.friend?.name ?: LinphoneUtils.getDisplayName(address) displayName.value = friend.name
} else if (searchResult.phoneNumber != null) { } else {
contact.value = coreContext.contactsManager.findContactByPhoneNumber(searchResult.phoneNumber.orEmpty()) val address = searchResult.address
displayName.value = searchResult.friend?.name ?: searchResult.phoneNumber.orEmpty() if (address != null) {
contact.value = coreContext.contactsManager.findContactByAddress(address)
displayName.value = LinphoneUtils.getDisplayName(address)
} else if (searchResult.phoneNumber != null) {
contact.value =
coreContext.contactsManager.findContactByPhoneNumber(searchResult.phoneNumber.orEmpty())
displayName.value = searchResult.phoneNumber.orEmpty()
}
} }
} }
} }