Minor messaging code improvement

This commit is contained in:
Naveen 2022-11-18 01:01:10 +05:30
parent 3d9cb5bdac
commit ca1ad0043b
2 changed files with 9 additions and 9 deletions

View file

@ -3,6 +3,8 @@ package com.simplemobiletools.smsmessenger.receivers
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.os.Handler
import android.os.Looper
import android.os.PowerManager
import com.simplemobiletools.commons.extensions.showErrorToast
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
@ -43,7 +45,9 @@ class ScheduledMessageReceiver : BroadcastReceiver() {
val attachments = message.attachment?.attachments ?: emptyList()
try {
context.sendMessage(message.body, addresses, message.subscriptionId, attachments)
Handler(Looper.getMainLooper()).post {
context.sendMessage(message.body, addresses, message.subscriptionId, attachments)
}
// delete temporary conversation and message as it's already persisted to the telephony db now
context.deleteScheduledMessage(messageId)