fix #103, make sure private contact names are shown at group conversations

This commit is contained in:
tibbi 2020-12-06 16:36:31 +01:00
parent 8b17b8a13e
commit 75fb84f9d4
2 changed files with 16 additions and 18 deletions

View file

@ -185,20 +185,8 @@ class MainActivity : SimpleActivity() {
private fun getNewConversations(cachedConversations: ArrayList<Conversation>) {
val privateCursor = getMyContactsCursor().loadInBackground()
ensureBackgroundThread {
val conversations = getConversations()
// check if no message came from a privately stored contact in Simple Contacts
val privateContacts = MyContactsContentProvider.getSimpleContacts(this, privateCursor)
if (privateContacts.isNotEmpty()) {
conversations.filter { it.title == it.phoneNumber }.forEach { conversation ->
privateContacts.forEach { contact ->
if (contact.doesContainPhoneNumber(conversation.phoneNumber)) {
conversation.title = contact.name
conversation.photoUri = contact.photoUri
}
}
}
}
val conversations = getConversations(privateContacts = privateContacts)
runOnUiThread {
setupConversations(conversations)