mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 13:08:46 +00:00
Add call disposition syncing.
This commit is contained in:
committed by
Greyson Parrelli
parent
d471647e12
commit
06b414f4ef
@@ -600,6 +600,8 @@ public class SignalServiceMessageSender {
|
||||
urgent = message.getRequest().get().isUrgent();
|
||||
} else if (message.getPniIdentity().isPresent()) {
|
||||
content = createPniIdentityContent(message.getPniIdentity().get());
|
||||
} else if (message.getCallEvent().isPresent()) {
|
||||
content = createCallEventContent(message.getCallEvent().get());
|
||||
} else {
|
||||
throw new IOException("Unsupported sync message!");
|
||||
}
|
||||
@@ -1513,14 +1515,21 @@ public class SignalServiceMessageSender {
|
||||
}
|
||||
|
||||
Content.Builder container = Content.newBuilder();
|
||||
SyncMessage.Builder builder = SyncMessage.newBuilder().setRequest(request);
|
||||
SyncMessage.Builder builder = createSyncMessageBuilder().setRequest(request);
|
||||
|
||||
return container.setSyncMessage(builder).build();
|
||||
}
|
||||
|
||||
private Content createPniIdentityContent(SyncMessage.PniIdentity proto) {
|
||||
Content.Builder container = Content.newBuilder();
|
||||
SyncMessage.Builder builder = SyncMessage.newBuilder().setPniIdentity(proto);
|
||||
SyncMessage.Builder builder = createSyncMessageBuilder().setPniIdentity(proto);
|
||||
|
||||
return container.setSyncMessage(builder).build();
|
||||
}
|
||||
|
||||
private Content createCallEventContent(SyncMessage.CallEvent proto) {
|
||||
Content.Builder container = Content.newBuilder();
|
||||
SyncMessage.Builder builder = createSyncMessageBuilder().setCallEvent(proto);
|
||||
|
||||
return container.setSyncMessage(builder).build();
|
||||
}
|
||||
|
||||
@@ -998,6 +998,10 @@ import javax.annotation.Nullable;
|
||||
return SignalServiceSyncMessage.forContacts(new ContactsMessage(createAttachmentPointer(content.getContacts().getBlob()), content.getContacts().getComplete()));
|
||||
}
|
||||
|
||||
if (content.hasCallEvent()) {
|
||||
return SignalServiceSyncMessage.forCallEvent(content.getCallEvent());
|
||||
}
|
||||
|
||||
return SignalServiceSyncMessage.empty();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,12 +8,15 @@ package org.whispersystems.signalservice.api.messages.multidevice;
|
||||
|
||||
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
|
||||
import org.whispersystems.signalservice.internal.push.SignalServiceProtos.SyncMessage.CallEvent;
|
||||
import org.whispersystems.signalservice.internal.push.SignalServiceProtos.SyncMessage.PniIdentity;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class SignalServiceSyncMessage {
|
||||
|
||||
private final Optional<SentTranscriptMessage> sent;
|
||||
@@ -32,23 +35,25 @@ public class SignalServiceSyncMessage {
|
||||
private final Optional<OutgoingPaymentMessage> outgoingPaymentMessage;
|
||||
private final Optional<PniIdentity> pniIdentity;
|
||||
private final Optional<List<ViewedMessage>> views;
|
||||
private final Optional<CallEvent> callEvent;
|
||||
|
||||
private SignalServiceSyncMessage(Optional<SentTranscriptMessage> sent,
|
||||
Optional<ContactsMessage> contacts,
|
||||
Optional<SignalServiceAttachment> groups,
|
||||
Optional<BlockedListMessage> blockedList,
|
||||
Optional<RequestMessage> request,
|
||||
Optional<List<ReadMessage>> reads,
|
||||
Optional<ViewOnceOpenMessage> viewOnceOpen,
|
||||
Optional<VerifiedMessage> verified,
|
||||
Optional<ConfigurationMessage> configuration,
|
||||
private SignalServiceSyncMessage(Optional<SentTranscriptMessage> sent,
|
||||
Optional<ContactsMessage> contacts,
|
||||
Optional<SignalServiceAttachment> groups,
|
||||
Optional<BlockedListMessage> blockedList,
|
||||
Optional<RequestMessage> request,
|
||||
Optional<List<ReadMessage>> reads,
|
||||
Optional<ViewOnceOpenMessage> viewOnceOpen,
|
||||
Optional<VerifiedMessage> verified,
|
||||
Optional<ConfigurationMessage> configuration,
|
||||
Optional<List<StickerPackOperationMessage>> stickerPackOperations,
|
||||
Optional<FetchType> fetchType,
|
||||
Optional<KeysMessage> keys,
|
||||
Optional<MessageRequestResponseMessage> messageRequestResponse,
|
||||
Optional<OutgoingPaymentMessage> outgoingPaymentMessage,
|
||||
Optional<List<ViewedMessage>> views,
|
||||
Optional<PniIdentity> pniIdentity)
|
||||
Optional<FetchType> fetchType,
|
||||
Optional<KeysMessage> keys,
|
||||
Optional<MessageRequestResponseMessage> messageRequestResponse,
|
||||
Optional<OutgoingPaymentMessage> outgoingPaymentMessage,
|
||||
Optional<List<ViewedMessage>> views,
|
||||
Optional<PniIdentity> pniIdentity,
|
||||
Optional<CallEvent> callEvent)
|
||||
{
|
||||
this.sent = sent;
|
||||
this.contacts = contacts;
|
||||
@@ -66,6 +71,7 @@ public class SignalServiceSyncMessage {
|
||||
this.outgoingPaymentMessage = outgoingPaymentMessage;
|
||||
this.views = views;
|
||||
this.pniIdentity = pniIdentity;
|
||||
this.callEvent = callEvent;
|
||||
}
|
||||
|
||||
public static SignalServiceSyncMessage forSentTranscript(SentTranscriptMessage sent) {
|
||||
@@ -84,6 +90,7 @@ public class SignalServiceSyncMessage {
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty());
|
||||
}
|
||||
|
||||
@@ -103,6 +110,7 @@ public class SignalServiceSyncMessage {
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty());
|
||||
}
|
||||
|
||||
@@ -122,6 +130,7 @@ public class SignalServiceSyncMessage {
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty());
|
||||
}
|
||||
|
||||
@@ -141,6 +150,7 @@ public class SignalServiceSyncMessage {
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty());
|
||||
}
|
||||
|
||||
@@ -160,6 +170,7 @@ public class SignalServiceSyncMessage {
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty());
|
||||
}
|
||||
|
||||
@@ -179,6 +190,7 @@ public class SignalServiceSyncMessage {
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.of(views),
|
||||
Optional.empty(),
|
||||
Optional.empty());
|
||||
}
|
||||
|
||||
@@ -198,6 +210,7 @@ public class SignalServiceSyncMessage {
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty());
|
||||
}
|
||||
|
||||
@@ -220,6 +233,7 @@ public class SignalServiceSyncMessage {
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty());
|
||||
}
|
||||
|
||||
@@ -239,6 +253,7 @@ public class SignalServiceSyncMessage {
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty());
|
||||
}
|
||||
|
||||
@@ -258,6 +273,7 @@ public class SignalServiceSyncMessage {
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty());
|
||||
}
|
||||
|
||||
@@ -277,6 +293,7 @@ public class SignalServiceSyncMessage {
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty());
|
||||
}
|
||||
|
||||
@@ -296,6 +313,7 @@ public class SignalServiceSyncMessage {
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty());
|
||||
}
|
||||
|
||||
@@ -315,6 +333,7 @@ public class SignalServiceSyncMessage {
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty());
|
||||
}
|
||||
|
||||
@@ -334,6 +353,7 @@ public class SignalServiceSyncMessage {
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty());
|
||||
}
|
||||
|
||||
@@ -353,6 +373,7 @@ public class SignalServiceSyncMessage {
|
||||
Optional.of(messageRequestResponse),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty());
|
||||
}
|
||||
|
||||
@@ -372,6 +393,7 @@ public class SignalServiceSyncMessage {
|
||||
Optional.empty(),
|
||||
Optional.of(outgoingPaymentMessage),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty());
|
||||
}
|
||||
|
||||
@@ -391,7 +413,28 @@ public class SignalServiceSyncMessage {
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.of(pniIdentity));
|
||||
Optional.of(pniIdentity),
|
||||
Optional.empty());
|
||||
}
|
||||
|
||||
public static SignalServiceSyncMessage forCallEvent(@Nonnull CallEvent callEvent) {
|
||||
return new SignalServiceSyncMessage(Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.of(callEvent));
|
||||
}
|
||||
|
||||
public static SignalServiceSyncMessage empty() {
|
||||
@@ -410,6 +453,7 @@ public class SignalServiceSyncMessage {
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty());
|
||||
}
|
||||
|
||||
@@ -477,6 +521,10 @@ public class SignalServiceSyncMessage {
|
||||
return pniIdentity;
|
||||
}
|
||||
|
||||
public Optional<CallEvent> getCallEvent() {
|
||||
return callEvent;
|
||||
}
|
||||
|
||||
public enum FetchType {
|
||||
LOCAL_PROFILE,
|
||||
STORAGE_MANIFEST,
|
||||
|
||||
@@ -590,6 +590,33 @@ message SyncMessage {
|
||||
optional uint32 registrationId = 3;
|
||||
}
|
||||
|
||||
message CallEvent {
|
||||
enum Type {
|
||||
UNKNOWN_TYPE = 0;
|
||||
AUDIO_CALL = 1;
|
||||
VIDEO_CALL = 2;
|
||||
}
|
||||
|
||||
enum Direction {
|
||||
UNKNOWN_DIRECTION = 0;
|
||||
INCOMING = 1;
|
||||
OUTGOING = 2;
|
||||
}
|
||||
|
||||
enum Event {
|
||||
UNKNOWN_ACTION = 0;
|
||||
ACCEPTED = 1;
|
||||
NOT_ACCEPTED = 2;
|
||||
}
|
||||
|
||||
optional bytes peerUuid = 1;
|
||||
optional uint64 id = 2;
|
||||
optional uint64 timestamp = 3;
|
||||
optional Type type = 4;
|
||||
optional Direction direction = 5;
|
||||
optional Event event = 6;
|
||||
}
|
||||
|
||||
optional Sent sent = 1;
|
||||
optional Contacts contacts = 2;
|
||||
optional Groups groups = 3;
|
||||
@@ -608,6 +635,7 @@ message SyncMessage {
|
||||
repeated Viewed viewed = 16;
|
||||
optional PniIdentity pniIdentity = 17;
|
||||
optional PniChangeNumber pniChangeNumber = 18;
|
||||
optional CallEvent callEvent = 19;
|
||||
}
|
||||
|
||||
message AttachmentPointer {
|
||||
|
||||
Reference in New Issue
Block a user