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

This commit is contained in:
Sylvain Berfini 2022-04-20 16:14:26 +02:00
parent b2a69f05f7
commit 616ca795cb

View file

@ -60,13 +60,20 @@ class ChatRoomCreationContactData(private val searchResult: SearchResult) : Cont
}
private fun searchMatchingContact() {
val address = searchResult.address
if (address != null) {
contact.value = coreContext.contactsManager.findContactByAddress(address)
displayName.value = searchResult.friend?.name ?: LinphoneUtils.getDisplayName(address)
} else if (searchResult.phoneNumber != null) {
contact.value = coreContext.contactsManager.findContactByPhoneNumber(searchResult.phoneNumber.orEmpty())
displayName.value = searchResult.friend?.name ?: searchResult.phoneNumber.orEmpty()
val friend = searchResult.friend
if (friend != null) {
contact.value = friend
displayName.value = friend.name
} else {
val address = searchResult.address
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()
}
}
}
}