mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-02-19 21:20:39 +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 ->
|
conversations.filter { it.title == it.phoneNumber }.forEach { conversation ->
|
||||||
privateContacts.firstOrNull { it.phoneNumber == conversation.phoneNumber }?.apply {
|
privateContacts.firstOrNull { it.phoneNumber == conversation.phoneNumber }?.apply {
|
||||||
conversation.title = name
|
conversation.title = name
|
||||||
|
conversation.photoUri = photoUri
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,6 +104,7 @@ class ThreadActivity : SimpleActivity() {
|
|||||||
privateContacts.firstOrNull { it.phoneNumber == participant.phoneNumber }?.apply {
|
privateContacts.firstOrNull { it.phoneNumber == participant.phoneNumber }?.apply {
|
||||||
senderNumbersToReplace[participant.phoneNumber] = name
|
senderNumbersToReplace[participant.phoneNumber] = name
|
||||||
participant.name = 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 senderNumber = cursor.getStringValue(Sms.ADDRESS) ?: return@queryCursor
|
||||||
val namePhoto = getNameAndPhotoFromPhoneNumber(senderNumber)
|
val namePhoto = getNameAndPhotoFromPhoneNumber(senderNumber)
|
||||||
var senderName = namePhoto?.name ?: ""
|
var senderName = namePhoto?.name ?: ""
|
||||||
|
var photoUri = namePhoto?.photoUri ?: ""
|
||||||
if (namePhoto == null || isNumberBlocked(senderNumber)) {
|
if (namePhoto == null || isNumberBlocked(senderNumber)) {
|
||||||
return@queryCursor
|
return@queryCursor
|
||||||
} else if (namePhoto.name == senderNumber) {
|
} else if (namePhoto.name == senderNumber) {
|
||||||
@ -390,6 +391,7 @@ fun Context.getSuggestedContacts(privateContacts: ArrayList<SimpleContact>): Arr
|
|||||||
val privateContact = privateContacts.firstOrNull { it.phoneNumber == senderNumber }
|
val privateContact = privateContacts.firstOrNull { it.phoneNumber == senderNumber }
|
||||||
if (privateContact != null) {
|
if (privateContact != null) {
|
||||||
senderName = privateContact.name
|
senderName = privateContact.name
|
||||||
|
photoUri = privateContact.photoUri
|
||||||
} else {
|
} else {
|
||||||
return@queryCursor
|
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)
|
val contact = SimpleContact(0, 0, senderName, photoUri, senderNumber)
|
||||||
if (!contacts.map { it.phoneNumber.trimToComparableNumber() }.contains(senderNumber.trimToComparableNumber())) {
|
if (!contacts.map { it.phoneNumber.trimToComparableNumber() }.contains(senderNumber.trimToComparableNumber())) {
|
||||||
contacts.add(contact)
|
contacts.add(contact)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user