avoid showing the same contact multiple times at Suggestions

This commit is contained in:
tibbi 2020-04-13 21:15:04 +02:00
parent c1652efb2e
commit 06f61b55cb
1 changed files with 3 additions and 1 deletions

View File

@ -371,7 +371,9 @@ fun Context.getSuggestedContacts(): ArrayList<Contact> {
val senderName = namePhoto.name
val photoUri = namePhoto.photoUri ?: ""
val contact = Contact(0, senderName, photoUri, senderNumber)
contacts.add(contact)
if (!contacts.map { it.phoneNumber.trimToComparableNumber() }.contains(senderNumber.trimToComparableNumber())) {
contacts.add(contact)
}
}
return contacts