mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Removed some debug logs, improved findContactByAddress performances a bit
This commit is contained in:
parent
d113797dfb
commit
7c78b021db
2 changed files with 3 additions and 15 deletions
|
|
@ -417,16 +417,13 @@ class ContactsManager
|
|||
|
||||
@WorkerThread
|
||||
fun findContactByAddress(address: Address): Friend? {
|
||||
val sipUri = LinphoneUtils.getAddressAsCleanStringUriOnly(address)
|
||||
Log.d("$TAG Looking for friend with SIP URI [$sipUri]")
|
||||
|
||||
val username = address.username
|
||||
val found = coreContext.core.findFriend(address)
|
||||
if (found != null) {
|
||||
Log.d("$TAG Friend [${found.name}] was found using SIP URI [$sipUri]")
|
||||
return found
|
||||
}
|
||||
|
||||
val username = address.username
|
||||
val sipUri = LinphoneUtils.getAddressAsCleanStringUriOnly(address)
|
||||
// Start an async query in Magic Search in case LDAP or remote CardDAV is configured
|
||||
val remoteContactDirectories = coreContext.core.remoteContactDirectories
|
||||
if (remoteContactDirectories.isNotEmpty() && !magicSearchMap.keys.contains(sipUri) && !unknownRemoteContactDirectoriesContactsMap.contains(
|
||||
|
|
@ -461,20 +458,11 @@ class ContactsManager
|
|||
Log.d("$TAG Looking for friend with phone number [$username]")
|
||||
val foundUsingPhoneNumber = coreContext.core.findFriendByPhoneNumber(username)
|
||||
if (foundUsingPhoneNumber != null) {
|
||||
Log.d(
|
||||
"$TAG Friend [${foundUsingPhoneNumber.name}] was found using phone number [$username]"
|
||||
)
|
||||
foundUsingPhoneNumber
|
||||
} else {
|
||||
Log.d(
|
||||
"$TAG Friend wasn't found using phone number [$username], looking in native address book directly"
|
||||
)
|
||||
null
|
||||
}
|
||||
} else {
|
||||
Log.d(
|
||||
"$TAG Friend wasn't found using SIP address [$sipAddress] and username [$username] isn't a phone number, looking in native address book directly"
|
||||
)
|
||||
null
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ class LinphoneUtils {
|
|||
fun getAddressAsCleanStringUriOnly(address: Address): String {
|
||||
val scheme = address.scheme ?: "sip"
|
||||
val username = address.username
|
||||
if (username.orEmpty().isEmpty()) {
|
||||
if (username.isNullOrEmpty()) {
|
||||
return "$scheme:${address.domain}"
|
||||
}
|
||||
return "$scheme:$username@${address.domain}"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue