Remove deprecated SMS fields from recipient table.

This commit is contained in:
Greyson Parrelli
2023-07-31 15:47:27 -04:00
parent e7972d4903
commit e3ec53c2d0
52 changed files with 34 additions and 2044 deletions

View File

@@ -76,7 +76,6 @@ public class RemoteReplyReceiver extends BroadcastReceiver {
long threadId;
Recipient recipient = Recipient.resolved(recipientId);
int subscriptionId = recipient.getDefaultSubscriptionId().orElse(-1);
long expiresIn = TimeUnit.SECONDS.toMillis(recipient.getExpiresInSeconds());
ParentStoryId parentStoryId = groupStoryId != Long.MIN_VALUE ? ParentStoryId.deserialize(groupStoryId) : null;
@@ -86,7 +85,6 @@ public class RemoteReplyReceiver extends BroadcastReceiver {
responseText.toString(),
new LinkedList<>(),
System.currentTimeMillis(),
subscriptionId,
expiresIn,
false,
0,
@@ -112,11 +110,6 @@ public class RemoteReplyReceiver extends BroadcastReceiver {
threadId = MessageSender.send(context, reply, -1, MessageSender.SendType.SIGNAL, null, null);
break;
}
case UnsecuredSmsMessage: {
OutgoingMessage reply = OutgoingMessage.sms(recipient, responseText.toString(), subscriptionId);
threadId = MessageSender.send(context, reply, -1, MessageSender.SendType.SMS, null, null);
break;
}
default:
throw new AssertionError("Unknown Reply method");
}

View File

@@ -1,26 +1,19 @@
package org.thoughtcrime.securesms.notifications;
import android.content.Context;
import androidx.annotation.NonNull;
import org.thoughtcrime.securesms.database.RecipientTable;
import org.thoughtcrime.securesms.keyvalue.SignalStore;
import org.thoughtcrime.securesms.recipients.Recipient;
public enum ReplyMethod {
GroupMessage,
SecureMessage,
UnsecuredSmsMessage;
SecureMessage;
public static @NonNull ReplyMethod forRecipient(Context context, Recipient recipient) {
public static @NonNull ReplyMethod forRecipient(Recipient recipient) {
if (recipient.isGroup()) {
return ReplyMethod.GroupMessage;
} else if (SignalStore.account().isRegistered() && recipient.getRegistered() == RecipientTable.RegisteredState.REGISTERED && !recipient.isForceSmsSelection()) {
return ReplyMethod.SecureMessage;
} else {
return ReplyMethod.UnsecuredSmsMessage;
return ReplyMethod.SecureMessage;
}
}
}

View File

@@ -123,7 +123,7 @@ sealed class NotificationBuilder(protected val context: Context) {
}
}
addActions(ReplyMethod.forRecipient(context, conversation.recipient), conversation)
addActions(ReplyMethod.forRecipient(conversation.recipient), conversation)
}
}
@@ -504,6 +504,5 @@ private fun ReplyMethod.toLongDescription(): Int {
return when (this) {
ReplyMethod.GroupMessage -> R.string.MessageNotifier_reply
ReplyMethod.SecureMessage -> R.string.MessageNotifier_signal_message
ReplyMethod.UnsecuredSmsMessage -> R.string.MessageNotifier_unsecured_sms
}
}