fix wrong sender name from private contacts
- use SimpleContact.doesHavePhoneNumber to perform comparision between a sender and private contact. SimpleContact.doesHavePhoneNumber does equality check.
This commit is contained in:
parent
52ebeeedc6
commit
91d81e3bd8
2 changed files with 3 additions and 3 deletions
|
|
@ -218,8 +218,8 @@ class ThreadActivity : SimpleActivity() {
|
||||||
privateContacts = MyContactsContentProvider.getSimpleContacts(this, privateCursor)
|
privateContacts = MyContactsContentProvider.getSimpleContacts(this, privateCursor)
|
||||||
if (privateContacts.isNotEmpty()) {
|
if (privateContacts.isNotEmpty()) {
|
||||||
val senderNumbersToReplace = HashMap<String, String>()
|
val senderNumbersToReplace = HashMap<String, String>()
|
||||||
participants.filter { it.doesContainPhoneNumber(it.name) }.forEach { participant ->
|
participants.filter { it.doesHavePhoneNumber(it.name) }.forEach { participant ->
|
||||||
privateContacts.firstOrNull { it.doesContainPhoneNumber(participant.phoneNumbers.first()) }?.apply {
|
privateContacts.firstOrNull { it.doesHavePhoneNumber(participant.phoneNumbers.first()) }?.apply {
|
||||||
senderNumbersToReplace[participant.phoneNumbers.first()] = name
|
senderNumbersToReplace[participant.phoneNumbers.first()] = name
|
||||||
participant.name = name
|
participant.name = name
|
||||||
participant.photoUri = photoUri
|
participant.photoUri = photoUri
|
||||||
|
|
|
||||||
|
|
@ -401,7 +401,7 @@ fun Context.getThreadContactNames(phoneNumbers: List<String>, privateContacts: A
|
||||||
if (name != number) {
|
if (name != number) {
|
||||||
names.add(name)
|
names.add(name)
|
||||||
} else {
|
} else {
|
||||||
val privateContact = privateContacts.firstOrNull { it.doesContainPhoneNumber(number) }
|
val privateContact = privateContacts.firstOrNull { it.doesHavePhoneNumber(number) }
|
||||||
if (privateContact == null) {
|
if (privateContact == null) {
|
||||||
names.add(name)
|
names.add(name)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue