try fixing a glitch with "Sending..." message getting stuck

This commit is contained in:
tibbi 2021-01-11 10:37:51 +01:00
parent d52b4da80e
commit 9412024baa
3 changed files with 14 additions and 6 deletions

View File

@ -123,8 +123,16 @@
<receiver android:name=".receivers.SmsStatusSentReceiver" />
<receiver
android:name="com.klinker.android.send_message.SentReceiver"
android:taskAffinity="com.simplemobiletools.smsmessenger.SMS_SENT"/>
<receiver android:name=".receivers.SmsStatusDeliveredReceiver" />
<receiver
android:name="com.klinker.android.send_message.DeliveredReceiver"
android:taskAffinity="com.simplemobiletools.smsmessenger.SMS_DELIVERED"/>
<receiver
android:name=".receivers.SmsReceiver"
android:permission="android.permission.BROADCAST_SMS">

View File

@ -1,20 +1,20 @@
package com.simplemobiletools.smsmessenger.receivers
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Handler
import android.os.Looper
import android.provider.Telephony
import com.klinker.android.send_message.DeliveredReceiver
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.smsmessenger.extensions.messagesDB
import com.simplemobiletools.smsmessenger.extensions.updateMessageType
import com.simplemobiletools.smsmessenger.helpers.refreshMessages
class SmsStatusDeliveredReceiver : BroadcastReceiver() {
class SmsStatusDeliveredReceiver : DeliveredReceiver() {
override fun onReceive(context: Context, intent: Intent) {
override fun onMessageStatusUpdated(context: Context, intent: Intent, receiverResultCode: Int) {
if (intent.extras?.containsKey("message_uri") == true) {
val uri = Uri.parse(intent.getStringExtra("message_uri"))
val messageId = uri?.lastPathSegment?.toLong() ?: 0L

View File

@ -5,7 +5,6 @@ import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.media.AudioAttributes
@ -16,6 +15,7 @@ import android.os.Handler
import android.os.Looper
import android.provider.Telephony
import androidx.core.app.NotificationCompat
import com.klinker.android.send_message.SentReceiver
import com.simplemobiletools.commons.extensions.getMyContactsCursor
import com.simplemobiletools.commons.helpers.SimpleContactsHelper
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
@ -27,9 +27,9 @@ import com.simplemobiletools.smsmessenger.helpers.NOTIFICATION_CHANNEL
import com.simplemobiletools.smsmessenger.helpers.THREAD_ID
import com.simplemobiletools.smsmessenger.helpers.refreshMessages
class SmsStatusSentReceiver : BroadcastReceiver() {
class SmsStatusSentReceiver : SentReceiver() {
override fun onReceive(context: Context, intent: Intent) {
override fun onMessageStatusUpdated(context: Context, intent: Intent, receiverResultCode: Int) {
if (intent.extras?.containsKey("message_uri") == true) {
val uri = Uri.parse(intent.getStringExtra("message_uri"))
val messageId = uri?.lastPathSegment?.toLong() ?: 0L