kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix sending group stories when you're the only group member.
rodzic
b78f06f064
commit
14e8f5cf98
|
@ -484,6 +484,7 @@ public final class GroupSendUtil {
|
||||||
@Nullable CancelationSignal cancelationSignal)
|
@Nullable CancelationSignal cancelationSignal)
|
||||||
throws IOException, UntrustedIdentityException
|
throws IOException, UntrustedIdentityException
|
||||||
{
|
{
|
||||||
|
// PniSignatures are only needed for 1:1 messages, but some message jobs use the GroupSendUtil methods to send 1:1
|
||||||
if (targets.size() == 1 && relatedMessageId == null) {
|
if (targets.size() == 1 && relatedMessageId == null) {
|
||||||
Recipient targetRecipient = targetRecipients.get(0);
|
Recipient targetRecipient = targetRecipients.get(0);
|
||||||
SendMessageResult result = messageSender.sendDataMessage(targets.get(0), access.get(0), contentHint, message, SignalServiceMessageSender.IndividualSendEvents.EMPTY, urgent, targetRecipient.needsPniSignature());
|
SendMessageResult result = messageSender.sendDataMessage(targets.get(0), access.get(0), contentHint, message, SignalServiceMessageSender.IndividualSendEvents.EMPTY, urgent, targetRecipient.needsPniSignature());
|
||||||
|
@ -689,8 +690,15 @@ public final class GroupSendUtil {
|
||||||
@Nullable CancelationSignal cancelationSignal)
|
@Nullable CancelationSignal cancelationSignal)
|
||||||
throws IOException, UntrustedIdentityException
|
throws IOException, UntrustedIdentityException
|
||||||
{
|
{
|
||||||
|
// We only allow legacy sends if you're sending to an empty group and just need to send a sync message.
|
||||||
|
if (targets.isEmpty()) {
|
||||||
|
Log.w(TAG, "Only sending a sync message.");
|
||||||
|
messageSender.sendStorySyncMessage(message, getSentTimestamp(), isRecipientUpdate, manifest);
|
||||||
|
return Collections.emptyList();
|
||||||
|
} else {
|
||||||
throw new UnsupportedOperationException("Stories can only be send via sender key!");
|
throw new UnsupportedOperationException("Stories can only be send via sender key!");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull ContentHint getContentHint() {
|
public @NonNull ContentHint getContentHint() {
|
||||||
|
|
|
@ -268,6 +268,20 @@ public class SignalServiceMessageSender {
|
||||||
sendGroupMessage(distributionId, recipients, unidentifiedAccess, message.getTimestamp(), content, ContentHint.IMPLICIT, message.getGroupId(), true, SenderKeyGroupEvents.EMPTY, false, false);
|
sendGroupMessage(distributionId, recipients, unidentifiedAccess, message.getTimestamp(), content, ContentHint.IMPLICIT, message.getGroupId(), true, SenderKeyGroupEvents.EMPTY, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only sends sync message for a story. Useful if you're sending to a group with no one else in it -- meaning you don't need to send a story, but you do need
|
||||||
|
* to send it to your linked devices.
|
||||||
|
*/
|
||||||
|
public void sendStorySyncMessage(SignalServiceStoryMessage message,
|
||||||
|
long timestamp,
|
||||||
|
boolean isRecipientUpdate,
|
||||||
|
Set<SignalServiceStoryMessageRecipient> manifest)
|
||||||
|
throws IOException, UntrustedIdentityException
|
||||||
|
{
|
||||||
|
SignalServiceSyncMessage syncMessage = createSelfSendSyncMessageForStory(message, timestamp, isRecipientUpdate, manifest);
|
||||||
|
sendSyncMessage(syncMessage, Optional.empty());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a story using sender key. Note: This is not just for group stories -- it's for any story. Just following the naming convention of making sender key
|
* Send a story using sender key. Note: This is not just for group stories -- it's for any story. Just following the naming convention of making sender key
|
||||||
* method named "sendGroup*"
|
* method named "sendGroup*"
|
||||||
|
|
Ładowanie…
Reference in New Issue