kopia lustrzana https://github.com/ryukoposting/Signal-Android
Prevent crash when opening conversation with unregistered UUID-only recipient.
rodzic
129effd0ec
commit
add65cf592
|
@ -1518,7 +1518,9 @@ public class ConversationActivity extends PassphraseRequiredActivity
|
|||
|
||||
sendButton.resetAvailableTransports(isMediaMessage);
|
||||
|
||||
if (!isSecureText && !isPushGroupConversation()) sendButton.disableTransport(Type.TEXTSECURE);
|
||||
if (!isSecureText && !isPushGroupConversation() && !recipient.get().isUuidOnly()) {
|
||||
sendButton.disableTransport(Type.TEXTSECURE);
|
||||
}
|
||||
|
||||
if (recipient.get().isPushGroup() || (!recipient.get().isMmsGroup() && !recipient.get().hasSmsAddress())) {
|
||||
sendButton.disableTransport(Type.SMS);
|
||||
|
@ -1527,8 +1529,11 @@ public class ConversationActivity extends PassphraseRequiredActivity
|
|||
if (!recipient.get().isPushGroup() && recipient.get().isForceSmsSelection()) {
|
||||
sendButton.setDefaultTransport(Type.SMS);
|
||||
} else {
|
||||
if (isSecureText || isPushGroupConversation()) sendButton.setDefaultTransport(Type.TEXTSECURE);
|
||||
else sendButton.setDefaultTransport(Type.SMS);
|
||||
if (isSecureText || isPushGroupConversation() || recipient.get().isUuidOnly()) {
|
||||
sendButton.setDefaultTransport(Type.TEXTSECURE);
|
||||
} else {
|
||||
sendButton.setDefaultTransport(Type.SMS);
|
||||
}
|
||||
}
|
||||
|
||||
calculateCharactersRemaining();
|
||||
|
@ -2588,7 +2593,7 @@ public class ConversationActivity extends PassphraseRequiredActivity
|
|||
inputPanel.setVisibility(View.GONE);
|
||||
makeDefaultSmsButton.setVisibility(View.GONE);
|
||||
registerButton.setVisibility(View.VISIBLE);
|
||||
} else if (!isSecureText && !isDefaultSms) {
|
||||
} else if (!isSecureText && !isDefaultSms && recipient.hasSmsAddress()) {
|
||||
unblockButton.setVisibility(View.GONE);
|
||||
inputPanel.setVisibility(View.GONE);
|
||||
makeDefaultSmsButton.setVisibility(View.VISIBLE);
|
||||
|
@ -2842,14 +2847,15 @@ public class ConversationActivity extends PassphraseRequiredActivity
|
|||
final boolean initiating,
|
||||
final boolean clearComposeBox)
|
||||
{
|
||||
if (!isDefaultSms && (!isSecureText || forceSms)) {
|
||||
if (!isDefaultSms && (!isSecureText || forceSms) && recipient.get().hasSmsAddress()) {
|
||||
showDefaultSmsPrompt();
|
||||
return new SettableFuture<>(null);
|
||||
}
|
||||
|
||||
final long thread = this.threadId;
|
||||
final boolean sendPush = (isSecureText && !forceSms) || recipient.get().isUuidOnly();
|
||||
final long thread = this.threadId;
|
||||
|
||||
if (isSecureText && !forceSms) {
|
||||
if (sendPush) {
|
||||
MessageUtil.SplitResult splitMessage = MessageUtil.getSplitMessage(this, body, sendButton.getSelectedTransport().calculateCharacters(body).maxPrimaryMessageSize);
|
||||
body = splitMessage.getBody();
|
||||
|
||||
|
@ -2865,7 +2871,7 @@ public class ConversationActivity extends PassphraseRequiredActivity
|
|||
|
||||
final OutgoingMediaMessage outgoingMessage;
|
||||
|
||||
if (isSecureText && !forceSms) {
|
||||
if (sendPush) {
|
||||
outgoingMessage = new OutgoingSecureMediaMessage(outgoingMessageCandidate);
|
||||
ApplicationDependencies.getTypingStatusSender().onTypingStopped(thread);
|
||||
} else {
|
||||
|
@ -2874,7 +2880,7 @@ public class ConversationActivity extends PassphraseRequiredActivity
|
|||
|
||||
Permissions.with(this)
|
||||
.request(Manifest.permission.SEND_SMS, Manifest.permission.READ_SMS)
|
||||
.ifNecessary(!isSecureText || forceSms)
|
||||
.ifNecessary(!sendPush)
|
||||
.withPermanentDenialDialog(getString(R.string.ConversationActivity_signal_needs_sms_permission_in_order_to_send_an_sms))
|
||||
.onAllGranted(() -> {
|
||||
if (clearComposeBox) {
|
||||
|
@ -2901,7 +2907,7 @@ public class ConversationActivity extends PassphraseRequiredActivity
|
|||
private void sendTextMessage(final boolean forceSms, final long expiresIn, final int subscriptionId, final boolean initiating)
|
||||
throws InvalidMessageException
|
||||
{
|
||||
if (!isDefaultSms && (!isSecureText || forceSms)) {
|
||||
if (!isDefaultSms && (!isSecureText || forceSms) && recipient.get().hasSmsAddress()) {
|
||||
showDefaultSmsPrompt();
|
||||
return;
|
||||
}
|
||||
|
@ -2909,10 +2915,11 @@ public class ConversationActivity extends PassphraseRequiredActivity
|
|||
final long thread = this.threadId;
|
||||
final Context context = getApplicationContext();
|
||||
final String messageBody = getMessage();
|
||||
final boolean sendPush = (isSecureText && !forceSms) || recipient.get().isUuidOnly();
|
||||
|
||||
OutgoingTextMessage message;
|
||||
|
||||
if (isSecureText && !forceSms) {
|
||||
if (sendPush) {
|
||||
message = new OutgoingEncryptedMessage(recipient.get(), messageBody, expiresIn);
|
||||
ApplicationDependencies.getTypingStatusSender().onTypingStopped(thread);
|
||||
} else {
|
||||
|
@ -2921,7 +2928,7 @@ public class ConversationActivity extends PassphraseRequiredActivity
|
|||
|
||||
Permissions.with(this)
|
||||
.request(Manifest.permission.SEND_SMS)
|
||||
.ifNecessary(forceSms || !isSecureText)
|
||||
.ifNecessary(!sendPush)
|
||||
.withPermanentDenialDialog(getString(R.string.ConversationActivity_signal_needs_sms_permission_in_order_to_send_an_sms))
|
||||
.onAllGranted(() -> {
|
||||
silentlySetComposeText("");
|
||||
|
|
|
@ -650,6 +650,10 @@ public class Recipient {
|
|||
return getUuid().isPresent();
|
||||
}
|
||||
|
||||
public boolean isUuidOnly() {
|
||||
return hasUuid() && !hasSmsAddress();
|
||||
}
|
||||
|
||||
public @NonNull GroupId requireGroupId() {
|
||||
GroupId resolved = resolving ? resolve().groupId : groupId;
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue