From 1efb92b9139795765273575ab6a70dd5911ae023 Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Wed, 6 Mar 2019 08:12:00 -0800 Subject: [PATCH] Fix issue where SMS were sometimes sent as MMS. Fixes #8664 --- .../conversation/ConversationActivity.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java index a90f4e773d..f5c8bdc439 100644 --- a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java @@ -2044,17 +2044,19 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity throw new RecipientFormattingException("Badly formatted"); } - String message = getMessage(); - boolean forceSms = sendButton.isManualSelection() && sendButton.getSelectedTransport().isSms(); - int subscriptionId = sendButton.getSelectedTransport().getSimSubscriptionId().or(-1); - long expiresIn = recipient.getExpireMessages() * 1000L; - boolean initiating = threadId == -1; - boolean isMediaMessage = attachmentManager.isAttachmentPresent() || - recipient.isGroupRecipient() || - recipient.getAddress().isEmail() || - inputPanel.getQuote().isPresent() || - linkPreviewViewModel.hasLinkPreview() || - message.length() > sendButton.getSelectedTransport().calculateCharacters(message).maxPrimaryMessageSize; + String message = getMessage(); + TransportOption transport = sendButton.getSelectedTransport(); + boolean forceSms = sendButton.isManualSelection() && transport.isSms(); + int subscriptionId = sendButton.getSelectedTransport().getSimSubscriptionId().or(-1); + long expiresIn = recipient.getExpireMessages() * 1000L; + boolean initiating = threadId == -1; + boolean needsSplit = !transport.isSms() && message.length() > transport.calculateCharacters(message).maxPrimaryMessageSize; + boolean isMediaMessage = attachmentManager.isAttachmentPresent() || + recipient.isGroupRecipient() || + recipient.getAddress().isEmail() || + inputPanel.getQuote().isPresent() || + linkPreviewViewModel.hasLinkPreview() || + needsSplit; Log.i(TAG, "isManual Selection: " + sendButton.isManualSelection()); Log.i(TAG, "forceSms: " + forceSms);