Add missing code

This commit is contained in:
AAlier 2023-06-24 04:28:35 +06:00
parent b076da3840
commit 5169539a88
5 changed files with 6 additions and 4 deletions

View file

@ -37,11 +37,13 @@ class DirectReplyReceiver : BroadcastReceiver() {
}
ensureBackgroundThread {
var messageId: Long = 0L
try {
context.sendMessageCompat(body, listOf(address), subscriptionId, emptyList())
val message = context.getMessages(threadId, getImageResolutions = false, includeScheduledMessages = false, limit = 1).lastOrNull()
if (message != null) {
context.messagesDB.insertOrUpdate(message)
messageId = message.id
}
} catch (e: Exception) {
context.showErrorToast(e)
@ -50,7 +52,7 @@ class DirectReplyReceiver : BroadcastReceiver() {
val photoUri = SimpleContactsHelper(context).getPhotoUriFromPhoneNumber(address)
val bitmap = context.getNotificationBitmap(photoUri)
Handler(Looper.getMainLooper()).post {
context.notificationHelper.showMessageNotification(address, body, threadId, bitmap, sender = null, alertOnlyOnce = true)
context.notificationHelper.showMessageNotification(messageId, address, body, threadId, bitmap, sender = null, alertOnlyOnce = true)
}
context.markThreadMessagesRead(threadId)