Show contact name and label in call uri field when a suggestion is selected

This commit is contained in:
Juha Heinanen
2026-08-14 10:05:04 +03:00
parent b9c8443aea
commit fd959082ce
3 changed files with 23 additions and 21 deletions

View File

@ -540,7 +540,7 @@ private fun NewChatPeer(navController: NavController, account: Account) {
.fillMaxWidth()
.clickable {
val uri = matchingUri?.uri ?: contact.uris().firstOrNull()?.uri ?: contact.name()
newPeer = uri.substringAfter(":")
newPeer = Utils.friendlyUri(uri, account)
showSuggestions = false
}
.padding(12.dp)

View File

@ -126,23 +126,18 @@ sealed class Contact {
fun contactContactUris(name: String, tel: Boolean = false): List<ContactUri> {
synchronized(BaresipService.contacts) {
for (c in BaresipService.contacts)
when (c) {
is BaresipContact -> {
if (c.name.equals(name, ignoreCase = true)) {
return if (tel)
c.uris.filter { it.uri.startsWith("tel:") }
for (c in BaresipService.contacts) {
val contactUris = if (tel)
c.uris().filter { it.uri.startsWith("tel:") }
else
c.uris
}
}
is AndroidContact -> {
if (c.name == name) {
return if (tel)
c.uris.filter { it.uri.startsWith("tel:") }
else
c.uris
}
c.uris()
if (c.name().equals(name, ignoreCase = true))
return contactUris
for (u in contactUris) {
val label = u.label
val nameWithLabel = if (label.isNotEmpty()) "${c.name()} $label" else c.name()
if (nameWithLabel.equals(name, ignoreCase = true))
return listOf(u)
}
}
}

View File

@ -1339,7 +1339,14 @@ private fun CallUriRow(
.fillMaxWidth()
.clickable {
val uri = matchingUri?.uri ?: contact.uris().firstOrNull()?.uri ?: contact.name()
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
}
.padding(12.dp)
@ -1752,7 +1759,7 @@ private fun CallRow(
.fillMaxWidth()
.clickable {
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
}
.padding(12.dp)