Show contact name and label in call uri field when a suggestion is selected
This commit is contained in:
@ -540,7 +540,7 @@ private fun NewChatPeer(navController: NavController, account: Account) {
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable {
|
.clickable {
|
||||||
val uri = matchingUri?.uri ?: contact.uris().firstOrNull()?.uri ?: contact.name()
|
val uri = matchingUri?.uri ?: contact.uris().firstOrNull()?.uri ?: contact.name()
|
||||||
newPeer = uri.substringAfter(":")
|
newPeer = Utils.friendlyUri(uri, account)
|
||||||
showSuggestions = false
|
showSuggestions = false
|
||||||
}
|
}
|
||||||
.padding(12.dp)
|
.padding(12.dp)
|
||||||
|
|||||||
@ -126,25 +126,20 @@ sealed class Contact {
|
|||||||
|
|
||||||
fun contactContactUris(name: String, tel: Boolean = false): List<ContactUri> {
|
fun contactContactUris(name: String, tel: Boolean = false): List<ContactUri> {
|
||||||
synchronized(BaresipService.contacts) {
|
synchronized(BaresipService.contacts) {
|
||||||
for (c in BaresipService.contacts)
|
for (c in BaresipService.contacts) {
|
||||||
when (c) {
|
val contactUris = if (tel)
|
||||||
is BaresipContact -> {
|
c.uris().filter { it.uri.startsWith("tel:") }
|
||||||
if (c.name.equals(name, ignoreCase = true)) {
|
else
|
||||||
return if (tel)
|
c.uris()
|
||||||
c.uris.filter { it.uri.startsWith("tel:") }
|
if (c.name().equals(name, ignoreCase = true))
|
||||||
else
|
return contactUris
|
||||||
c.uris
|
for (u in contactUris) {
|
||||||
}
|
val label = u.label
|
||||||
}
|
val nameWithLabel = if (label.isNotEmpty()) "${c.name()} $label" else c.name()
|
||||||
is AndroidContact -> {
|
if (nameWithLabel.equals(name, ignoreCase = true))
|
||||||
if (c.name == name) {
|
return listOf(u)
|
||||||
return if (tel)
|
|
||||||
c.uris.filter { it.uri.startsWith("tel:") }
|
|
||||||
else
|
|
||||||
c.uris
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return emptyList()
|
return emptyList()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1339,7 +1339,14 @@ private fun CallUriRow(
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable {
|
.clickable {
|
||||||
val uri = matchingUri?.uri ?: contact.uris().firstOrNull()?.uri ?: contact.name()
|
val uri = matchingUri?.uri ?: contact.uris().firstOrNull()?.uri ?: contact.name()
|
||||||
dialerState.callUri.value = uri.substringAfter(":")
|
val aor = viewModel.selectedAor.value
|
||||||
|
val account = Account.ofAor(aor)
|
||||||
|
if (account != null) {
|
||||||
|
dialerState.callUri.value = Utils.friendlyUri(ctx, uri, account)
|
||||||
|
dialerState.redialUri = uri
|
||||||
|
} else {
|
||||||
|
dialerState.callUri.value = uri.substringAfter(":")
|
||||||
|
}
|
||||||
dialerState.showSuggestions.value = false
|
dialerState.showSuggestions.value = false
|
||||||
}
|
}
|
||||||
.padding(12.dp)
|
.padding(12.dp)
|
||||||
@ -1752,7 +1759,7 @@ private fun CallRow(
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable {
|
.clickable {
|
||||||
val uri = matchingUri?.uri ?: contact.uris().firstOrNull()?.uri ?: contact.name()
|
val uri = matchingUri?.uri ?: contact.uris().firstOrNull()?.uri ?: contact.name()
|
||||||
transferUri = uri.substringAfter(":")
|
transferUri = Utils.friendlyUri(ctx, uri, call.ua.account)
|
||||||
call.showSuggestions.value = false
|
call.showSuggestions.value = false
|
||||||
}
|
}
|
||||||
.padding(12.dp)
|
.padding(12.dp)
|
||||||
|
|||||||
Reference in New Issue
Block a user