mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-17 05:41:40 +01:00
Switch MMS groups to use the group database infrastructure
Eliminate the concept of 'Recipients' (plural). There is now just a 'Recipient', which contains an Address that is either an individual or a group ID. MMS groups now exist as part of the group database, just like push groups. // FREEBIE
This commit is contained in:
@@ -31,8 +31,8 @@ import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.database.MessagingDatabase.MarkedMessageInfo;
|
||||
import org.thoughtcrime.securesms.database.RecipientPreferenceDatabase.RecipientsPreferences;
|
||||
import org.thoughtcrime.securesms.mms.OutgoingMediaMessage;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.sms.MessageSender;
|
||||
import org.thoughtcrime.securesms.sms.OutgoingTextMessage;
|
||||
import org.whispersystems.libsignal.logging.Log;
|
||||
@@ -48,7 +48,7 @@ public class AndroidAutoReplyReceiver extends MasterSecretBroadcastReceiver {
|
||||
|
||||
public static final String TAG = AndroidAutoReplyReceiver.class.getSimpleName();
|
||||
public static final String REPLY_ACTION = "org.thoughtcrime.securesms.notifications.ANDROID_AUTO_REPLY";
|
||||
public static final String ADDRESSES_EXTRA = "car_addresses";
|
||||
public static final String ADDRESS_EXTRA = "car_address";
|
||||
public static final String VOICE_REPLY_KEY = "car_voice_reply_key";
|
||||
public static final String THREAD_ID_EXTRA = "car_reply_thread_id";
|
||||
|
||||
@@ -62,10 +62,10 @@ public class AndroidAutoReplyReceiver extends MasterSecretBroadcastReceiver {
|
||||
|
||||
if (remoteInput == null) return;
|
||||
|
||||
final Address[] addresses = Address.fromParcelable(intent.getParcelableArrayExtra(ADDRESSES_EXTRA));
|
||||
final Address address = intent.getParcelableExtra(ADDRESS_EXTRA);
|
||||
final long threadId = intent.getLongExtra(THREAD_ID_EXTRA, -1);
|
||||
final CharSequence responseText = getMessageText(intent);
|
||||
final Recipients recipients = RecipientFactory.getRecipientsFor(context, addresses, false);
|
||||
final Recipient recipient = RecipientFactory.getRecipientFor(context, address, false);
|
||||
|
||||
if (responseText != null) {
|
||||
new AsyncTask<Void, Void, Void>() {
|
||||
@@ -74,17 +74,17 @@ public class AndroidAutoReplyReceiver extends MasterSecretBroadcastReceiver {
|
||||
|
||||
long replyThreadId;
|
||||
|
||||
Optional<RecipientsPreferences> preferences = DatabaseFactory.getRecipientPreferenceDatabase(context).getRecipientsPreferences(addresses);
|
||||
Optional<RecipientsPreferences> preferences = DatabaseFactory.getRecipientPreferenceDatabase(context).getRecipientsPreferences(address);
|
||||
int subscriptionId = preferences.isPresent() ? preferences.get().getDefaultSubscriptionId().or(-1) : -1;
|
||||
long expiresIn = preferences.isPresent() ? preferences.get().getExpireMessages() * 1000 : 0;
|
||||
|
||||
if (recipients.isGroupRecipient()) {
|
||||
if (recipient.isGroupRecipient()) {
|
||||
Log.w("AndroidAutoReplyReceiver", "GroupRecipient, Sending media message");
|
||||
OutgoingMediaMessage reply = new OutgoingMediaMessage(recipients, responseText.toString(), new LinkedList<Attachment>(), System.currentTimeMillis(), subscriptionId, expiresIn, 0);
|
||||
OutgoingMediaMessage reply = new OutgoingMediaMessage(recipient, responseText.toString(), new LinkedList<Attachment>(), System.currentTimeMillis(), subscriptionId, expiresIn, 0);
|
||||
replyThreadId = MessageSender.send(context, masterSecret, reply, threadId, false, null);
|
||||
} else {
|
||||
Log.w("AndroidAutoReplyReceiver", "Sending regular message ");
|
||||
OutgoingTextMessage reply = new OutgoingTextMessage(recipients, responseText.toString(), expiresIn, subscriptionId);
|
||||
OutgoingTextMessage reply = new OutgoingTextMessage(recipient, responseText.toString(), expiresIn, subscriptionId);
|
||||
replyThreadId = MessageSender.send(context, masterSecret, reply, threadId, false, null);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user