mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-02-16 19:50:40 +01:00
get the Photo Uri of private contacts too
This commit is contained in:
parent
81e5905bf7
commit
1c1a2d2855
@ -155,6 +155,7 @@ class MainActivity : SimpleActivity() {
|
||||
conversations.filter { it.title == it.phoneNumber }.forEach { conversation ->
|
||||
privateContacts.firstOrNull { it.phoneNumber == conversation.phoneNumber }?.apply {
|
||||
conversation.title = name
|
||||
conversation.photoUri = photoUri
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -104,6 +104,7 @@ class ThreadActivity : SimpleActivity() {
|
||||
privateContacts.firstOrNull { it.phoneNumber == participant.phoneNumber }?.apply {
|
||||
senderNumbersToReplace[participant.phoneNumber] = name
|
||||
participant.name = name
|
||||
participant.photoUri = photoUri
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -383,6 +383,7 @@ fun Context.getSuggestedContacts(privateContacts: ArrayList<SimpleContact>): Arr
|
||||
val senderNumber = cursor.getStringValue(Sms.ADDRESS) ?: return@queryCursor
|
||||
val namePhoto = getNameAndPhotoFromPhoneNumber(senderNumber)
|
||||
var senderName = namePhoto?.name ?: ""
|
||||
var photoUri = namePhoto?.photoUri ?: ""
|
||||
if (namePhoto == null || isNumberBlocked(senderNumber)) {
|
||||
return@queryCursor
|
||||
} else if (namePhoto.name == senderNumber) {
|
||||
@ -390,6 +391,7 @@ fun Context.getSuggestedContacts(privateContacts: ArrayList<SimpleContact>): Arr
|
||||
val privateContact = privateContacts.firstOrNull { it.phoneNumber == senderNumber }
|
||||
if (privateContact != null) {
|
||||
senderName = privateContact.name
|
||||
photoUri = privateContact.photoUri
|
||||
} else {
|
||||
return@queryCursor
|
||||
}
|
||||
@ -398,7 +400,6 @@ fun Context.getSuggestedContacts(privateContacts: ArrayList<SimpleContact>): Arr
|
||||
}
|
||||
}
|
||||
|
||||
val photoUri = namePhoto.photoUri ?: ""
|
||||
val contact = SimpleContact(0, 0, senderName, photoUri, senderNumber)
|
||||
if (!contacts.map { it.phoneNumber.trimToComparableNumber() }.contains(senderNumber.trimToComparableNumber())) {
|
||||
contacts.add(contact)
|
||||
|
Loading…
x
Reference in New Issue
Block a user