check if no message came from a privately stored contact in Simple Contacts
This commit is contained in:
parent
910aa365ac
commit
db90f0f08c
3 changed files with 13 additions and 1 deletions
|
|
@ -144,8 +144,19 @@ class MainActivity : SimpleActivity() {
|
|||
|
||||
private fun initMessenger() {
|
||||
storeStateVariables()
|
||||
val privateCursor = getMyContactsContentProviderCursorLoader().loadInBackground()
|
||||
|
||||
ensureBackgroundThread {
|
||||
val conversations = getConversations()
|
||||
|
||||
// check if no message came from a privately stored contact in Simple Contacts
|
||||
val privateContacts = MyContactsContentProvider.getSimpleContacts(this, privateCursor)
|
||||
conversations.filter { it.title == it.phoneNumber }.forEach { conversation ->
|
||||
privateContacts.firstOrNull { it.phoneNumber == conversation.phoneNumber }?.apply {
|
||||
conversation.title = name
|
||||
}
|
||||
}
|
||||
|
||||
runOnUiThread {
|
||||
val hasConversations = conversations.isNotEmpty()
|
||||
conversations_list.beVisibleIf(hasConversations)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue