Improve call tab performance.

This commit is contained in:
Alex Hart
2025-01-16 17:19:55 -04:00
committed by Greyson Parrelli
parent 71c21eeba6
commit 0b24e42448
9 changed files with 634 additions and 315 deletions

View File

@@ -499,6 +499,27 @@ class Recipient(
profileName.toString().isNotNullOrBlank()
}
fun isMatch(query: String): Boolean {
if (query.isEmpty()) {
return true
}
val lowercaseQuery = query.lowercase()
val sortName = listOf(
nickname.toString(),
nickname.givenName,
systemProfileName.toString(),
systemProfileName.givenName,
profileName.toString(),
profileName.givenName,
username.orElse("")
).firstOrNull { it.isNotNullOrBlank() }?.lowercase()
return sortName?.contains(lowercaseQuery) == true ||
e164.map { it.contains(query) }.orElse(false) ||
email.map { it.contains(query) }.orElse(false)
}
/** A full-length display name to render for this recipient. */
fun getDisplayName(context: Context): String {
var name = getNameFromLocalData(context)