mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +00:00
parent
d8a6fcf979
commit
8bec5a96f5
@ -7,6 +7,7 @@ import android.telephony.SmsMessage;
|
||||
import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.ApplicationContext;
|
||||
import org.thoughtcrime.securesms.database.SmsDatabase;
|
||||
import org.thoughtcrime.securesms.jobs.SmsSentJob;
|
||||
import org.whispersystems.jobqueue.JobManager;
|
||||
|
||||
@ -43,7 +44,21 @@ public class SmsDeliveryListener extends BroadcastReceiver {
|
||||
break;
|
||||
}
|
||||
|
||||
jobManager.add(new SmsSentJob(context, messageId, DELIVERED_SMS_ACTION, message.getStatus()));
|
||||
int status = message.getStatus();
|
||||
|
||||
Log.w(TAG, "Original status: " + status);
|
||||
|
||||
// Note: https://developer.android.com/reference/android/telephony/SmsMessage.html#getStatus()
|
||||
// " CDMA: For not interfering with status codes from GSM, the value is shifted to the bits 31-16"
|
||||
// Note: https://stackoverflow.com/a/33240109
|
||||
if ("3gpp2".equals(intent.getStringExtra("format"))) {
|
||||
Log.w(TAG, "Correcting for CDMA delivery receipt...");
|
||||
if (status >> 24 <= 0) status = SmsDatabase.Status.STATUS_COMPLETE;
|
||||
else if (status >> 24 == 2) status = SmsDatabase.Status.STATUS_PENDING;
|
||||
else if (status >> 24 == 3) status = SmsDatabase.Status.STATUS_FAILED;
|
||||
}
|
||||
|
||||
jobManager.add(new SmsSentJob(context, messageId, DELIVERED_SMS_ACTION, status));
|
||||
break;
|
||||
default:
|
||||
Log.w(TAG, "Unknown action: " + intent.getAction());
|
||||
|
Loading…
x
Reference in New Issue
Block a user