From f36373e3ca858fbdf47645ccc92eaf3ed2599f12 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Wed, 20 Feb 2019 09:11:29 -0500 Subject: [PATCH] Add 'sent update' transcripts to proto schema. --- SignalServiceKit/protobuf/SignalService.proto | 29 +- .../src/Protos/Generated/SSKProto.swift | 252 ++++++++++++++++++ .../Protos/Generated/SignalService.pb.swift | 157 +++++++++++ 3 files changed, 429 insertions(+), 9 deletions(-) diff --git a/SignalServiceKit/protobuf/SignalService.proto b/SignalServiceKit/protobuf/SignalService.proto index bbca43987..ccbaae55f 100644 --- a/SignalServiceKit/protobuf/SignalService.proto +++ b/SignalServiceKit/protobuf/SignalService.proto @@ -267,6 +267,16 @@ message SyncMessage { repeated UnidentifiedDeliveryStatus unidentifiedStatus = 5; } + message SentUpdate { + message UnidentifiedDeliveryStatus { + optional string destination = 1; + optional bool unidentified = 2; + } + optional string destination = 1; + optional uint64 timestamp = 2; + repeated UnidentifiedDeliveryStatus unidentifiedStatus = 3; + } + message Contacts { // @required optional AttachmentPointer blob = 1; @@ -310,15 +320,16 @@ message SyncMessage { optional bool linkPreviews = 4; } - optional Sent sent = 1; - optional Contacts contacts = 2; - optional Groups groups = 3; - optional Request request = 4; - repeated Read read = 5; - optional Blocked blocked = 6; - optional Verified verified = 7; - optional Configuration configuration = 9; - optional bytes padding = 8; + optional Sent sent = 1; + optional SentUpdate sentUpdate = 10; + optional Contacts contacts = 2; + optional Groups groups = 3; + optional Request request = 4; + repeated Read read = 5; + optional Blocked blocked = 6; + optional Verified verified = 7; + optional Configuration configuration = 9; + optional bytes padding = 8; } message AttachmentPointer { diff --git a/SignalServiceKit/src/Protos/Generated/SSKProto.swift b/SignalServiceKit/src/Protos/Generated/SSKProto.swift index e4002e51c..02395d413 100644 --- a/SignalServiceKit/src/Protos/Generated/SSKProto.swift +++ b/SignalServiceKit/src/Protos/Generated/SSKProto.swift @@ -3734,6 +3734,241 @@ extension SSKProtoSyncMessageSent.SSKProtoSyncMessageSentBuilder { #endif +// MARK: - SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatus + +@objc public class SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatus: NSObject { + + // MARK: - SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatusBuilder + + @objc public class func builder() -> SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatusBuilder { + return SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatusBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatusBuilder { + let builder = SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatusBuilder() + if let _value = destination { + builder.setDestination(_value) + } + if hasUnidentified { + builder.setUnidentified(unidentified) + } + return builder + } + + @objc public class SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatusBuilder: NSObject { + + private var proto = SignalServiceProtos_SyncMessage.SentUpdate.UnidentifiedDeliveryStatus() + + @objc fileprivate override init() {} + + @objc public func setDestination(_ valueParam: String) { + proto.destination = valueParam + } + + @objc public func setUnidentified(_ valueParam: Bool) { + proto.unidentified = valueParam + } + + @objc public func build() throws -> SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatus { + return try SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatus.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatus.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SignalServiceProtos_SyncMessage.SentUpdate.UnidentifiedDeliveryStatus + + @objc public var destination: String? { + guard proto.hasDestination else { + return nil + } + return proto.destination + } + @objc public var hasDestination: Bool { + return proto.hasDestination + } + + @objc public var unidentified: Bool { + return proto.unidentified + } + @objc public var hasUnidentified: Bool { + return proto.hasUnidentified + } + + private init(proto: SignalServiceProtos_SyncMessage.SentUpdate.UnidentifiedDeliveryStatus) { + self.proto = proto + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatus { + let proto = try SignalServiceProtos_SyncMessage.SentUpdate.UnidentifiedDeliveryStatus(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SignalServiceProtos_SyncMessage.SentUpdate.UnidentifiedDeliveryStatus) throws -> SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatus { + // MARK: - Begin Validation Logic for SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatus - + + // MARK: - End Validation Logic for SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatus - + + let result = SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatus(proto: proto) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatus { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatus.SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatusBuilder { + @objc public func buildIgnoringErrors() -> SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatus? { + return try! self.build() + } +} + +#endif + +// MARK: - SSKProtoSyncMessageSentUpdate + +@objc public class SSKProtoSyncMessageSentUpdate: NSObject { + + // MARK: - SSKProtoSyncMessageSentUpdateBuilder + + @objc public class func builder() -> SSKProtoSyncMessageSentUpdateBuilder { + return SSKProtoSyncMessageSentUpdateBuilder() + } + + // asBuilder() constructs a builder that reflects the proto's contents. + @objc public func asBuilder() -> SSKProtoSyncMessageSentUpdateBuilder { + let builder = SSKProtoSyncMessageSentUpdateBuilder() + if let _value = destination { + builder.setDestination(_value) + } + if hasTimestamp { + builder.setTimestamp(timestamp) + } + builder.setUnidentifiedStatus(unidentifiedStatus) + return builder + } + + @objc public class SSKProtoSyncMessageSentUpdateBuilder: NSObject { + + private var proto = SignalServiceProtos_SyncMessage.SentUpdate() + + @objc fileprivate override init() {} + + @objc public func setDestination(_ valueParam: String) { + proto.destination = valueParam + } + + @objc public func setTimestamp(_ valueParam: UInt64) { + proto.timestamp = valueParam + } + + @objc public func addUnidentifiedStatus(_ valueParam: SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatus) { + var items = proto.unidentifiedStatus + items.append(valueParam.proto) + proto.unidentifiedStatus = items + } + + @objc public func setUnidentifiedStatus(_ wrappedItems: [SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatus]) { + proto.unidentifiedStatus = wrappedItems.map { $0.proto } + } + + @objc public func build() throws -> SSKProtoSyncMessageSentUpdate { + return try SSKProtoSyncMessageSentUpdate.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoSyncMessageSentUpdate.parseProto(proto).serializedData() + } + } + + fileprivate let proto: SignalServiceProtos_SyncMessage.SentUpdate + + @objc public let unidentifiedStatus: [SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatus] + + @objc public var destination: String? { + guard proto.hasDestination else { + return nil + } + return proto.destination + } + @objc public var hasDestination: Bool { + return proto.hasDestination + } + + @objc public var timestamp: UInt64 { + return proto.timestamp + } + @objc public var hasTimestamp: Bool { + return proto.hasTimestamp + } + + private init(proto: SignalServiceProtos_SyncMessage.SentUpdate, + unidentifiedStatus: [SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatus]) { + self.proto = proto + self.unidentifiedStatus = unidentifiedStatus + } + + @objc + public func serializedData() throws -> Data { + return try self.proto.serializedData() + } + + @objc public class func parseData(_ serializedData: Data) throws -> SSKProtoSyncMessageSentUpdate { + let proto = try SignalServiceProtos_SyncMessage.SentUpdate(serializedData: serializedData) + return try parseProto(proto) + } + + fileprivate class func parseProto(_ proto: SignalServiceProtos_SyncMessage.SentUpdate) throws -> SSKProtoSyncMessageSentUpdate { + var unidentifiedStatus: [SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatus] = [] + unidentifiedStatus = try proto.unidentifiedStatus.map { try SSKProtoSyncMessageSentUpdateUnidentifiedDeliveryStatus.parseProto($0) } + + // MARK: - Begin Validation Logic for SSKProtoSyncMessageSentUpdate - + + // MARK: - End Validation Logic for SSKProtoSyncMessageSentUpdate - + + let result = SSKProtoSyncMessageSentUpdate(proto: proto, + unidentifiedStatus: unidentifiedStatus) + return result + } + + @objc public override var debugDescription: String { + return "\(proto)" + } +} + +#if DEBUG + +extension SSKProtoSyncMessageSentUpdate { + @objc public func serializedDataIgnoringErrors() -> Data? { + return try! self.serializedData() + } +} + +extension SSKProtoSyncMessageSentUpdate.SSKProtoSyncMessageSentUpdateBuilder { + @objc public func buildIgnoringErrors() -> SSKProtoSyncMessageSentUpdate? { + return try! self.build() + } +} + +#endif + // MARK: - SSKProtoSyncMessageContacts @objc public class SSKProtoSyncMessageContacts: NSObject { @@ -4434,6 +4669,9 @@ extension SSKProtoSyncMessageConfiguration.SSKProtoSyncMessageConfigurationBuild if let _value = sent { builder.setSent(_value) } + if let _value = sentUpdate { + builder.setSentUpdate(_value) + } if let _value = contacts { builder.setContacts(_value) } @@ -4469,6 +4707,10 @@ extension SSKProtoSyncMessageConfiguration.SSKProtoSyncMessageConfigurationBuild proto.sent = valueParam.proto } + @objc public func setSentUpdate(_ valueParam: SSKProtoSyncMessageSentUpdate) { + proto.sentUpdate = valueParam.proto + } + @objc public func setContacts(_ valueParam: SSKProtoSyncMessageContacts) { proto.contacts = valueParam.proto } @@ -4520,6 +4762,8 @@ extension SSKProtoSyncMessageConfiguration.SSKProtoSyncMessageConfigurationBuild @objc public let sent: SSKProtoSyncMessageSent? + @objc public let sentUpdate: SSKProtoSyncMessageSentUpdate? + @objc public let contacts: SSKProtoSyncMessageContacts? @objc public let groups: SSKProtoSyncMessageGroups? @@ -4546,6 +4790,7 @@ extension SSKProtoSyncMessageConfiguration.SSKProtoSyncMessageConfigurationBuild private init(proto: SignalServiceProtos_SyncMessage, sent: SSKProtoSyncMessageSent?, + sentUpdate: SSKProtoSyncMessageSentUpdate?, contacts: SSKProtoSyncMessageContacts?, groups: SSKProtoSyncMessageGroups?, request: SSKProtoSyncMessageRequest?, @@ -4555,6 +4800,7 @@ extension SSKProtoSyncMessageConfiguration.SSKProtoSyncMessageConfigurationBuild configuration: SSKProtoSyncMessageConfiguration?) { self.proto = proto self.sent = sent + self.sentUpdate = sentUpdate self.contacts = contacts self.groups = groups self.request = request @@ -4580,6 +4826,11 @@ extension SSKProtoSyncMessageConfiguration.SSKProtoSyncMessageConfigurationBuild sent = try SSKProtoSyncMessageSent.parseProto(proto.sent) } + var sentUpdate: SSKProtoSyncMessageSentUpdate? = nil + if proto.hasSentUpdate { + sentUpdate = try SSKProtoSyncMessageSentUpdate.parseProto(proto.sentUpdate) + } + var contacts: SSKProtoSyncMessageContacts? = nil if proto.hasContacts { contacts = try SSKProtoSyncMessageContacts.parseProto(proto.contacts) @@ -4619,6 +4870,7 @@ extension SSKProtoSyncMessageConfiguration.SSKProtoSyncMessageConfigurationBuild let result = SSKProtoSyncMessage(proto: proto, sent: sent, + sentUpdate: sentUpdate, contacts: contacts, groups: groups, request: request, diff --git a/SignalServiceKit/src/Protos/Generated/SignalService.pb.swift b/SignalServiceKit/src/Protos/Generated/SignalService.pb.swift index caa6a045b..eda7d1520 100644 --- a/SignalServiceKit/src/Protos/Generated/SignalService.pb.swift +++ b/SignalServiceKit/src/Protos/Generated/SignalService.pb.swift @@ -1452,6 +1452,15 @@ struct SignalServiceProtos_SyncMessage { /// Clears the value of `sent`. Subsequent reads from it will return its default value. mutating func clearSent() {_uniqueStorage()._sent = nil} + var sentUpdate: SignalServiceProtos_SyncMessage.SentUpdate { + get {return _storage._sentUpdate ?? SignalServiceProtos_SyncMessage.SentUpdate()} + set {_uniqueStorage()._sentUpdate = newValue} + } + /// Returns true if `sentUpdate` has been explicitly set. + var hasSentUpdate: Bool {return _storage._sentUpdate != nil} + /// Clears the value of `sentUpdate`. Subsequent reads from it will return its default value. + mutating func clearSentUpdate() {_uniqueStorage()._sentUpdate = nil} + var contacts: SignalServiceProtos_SyncMessage.Contacts { get {return _storage._contacts ?? SignalServiceProtos_SyncMessage.Contacts()} set {_uniqueStorage()._contacts = newValue} @@ -1606,6 +1615,70 @@ struct SignalServiceProtos_SyncMessage { fileprivate var _storage = _StorageClass.defaultInstance } + struct SentUpdate { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var destination: String { + get {return _destination ?? String()} + set {_destination = newValue} + } + /// Returns true if `destination` has been explicitly set. + var hasDestination: Bool {return self._destination != nil} + /// Clears the value of `destination`. Subsequent reads from it will return its default value. + mutating func clearDestination() {self._destination = nil} + + var timestamp: UInt64 { + get {return _timestamp ?? 0} + set {_timestamp = newValue} + } + /// Returns true if `timestamp` has been explicitly set. + var hasTimestamp: Bool {return self._timestamp != nil} + /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. + mutating func clearTimestamp() {self._timestamp = nil} + + var unidentifiedStatus: [SignalServiceProtos_SyncMessage.SentUpdate.UnidentifiedDeliveryStatus] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + struct UnidentifiedDeliveryStatus { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var destination: String { + get {return _destination ?? String()} + set {_destination = newValue} + } + /// Returns true if `destination` has been explicitly set. + var hasDestination: Bool {return self._destination != nil} + /// Clears the value of `destination`. Subsequent reads from it will return its default value. + mutating func clearDestination() {self._destination = nil} + + var unidentified: Bool { + get {return _unidentified ?? false} + set {_unidentified = newValue} + } + /// Returns true if `unidentified` has been explicitly set. + var hasUnidentified: Bool {return self._unidentified != nil} + /// Clears the value of `unidentified`. Subsequent reads from it will return its default value. + mutating func clearUnidentified() {self._unidentified = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _destination: String? = nil + fileprivate var _unidentified: Bool? = nil + } + + init() {} + + fileprivate var _destination: String? = nil + fileprivate var _timestamp: UInt64? = nil + } + struct Contacts { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for @@ -3715,6 +3788,7 @@ extension SignalServiceProtos_SyncMessage: SwiftProtobuf.Message, SwiftProtobuf. static let protoMessageName: String = _protobuf_package + ".SyncMessage" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "sent"), + 10: .same(proto: "sentUpdate"), 2: .same(proto: "contacts"), 3: .same(proto: "groups"), 4: .same(proto: "request"), @@ -3727,6 +3801,7 @@ extension SignalServiceProtos_SyncMessage: SwiftProtobuf.Message, SwiftProtobuf. fileprivate class _StorageClass { var _sent: SignalServiceProtos_SyncMessage.Sent? = nil + var _sentUpdate: SignalServiceProtos_SyncMessage.SentUpdate? = nil var _contacts: SignalServiceProtos_SyncMessage.Contacts? = nil var _groups: SignalServiceProtos_SyncMessage.Groups? = nil var _request: SignalServiceProtos_SyncMessage.Request? = nil @@ -3742,6 +3817,7 @@ extension SignalServiceProtos_SyncMessage: SwiftProtobuf.Message, SwiftProtobuf. init(copying source: _StorageClass) { _sent = source._sent + _sentUpdate = source._sentUpdate _contacts = source._contacts _groups = source._groups _request = source._request @@ -3774,6 +3850,7 @@ extension SignalServiceProtos_SyncMessage: SwiftProtobuf.Message, SwiftProtobuf. case 7: try decoder.decodeSingularMessageField(value: &_storage._verified) case 8: try decoder.decodeSingularBytesField(value: &_storage._padding) case 9: try decoder.decodeSingularMessageField(value: &_storage._configuration) + case 10: try decoder.decodeSingularMessageField(value: &_storage._sentUpdate) default: break } } @@ -3809,6 +3886,9 @@ extension SignalServiceProtos_SyncMessage: SwiftProtobuf.Message, SwiftProtobuf. if let v = _storage._configuration { try visitor.visitSingularMessageField(value: v, fieldNumber: 9) } + if let v = _storage._sentUpdate { + try visitor.visitSingularMessageField(value: v, fieldNumber: 10) + } } try unknownFields.traverse(visitor: &visitor) } @@ -3819,6 +3899,7 @@ extension SignalServiceProtos_SyncMessage: SwiftProtobuf.Message, SwiftProtobuf. let _storage = _args.0 let rhs_storage = _args.1 if _storage._sent != rhs_storage._sent {return false} + if _storage._sentUpdate != rhs_storage._sentUpdate {return false} if _storage._contacts != rhs_storage._contacts {return false} if _storage._groups != rhs_storage._groups {return false} if _storage._request != rhs_storage._request {return false} @@ -3964,6 +4045,82 @@ extension SignalServiceProtos_SyncMessage.Sent.UnidentifiedDeliveryStatus: Swift } } +extension SignalServiceProtos_SyncMessage.SentUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_SyncMessage.protoMessageName + ".SentUpdate" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "destination"), + 2: .same(proto: "timestamp"), + 3: .same(proto: "unidentifiedStatus"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._destination) + case 2: try decoder.decodeSingularUInt64Field(value: &self._timestamp) + case 3: try decoder.decodeRepeatedMessageField(value: &self.unidentifiedStatus) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._destination { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._timestamp { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 2) + } + if !self.unidentifiedStatus.isEmpty { + try visitor.visitRepeatedMessageField(value: self.unidentifiedStatus, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SignalServiceProtos_SyncMessage.SentUpdate, rhs: SignalServiceProtos_SyncMessage.SentUpdate) -> Bool { + if lhs._destination != rhs._destination {return false} + if lhs._timestamp != rhs._timestamp {return false} + if lhs.unidentifiedStatus != rhs.unidentifiedStatus {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension SignalServiceProtos_SyncMessage.SentUpdate.UnidentifiedDeliveryStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_SyncMessage.SentUpdate.protoMessageName + ".UnidentifiedDeliveryStatus" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "destination"), + 2: .same(proto: "unidentified"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._destination) + case 2: try decoder.decodeSingularBoolField(value: &self._unidentified) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._destination { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._unidentified { + try visitor.visitSingularBoolField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SignalServiceProtos_SyncMessage.SentUpdate.UnidentifiedDeliveryStatus, rhs: SignalServiceProtos_SyncMessage.SentUpdate.UnidentifiedDeliveryStatus) -> Bool { + if lhs._destination != rhs._destination {return false} + if lhs._unidentified != rhs._unidentified {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + extension SignalServiceProtos_SyncMessage.Contacts: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = SignalServiceProtos_SyncMessage.protoMessageName + ".Contacts" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [