Fixed missing contacts after LDAP query
This commit is contained in:
parent
ed9f590f4f
commit
f07bc19d5f
1 changed files with 4 additions and 5 deletions
|
@ -34,7 +34,6 @@ import org.linphone.contact.NativeContact
|
||||||
import org.linphone.core.*
|
import org.linphone.core.*
|
||||||
import org.linphone.core.tools.Log
|
import org.linphone.core.tools.Log
|
||||||
import org.linphone.utils.Event
|
import org.linphone.utils.Event
|
||||||
import org.linphone.utils.LinphoneUtils
|
|
||||||
|
|
||||||
class ContactsListViewModel : ViewModel() {
|
class ContactsListViewModel : ViewModel() {
|
||||||
val sipContactsSelected = MutableLiveData<Boolean>()
|
val sipContactsSelected = MutableLiveData<Boolean>()
|
||||||
|
@ -230,15 +229,15 @@ class ContactsListViewModel : ViewModel() {
|
||||||
|
|
||||||
val address = searchResult.address
|
val address = searchResult.address
|
||||||
if (address != null) {
|
if (address != null) {
|
||||||
if (displayName == "") displayName = LinphoneUtils.getDisplayName(address)
|
if (displayName.isEmpty()) displayName = address.displayName ?: ""
|
||||||
val contact = coreContext.contactsManager.findContactByAddress(address, ignoreLocalContact = true)
|
val contact = coreContext.contactsManager.findContactByAddress(address, ignoreLocalContact = true)
|
||||||
if (contact != null) return contact
|
if (contact != null && (displayName.isEmpty() || contact.fullName == displayName)) return contact
|
||||||
}
|
}
|
||||||
|
|
||||||
val phoneNumber = searchResult.phoneNumber
|
val phoneNumber = searchResult.phoneNumber
|
||||||
if (phoneNumber != null) {
|
if (phoneNumber != null && address?.username != phoneNumber) {
|
||||||
val contact = coreContext.contactsManager.findContactByPhoneNumber(phoneNumber)
|
val contact = coreContext.contactsManager.findContactByPhoneNumber(phoneNumber)
|
||||||
if (contact != null && contact.fullName != displayName) return contact
|
if (contact != null && (displayName.isEmpty() || contact.fullName == displayName)) return contact
|
||||||
}
|
}
|
||||||
|
|
||||||
return null
|
return null
|
||||||
|
|
Loading…
Reference in a new issue