Check result code when updating MMS status

This fixes the issue where attachments are marked sent even when they aren't
This commit is contained in:
Naveen 2023-01-10 17:01:38 +05:30
parent 0095352713
commit 61c1e7b6b5
1 changed files with 8 additions and 2 deletions

View File

@ -16,8 +16,14 @@ class MmsSentReceiver : SendStatusReceiver() {
override fun updateAndroidDatabase(context: Context, intent: Intent, receiverResultCode: Int) {
val uri = Uri.parse(intent.getStringExtra(EXTRA_CONTENT_URI))
val values = ContentValues(1)
values.put(Telephony.Mms.MESSAGE_BOX, Telephony.Mms.MESSAGE_BOX_SENT)
val messageBox = if (receiverResultCode == Activity.RESULT_OK) {
Telephony.Mms.MESSAGE_BOX_SENT
} else {
Telephony.Mms.MESSAGE_BOX_FAILED
}
val values = ContentValues(1).apply {
put(Telephony.Mms.MESSAGE_BOX, messageBox)
}
try {
context.contentResolver.update(uri, values, null, null)
} catch (e: SQLiteException) {