Fix story sync message behaviour between iOS and Android.

This commit is contained in:
Alex Hart
2022-11-30 16:34:59 -04:00
committed by Cody Henthorne
parent e5d196c642
commit 7945b3c971
6 changed files with 30 additions and 39 deletions

View File

@@ -278,6 +278,11 @@ public class SignalServiceMessageSender {
Set<SignalServiceStoryMessageRecipient> manifest)
throws IOException, UntrustedIdentityException
{
if (manifest.isEmpty()) {
Log.w(TAG, "Refusing to send sync message for empty manifest.");
return;
}
SignalServiceSyncMessage syncMessage = createSelfSendSyncMessageForStory(message, timestamp, isRecipientUpdate, manifest);
sendSyncMessage(syncMessage, Optional.empty());
}
@@ -300,8 +305,7 @@ public class SignalServiceMessageSender {
List<SendMessageResult> sendMessageResults = sendGroupMessage(distributionId, recipients, unidentifiedAccess, timestamp, content, ContentHint.IMPLICIT, groupId, false, SenderKeyGroupEvents.EMPTY, false, true);
if (aciStore.isMultiDevice()) {
SignalServiceSyncMessage syncMessage = createSelfSendSyncMessageForStory(message, timestamp, isRecipientUpdate, manifest);
sendSyncMessage(syncMessage, Optional.empty());
sendStorySyncMessage(message, timestamp, isRecipientUpdate, manifest);
}
return sendMessageResults;

View File

@@ -763,8 +763,10 @@ public final class SignalServiceContent {
if (!address.isPresent() &&
!dataMessage.flatMap(SignalServiceDataMessage::getGroupContext).isPresent() &&
!storyMessage.flatMap(SignalServiceStoryMessage::getGroupContext).isPresent()) {
throw new InvalidMessageStructureException("SyncMessage missing both destination and group ID!");
!storyMessage.flatMap(SignalServiceStoryMessage::getGroupContext).isPresent() &&
recipientManifest.isEmpty())
{
throw new InvalidMessageStructureException("SyncMessage missing destination, group ID, and recipient manifest!");
}
for (SignalServiceProtos.SyncMessage.Sent.UnidentifiedDeliveryStatus status : sentContent.getUnidentifiedStatusList()) {