Trying to speed up process contacts filtering by using nativeid & friends' refkey

This commit is contained in:
Sylvain Berfini 2022-03-03 13:47:51 +01:00
parent cc632d89f3
commit f86c9dc99c

View file

@ -226,6 +226,12 @@ class ContactsManager(private val context: Context) {
@Synchronized @Synchronized
fun findContactByFriend(friend: Friend): Contact? { fun findContactByFriend(friend: Friend): Contact? {
val refKey = friend.refKey
if (refKey != null) {
val contact = findContactById(refKey)
if (contact != null) return contact
}
val address = friend.address val address = friend.address
if (address != null) { if (address != null) {
val friends = coreContext.core.findFriends(address) val friends = coreContext.core.findFriends(address)