mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-22 16:07:30 +00:00
Tweak MMS retrieval and submission.
1) Only attempt direct connect outside of MMS radio mode on CDMA. 2) Don't switch back to normal radio state if pending messages remain.
This commit is contained in:
parent
27e039c4a6
commit
ef6a5c69af
@ -18,6 +18,7 @@ package org.thoughtcrime.securesms.service;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.telephony.TelephonyManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.R;
|
import org.thoughtcrime.securesms.R;
|
||||||
@ -46,7 +47,8 @@ public class MmsDownloader extends MmscProcessor {
|
|||||||
|
|
||||||
public void process(MasterSecret masterSecret, Intent intent) {
|
public void process(MasterSecret masterSecret, Intent intent) {
|
||||||
if (intent.getAction().equals(SendReceiveService.DOWNLOAD_MMS_ACTION)) {
|
if (intent.getAction().equals(SendReceiveService.DOWNLOAD_MMS_ACTION)) {
|
||||||
DownloadItem item = new DownloadItem(masterSecret, false, false,
|
boolean isCdma = ((TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE)).getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA;
|
||||||
|
DownloadItem item = new DownloadItem(masterSecret, !isCdma, false,
|
||||||
intent.getLongExtra("message_id", -1),
|
intent.getLongExtra("message_id", -1),
|
||||||
intent.getLongExtra("thread_id", -1),
|
intent.getLongExtra("thread_id", -1),
|
||||||
intent.getStringExtra("content_location"),
|
intent.getStringExtra("content_location"),
|
||||||
@ -147,7 +149,9 @@ public class MmsDownloader extends MmscProcessor {
|
|||||||
downloadMms(item);
|
downloadMms(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pendingMessages.isEmpty())
|
||||||
finishConnectivity();
|
finishConnectivity();
|
||||||
|
|
||||||
} else if (!isConnected() && !isConnectivityPossible()) {
|
} else if (!isConnected() && !isConnectivityPossible()) {
|
||||||
pendingMessages.clear();
|
pendingMessages.clear();
|
||||||
|
|
||||||
|
@ -64,13 +64,14 @@ public class MmsSender extends MmscProcessor {
|
|||||||
public void process(MasterSecret masterSecret, Intent intent) {
|
public void process(MasterSecret masterSecret, Intent intent) {
|
||||||
if (intent.getAction().equals(SendReceiveService.SEND_MMS_ACTION)) {
|
if (intent.getAction().equals(SendReceiveService.SEND_MMS_ACTION)) {
|
||||||
long messageId = intent.getLongExtra("message_id", -1);
|
long messageId = intent.getLongExtra("message_id", -1);
|
||||||
|
boolean isCdma = ((TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE)).getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA;
|
||||||
MmsDatabase database = DatabaseFactory.getEncryptingMmsDatabase(context, masterSecret);
|
MmsDatabase database = DatabaseFactory.getEncryptingMmsDatabase(context, masterSecret);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<SendReq> sendRequests = getOutgoingMessages(masterSecret, messageId);
|
List<SendReq> sendRequests = getOutgoingMessages(masterSecret, messageId);
|
||||||
|
|
||||||
for (SendReq sendRequest : sendRequests) {
|
for (SendReq sendRequest : sendRequests) {
|
||||||
handleSendMmsAction(new SendItem(masterSecret, sendRequest, messageId != -1, false, false));
|
handleSendMmsAction(new SendItem(masterSecret, sendRequest, messageId != -1, !isCdma, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (MmsException me) {
|
} catch (MmsException me) {
|
||||||
@ -192,11 +193,14 @@ public class MmsSender extends MmscProcessor {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SendItem item : pendingMessages) {
|
List<SendItem> outgoing = (List<SendItem>)pendingMessages.clone();
|
||||||
|
pendingMessages.clear();
|
||||||
|
|
||||||
|
for (SendItem item : outgoing) {
|
||||||
sendMmsMessage(item);
|
sendMmsMessage(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
pendingMessages.clear();
|
if (pendingMessages.isEmpty())
|
||||||
finishConnectivity();
|
finishConnectivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user