Merge pull request #57 from loki-project/disable-sms

Disable insecure sms option
This commit is contained in:
gmbnt 2020-01-28 11:31:57 +11:00 committed by GitHub
commit 2fec819b48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 12 deletions

View File

@ -32,7 +32,7 @@ public class TransportOptions {
private final Context context; private final Context context;
private final List<TransportOption> enabledTransports; private final List<TransportOption> enabledTransports;
private Type defaultTransportType = Type.SMS; private Type defaultTransportType = Type.TEXTSECURE;
private Optional<Integer> defaultSubscriptionId = Optional.absent(); private Optional<Integer> defaultSubscriptionId = Optional.absent();
private Optional<TransportOption> selectedOption = Optional.absent(); private Optional<TransportOption> selectedOption = Optional.absent();
@ -53,7 +53,7 @@ public class TransportOptions {
if (selectedOption.isPresent() && !isEnabled(selectedOption.get())) { if (selectedOption.isPresent() && !isEnabled(selectedOption.get())) {
setSelectedTransport(null); setSelectedTransport(null);
} else { } else {
this.defaultTransportType = Type.SMS; this.defaultTransportType = Type.TEXTSECURE;
this.defaultSubscriptionId = Optional.absent(); this.defaultSubscriptionId = Optional.absent();
notifyTransportChangeListeners(); notifyTransportChangeListeners();
@ -149,16 +149,6 @@ public class TransportOptions {
private List<TransportOption> initializeAvailableTransports(boolean isMediaMessage) { private List<TransportOption> initializeAvailableTransports(boolean isMediaMessage) {
List<TransportOption> results = new LinkedList<>(); List<TransportOption> results = new LinkedList<>();
if (isMediaMessage) {
results.addAll(getTransportOptionsForSimCards(context.getString(R.string.ConversationActivity_transport_insecure_mms),
context.getString(R.string.conversation_activity__type_message_mms_insecure),
new MmsCharacterCalculator()));
} else {
results.addAll(getTransportOptionsForSimCards(context.getString(R.string.ConversationActivity_transport_insecure_sms),
context.getString(R.string.conversation_activity__type_message_sms_insecure),
new SmsCharacterCalculator()));
}
results.add(new TransportOption(Type.TEXTSECURE, R.drawable.ic_send_push_white_24dp, results.add(new TransportOption(Type.TEXTSECURE, R.drawable.ic_send_push_white_24dp,
context.getResources().getColor(R.color.textsecure_primary), context.getResources().getColor(R.color.textsecure_primary),
context.getString(R.string.ConversationActivity_transport_signal), context.getString(R.string.ConversationActivity_transport_signal),

View File

@ -1330,7 +1330,9 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
boolean isMediaMessage = recipient.isMmsGroupRecipient() || attachmentManager.isAttachmentPresent(); boolean isMediaMessage = recipient.isMmsGroupRecipient() || attachmentManager.isAttachmentPresent();
sendButton.resetAvailableTransports(isMediaMessage); sendButton.resetAvailableTransports(isMediaMessage);
sendButton.setDefaultTransport(Type.TEXTSECURE);
/* Loki - We don't support SMS
if (!isSecureText && !isPushGroupConversation()) sendButton.disableTransport(Type.TEXTSECURE); if (!isSecureText && !isPushGroupConversation()) sendButton.disableTransport(Type.TEXTSECURE);
if (recipient.isPushGroupRecipient()) sendButton.disableTransport(Type.SMS); if (recipient.isPushGroupRecipient()) sendButton.disableTransport(Type.SMS);
@ -1340,6 +1342,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
if (isSecureText || isPushGroupConversation()) sendButton.setDefaultTransport(Type.TEXTSECURE); if (isSecureText || isPushGroupConversation()) sendButton.setDefaultTransport(Type.TEXTSECURE);
else sendButton.setDefaultTransport(Type.SMS); else sendButton.setDefaultTransport(Type.SMS);
} }
*/
calculateCharactersRemaining(); calculateCharactersRemaining();
supportInvalidateOptionsMenu(); supportInvalidateOptionsMenu();