From 6e7dbb90561b63589e7a6aa88b7738d2b0ebba89 Mon Sep 17 00:00:00 2001 From: Naveen Date: Wed, 7 Dec 2022 22:39:04 +0530 Subject: [PATCH] Properly update sent message type --- .../smsmessenger/receivers/SmsStatusSentReceiver.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/SmsStatusSentReceiver.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/SmsStatusSentReceiver.kt index 1c5635a5..32db10ea 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/SmsStatusSentReceiver.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/SmsStatusSentReceiver.kt @@ -1,5 +1,6 @@ package com.simplemobiletools.smsmessenger.receivers +import android.app.Activity import android.content.Context import android.content.Intent import android.net.Uri @@ -19,11 +20,13 @@ class SmsStatusSentReceiver : SentReceiver() { val uri = Uri.parse(intent.getStringExtra("message_uri")) val messageId = uri?.lastPathSegment?.toLong() ?: 0L ensureBackgroundThread { - val type = if (intent.extras!!.containsKey("errorCode")) { + if (intent.extras!!.containsKey("errorCode")) { showSendingFailedNotification(context, messageId) - Telephony.Sms.MESSAGE_TYPE_FAILED - } else { + } + val type = if (receiverResultCode == Activity.RESULT_OK) { Telephony.Sms.MESSAGE_TYPE_SENT + } else { + Telephony.Sms.MESSAGE_TYPE_FAILED } context.updateMessageType(messageId, type)