make sure received messages are stored on the background thread

This commit is contained in:
tibbi 2020-11-03 19:23:49 +01:00
parent 738c41715b
commit 953d521e47
2 changed files with 6 additions and 5 deletions

View File

@ -56,7 +56,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:5.31.20' implementation 'com.simplemobiletools:commons:5.31.21'
implementation 'org.greenrobot:eventbus:3.2.0' implementation 'org.greenrobot:eventbus:3.2.0'
implementation 'com.klinkerapps:android-smsmms:5.2.6' implementation 'com.klinkerapps:android-smsmms:5.2.6'
implementation 'com.github.tibbi:IndicatorFastScroll:08f512858a' implementation 'com.github.tibbi:IndicatorFastScroll:08f512858a'

View File

@ -30,15 +30,16 @@ class SmsReceiver : BroadcastReceiver() {
} }
if (!context.isNumberBlocked(address)) { if (!context.isNumberBlocked(address)) {
context.insertNewSMS(address, subject, body, date, read, threadId, type, subscriptionId)
context.showReceivedMessageNotification(address, body, threadId.toInt(), null)
refreshMessages()
ensureBackgroundThread { ensureBackgroundThread {
context.insertNewSMS(address, subject, body, date, read, threadId, type, subscriptionId)
val conversation = context.getConversations(threadId).firstOrNull() ?: return@ensureBackgroundThread val conversation = context.getConversations(threadId).firstOrNull() ?: return@ensureBackgroundThread
context.conversationsDB.insertOrUpdate(conversation) context.conversationsDB.insertOrUpdate(conversation)
context.updateUnreadCountBadge(context.conversationsDB.getUnreadConversations()) context.updateUnreadCountBadge(context.conversationsDB.getUnreadConversations())
} }
context.showReceivedMessageNotification(address, body, threadId.toInt(), null)
refreshMessages()
} }
} }
} }