diff --git a/Scripts/ProtoWrappers.py b/Scripts/ProtoWrappers.py index 60a8331fd..1ccfcadfe 100755 --- a/Scripts/ProtoWrappers.py +++ b/Scripts/ProtoWrappers.py @@ -724,9 +724,15 @@ public func serializedData() throws -> Data { # build() func writer.add('@objc public func build() throws -> %s {' % self.swift_name) writer.push_indent() - writer.add('let wrapper = try %s.parseProto(proto)' % self.swift_name) - writer.add('return wrapper') - + writer.add('return try %s.parseProto(proto)' % self.swift_name) + writer.pop_indent() + writer.add('}') + writer.newline() + + # build() func + writer.add('@objc public func buildSerializedData() throws -> Data {') + writer.push_indent() + writer.add('return try %s.parseProto(proto).serializedData()' % self.swift_name) writer.pop_indent() writer.add('}') writer.newline() diff --git a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m index 3dceb970f..8fa6058dd 100644 --- a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m +++ b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m @@ -3900,13 +3900,7 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac envelopeBuilder.timestamp = timestamp; envelopeBuilder.content = content; NSError *error; - SSKProtoEnvelope *_Nullable envelope = [envelopeBuilder buildAndReturnError:&error]; - if (error || !envelope) { - OWSFail(@"%@ Could not construct envelope: %@.", self.logTag, error); - return; - } - - NSData *_Nullable envelopeData = [envelope serializedDataAndReturnError:&error]; + NSData *_Nullable envelopeData = [envelopeBuilder buildSerializedDataAndReturnError:&error]; if (error || !envelopeData) { OWSFail(@"%@ Could not serialize envelope: %@.", self.logTag, error); return; diff --git a/SignalServiceKit/src/Devices/OWSContactsOutputStream.m b/SignalServiceKit/src/Devices/OWSContactsOutputStream.m index 8e03faad6..de69dc79d 100644 --- a/SignalServiceKit/src/Devices/OWSContactsOutputStream.m +++ b/SignalServiceKit/src/Devices/OWSContactsOutputStream.m @@ -89,12 +89,7 @@ disappearingMessagesConfiguration:(nullable OWSDisappearingMessagesConfiguration } NSError *error; - SSKProtoContactDetails *_Nullable contactProto = [contactBuilder buildAndReturnError:&error]; - if (error || !contactProto) { - OWSFail(@"%@ could not build protobuf: %@", self.logTag, error); - return; - } - NSData *_Nullable contactData = [contactProto serializedDataAndReturnError:&error]; + NSData *_Nullable contactData = [contactBuilder buildSerializedDataAndReturnError:&error]; if (error || !contactData) { OWSFail(@"%@ could not serialize protobuf: %@", self.logTag, error); return; diff --git a/SignalServiceKit/src/Devices/OWSGroupsOutputStream.m b/SignalServiceKit/src/Devices/OWSGroupsOutputStream.m index d02502044..5de134fd9 100644 --- a/SignalServiceKit/src/Devices/OWSGroupsOutputStream.m +++ b/SignalServiceKit/src/Devices/OWSGroupsOutputStream.m @@ -61,12 +61,7 @@ NS_ASSUME_NONNULL_BEGIN } NSError *error; - SSKProtoGroupDetails *_Nullable groupProto = [groupBuilder buildAndReturnError:&error]; - if (error || !groupProto) { - OWSFail(@"%@ could not build protobuf: %@", self.logTag, error); - return; - } - NSData *_Nullable groupData = [groupProto serializedDataAndReturnError:&error]; + NSData *_Nullable groupData = [groupBuilder buildSerializedDataAndReturnError:&error]; if (error || !groupData) { OWSFail(@"%@ could not serialize protobuf: %@", self.logTag, error); return; diff --git a/SignalServiceKit/src/Devices/OWSReadReceiptsForSenderMessage.m b/SignalServiceKit/src/Devices/OWSReadReceiptsForSenderMessage.m index 980bc5583..8e06e1c87 100644 --- a/SignalServiceKit/src/Devices/OWSReadReceiptsForSenderMessage.m +++ b/SignalServiceKit/src/Devices/OWSReadReceiptsForSenderMessage.m @@ -68,12 +68,7 @@ NS_ASSUME_NONNULL_BEGIN [contentBuilder setReceiptMessage:receiptMessage]; NSError *error; - SSKProtoContent *_Nullable contentProto = [contentBuilder buildAndReturnError:&error]; - if (error || !contentProto) { - OWSFail(@"%@ could not build protobuf: %@", self.logTag, error); - return nil; - } - NSData *_Nullable contentData = [contentProto serializedDataAndReturnError:&error]; + NSData *_Nullable contentData = [contentBuilder buildSerializedDataAndReturnError:&error]; if (error || !contentData) { OWSFail(@"%@ could not serialize protobuf: %@", self.logTag, error); return nil; diff --git a/SignalServiceKit/src/Messages/DeviceSyncing/OWSOutgoingSyncMessage.m b/SignalServiceKit/src/Messages/DeviceSyncing/OWSOutgoingSyncMessage.m index d973b2299..d2a1d62f8 100644 --- a/SignalServiceKit/src/Messages/DeviceSyncing/OWSOutgoingSyncMessage.m +++ b/SignalServiceKit/src/Messages/DeviceSyncing/OWSOutgoingSyncMessage.m @@ -86,13 +86,7 @@ NS_ASSUME_NONNULL_BEGIN [contentBuilder setSyncMessage:syncMessage]; NSError *error; - SSKProtoContent *_Nullable contentProto = [contentBuilder buildAndReturnError:&error]; - if (error || !contentProto) { - OWSFail(@"%@ could not build protobuf: %@", self.logTag, error); - return nil; - } - - NSData *_Nullable data = [contentProto serializedDataAndReturnError:&error]; + NSData *_Nullable data = [contentBuilder buildSerializedDataAndReturnError:&error]; if (error || !data) { OWSFail(@"%@ could not serialize protobuf: %@", self.logTag, error); return nil; diff --git a/SignalServiceKit/src/Messages/Interactions/OWSContact.m b/SignalServiceKit/src/Messages/Interactions/OWSContact.m index e7b89d9a5..17db83139 100644 --- a/SignalServiceKit/src/Messages/Interactions/OWSContact.m +++ b/SignalServiceKit/src/Messages/Interactions/OWSContact.m @@ -800,10 +800,10 @@ NSString *NSStringForContactAddressType(OWSContactAddressType value) NSError *error; SSKProtoDataMessageContactName *_Nullable nameProto = [nameBuilder buildAndReturnError:&error]; if (error || !nameProto) { - OWSFail(@"%@ could not build protobuf: %@", self.logTag, error); - return nil; + DDLogError(@"%@ could not build protobuf: %@", self.logTag, error); + } else { + [contactBuilder setName:nameProto]; } - [contactBuilder setName:nameProto]; for (OWSContactPhoneNumber *phoneNumber in contact.phoneNumbers) { SSKProtoDataMessageContactPhoneBuilder *phoneBuilder = @@ -828,10 +828,10 @@ NSString *NSStringForContactAddressType(OWSContactAddressType value) } SSKProtoDataMessageContactPhone *_Nullable numberProto = [phoneBuilder buildAndReturnError:&error]; if (error || !numberProto) { - OWSFail(@"%@ could not build protobuf: %@", self.logTag, error); - return nil; + DDLogError(@"%@ could not build protobuf: %@", self.logTag, error); + } else { + [contactBuilder addNumber:numberProto]; } - [contactBuilder addNumber:numberProto]; } for (OWSContactEmail *email in contact.emails) { @@ -857,10 +857,10 @@ NSString *NSStringForContactAddressType(OWSContactAddressType value) } SSKProtoDataMessageContactEmail *_Nullable emailProto = [emailBuilder buildAndReturnError:&error]; if (error || !emailProto) { - OWSFail(@"%@ could not build protobuf: %@", self.logTag, error); - return nil; + DDLogError(@"%@ could not build protobuf: %@", self.logTag, error); + } else { + [contactBuilder addEmail:emailProto]; } - [contactBuilder addEmail:emailProto]; } for (OWSContactAddress *address in contact.addresses) { @@ -892,29 +892,27 @@ NSString *NSStringForContactAddressType(OWSContactAddressType value) } SSKProtoDataMessageContactPostalAddress *_Nullable addressProto = [addressBuilder buildAndReturnError:&error]; if (error || !addressProto) { - OWSFail(@"%@ could not build protobuf: %@", self.logTag, error); - return nil; + DDLogError(@"%@ could not build protobuf: %@", self.logTag, error); + } else { + [contactBuilder addAddress:addressProto]; } - [contactBuilder addAddress:addressProto]; } if (contact.avatarAttachmentId != nil) { SSKProtoAttachmentPointer *_Nullable attachmentProto = [TSAttachmentStream buildProtoForAttachmentId:contact.avatarAttachmentId]; if (!attachmentProto) { - OWSFail(@"%@ could not build protobuf: %@", self.logTag, error); - return nil; + DDLogError(@"%@ could not build protobuf: %@", self.logTag, error); + } else { + SSKProtoDataMessageContactAvatarBuilder *avatarBuilder = [SSKProtoDataMessageContactAvatarBuilder new]; + avatarBuilder.avatar = attachmentProto; + SSKProtoDataMessageContactAvatar *_Nullable avatarProto = [avatarBuilder buildAndReturnError:&error]; + if (error || !avatarProto) { + DDLogError(@"%@ could not build protobuf: %@", self.logTag, error); + } else { + contactBuilder.avatar = avatarProto; + } } - - SSKProtoDataMessageContactAvatarBuilder *avatarBuilder = - [SSKProtoDataMessageContactAvatarBuilder new]; - avatarBuilder.avatar = attachmentProto; - SSKProtoDataMessageContactAvatar *_Nullable avatarProto = [avatarBuilder buildAndReturnError:&error]; - if (error || !avatarProto) { - OWSFail(@"%@ could not build protobuf: %@", self.logTag, error); - return nil; - } - contactBuilder.avatar = avatarProto; } SSKProtoDataMessageContact *_Nullable contactProto = [contactBuilder buildAndReturnError:&error]; diff --git a/SignalServiceKit/src/Messages/Interactions/OWSDisappearingMessagesConfigurationMessage.m b/SignalServiceKit/src/Messages/Interactions/OWSDisappearingMessagesConfigurationMessage.m index c52cf7374..2144542f2 100644 --- a/SignalServiceKit/src/Messages/Interactions/OWSDisappearingMessagesConfigurationMessage.m +++ b/SignalServiceKit/src/Messages/Interactions/OWSDisappearingMessagesConfigurationMessage.m @@ -48,7 +48,10 @@ NS_ASSUME_NONNULL_BEGIN - (nullable SSKProtoDataMessageBuilder *)dataMessageBuilder { - SSKProtoDataMessageBuilder *dataMessageBuilder = [super dataMessageBuilder]; + SSKProtoDataMessageBuilder *_Nullable dataMessageBuilder = [super dataMessageBuilder]; + if (!dataMessageBuilder) { + return nil; + } [dataMessageBuilder setTimestamp:self.timestamp]; [dataMessageBuilder setFlags:SSKProtoDataMessageFlagsExpirationTimerUpdate]; if (self.configuration.isEnabled) { diff --git a/SignalServiceKit/src/Messages/Interactions/OWSEndSessionMessage.m b/SignalServiceKit/src/Messages/Interactions/OWSEndSessionMessage.m index c996ee4c8..abad30f5a 100644 --- a/SignalServiceKit/src/Messages/Interactions/OWSEndSessionMessage.m +++ b/SignalServiceKit/src/Messages/Interactions/OWSEndSessionMessage.m @@ -35,7 +35,10 @@ NS_ASSUME_NONNULL_BEGIN - (nullable SSKProtoDataMessageBuilder *)dataMessageBuilder { - SSKProtoDataMessageBuilder *builder = [super dataMessageBuilder]; + SSKProtoDataMessageBuilder *_Nullable builder = [super dataMessageBuilder]; + if (!dataMessageBuilder) { + return nil; + } [builder setTimestamp:self.timestamp]; [builder setFlags:SSKProtoDataMessageFlagsEndSession]; diff --git a/SignalServiceKit/src/Messages/Interactions/TSOutgoingMessage.m b/SignalServiceKit/src/Messages/Interactions/TSOutgoingMessage.m index 15cfc7bc2..1d16e0d3a 100644 --- a/SignalServiceKit/src/Messages/Interactions/TSOutgoingMessage.m +++ b/SignalServiceKit/src/Messages/Interactions/TSOutgoingMessage.m @@ -944,7 +944,7 @@ NSString *NSStringForOutgoingMessageRecipientState(OWSOutgoingMessageRecipientSt NSError *error; SSKProtoDataMessageQuoteQuotedAttachment *_Nullable quotedAttachmentMessage = [quotedAttachmentBuilder buildAndReturnError:&error]; - if (!quotedAttachmentMessage) { + if (error || !quotedAttachmentMessage) { OWSFail(@"%@ could not build protobuf: %@", self.logTag, error); return nil; } @@ -986,19 +986,14 @@ NSString *NSStringForOutgoingMessageRecipientState(OWSOutgoingMessageRecipientSt { NSError *error; SSKProtoDataMessage *_Nullable dataMessage = [self buildDataMessage:recipient.recipientId]; - if (!dataMessage) { + if (error || !dataMessage) { OWSFail(@"%@ could not build protobuf: %@", self.logTag, error); return nil; } SSKProtoContentBuilder *contentBuilder = [SSKProtoContentBuilder new]; [contentBuilder setDataMessage:dataMessage]; - SSKProtoContent *_Nullable contentProto = [contentBuilder buildAndReturnError:&error]; - if (error || !contentProto) { - OWSFail(@"%@ could not build protobuf: %@", self.logTag, error); - return nil; - } - NSData *_Nullable contentData = [contentProto serializedDataAndReturnError:&error]; + NSData *_Nullable contentData = [contentBuilder buildSerializedDataAndReturnError:&error]; if (error || !contentData) { OWSFail(@"%@ could not serialize protobuf: %@", self.logTag, error); return nil; diff --git a/SignalServiceKit/src/Messages/OWSOutgoingCallMessage.m b/SignalServiceKit/src/Messages/OWSOutgoingCallMessage.m index d907c19cd..dfba56952 100644 --- a/SignalServiceKit/src/Messages/OWSOutgoingCallMessage.m +++ b/SignalServiceKit/src/Messages/OWSOutgoingCallMessage.m @@ -134,12 +134,7 @@ NS_ASSUME_NONNULL_BEGIN [builder setCallMessage:[self buildCallMessage:recipient.recipientId]]; NSError *error; - SSKProtoContent *_Nullable result = [builder buildAndReturnError:&error]; - if (error || !result) { - OWSFail(@"%@ could not build protobuf: %@", self.logTag, error); - return nil; - } - NSData *_Nullable data = [result serializedDataAndReturnError:&error]; + NSData *_Nullable data = [builder buildSerializedDataAndReturnError:&error]; if (error || !data) { OWSFail(@"%@ could not serialize protobuf: %@", self.logTag, error); return nil; diff --git a/SignalServiceKit/src/Messages/OWSOutgoingNullMessage.m b/SignalServiceKit/src/Messages/OWSOutgoingNullMessage.m index 37c46fb69..3d5d14168 100644 --- a/SignalServiceKit/src/Messages/OWSOutgoingNullMessage.m +++ b/SignalServiceKit/src/Messages/OWSOutgoingNullMessage.m @@ -74,12 +74,7 @@ NS_ASSUME_NONNULL_BEGIN SSKProtoContentBuilder *contentBuilder = [SSKProtoContentBuilder new]; contentBuilder.nullMessage = nullMessage; - SSKProtoContent *_Nullable contentProto = [contentBuilder buildAndReturnError:&error]; - if (error || !contentProto) { - OWSFail(@"%@ could not build protobuf: %@", self.logTag, error); - return nil; - } - NSData *_Nullable contentData = [contentProto serializedDataAndReturnError:&error]; + NSData *_Nullable contentData = [contentBuilder buildSerializedDataAndReturnError:&error]; if (error || !contentData) { OWSFail(@"%@ could not serialize protobuf: %@", self.logTag, error); return nil; diff --git a/SignalServiceKit/src/Protos/Generated/FingerprintProto.swift b/SignalServiceKit/src/Protos/Generated/FingerprintProto.swift index 721a87fde..a77eaf179 100644 --- a/SignalServiceKit/src/Protos/Generated/FingerprintProto.swift +++ b/SignalServiceKit/src/Protos/Generated/FingerprintProto.swift @@ -37,8 +37,11 @@ public enum FingerprintProtoError: Error { } @objc public func build() throws -> FingerprintProtoLogicalFingerprint { - let wrapper = try FingerprintProtoLogicalFingerprint.parseProto(proto) - return wrapper + return try FingerprintProtoLogicalFingerprint.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try FingerprintProtoLogicalFingerprint.parseProto(proto).serializedData() } } @@ -121,8 +124,11 @@ public enum FingerprintProtoError: Error { } @objc public func build() throws -> FingerprintProtoLogicalFingerprints { - let wrapper = try FingerprintProtoLogicalFingerprints.parseProto(proto) - return wrapper + return try FingerprintProtoLogicalFingerprints.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try FingerprintProtoLogicalFingerprints.parseProto(proto).serializedData() } } diff --git a/SignalServiceKit/src/Protos/Generated/ProvisioningProto.swift b/SignalServiceKit/src/Protos/Generated/ProvisioningProto.swift index ad5555538..ecee3b145 100644 --- a/SignalServiceKit/src/Protos/Generated/ProvisioningProto.swift +++ b/SignalServiceKit/src/Protos/Generated/ProvisioningProto.swift @@ -41,8 +41,11 @@ public enum ProvisioningProtoError: Error { } @objc public func build() throws -> ProvisioningProtoProvisionEnvelope { - let wrapper = try ProvisioningProtoProvisionEnvelope.parseProto(proto) - return wrapper + return try ProvisioningProtoProvisionEnvelope.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try ProvisioningProtoProvisionEnvelope.parseProto(proto).serializedData() } } @@ -151,8 +154,11 @@ public enum ProvisioningProtoError: Error { } @objc public func build() throws -> ProvisioningProtoProvisionMessage { - let wrapper = try ProvisioningProtoProvisionMessage.parseProto(proto) - return wrapper + return try ProvisioningProtoProvisionMessage.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try ProvisioningProtoProvisionMessage.parseProto(proto).serializedData() } } diff --git a/SignalServiceKit/src/Protos/Generated/SSKProto.swift b/SignalServiceKit/src/Protos/Generated/SSKProto.swift index 7b2ae0360..52c4a8a18 100644 --- a/SignalServiceKit/src/Protos/Generated/SSKProto.swift +++ b/SignalServiceKit/src/Protos/Generated/SSKProto.swift @@ -91,8 +91,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoEnvelope { - let wrapper = try SSKProtoEnvelope.parseProto(proto) - return wrapper + return try SSKProtoEnvelope.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoEnvelope.parseProto(proto).serializedData() } } @@ -243,8 +246,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoContent { - let wrapper = try SSKProtoContent.parseProto(proto) - return wrapper + return try SSKProtoContent.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoContent.parseProto(proto).serializedData() } } @@ -378,8 +384,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoCallMessageOffer { - let wrapper = try SSKProtoCallMessageOffer.parseProto(proto) - return wrapper + return try SSKProtoCallMessageOffer.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoCallMessageOffer.parseProto(proto).serializedData() } } @@ -468,8 +477,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoCallMessageAnswer { - let wrapper = try SSKProtoCallMessageAnswer.parseProto(proto) - return wrapper + return try SSKProtoCallMessageAnswer.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoCallMessageAnswer.parseProto(proto).serializedData() } } @@ -566,8 +578,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoCallMessageIceUpdate { - let wrapper = try SSKProtoCallMessageIceUpdate.parseProto(proto) - return wrapper + return try SSKProtoCallMessageIceUpdate.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoCallMessageIceUpdate.parseProto(proto).serializedData() } } @@ -672,8 +687,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoCallMessageBusy { - let wrapper = try SSKProtoCallMessageBusy.parseProto(proto) - return wrapper + return try SSKProtoCallMessageBusy.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoCallMessageBusy.parseProto(proto).serializedData() } } @@ -748,8 +766,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoCallMessageHangup { - let wrapper = try SSKProtoCallMessageHangup.parseProto(proto) - return wrapper + return try SSKProtoCallMessageHangup.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoCallMessageHangup.parseProto(proto).serializedData() } } @@ -854,8 +875,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoCallMessage { - let wrapper = try SSKProtoCallMessage.parseProto(proto) - return wrapper + return try SSKProtoCallMessage.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoCallMessage.parseProto(proto).serializedData() } } @@ -1023,8 +1047,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoDataMessageQuoteQuotedAttachment { - let wrapper = try SSKProtoDataMessageQuoteQuotedAttachment.parseProto(proto) - return wrapper + return try SSKProtoDataMessageQuoteQuotedAttachment.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoDataMessageQuoteQuotedAttachment.parseProto(proto).serializedData() } } @@ -1151,8 +1178,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoDataMessageQuote { - let wrapper = try SSKProtoDataMessageQuote.parseProto(proto) - return wrapper + return try SSKProtoDataMessageQuote.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoDataMessageQuote.parseProto(proto).serializedData() } } @@ -1278,8 +1308,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoDataMessageContactName { - let wrapper = try SSKProtoDataMessageContactName.parseProto(proto) - return wrapper + return try SSKProtoDataMessageContactName.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoDataMessageContactName.parseProto(proto).serializedData() } } @@ -1439,8 +1472,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoDataMessageContactPhone { - let wrapper = try SSKProtoDataMessageContactPhone.parseProto(proto) - return wrapper + return try SSKProtoDataMessageContactPhone.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoDataMessageContactPhone.parseProto(proto).serializedData() } } @@ -1567,8 +1603,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoDataMessageContactEmail { - let wrapper = try SSKProtoDataMessageContactEmail.parseProto(proto) - return wrapper + return try SSKProtoDataMessageContactEmail.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoDataMessageContactEmail.parseProto(proto).serializedData() } } @@ -1716,8 +1755,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoDataMessageContactPostalAddress { - let wrapper = try SSKProtoDataMessageContactPostalAddress.parseProto(proto) - return wrapper + return try SSKProtoDataMessageContactPostalAddress.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoDataMessageContactPostalAddress.parseProto(proto).serializedData() } } @@ -1873,8 +1915,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoDataMessageContactAvatar { - let wrapper = try SSKProtoDataMessageContactAvatar.parseProto(proto) - return wrapper + return try SSKProtoDataMessageContactAvatar.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoDataMessageContactAvatar.parseProto(proto).serializedData() } } @@ -2009,8 +2054,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoDataMessageContact { - let wrapper = try SSKProtoDataMessageContact.parseProto(proto) - return wrapper + return try SSKProtoDataMessageContact.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoDataMessageContact.parseProto(proto).serializedData() } } @@ -2220,8 +2268,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoDataMessage { - let wrapper = try SSKProtoDataMessage.parseProto(proto) - return wrapper + return try SSKProtoDataMessage.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoDataMessage.parseProto(proto).serializedData() } } @@ -2375,8 +2426,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoNullMessage { - let wrapper = try SSKProtoNullMessage.parseProto(proto) - return wrapper + return try SSKProtoNullMessage.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoNullMessage.parseProto(proto).serializedData() } } @@ -2486,8 +2540,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoReceiptMessage { - let wrapper = try SSKProtoReceiptMessage.parseProto(proto) - return wrapper + return try SSKProtoReceiptMessage.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoReceiptMessage.parseProto(proto).serializedData() } } @@ -2602,8 +2659,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoVerified { - let wrapper = try SSKProtoVerified.parseProto(proto) - return wrapper + return try SSKProtoVerified.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoVerified.parseProto(proto).serializedData() } } @@ -2717,8 +2777,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoSyncMessageSent { - let wrapper = try SSKProtoSyncMessageSent.parseProto(proto) - return wrapper + return try SSKProtoSyncMessageSent.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoSyncMessageSent.parseProto(proto).serializedData() } } @@ -2824,8 +2887,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoSyncMessageContacts { - let wrapper = try SSKProtoSyncMessageContacts.parseProto(proto) - return wrapper + return try SSKProtoSyncMessageContacts.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoSyncMessageContacts.parseProto(proto).serializedData() } } @@ -2907,8 +2973,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoSyncMessageGroups { - let wrapper = try SSKProtoSyncMessageGroups.parseProto(proto) - return wrapper + return try SSKProtoSyncMessageGroups.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoSyncMessageGroups.parseProto(proto).serializedData() } } @@ -2996,8 +3065,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoSyncMessageBlocked { - let wrapper = try SSKProtoSyncMessageBlocked.parseProto(proto) - return wrapper + return try SSKProtoSyncMessageBlocked.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoSyncMessageBlocked.parseProto(proto).serializedData() } } @@ -3096,8 +3168,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoSyncMessageRequest { - let wrapper = try SSKProtoSyncMessageRequest.parseProto(proto) - return wrapper + return try SSKProtoSyncMessageRequest.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoSyncMessageRequest.parseProto(proto).serializedData() } } @@ -3176,8 +3251,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoSyncMessageRead { - let wrapper = try SSKProtoSyncMessageRead.parseProto(proto) - return wrapper + return try SSKProtoSyncMessageRead.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoSyncMessageRead.parseProto(proto).serializedData() } } @@ -3262,8 +3340,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoSyncMessageConfiguration { - let wrapper = try SSKProtoSyncMessageConfiguration.parseProto(proto) - return wrapper + return try SSKProtoSyncMessageConfiguration.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoSyncMessageConfiguration.parseProto(proto).serializedData() } } @@ -3377,8 +3458,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoSyncMessage { - let wrapper = try SSKProtoSyncMessage.parseProto(proto) - return wrapper + return try SSKProtoSyncMessage.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoSyncMessage.parseProto(proto).serializedData() } } @@ -3609,8 +3693,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoAttachmentPointer { - let wrapper = try SSKProtoAttachmentPointer.parseProto(proto) - return wrapper + return try SSKProtoAttachmentPointer.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoAttachmentPointer.parseProto(proto).serializedData() } } @@ -3819,8 +3906,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoGroupContext { - let wrapper = try SSKProtoGroupContext.parseProto(proto) - return wrapper + return try SSKProtoGroupContext.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoGroupContext.parseProto(proto).serializedData() } } @@ -3936,8 +4026,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoContactDetailsAvatar { - let wrapper = try SSKProtoContactDetailsAvatar.parseProto(proto) - return wrapper + return try SSKProtoContactDetailsAvatar.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoContactDetailsAvatar.parseProto(proto).serializedData() } } @@ -4047,8 +4140,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoContactDetails { - let wrapper = try SSKProtoContactDetails.parseProto(proto) - return wrapper + return try SSKProtoContactDetails.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoContactDetails.parseProto(proto).serializedData() } } @@ -4197,8 +4293,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoGroupDetailsAvatar { - let wrapper = try SSKProtoGroupDetailsAvatar.parseProto(proto) - return wrapper + return try SSKProtoGroupDetailsAvatar.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoGroupDetailsAvatar.parseProto(proto).serializedData() } } @@ -4314,8 +4413,11 @@ public enum SSKProtoError: Error { } @objc public func build() throws -> SSKProtoGroupDetails { - let wrapper = try SSKProtoGroupDetails.parseProto(proto) - return wrapper + return try SSKProtoGroupDetails.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SSKProtoGroupDetails.parseProto(proto).serializedData() } } diff --git a/SignalServiceKit/src/Protos/Generated/SignalIOSProto.swift b/SignalServiceKit/src/Protos/Generated/SignalIOSProto.swift index dfc46711e..6b50bb778 100644 --- a/SignalServiceKit/src/Protos/Generated/SignalIOSProto.swift +++ b/SignalServiceKit/src/Protos/Generated/SignalIOSProto.swift @@ -71,8 +71,11 @@ public enum SignalIOSProtoError: Error { } @objc public func build() throws -> SignalIOSProtoBackupSnapshotBackupEntity { - let wrapper = try SignalIOSProtoBackupSnapshotBackupEntity.parseProto(proto) - return wrapper + return try SignalIOSProtoBackupSnapshotBackupEntity.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SignalIOSProtoBackupSnapshotBackupEntity.parseProto(proto).serializedData() } } @@ -167,8 +170,11 @@ public enum SignalIOSProtoError: Error { } @objc public func build() throws -> SignalIOSProtoBackupSnapshot { - let wrapper = try SignalIOSProtoBackupSnapshot.parseProto(proto) - return wrapper + return try SignalIOSProtoBackupSnapshot.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try SignalIOSProtoBackupSnapshot.parseProto(proto).serializedData() } } diff --git a/SignalServiceKit/src/Protos/Generated/WebSocketProto.swift b/SignalServiceKit/src/Protos/Generated/WebSocketProto.swift index d9377ea12..b779cbe02 100644 --- a/SignalServiceKit/src/Protos/Generated/WebSocketProto.swift +++ b/SignalServiceKit/src/Protos/Generated/WebSocketProto.swift @@ -63,8 +63,11 @@ public enum WebSocketProtoError: Error { } @objc public func build() throws -> WebSocketProtoWebSocketRequestMessage { - let wrapper = try WebSocketProtoWebSocketRequestMessage.parseProto(proto) - return wrapper + return try WebSocketProtoWebSocketRequestMessage.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try WebSocketProtoWebSocketRequestMessage.parseProto(proto).serializedData() } } @@ -199,8 +202,11 @@ public enum WebSocketProtoError: Error { } @objc public func build() throws -> WebSocketProtoWebSocketResponseMessage { - let wrapper = try WebSocketProtoWebSocketResponseMessage.parseProto(proto) - return wrapper + return try WebSocketProtoWebSocketResponseMessage.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try WebSocketProtoWebSocketResponseMessage.parseProto(proto).serializedData() } } @@ -341,8 +347,11 @@ public enum WebSocketProtoError: Error { } @objc public func build() throws -> WebSocketProtoWebSocketMessage { - let wrapper = try WebSocketProtoWebSocketMessage.parseProto(proto) - return wrapper + return try WebSocketProtoWebSocketMessage.parseProto(proto) + } + + @objc public func buildSerializedData() throws -> Data { + return try WebSocketProtoWebSocketMessage.parseProto(proto).serializedData() } }