mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-06-05 21:49:22 +02:00
lets check those private contacts only if we actually have any
This commit is contained in:
@ -151,11 +151,13 @@ class MainActivity : SimpleActivity() {
|
|||||||
|
|
||||||
// check if no message came from a privately stored contact in Simple Contacts
|
// check if no message came from a privately stored contact in Simple Contacts
|
||||||
val privateContacts = MyContactsContentProvider.getSimpleContacts(this, privateCursor)
|
val privateContacts = MyContactsContentProvider.getSimpleContacts(this, privateCursor)
|
||||||
|
if (privateContacts.isNotEmpty()) {
|
||||||
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
val hasConversations = conversations.isNotEmpty()
|
val hasConversations = conversations.isNotEmpty()
|
||||||
|
@ -95,9 +95,10 @@ class ThreadActivity : SimpleActivity() {
|
|||||||
messages.first().participants
|
messages.first().participants
|
||||||
}
|
}
|
||||||
|
|
||||||
val senderNumbersToReplace = HashMap<String, String>()
|
|
||||||
// check if no participant came from a privately stored contact in Simple Contacts
|
// check if no participant came from a privately stored contact in Simple Contacts
|
||||||
val privateContacts = MyContactsContentProvider.getSimpleContacts(this, privateCursor)
|
val privateContacts = MyContactsContentProvider.getSimpleContacts(this, privateCursor)
|
||||||
|
if (privateContacts.isNotEmpty()) {
|
||||||
|
val senderNumbersToReplace = HashMap<String, String>()
|
||||||
participants.filter { it.name == it.phoneNumber }.forEach { participant ->
|
participants.filter { it.name == it.phoneNumber }.forEach { participant ->
|
||||||
privateContacts.firstOrNull { it.phoneNumber == participant.phoneNumber }?.apply {
|
privateContacts.firstOrNull { it.phoneNumber == participant.phoneNumber }?.apply {
|
||||||
senderNumbersToReplace[participant.phoneNumber] = name
|
senderNumbersToReplace[participant.phoneNumber] = name
|
||||||
@ -110,6 +111,7 @@ class ThreadActivity : SimpleActivity() {
|
|||||||
message.senderName = senderNumbersToReplace[message.senderName]!!
|
message.senderName = senderNumbersToReplace[message.senderName]!!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (participants.isEmpty()) {
|
if (participants.isEmpty()) {
|
||||||
val name = intent.getStringExtra(THREAD_TITLE) ?: ""
|
val name = intent.getStringExtra(THREAD_TITLE) ?: ""
|
||||||
|
Reference in New Issue
Block a user