Show URI's label (if exists) in the list of selectable contact URIs

This commit is contained in:
Juha Heinanen
2026-05-31 17:46:30 +03:00
parent be65d99ac1
commit 269373f259
6 changed files with 27 additions and 49 deletions
@@ -95,34 +95,29 @@ sealed class Contact {
return null
}
fun contactUris(name: String, tel: Boolean = false): ArrayList<String> {
val uris = ArrayList<String>()
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)) {
for (u in c.uris) {
if (tel && !u.uri.startsWith("tel:"))
continue
uris.add(u.uri)
}
return uris
return if (tel)
c.uris.filter { it.uri.startsWith("tel:") }
else
c.uris
}
}
is AndroidContact -> {
if (c.name == name) {
for (u in c.uris) {
if (tel && !u.uri.startsWith("tel:"))
continue
uris.add(u.uri)
}
return uris
return if (tel)
c.uris.filter { it.uri.startsWith("tel:") }
else
c.uris
}
}
}
}
return uris
return emptyList()
}
fun findContact(uri: String): Contact? {