From 983bf672cfeceab5c3e544110b5876819b9d7881 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Fri, 13 Jun 2014 17:39:29 -0700 Subject: [PATCH] Fix UI side of broken MMS fallback. 1) Actually tell the SendReceiveService to send the MMS if it is one. 2) Display the correct string (SMS vs MMS) in the fallback dialog. --- res/values/strings.xml | 6 ++++-- .../securesms/ConversationItem.java | 18 +++++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 85939a0043..44f2e8da6e 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -58,8 +58,10 @@ %1$s has updated the group. Tap for SMS fallback Tap for insecure fallback - Fallback to SMS? - Fallback to unencrypted SMS? + Fallback to SMS? + Fallback to MMS? + Fallback to unencrypted SMS? + Fallback to unencrypted MMS? This message will not be encrypted because a secure session could not be established.\n\nSend insecure message? diff --git a/src/org/thoughtcrime/securesms/ConversationItem.java b/src/org/thoughtcrime/securesms/ConversationItem.java index 9553952a59..3c34f34b8c 100644 --- a/src/org/thoughtcrime/securesms/ConversationItem.java +++ b/src/org/thoughtcrime/securesms/ConversationItem.java @@ -518,17 +518,24 @@ public class ConversationItem extends LinearLayout { private void handleMessageApproval() { final int title; final int message; + if (messageRecord.isPendingSecureSmsFallback()) { - title = R.string.ConversationItem_click_to_approve_dialog_title; + if (messageRecord.isMms()) title = R.string.ConversationItem_click_to_approve_mms_dialog_title; + else title = R.string.ConversationItem_click_to_approve_sms_dialog_title; + message = -1; } else { - title = R.string.ConversationItem_click_to_approve_unencrypted_dialog_title; + if (messageRecord.isMms()) title = R.string.ConversationItem_click_to_approve_unencrypted_mms_dialog_title; + else title = R.string.ConversationItem_click_to_approve_unencrypted_sms_dialog_title; + message = R.string.ConversationItem_click_to_approve_unencrypted_dialog_message; } AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(title); + if (message > -1) builder.setMessage(message); + builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { @@ -547,12 +554,17 @@ public class ConversationItem extends LinearLayout { database.markAsOutbox(messageRecord.getId()); database.markAsForcedSms(messageRecord.getId()); } + Intent intent = new Intent(context, SendReceiveService.class); - intent.setAction(SendReceiveService.SEND_SMS_ACTION); + intent.setAction(messageRecord.isMms() ? + SendReceiveService.SEND_MMS_ACTION : + SendReceiveService.SEND_SMS_ACTION); intent.putExtra(SendReceiveService.MASTER_SECRET_EXTRA, masterSecret); + context.startService(intent); } }); + builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) {