Code generate Swift wrappers for protocol buffers.
This commit is contained in:
parent
8d814a5210
commit
6be3d2e42d
|
@ -491,6 +491,15 @@ class MessageContext(BaseContext):
|
|||
writer.add('}')
|
||||
writer.newline()
|
||||
|
||||
# serializedDataIgnoringErrors() func
|
||||
writer.add('// NOTE: This method is intended for debugging purposes only.')
|
||||
writer.add('@objc public func serializedDataIgnoringErrors() -> Data? {')
|
||||
writer.push_indent()
|
||||
writer.add('return try! self.serializedData()')
|
||||
writer.pop_indent()
|
||||
writer.add('}')
|
||||
writer.newline()
|
||||
|
||||
# serializedData() func
|
||||
writer.extend(('''
|
||||
@objc
|
||||
|
@ -689,7 +698,16 @@ public func serializedData() throws -> Data {
|
|||
writer.pop_indent()
|
||||
writer.add('}')
|
||||
writer.newline()
|
||||
|
||||
|
||||
# buildIgnoringErrors() func
|
||||
writer.add('// NOTE: This method is intended for debugging purposes only.')
|
||||
writer.add('@objc public func buildIgnoringErrors() -> %s? {' % self.swift_name)
|
||||
writer.push_indent()
|
||||
writer.add('return try! self.build()')
|
||||
writer.pop_indent()
|
||||
writer.add('}')
|
||||
writer.newline()
|
||||
|
||||
# build() func
|
||||
writer.add('@objc public func build() throws -> %s {' % self.swift_name)
|
||||
writer.push_indent()
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
shift-base:CodedInputStream.m
|
||||
# generated protos
|
||||
bool:WebSocketResources.pb.m
|
||||
bool:OWSSignalServiceProtos.pb.m
|
||||
bool:SSKProto.pb.m
|
||||
bool:WhisperTextProtocol.pb.m
|
||||
bool:OWSWebRTCDataProtos.pb.m
|
||||
bool:OWSSignaliOSProtos.pb.m
|
||||
|
|
|
@ -3863,20 +3863,20 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
|
|||
NSString *randomText = [self randomText];
|
||||
NSString *text = [[[@(counter) description] stringByAppendingString:@" "] stringByAppendingString:randomText];
|
||||
|
||||
OWSSignalServiceProtosDataMessageBuilder *dataMessageBuilder = [OWSSignalServiceProtosDataMessageBuilder new];
|
||||
SSKProtoDataMessageBuilder *dataMessageBuilder = [SSKProtoDataMessageBuilder new];
|
||||
[dataMessageBuilder setBody:text];
|
||||
|
||||
if ([thread isKindOfClass:[TSGroupThread class]]) {
|
||||
TSGroupThread *groupThread = (TSGroupThread *)thread;
|
||||
OWSSignalServiceProtosGroupContextBuilder *groupBuilder = [OWSSignalServiceProtosGroupContextBuilder new];
|
||||
[groupBuilder setType:OWSSignalServiceProtosGroupContextTypeDeliver];
|
||||
SSKProtoGroupContextBuilder *groupBuilder = [SSKProtoGroupContextBuilder new];
|
||||
[groupBuilder setType:SSKProtoGroupContextTypeDeliver];
|
||||
[groupBuilder setId:groupThread.groupModel.groupId];
|
||||
[dataMessageBuilder setGroup:groupBuilder.build];
|
||||
[dataMessageBuilder setGroup:groupBuilder.buildIgnoringErrors];
|
||||
}
|
||||
|
||||
OWSSignalServiceProtosContentBuilder *payloadBuilder = [OWSSignalServiceProtosContentBuilder new];
|
||||
[payloadBuilder setDataMessage:dataMessageBuilder.build];
|
||||
NSData *plaintextData = [payloadBuilder build].data;
|
||||
SSKProtoContentBuilder *payloadBuilder = [SSKProtoContentBuilder new];
|
||||
[payloadBuilder setDataMessage:dataMessageBuilder.buildIgnoringErrors];
|
||||
NSData *plaintextData = [payloadBuilder buildIgnoringErrors].serializedDataIgnoringErrors;
|
||||
|
||||
// Try to use an arbitrary member of the current thread that isn't
|
||||
// ourselves as the sender.
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#import <SignalServiceKit/OWSDynamicOutgoingMessage.h>
|
||||
#import <SignalServiceKit/OWSPrimaryStorage.h>
|
||||
#import <SignalServiceKit/SecurityUtils.h>
|
||||
#import <SignalServiceKit/SignalServiceKit-Swift.h>
|
||||
#import <SignalServiceKit/TSGroupThread.h>
|
||||
#import <SignalServiceKit/TSThread.h>
|
||||
|
||||
|
@ -49,120 +50,135 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
}]];
|
||||
[items addObject:[OWSTableItem itemWithTitle:@"Send no payload message"
|
||||
actionBlock:^{
|
||||
[DebugUIStress sendStressMessage:thread block:^(SignalRecipient *recipient) {
|
||||
OWSSignalServiceProtosContentBuilder *contentBuilder = [OWSSignalServiceProtosContentBuilder new];
|
||||
return [[contentBuilder build] data];
|
||||
}];
|
||||
[DebugUIStress sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
SSKProtoContentBuilder *contentBuilder =
|
||||
[SSKProtoContentBuilder new];
|
||||
return [[contentBuilder buildIgnoringErrors]
|
||||
serializedDataIgnoringErrors];
|
||||
}];
|
||||
}]];
|
||||
[items addObject:[OWSTableItem itemWithTitle:@"Send empty null message"
|
||||
actionBlock:^{
|
||||
[DebugUIStress sendStressMessage:thread block:^(SignalRecipient *recipient) {
|
||||
OWSSignalServiceProtosContentBuilder *contentBuilder = [OWSSignalServiceProtosContentBuilder new];
|
||||
OWSSignalServiceProtosNullMessageBuilder *nullMessageBuilder = [OWSSignalServiceProtosNullMessageBuilder new];
|
||||
contentBuilder.nullMessage = [nullMessageBuilder build];
|
||||
return [[contentBuilder build] data];
|
||||
}];
|
||||
[DebugUIStress sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
SSKProtoContentBuilder *contentBuilder =
|
||||
[SSKProtoContentBuilder new];
|
||||
SSKProtoNullMessageBuilder *nullMessageBuilder =
|
||||
[SSKProtoNullMessageBuilder new];
|
||||
contentBuilder.nullMessage =
|
||||
[nullMessageBuilder buildIgnoringErrors];
|
||||
return [[contentBuilder buildIgnoringErrors]
|
||||
serializedDataIgnoringErrors];
|
||||
}];
|
||||
}]];
|
||||
[items addObject:[OWSTableItem itemWithTitle:@"Send random null message"
|
||||
actionBlock:^{
|
||||
[DebugUIStress
|
||||
sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
SSKProtoContentBuilder *contentBuilder =
|
||||
[SSKProtoContentBuilder new];
|
||||
SSKProtoNullMessageBuilder *nullMessageBuilder =
|
||||
[SSKProtoNullMessageBuilder new];
|
||||
NSUInteger contentLength = arc4random_uniform(32);
|
||||
nullMessageBuilder.padding =
|
||||
[Cryptography generateRandomBytes:contentLength];
|
||||
contentBuilder.nullMessage =
|
||||
[nullMessageBuilder buildIgnoringErrors];
|
||||
return [[contentBuilder buildIgnoringErrors]
|
||||
serializedDataIgnoringErrors];
|
||||
}];
|
||||
}]];
|
||||
[items addObject:[OWSTableItem itemWithTitle:@"Send empty sync message"
|
||||
actionBlock:^{
|
||||
[DebugUIStress sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
SSKProtoContentBuilder *contentBuilder =
|
||||
[SSKProtoContentBuilder new];
|
||||
SSKProtoSyncMessageBuilder *syncMessageBuilder =
|
||||
[SSKProtoSyncMessageBuilder new];
|
||||
contentBuilder.syncMessage =
|
||||
[syncMessageBuilder buildIgnoringErrors];
|
||||
return [[contentBuilder buildIgnoringErrors]
|
||||
serializedDataIgnoringErrors];
|
||||
}];
|
||||
}]];
|
||||
[items addObject:[OWSTableItem itemWithTitle:@"Send empty sync sent message"
|
||||
actionBlock:^{
|
||||
[DebugUIStress sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
SSKProtoContentBuilder *contentBuilder =
|
||||
[SSKProtoContentBuilder new];
|
||||
SSKProtoSyncMessageBuilder *syncMessageBuilder =
|
||||
[SSKProtoSyncMessageBuilder new];
|
||||
SSKProtoSyncMessageSentBuilder *sentBuilder =
|
||||
[SSKProtoSyncMessageSentBuilder new];
|
||||
syncMessageBuilder.sent =
|
||||
[sentBuilder buildIgnoringErrors];
|
||||
contentBuilder.syncMessage =
|
||||
[syncMessageBuilder buildIgnoringErrors];
|
||||
return [[contentBuilder buildIgnoringErrors]
|
||||
serializedDataIgnoringErrors];
|
||||
}];
|
||||
}]];
|
||||
[items
|
||||
addObject:[OWSTableItem itemWithTitle:@"Send random null message"
|
||||
actionBlock:^{
|
||||
[DebugUIStress
|
||||
sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
||||
[OWSSignalServiceProtosContentBuilder new];
|
||||
OWSSignalServiceProtosNullMessageBuilder *nullMessageBuilder =
|
||||
[OWSSignalServiceProtosNullMessageBuilder new];
|
||||
NSUInteger contentLength = arc4random_uniform(32);
|
||||
nullMessageBuilder.padding =
|
||||
[Cryptography generateRandomBytes:contentLength];
|
||||
contentBuilder.nullMessage = [nullMessageBuilder build];
|
||||
return [[contentBuilder build] data];
|
||||
}];
|
||||
}]];
|
||||
[items
|
||||
addObject:[OWSTableItem itemWithTitle:@"Send empty sync message"
|
||||
actionBlock:^{
|
||||
[DebugUIStress
|
||||
sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
||||
[OWSSignalServiceProtosContentBuilder new];
|
||||
OWSSignalServiceProtosSyncMessageBuilder *syncMessageBuilder =
|
||||
[OWSSignalServiceProtosSyncMessageBuilder new];
|
||||
contentBuilder.syncMessage = [syncMessageBuilder build];
|
||||
return [[contentBuilder build] data];
|
||||
}];
|
||||
}]];
|
||||
[items
|
||||
addObject:[OWSTableItem itemWithTitle:@"Send empty sync sent message"
|
||||
actionBlock:^{
|
||||
[DebugUIStress
|
||||
sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
||||
[OWSSignalServiceProtosContentBuilder new];
|
||||
OWSSignalServiceProtosSyncMessageBuilder *syncMessageBuilder =
|
||||
[OWSSignalServiceProtosSyncMessageBuilder new];
|
||||
OWSSignalServiceProtosSyncMessageSentBuilder *sentBuilder =
|
||||
[OWSSignalServiceProtosSyncMessageSentBuilder new];
|
||||
syncMessageBuilder.sent = [sentBuilder build];
|
||||
contentBuilder.syncMessage = [syncMessageBuilder build];
|
||||
return [[contentBuilder build] data];
|
||||
}];
|
||||
}]];
|
||||
[items addObject:[OWSTableItem itemWithTitle:@"Send whitespace text data message"
|
||||
actionBlock:^{
|
||||
[DebugUIStress
|
||||
sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
||||
[OWSSignalServiceProtosContentBuilder new];
|
||||
OWSSignalServiceProtosDataMessageBuilder *dataBuilder =
|
||||
[OWSSignalServiceProtosDataMessageBuilder new];
|
||||
SSKProtoContentBuilder *contentBuilder =
|
||||
[SSKProtoContentBuilder new];
|
||||
SSKProtoDataMessageBuilder *dataBuilder =
|
||||
[SSKProtoDataMessageBuilder new];
|
||||
dataBuilder.body = @" ";
|
||||
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder
|
||||
thread:thread];
|
||||
contentBuilder.dataMessage = [dataBuilder build];
|
||||
return [[contentBuilder build] data];
|
||||
contentBuilder.dataMessage =
|
||||
[dataBuilder buildIgnoringErrors];
|
||||
return [[contentBuilder buildIgnoringErrors]
|
||||
serializedDataIgnoringErrors];
|
||||
}];
|
||||
}]];
|
||||
[items addObject:[OWSTableItem
|
||||
itemWithTitle:@"Send bad attachment data message"
|
||||
actionBlock:^{
|
||||
[DebugUIStress
|
||||
sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
||||
[OWSSignalServiceProtosContentBuilder new];
|
||||
OWSSignalServiceProtosDataMessageBuilder *dataBuilder =
|
||||
[OWSSignalServiceProtosDataMessageBuilder new];
|
||||
OWSSignalServiceProtosAttachmentPointerBuilder *attachmentPointer =
|
||||
[OWSSignalServiceProtosAttachmentPointerBuilder new];
|
||||
[attachmentPointer setId:arc4random_uniform(32) + 1];
|
||||
[attachmentPointer setContentType:@"1"];
|
||||
[attachmentPointer setSize:arc4random_uniform(32) + 1];
|
||||
[attachmentPointer setDigest:[Cryptography generateRandomBytes:1]];
|
||||
[attachmentPointer setFileName:@" "];
|
||||
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder thread:thread];
|
||||
contentBuilder.dataMessage = [dataBuilder build];
|
||||
return [[contentBuilder build] data];
|
||||
}];
|
||||
}]];
|
||||
[items
|
||||
addObject:[OWSTableItem
|
||||
itemWithTitle:@"Send bad attachment data message"
|
||||
actionBlock:^{
|
||||
[DebugUIStress
|
||||
sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
SSKProtoContentBuilder *contentBuilder = [SSKProtoContentBuilder new];
|
||||
SSKProtoDataMessageBuilder *dataBuilder =
|
||||
[SSKProtoDataMessageBuilder new];
|
||||
SSKProtoAttachmentPointerBuilder *attachmentPointer =
|
||||
[SSKProtoAttachmentPointerBuilder new];
|
||||
[attachmentPointer setId:arc4random_uniform(32) + 1];
|
||||
[attachmentPointer setContentType:@"1"];
|
||||
[attachmentPointer setSize:arc4random_uniform(32) + 1];
|
||||
[attachmentPointer setDigest:[Cryptography generateRandomBytes:1]];
|
||||
[attachmentPointer setFileName:@" "];
|
||||
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder thread:thread];
|
||||
contentBuilder.dataMessage = [dataBuilder buildIgnoringErrors];
|
||||
return
|
||||
[[contentBuilder buildIgnoringErrors] serializedDataIgnoringErrors];
|
||||
}];
|
||||
}]];
|
||||
[items addObject:[OWSTableItem itemWithTitle:@"Send normal text data message"
|
||||
actionBlock:^{
|
||||
[DebugUIStress
|
||||
sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
||||
[OWSSignalServiceProtosContentBuilder new];
|
||||
OWSSignalServiceProtosDataMessageBuilder *dataBuilder =
|
||||
[OWSSignalServiceProtosDataMessageBuilder new];
|
||||
SSKProtoContentBuilder *contentBuilder =
|
||||
[SSKProtoContentBuilder new];
|
||||
SSKProtoDataMessageBuilder *dataBuilder =
|
||||
[SSKProtoDataMessageBuilder new];
|
||||
dataBuilder.body = @"alice";
|
||||
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder
|
||||
thread:thread];
|
||||
contentBuilder.dataMessage = [dataBuilder build];
|
||||
return [[contentBuilder build] data];
|
||||
contentBuilder.dataMessage =
|
||||
[dataBuilder buildIgnoringErrors];
|
||||
return [[contentBuilder buildIgnoringErrors]
|
||||
serializedDataIgnoringErrors];
|
||||
}];
|
||||
}]];
|
||||
[items addObject:[OWSTableItem itemWithTitle:@"Send N text messages with same timestamp"
|
||||
|
@ -173,17 +189,19 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
sendStressMessage:thread
|
||||
timestamp:timestamp
|
||||
block:^(SignalRecipient *recipient) {
|
||||
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
||||
[OWSSignalServiceProtosContentBuilder new];
|
||||
OWSSignalServiceProtosDataMessageBuilder *dataBuilder =
|
||||
[OWSSignalServiceProtosDataMessageBuilder new];
|
||||
SSKProtoContentBuilder *contentBuilder =
|
||||
[SSKProtoContentBuilder new];
|
||||
SSKProtoDataMessageBuilder *dataBuilder =
|
||||
[SSKProtoDataMessageBuilder new];
|
||||
dataBuilder.body = [NSString stringWithFormat:@"%@ %d",
|
||||
[NSUUID UUID].UUIDString,
|
||||
i];
|
||||
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder
|
||||
thread:thread];
|
||||
contentBuilder.dataMessage = [dataBuilder build];
|
||||
return [[contentBuilder build] data];
|
||||
contentBuilder.dataMessage =
|
||||
[dataBuilder buildIgnoringErrors];
|
||||
return [[contentBuilder buildIgnoringErrors]
|
||||
serializedDataIgnoringErrors];
|
||||
}];
|
||||
}
|
||||
}]];
|
||||
|
@ -195,15 +213,16 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
sendStressMessage:thread
|
||||
timestamp:timestamp
|
||||
block:^(SignalRecipient *recipient) {
|
||||
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
||||
[OWSSignalServiceProtosContentBuilder new];
|
||||
OWSSignalServiceProtosDataMessageBuilder *dataBuilder =
|
||||
[OWSSignalServiceProtosDataMessageBuilder new];
|
||||
SSKProtoContentBuilder *contentBuilder =
|
||||
[SSKProtoContentBuilder new];
|
||||
SSKProtoDataMessageBuilder *dataBuilder =
|
||||
[SSKProtoDataMessageBuilder new];
|
||||
dataBuilder.body =
|
||||
[[NSUUID UUID].UUIDString stringByAppendingString:@" now"];
|
||||
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder thread:thread];
|
||||
contentBuilder.dataMessage = [dataBuilder build];
|
||||
return [[contentBuilder build] data];
|
||||
contentBuilder.dataMessage = [dataBuilder buildIgnoringErrors];
|
||||
return [[contentBuilder buildIgnoringErrors]
|
||||
serializedDataIgnoringErrors];
|
||||
}];
|
||||
}]];
|
||||
[items addObject:[OWSTableItem
|
||||
|
@ -215,15 +234,16 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
sendStressMessage:thread
|
||||
timestamp:timestamp
|
||||
block:^(SignalRecipient *recipient) {
|
||||
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
||||
[OWSSignalServiceProtosContentBuilder new];
|
||||
OWSSignalServiceProtosDataMessageBuilder *dataBuilder =
|
||||
[OWSSignalServiceProtosDataMessageBuilder new];
|
||||
SSKProtoContentBuilder *contentBuilder =
|
||||
[SSKProtoContentBuilder new];
|
||||
SSKProtoDataMessageBuilder *dataBuilder =
|
||||
[SSKProtoDataMessageBuilder new];
|
||||
dataBuilder.body =
|
||||
[[NSUUID UUID].UUIDString stringByAppendingString:@" now"];
|
||||
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder thread:thread];
|
||||
contentBuilder.dataMessage = [dataBuilder build];
|
||||
return [[contentBuilder build] data];
|
||||
contentBuilder.dataMessage = [dataBuilder buildIgnoringErrors];
|
||||
return [[contentBuilder buildIgnoringErrors]
|
||||
serializedDataIgnoringErrors];
|
||||
}];
|
||||
}]];
|
||||
[items addObject:[OWSTableItem
|
||||
|
@ -235,27 +255,27 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
sendStressMessage:thread
|
||||
timestamp:timestamp
|
||||
block:^(SignalRecipient *recipient) {
|
||||
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
||||
[OWSSignalServiceProtosContentBuilder new];
|
||||
OWSSignalServiceProtosDataMessageBuilder *dataBuilder =
|
||||
[OWSSignalServiceProtosDataMessageBuilder new];
|
||||
SSKProtoContentBuilder *contentBuilder =
|
||||
[SSKProtoContentBuilder new];
|
||||
SSKProtoDataMessageBuilder *dataBuilder =
|
||||
[SSKProtoDataMessageBuilder new];
|
||||
dataBuilder.body =
|
||||
[[NSUUID UUID].UUIDString stringByAppendingString:@" now"];
|
||||
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder thread:thread];
|
||||
contentBuilder.dataMessage = [dataBuilder build];
|
||||
return [[contentBuilder build] data];
|
||||
contentBuilder.dataMessage = [dataBuilder buildIgnoringErrors];
|
||||
return [[contentBuilder buildIgnoringErrors]
|
||||
serializedDataIgnoringErrors];
|
||||
}];
|
||||
}]];
|
||||
[items addObject:[OWSTableItem itemWithTitle:@"Send N text messages with same timestamp"
|
||||
actionBlock:^{
|
||||
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
||||
[OWSSignalServiceProtosContentBuilder new];
|
||||
OWSSignalServiceProtosDataMessageBuilder *dataBuilder =
|
||||
[OWSSignalServiceProtosDataMessageBuilder new];
|
||||
SSKProtoContentBuilder *contentBuilder = [SSKProtoContentBuilder new];
|
||||
SSKProtoDataMessageBuilder *dataBuilder = [SSKProtoDataMessageBuilder new];
|
||||
dataBuilder.body = @"alice";
|
||||
contentBuilder.dataMessage = [dataBuilder build];
|
||||
contentBuilder.dataMessage = [dataBuilder buildIgnoringErrors];
|
||||
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder thread:thread];
|
||||
NSData *data = [[contentBuilder build] data];
|
||||
NSData *data =
|
||||
[[contentBuilder buildIgnoringErrors] serializedDataIgnoringErrors];
|
||||
|
||||
uint64_t timestamp = [NSDate ows_millisecondTimeStamp];
|
||||
|
||||
|
@ -268,145 +288,151 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
}
|
||||
}]];
|
||||
[items
|
||||
addObject:[OWSTableItem itemWithTitle:@"Send malformed sync sent message 1"
|
||||
actionBlock:^{
|
||||
[DebugUIStress
|
||||
sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
||||
[OWSSignalServiceProtosContentBuilder new];
|
||||
OWSSignalServiceProtosSyncMessageBuilder *syncMessageBuilder =
|
||||
[OWSSignalServiceProtosSyncMessageBuilder new];
|
||||
OWSSignalServiceProtosSyncMessageSentBuilder *sentBuilder =
|
||||
[OWSSignalServiceProtosSyncMessageSentBuilder new];
|
||||
sentBuilder.destination = @"abc";
|
||||
sentBuilder.timestamp = arc4random_uniform(32) + 1;
|
||||
OWSSignalServiceProtosDataMessageBuilder *dataBuilder =
|
||||
[OWSSignalServiceProtosDataMessageBuilder new];
|
||||
sentBuilder.message = [dataBuilder build];
|
||||
syncMessageBuilder.sent = [sentBuilder build];
|
||||
contentBuilder.syncMessage = [syncMessageBuilder build];
|
||||
return [[contentBuilder build] data];
|
||||
}];
|
||||
}]];
|
||||
addObject:[OWSTableItem
|
||||
itemWithTitle:@"Send malformed sync sent message 1"
|
||||
actionBlock:^{
|
||||
[DebugUIStress
|
||||
sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
SSKProtoContentBuilder *contentBuilder = [SSKProtoContentBuilder new];
|
||||
SSKProtoSyncMessageBuilder *syncMessageBuilder =
|
||||
[SSKProtoSyncMessageBuilder new];
|
||||
SSKProtoSyncMessageSentBuilder *sentBuilder =
|
||||
[SSKProtoSyncMessageSentBuilder new];
|
||||
sentBuilder.destination = @"abc";
|
||||
sentBuilder.timestamp = arc4random_uniform(32) + 1;
|
||||
SSKProtoDataMessageBuilder *dataBuilder =
|
||||
[SSKProtoDataMessageBuilder new];
|
||||
sentBuilder.message = [dataBuilder buildIgnoringErrors];
|
||||
syncMessageBuilder.sent = [sentBuilder buildIgnoringErrors];
|
||||
contentBuilder.syncMessage = [syncMessageBuilder buildIgnoringErrors];
|
||||
return
|
||||
[[contentBuilder buildIgnoringErrors] serializedDataIgnoringErrors];
|
||||
}];
|
||||
}]];
|
||||
[items
|
||||
addObject:[OWSTableItem itemWithTitle:@"Send malformed sync sent message 2"
|
||||
actionBlock:^{
|
||||
[DebugUIStress
|
||||
sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
||||
[OWSSignalServiceProtosContentBuilder new];
|
||||
OWSSignalServiceProtosSyncMessageBuilder *syncMessageBuilder =
|
||||
[OWSSignalServiceProtosSyncMessageBuilder new];
|
||||
OWSSignalServiceProtosSyncMessageSentBuilder *sentBuilder =
|
||||
[OWSSignalServiceProtosSyncMessageSentBuilder new];
|
||||
sentBuilder.destination = @"abc";
|
||||
sentBuilder.timestamp = 0;
|
||||
OWSSignalServiceProtosDataMessageBuilder *dataBuilder =
|
||||
[OWSSignalServiceProtosDataMessageBuilder new];
|
||||
sentBuilder.message = [dataBuilder build];
|
||||
syncMessageBuilder.sent = [sentBuilder build];
|
||||
contentBuilder.syncMessage = [syncMessageBuilder build];
|
||||
return [[contentBuilder build] data];
|
||||
}];
|
||||
}]];
|
||||
addObject:[OWSTableItem
|
||||
itemWithTitle:@"Send malformed sync sent message 2"
|
||||
actionBlock:^{
|
||||
[DebugUIStress
|
||||
sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
SSKProtoContentBuilder *contentBuilder = [SSKProtoContentBuilder new];
|
||||
SSKProtoSyncMessageBuilder *syncMessageBuilder =
|
||||
[SSKProtoSyncMessageBuilder new];
|
||||
SSKProtoSyncMessageSentBuilder *sentBuilder =
|
||||
[SSKProtoSyncMessageSentBuilder new];
|
||||
sentBuilder.destination = @"abc";
|
||||
sentBuilder.timestamp = 0;
|
||||
SSKProtoDataMessageBuilder *dataBuilder =
|
||||
[SSKProtoDataMessageBuilder new];
|
||||
sentBuilder.message = [dataBuilder buildIgnoringErrors];
|
||||
syncMessageBuilder.sent = [sentBuilder buildIgnoringErrors];
|
||||
contentBuilder.syncMessage = [syncMessageBuilder buildIgnoringErrors];
|
||||
return
|
||||
[[contentBuilder buildIgnoringErrors] serializedDataIgnoringErrors];
|
||||
}];
|
||||
}]];
|
||||
[items
|
||||
addObject:[OWSTableItem itemWithTitle:@"Send malformed sync sent message 3"
|
||||
actionBlock:^{
|
||||
[DebugUIStress
|
||||
sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
||||
[OWSSignalServiceProtosContentBuilder new];
|
||||
OWSSignalServiceProtosSyncMessageBuilder *syncMessageBuilder =
|
||||
[OWSSignalServiceProtosSyncMessageBuilder new];
|
||||
OWSSignalServiceProtosSyncMessageSentBuilder *sentBuilder =
|
||||
[OWSSignalServiceProtosSyncMessageSentBuilder new];
|
||||
sentBuilder.destination = @"abc";
|
||||
sentBuilder.timestamp = 0;
|
||||
OWSSignalServiceProtosDataMessageBuilder *dataBuilder =
|
||||
[OWSSignalServiceProtosDataMessageBuilder new];
|
||||
dataBuilder.body = @" ";
|
||||
sentBuilder.message = [dataBuilder build];
|
||||
syncMessageBuilder.sent = [sentBuilder build];
|
||||
contentBuilder.syncMessage = [syncMessageBuilder build];
|
||||
return [[contentBuilder build] data];
|
||||
}];
|
||||
}]];
|
||||
addObject:[OWSTableItem
|
||||
itemWithTitle:@"Send malformed sync sent message 3"
|
||||
actionBlock:^{
|
||||
[DebugUIStress
|
||||
sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
SSKProtoContentBuilder *contentBuilder = [SSKProtoContentBuilder new];
|
||||
SSKProtoSyncMessageBuilder *syncMessageBuilder =
|
||||
[SSKProtoSyncMessageBuilder new];
|
||||
SSKProtoSyncMessageSentBuilder *sentBuilder =
|
||||
[SSKProtoSyncMessageSentBuilder new];
|
||||
sentBuilder.destination = @"abc";
|
||||
sentBuilder.timestamp = 0;
|
||||
SSKProtoDataMessageBuilder *dataBuilder =
|
||||
[SSKProtoDataMessageBuilder new];
|
||||
dataBuilder.body = @" ";
|
||||
sentBuilder.message = [dataBuilder buildIgnoringErrors];
|
||||
syncMessageBuilder.sent = [sentBuilder buildIgnoringErrors];
|
||||
contentBuilder.syncMessage = [syncMessageBuilder buildIgnoringErrors];
|
||||
return
|
||||
[[contentBuilder buildIgnoringErrors] serializedDataIgnoringErrors];
|
||||
}];
|
||||
}]];
|
||||
[items
|
||||
addObject:[OWSTableItem itemWithTitle:@"Send malformed sync sent message 4"
|
||||
actionBlock:^{
|
||||
[DebugUIStress
|
||||
sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
||||
[OWSSignalServiceProtosContentBuilder new];
|
||||
OWSSignalServiceProtosSyncMessageBuilder *syncMessageBuilder =
|
||||
[OWSSignalServiceProtosSyncMessageBuilder new];
|
||||
OWSSignalServiceProtosSyncMessageSentBuilder *sentBuilder =
|
||||
[OWSSignalServiceProtosSyncMessageSentBuilder new];
|
||||
sentBuilder.destination = @"abc";
|
||||
sentBuilder.timestamp = 0;
|
||||
OWSSignalServiceProtosDataMessageBuilder *dataBuilder =
|
||||
[OWSSignalServiceProtosDataMessageBuilder new];
|
||||
dataBuilder.body = @" ";
|
||||
OWSSignalServiceProtosGroupContextBuilder *groupBuilder =
|
||||
[OWSSignalServiceProtosGroupContextBuilder new];
|
||||
[groupBuilder setId:[Cryptography generateRandomBytes:1]];
|
||||
dataBuilder.group = [groupBuilder build];
|
||||
sentBuilder.message = [dataBuilder build];
|
||||
syncMessageBuilder.sent = [sentBuilder build];
|
||||
contentBuilder.syncMessage = [syncMessageBuilder build];
|
||||
return [[contentBuilder build] data];
|
||||
}];
|
||||
}]];
|
||||
addObject:[OWSTableItem
|
||||
itemWithTitle:@"Send malformed sync sent message 4"
|
||||
actionBlock:^{
|
||||
[DebugUIStress
|
||||
sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
SSKProtoContentBuilder *contentBuilder = [SSKProtoContentBuilder new];
|
||||
SSKProtoSyncMessageBuilder *syncMessageBuilder =
|
||||
[SSKProtoSyncMessageBuilder new];
|
||||
SSKProtoSyncMessageSentBuilder *sentBuilder =
|
||||
[SSKProtoSyncMessageSentBuilder new];
|
||||
sentBuilder.destination = @"abc";
|
||||
sentBuilder.timestamp = 0;
|
||||
SSKProtoDataMessageBuilder *dataBuilder =
|
||||
[SSKProtoDataMessageBuilder new];
|
||||
dataBuilder.body = @" ";
|
||||
SSKProtoGroupContextBuilder *groupBuilder =
|
||||
[SSKProtoGroupContextBuilder new];
|
||||
[groupBuilder setId:[Cryptography generateRandomBytes:1]];
|
||||
dataBuilder.group = [groupBuilder buildIgnoringErrors];
|
||||
sentBuilder.message = [dataBuilder buildIgnoringErrors];
|
||||
syncMessageBuilder.sent = [sentBuilder buildIgnoringErrors];
|
||||
contentBuilder.syncMessage = [syncMessageBuilder buildIgnoringErrors];
|
||||
return
|
||||
[[contentBuilder buildIgnoringErrors] serializedDataIgnoringErrors];
|
||||
}];
|
||||
}]];
|
||||
[items
|
||||
addObject:[OWSTableItem itemWithTitle:@"Send malformed sync sent message 5"
|
||||
actionBlock:^{
|
||||
[DebugUIStress
|
||||
sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
||||
[OWSSignalServiceProtosContentBuilder new];
|
||||
OWSSignalServiceProtosSyncMessageBuilder *syncMessageBuilder =
|
||||
[OWSSignalServiceProtosSyncMessageBuilder new];
|
||||
OWSSignalServiceProtosSyncMessageSentBuilder *sentBuilder =
|
||||
[OWSSignalServiceProtosSyncMessageSentBuilder new];
|
||||
sentBuilder.destination = @"abc";
|
||||
sentBuilder.timestamp = 0;
|
||||
OWSSignalServiceProtosDataMessageBuilder *dataBuilder =
|
||||
[OWSSignalServiceProtosDataMessageBuilder new];
|
||||
dataBuilder.body = @" ";
|
||||
OWSSignalServiceProtosGroupContextBuilder *groupBuilder =
|
||||
[OWSSignalServiceProtosGroupContextBuilder new];
|
||||
[groupBuilder setId:[Cryptography generateRandomBytes:1]];
|
||||
dataBuilder.group = [groupBuilder build];
|
||||
sentBuilder.message = [dataBuilder build];
|
||||
syncMessageBuilder.sent = [sentBuilder build];
|
||||
contentBuilder.syncMessage = [syncMessageBuilder build];
|
||||
return [[contentBuilder build] data];
|
||||
}];
|
||||
}]];
|
||||
[items
|
||||
addObject:[OWSTableItem itemWithTitle:@"Send empty sync sent message 6"
|
||||
actionBlock:^{
|
||||
[DebugUIStress
|
||||
sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
||||
[OWSSignalServiceProtosContentBuilder new];
|
||||
OWSSignalServiceProtosSyncMessageBuilder *syncMessageBuilder =
|
||||
[OWSSignalServiceProtosSyncMessageBuilder new];
|
||||
OWSSignalServiceProtosSyncMessageSentBuilder *sentBuilder =
|
||||
[OWSSignalServiceProtosSyncMessageSentBuilder new];
|
||||
sentBuilder.destination = @"abc";
|
||||
syncMessageBuilder.sent = [sentBuilder build];
|
||||
contentBuilder.syncMessage = [syncMessageBuilder build];
|
||||
return [[contentBuilder build] data];
|
||||
}];
|
||||
}]];
|
||||
|
||||
addObject:[OWSTableItem
|
||||
itemWithTitle:@"Send malformed sync sent message 5"
|
||||
actionBlock:^{
|
||||
[DebugUIStress
|
||||
sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
SSKProtoContentBuilder *contentBuilder = [SSKProtoContentBuilder new];
|
||||
SSKProtoSyncMessageBuilder *syncMessageBuilder =
|
||||
[SSKProtoSyncMessageBuilder new];
|
||||
SSKProtoSyncMessageSentBuilder *sentBuilder =
|
||||
[SSKProtoSyncMessageSentBuilder new];
|
||||
sentBuilder.destination = @"abc";
|
||||
sentBuilder.timestamp = 0;
|
||||
SSKProtoDataMessageBuilder *dataBuilder =
|
||||
[SSKProtoDataMessageBuilder new];
|
||||
dataBuilder.body = @" ";
|
||||
SSKProtoGroupContextBuilder *groupBuilder =
|
||||
[SSKProtoGroupContextBuilder new];
|
||||
[groupBuilder setId:[Cryptography generateRandomBytes:1]];
|
||||
dataBuilder.group = [groupBuilder buildIgnoringErrors];
|
||||
sentBuilder.message = [dataBuilder buildIgnoringErrors];
|
||||
syncMessageBuilder.sent = [sentBuilder buildIgnoringErrors];
|
||||
contentBuilder.syncMessage = [syncMessageBuilder buildIgnoringErrors];
|
||||
return
|
||||
[[contentBuilder buildIgnoringErrors] serializedDataIgnoringErrors];
|
||||
}];
|
||||
}]];
|
||||
[items addObject:[OWSTableItem itemWithTitle:@"Send empty sync sent message 6"
|
||||
actionBlock:^{
|
||||
[DebugUIStress sendStressMessage:thread
|
||||
block:^(SignalRecipient *recipient) {
|
||||
SSKProtoContentBuilder *contentBuilder =
|
||||
[SSKProtoContentBuilder new];
|
||||
SSKProtoSyncMessageBuilder *syncMessageBuilder =
|
||||
[SSKProtoSyncMessageBuilder new];
|
||||
SSKProtoSyncMessageSentBuilder *sentBuilder =
|
||||
[SSKProtoSyncMessageSentBuilder new];
|
||||
sentBuilder.destination = @"abc";
|
||||
syncMessageBuilder.sent =
|
||||
[sentBuilder buildIgnoringErrors];
|
||||
contentBuilder.syncMessage =
|
||||
[syncMessageBuilder buildIgnoringErrors];
|
||||
return [[contentBuilder buildIgnoringErrors]
|
||||
serializedDataIgnoringErrors];
|
||||
}];
|
||||
}]];
|
||||
|
||||
if ([thread isKindOfClass:[TSGroupThread class]]) {
|
||||
TSGroupThread *groupThread = (TSGroupThread *)thread;
|
||||
[items addObject:[OWSTableItem itemWithTitle:@"Hallucinate twin group"
|
||||
|
@ -417,7 +443,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
return [OWSTableSection sectionWithTitle:self.name items:items];
|
||||
}
|
||||
|
||||
+ (void)ensureGroupOfDataBuilder:(OWSSignalServiceProtosDataMessageBuilder *)dataBuilder thread:(TSThread *)thread
|
||||
+ (void)ensureGroupOfDataBuilder:(SSKProtoDataMessageBuilder *)dataBuilder thread:(TSThread *)thread
|
||||
{
|
||||
OWSAssert(dataBuilder);
|
||||
OWSAssert(thread);
|
||||
|
@ -427,10 +453,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
}
|
||||
|
||||
TSGroupThread *groupThread = (TSGroupThread *)thread;
|
||||
OWSSignalServiceProtosGroupContextBuilder *groupBuilder = [OWSSignalServiceProtosGroupContextBuilder new];
|
||||
[groupBuilder setType:OWSSignalServiceProtosGroupContextTypeDeliver];
|
||||
SSKProtoGroupContextBuilder *groupBuilder = [SSKProtoGroupContextBuilder new];
|
||||
[groupBuilder setType:SSKProtoGroupContextTypeDeliver];
|
||||
[groupBuilder setId:groupThread.groupModel.groupId];
|
||||
[dataBuilder setGroup:groupBuilder.build];
|
||||
[dataBuilder setGroup:groupBuilder.buildIgnoringErrors];
|
||||
}
|
||||
|
||||
+ (void)sendStressMessage:(TSOutgoingMessage *)message
|
||||
|
|
|
@ -9,7 +9,7 @@ import SignalMessaging
|
|||
@objc(OWSWebRTCCallMessageHandler)
|
||||
public class WebRTCCallMessageHandler: NSObject, OWSCallMessageHandler {
|
||||
|
||||
// MARK - Properties
|
||||
// MARK: - Properties
|
||||
|
||||
let TAG = "[WebRTCCallMessageHandler]"
|
||||
|
||||
|
@ -33,34 +33,22 @@ public class WebRTCCallMessageHandler: NSObject, OWSCallMessageHandler {
|
|||
|
||||
// MARK: - Call Handlers
|
||||
|
||||
public func receivedOffer(_ offer: OWSSignalServiceProtosCallMessageOffer, from callerId: String) {
|
||||
public func receivedOffer(_ offer: SSKProtoCallMessageOffer, from callerId: String) {
|
||||
SwiftAssertIsOnMainThread(#function)
|
||||
guard offer.hasId() else {
|
||||
owsFail("no callId in \(#function)")
|
||||
return
|
||||
}
|
||||
|
||||
let thread = TSContactThread.getOrCreateThread(contactId: callerId)
|
||||
self.callService.handleReceivedOffer(thread: thread, callId: offer.id, sessionDescription: offer.sessionDescription)
|
||||
}
|
||||
|
||||
public func receivedAnswer(_ answer: OWSSignalServiceProtosCallMessageAnswer, from callerId: String) {
|
||||
public func receivedAnswer(_ answer: SSKProtoCallMessageAnswer, from callerId: String) {
|
||||
SwiftAssertIsOnMainThread(#function)
|
||||
guard answer.hasId() else {
|
||||
owsFail("no callId in \(#function)")
|
||||
return
|
||||
}
|
||||
|
||||
let thread = TSContactThread.getOrCreateThread(contactId: callerId)
|
||||
self.callService.handleReceivedAnswer(thread: thread, callId: answer.id, sessionDescription: answer.sessionDescription)
|
||||
}
|
||||
|
||||
public func receivedIceUpdate(_ iceUpdate: OWSSignalServiceProtosCallMessageIceUpdate, from callerId: String) {
|
||||
public func receivedIceUpdate(_ iceUpdate: SSKProtoCallMessageIceUpdate, from callerId: String) {
|
||||
SwiftAssertIsOnMainThread(#function)
|
||||
guard iceUpdate.hasId() else {
|
||||
owsFail("no callId in \(#function)")
|
||||
return
|
||||
}
|
||||
|
||||
let thread = TSContactThread.getOrCreateThread(contactId: callerId)
|
||||
|
||||
|
@ -71,23 +59,15 @@ public class WebRTCCallMessageHandler: NSObject, OWSCallMessageHandler {
|
|||
self.callService.handleRemoteAddedIceCandidate(thread: thread, callId: iceUpdate.id, sdp: iceUpdate.sdp, lineIndex: lineIndex, mid: iceUpdate.sdpMid)
|
||||
}
|
||||
|
||||
public func receivedHangup(_ hangup: OWSSignalServiceProtosCallMessageHangup, from callerId: String) {
|
||||
public func receivedHangup(_ hangup: SSKProtoCallMessageHangup, from callerId: String) {
|
||||
SwiftAssertIsOnMainThread(#function)
|
||||
guard hangup.hasId() else {
|
||||
owsFail("no callId in \(#function)")
|
||||
return
|
||||
}
|
||||
|
||||
let thread = TSContactThread.getOrCreateThread(contactId: callerId)
|
||||
self.callService.handleRemoteHangup(thread: thread, callId: hangup.id)
|
||||
}
|
||||
|
||||
public func receivedBusy(_ busy: OWSSignalServiceProtosCallMessageBusy, from callerId: String) {
|
||||
public func receivedBusy(_ busy: SSKProtoCallMessageBusy, from callerId: String) {
|
||||
SwiftAssertIsOnMainThread(#function)
|
||||
guard busy.hasId() else {
|
||||
owsFail("no callId in \(#function)")
|
||||
return
|
||||
}
|
||||
|
||||
let thread = TSContactThread.getOrCreateThread(contactId: callerId)
|
||||
self.callService.handleRemoteBusy(thread: thread, callId: busy.id)
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#import "OWSBackupExportJob.h"
|
||||
#import "OWSBackupIO.h"
|
||||
#import "OWSDatabaseMigration.h"
|
||||
#import "OWSSignalServiceProtos.pb.h"
|
||||
#import "Signal-Swift.h"
|
||||
#import <SignalServiceKit/NSData+Base64.h>
|
||||
#import <SignalServiceKit/NSDate+OWS.h>
|
||||
|
|
|
@ -33,11 +33,11 @@ class SSKProtoEnvelopeTest: XCTestCase {
|
|||
|
||||
func testParse_ValidData() {
|
||||
// `encodedData` was derived thus:
|
||||
// let builder = OWSSignalServiceProtosEnvelopeBuilder()
|
||||
// let builder = SSKProtoEnvelopeBuilder()
|
||||
// builder.setTimestamp(NSDate.ows_millisecondTimeStamp())
|
||||
// builder.setSource("+15551231234")
|
||||
// builder.setSourceDevice(1)
|
||||
// builder.setType(OWSSignalServiceProtosEnvelopeType.ciphertext)
|
||||
// builder.setType(SSKProtoEnvelopeType.ciphertext)
|
||||
// let encodedData = builder.build().data()!.base64EncodedString()
|
||||
let encodedData = "CAESDCsxNTU1MTIzMTIzNCjKm4WazSw4AQ=="
|
||||
let data = Data(base64Encoded: encodedData)!
|
||||
|
@ -47,7 +47,7 @@ class SSKProtoEnvelopeTest: XCTestCase {
|
|||
|
||||
func testParse_invalidData() {
|
||||
// `encodedData` was derived thus:
|
||||
// let builder = OWSSignalServiceProtosEnvelopeBuilder()
|
||||
// let builder = SSKProtoEnvelopeBuilder()
|
||||
// builder.setTimestamp(NSDate.ows_millisecondTimeStamp())
|
||||
// builder.setSource("+15551231234")
|
||||
// builder.setSourceDevice(1)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OWSSignalServiceProtos.pb.h"
|
||||
#import "SSKProto.pb.h"
|
||||
#import <SignalServiceKit/CDSSigningCertificate.h>
|
||||
#import <SignalServiceKit/NSData+Base64.h>
|
||||
#import <SignalServiceKit/NSData+OWS.h>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OWSSignalServiceProtos.pb.h"
|
||||
#import "SSKProto.pb.h"
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
@interface ProtoParsingTest : XCTestCase
|
||||
|
@ -15,14 +15,14 @@
|
|||
|
||||
- (void)testProtoParsing_nil
|
||||
{
|
||||
OWSSignalServiceProtosEnvelope *_Nullable envelope = [OWSSignalServiceProtosEnvelope parseFromData:nil];
|
||||
SSKProtoEnvelope *_Nullable envelope = [SSKProtoEnvelope parseFromData:nil];
|
||||
XCTAssertNotNil(envelope);
|
||||
}
|
||||
|
||||
- (void)testProtoParsing_empty
|
||||
{
|
||||
NSData *data = [NSData new];
|
||||
OWSSignalServiceProtosEnvelope *_Nullable envelope = [OWSSignalServiceProtosEnvelope parseFromData:data];
|
||||
SSKProtoEnvelope *_Nullable envelope = [SSKProtoEnvelope parseFromData:data];
|
||||
XCTAssertNotNil(envelope);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
|||
{
|
||||
@try {
|
||||
NSData *data = [@"test" dataUsingEncoding:NSUTF8StringEncoding];
|
||||
[OWSSignalServiceProtosEnvelope parseFromData:data];
|
||||
[SSKProtoEnvelope parseFromData:data];
|
||||
XCTFail(@"Missing expected exception");
|
||||
} @catch (NSException *exception) {
|
||||
// Exception is expected.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
import SignalServiceKit
|
||||
|
@ -7,23 +7,23 @@ import SignalServiceKit
|
|||
@objc
|
||||
public class NoopCallMessageHandler: NSObject, OWSCallMessageHandler {
|
||||
|
||||
public func receivedOffer(_ offer: OWSSignalServiceProtosCallMessageOffer, from callerId: String) {
|
||||
public func receivedOffer(_ offer: SSKProtoCallMessageOffer, from callerId: String) {
|
||||
owsFail("\(self.logTag) in \(#function).")
|
||||
}
|
||||
|
||||
public func receivedAnswer(_ answer: OWSSignalServiceProtosCallMessageAnswer, from callerId: String) {
|
||||
public func receivedAnswer(_ answer: SSKProtoCallMessageAnswer, from callerId: String) {
|
||||
owsFail("\(self.logTag) in \(#function).")
|
||||
}
|
||||
|
||||
public func receivedIceUpdate(_ iceUpdate: OWSSignalServiceProtosCallMessageIceUpdate, from callerId: String) {
|
||||
public func receivedIceUpdate(_ iceUpdate: SSKProtoCallMessageIceUpdate, from callerId: String) {
|
||||
owsFail("\(self.logTag) in \(#function).")
|
||||
}
|
||||
|
||||
public func receivedHangup(_ hangup: OWSSignalServiceProtosCallMessageHangup, from callerId: String) {
|
||||
public func receivedHangup(_ hangup: SSKProtoCallMessageHangup, from callerId: String) {
|
||||
owsFail("\(self.logTag) in \(#function).")
|
||||
}
|
||||
|
||||
public func receivedBusy(_ busy: OWSSignalServiceProtosCallMessageBusy, from callerId: String) {
|
||||
public func receivedBusy(_ busy: SSKProtoCallMessageBusy, from callerId: String) {
|
||||
owsFail("\(self.logTag) in \(#function).")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ message CallMessage {
|
|||
optional uint64 id = 1;
|
||||
// Signal-iOS renamed the description field to avoid
|
||||
// conflicts with [NSObject description].
|
||||
// @required
|
||||
optional string sessionDescription = 2;
|
||||
}
|
||||
|
||||
|
@ -58,14 +59,18 @@ message CallMessage {
|
|||
optional uint64 id = 1;
|
||||
// Signal-iOS renamed the description field to avoid
|
||||
// conflicts with [NSObject description].
|
||||
// @required
|
||||
optional string sessionDescription = 2;
|
||||
}
|
||||
|
||||
message IceUpdate {
|
||||
// @required
|
||||
optional uint64 id = 1;
|
||||
// @required
|
||||
optional string sdpMid = 2;
|
||||
// @required
|
||||
optional uint32 sdpMLineIndex = 3;
|
||||
// @required
|
||||
optional string sdp = 4;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,6 +80,11 @@ public enum SSKProtoError: Error {
|
|||
proto.content = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoEnvelope? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoEnvelope {
|
||||
let wrapper = try SSKProtoEnvelope.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -138,6 +143,11 @@ public enum SSKProtoError: Error {
|
|||
self.timestamp = timestamp
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -214,6 +224,11 @@ public enum SSKProtoError: Error {
|
|||
proto.receiptMessage = valueParam.proto
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoContent? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoContent {
|
||||
let wrapper = try SSKProtoContent.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -261,6 +276,11 @@ public enum SSKProtoError: Error {
|
|||
self.receiptMessage = receiptMessage
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -331,6 +351,11 @@ public enum SSKProtoError: Error {
|
|||
proto.sessionDescription = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoCallMessageOffer? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoCallMessageOffer {
|
||||
let wrapper = try SSKProtoCallMessageOffer.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -341,20 +366,19 @@ public enum SSKProtoError: Error {
|
|||
|
||||
@objc public let id: UInt64
|
||||
|
||||
@objc public var sessionDescription: String? {
|
||||
guard proto.hasSessionDescription else {
|
||||
return nil
|
||||
}
|
||||
return proto.sessionDescription
|
||||
}
|
||||
@objc public var hasSessionDescription: Bool {
|
||||
return proto.hasSessionDescription
|
||||
}
|
||||
@objc public let sessionDescription: String
|
||||
|
||||
private init(proto: SignalServiceProtos_CallMessage.Offer,
|
||||
id: UInt64) {
|
||||
id: UInt64,
|
||||
sessionDescription: String) {
|
||||
self.proto = proto
|
||||
self.id = id
|
||||
self.sessionDescription = sessionDescription
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
|
@ -373,12 +397,18 @@ public enum SSKProtoError: Error {
|
|||
}
|
||||
let id = proto.id
|
||||
|
||||
guard proto.hasSessionDescription else {
|
||||
throw SSKProtoError.invalidProtobuf(description: "\(logTag) missing required field: sessionDescription")
|
||||
}
|
||||
let sessionDescription = proto.sessionDescription
|
||||
|
||||
// MARK: - Begin Validation Logic for SSKProtoCallMessageOffer -
|
||||
|
||||
// MARK: - End Validation Logic for SSKProtoCallMessageOffer -
|
||||
|
||||
let result = SSKProtoCallMessageOffer(proto: proto,
|
||||
id: id)
|
||||
id: id,
|
||||
sessionDescription: sessionDescription)
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
@ -403,6 +433,11 @@ public enum SSKProtoError: Error {
|
|||
proto.sessionDescription = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoCallMessageAnswer? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoCallMessageAnswer {
|
||||
let wrapper = try SSKProtoCallMessageAnswer.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -413,20 +448,19 @@ public enum SSKProtoError: Error {
|
|||
|
||||
@objc public let id: UInt64
|
||||
|
||||
@objc public var sessionDescription: String? {
|
||||
guard proto.hasSessionDescription else {
|
||||
return nil
|
||||
}
|
||||
return proto.sessionDescription
|
||||
}
|
||||
@objc public var hasSessionDescription: Bool {
|
||||
return proto.hasSessionDescription
|
||||
}
|
||||
@objc public let sessionDescription: String
|
||||
|
||||
private init(proto: SignalServiceProtos_CallMessage.Answer,
|
||||
id: UInt64) {
|
||||
id: UInt64,
|
||||
sessionDescription: String) {
|
||||
self.proto = proto
|
||||
self.id = id
|
||||
self.sessionDescription = sessionDescription
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
|
@ -445,12 +479,18 @@ public enum SSKProtoError: Error {
|
|||
}
|
||||
let id = proto.id
|
||||
|
||||
guard proto.hasSessionDescription else {
|
||||
throw SSKProtoError.invalidProtobuf(description: "\(logTag) missing required field: sessionDescription")
|
||||
}
|
||||
let sessionDescription = proto.sessionDescription
|
||||
|
||||
// MARK: - Begin Validation Logic for SSKProtoCallMessageAnswer -
|
||||
|
||||
// MARK: - End Validation Logic for SSKProtoCallMessageAnswer -
|
||||
|
||||
let result = SSKProtoCallMessageAnswer(proto: proto,
|
||||
id: id)
|
||||
id: id,
|
||||
sessionDescription: sessionDescription)
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
@ -483,6 +523,11 @@ public enum SSKProtoError: Error {
|
|||
proto.sdp = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoCallMessageIceUpdate? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoCallMessageIceUpdate {
|
||||
let wrapper = try SSKProtoCallMessageIceUpdate.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -493,37 +538,27 @@ public enum SSKProtoError: Error {
|
|||
|
||||
@objc public let id: UInt64
|
||||
|
||||
@objc public var sdpMid: String? {
|
||||
guard proto.hasSdpMid else {
|
||||
return nil
|
||||
}
|
||||
return proto.sdpMid
|
||||
}
|
||||
@objc public var hasSdpMid: Bool {
|
||||
return proto.hasSdpMid
|
||||
}
|
||||
@objc public let sdpMid: String
|
||||
|
||||
@objc public var sdpMlineIndex: UInt32 {
|
||||
return proto.sdpMlineIndex
|
||||
}
|
||||
@objc public var hasSdpMlineIndex: Bool {
|
||||
return proto.hasSdpMlineIndex
|
||||
}
|
||||
@objc public let sdpMlineIndex: UInt32
|
||||
|
||||
@objc public var sdp: String? {
|
||||
guard proto.hasSdp else {
|
||||
return nil
|
||||
}
|
||||
return proto.sdp
|
||||
}
|
||||
@objc public var hasSdp: Bool {
|
||||
return proto.hasSdp
|
||||
}
|
||||
@objc public let sdp: String
|
||||
|
||||
private init(proto: SignalServiceProtos_CallMessage.IceUpdate,
|
||||
id: UInt64) {
|
||||
id: UInt64,
|
||||
sdpMid: String,
|
||||
sdpMlineIndex: UInt32,
|
||||
sdp: String) {
|
||||
self.proto = proto
|
||||
self.id = id
|
||||
self.sdpMid = sdpMid
|
||||
self.sdpMlineIndex = sdpMlineIndex
|
||||
self.sdp = sdp
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
|
@ -542,12 +577,30 @@ public enum SSKProtoError: Error {
|
|||
}
|
||||
let id = proto.id
|
||||
|
||||
guard proto.hasSdpMid else {
|
||||
throw SSKProtoError.invalidProtobuf(description: "\(logTag) missing required field: sdpMid")
|
||||
}
|
||||
let sdpMid = proto.sdpMid
|
||||
|
||||
guard proto.hasSdpMlineIndex else {
|
||||
throw SSKProtoError.invalidProtobuf(description: "\(logTag) missing required field: sdpMlineIndex")
|
||||
}
|
||||
let sdpMlineIndex = proto.sdpMlineIndex
|
||||
|
||||
guard proto.hasSdp else {
|
||||
throw SSKProtoError.invalidProtobuf(description: "\(logTag) missing required field: sdp")
|
||||
}
|
||||
let sdp = proto.sdp
|
||||
|
||||
// MARK: - Begin Validation Logic for SSKProtoCallMessageIceUpdate -
|
||||
|
||||
// MARK: - End Validation Logic for SSKProtoCallMessageIceUpdate -
|
||||
|
||||
let result = SSKProtoCallMessageIceUpdate(proto: proto,
|
||||
id: id)
|
||||
id: id,
|
||||
sdpMid: sdpMid,
|
||||
sdpMlineIndex: sdpMlineIndex,
|
||||
sdp: sdp)
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
@ -568,6 +621,11 @@ public enum SSKProtoError: Error {
|
|||
proto.id = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoCallMessageBusy? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoCallMessageBusy {
|
||||
let wrapper = try SSKProtoCallMessageBusy.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -584,6 +642,11 @@ public enum SSKProtoError: Error {
|
|||
self.id = id
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -626,6 +689,11 @@ public enum SSKProtoError: Error {
|
|||
proto.id = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoCallMessageHangup? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoCallMessageHangup {
|
||||
let wrapper = try SSKProtoCallMessageHangup.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -642,6 +710,11 @@ public enum SSKProtoError: Error {
|
|||
self.id = id
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -714,6 +787,11 @@ public enum SSKProtoError: Error {
|
|||
proto.profileKey = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoCallMessage? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoCallMessage {
|
||||
let wrapper = try SSKProtoCallMessage.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -768,6 +846,11 @@ public enum SSKProtoError: Error {
|
|||
self.busy = busy
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -865,6 +948,11 @@ public enum SSKProtoError: Error {
|
|||
proto.flags = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoDataMessageQuoteQuotedAttachment? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoDataMessageQuoteQuotedAttachment {
|
||||
let wrapper = try SSKProtoDataMessageQuoteQuotedAttachment.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -911,6 +999,11 @@ public enum SSKProtoError: Error {
|
|||
self.thumbnail = thumbnail
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -975,6 +1068,11 @@ public enum SSKProtoError: Error {
|
|||
proto.attachments = unwrappedItems
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoDataMessageQuote? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoDataMessageQuote {
|
||||
let wrapper = try SSKProtoDataMessageQuote.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -1009,6 +1107,11 @@ public enum SSKProtoError: Error {
|
|||
self.attachments = attachments
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -1084,6 +1187,11 @@ public enum SSKProtoError: Error {
|
|||
proto.displayName = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoDataMessageContactName? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoDataMessageContactName {
|
||||
let wrapper = try SSKProtoDataMessageContactName.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -1156,6 +1264,11 @@ public enum SSKProtoError: Error {
|
|||
self.proto = proto
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -1227,6 +1340,11 @@ public enum SSKProtoError: Error {
|
|||
proto.label = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoDataMessageContactPhone? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoDataMessageContactPhone {
|
||||
let wrapper = try SSKProtoDataMessageContactPhone.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -1266,6 +1384,11 @@ public enum SSKProtoError: Error {
|
|||
self.proto = proto
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -1337,6 +1460,11 @@ public enum SSKProtoError: Error {
|
|||
proto.label = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoDataMessageContactEmail? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoDataMessageContactEmail {
|
||||
let wrapper = try SSKProtoDataMessageContactEmail.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -1376,6 +1504,11 @@ public enum SSKProtoError: Error {
|
|||
self.proto = proto
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -1468,6 +1601,11 @@ public enum SSKProtoError: Error {
|
|||
proto.country = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoDataMessageContactPostalAddress? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoDataMessageContactPostalAddress {
|
||||
let wrapper = try SSKProtoDataMessageContactPostalAddress.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -1567,6 +1705,11 @@ public enum SSKProtoError: Error {
|
|||
self.proto = proto
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -1607,6 +1750,11 @@ public enum SSKProtoError: Error {
|
|||
proto.isProfile = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoDataMessageContactAvatar? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoDataMessageContactAvatar {
|
||||
let wrapper = try SSKProtoDataMessageContactAvatar.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -1633,6 +1781,11 @@ public enum SSKProtoError: Error {
|
|||
self.avatar = avatar
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -1725,6 +1878,11 @@ public enum SSKProtoError: Error {
|
|||
proto.organization = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoDataMessageContact? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoDataMessageContact {
|
||||
let wrapper = try SSKProtoDataMessageContact.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -1773,6 +1931,11 @@ public enum SSKProtoError: Error {
|
|||
self.avatar = avatar
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -1918,6 +2081,11 @@ public enum SSKProtoError: Error {
|
|||
proto.contact = unwrappedItems
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoDataMessage? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoDataMessage {
|
||||
let wrapper = try SSKProtoDataMessage.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -1993,6 +2161,11 @@ public enum SSKProtoError: Error {
|
|||
self.contact = contact
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -2055,6 +2228,11 @@ public enum SSKProtoError: Error {
|
|||
proto.padding = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoNullMessage? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoNullMessage {
|
||||
let wrapper = try SSKProtoNullMessage.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -2077,6 +2255,11 @@ public enum SSKProtoError: Error {
|
|||
self.proto = proto
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -2148,6 +2331,11 @@ public enum SSKProtoError: Error {
|
|||
proto.timestamp = unwrappedItems
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoReceiptMessage? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoReceiptMessage {
|
||||
let wrapper = try SSKProtoReceiptMessage.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -2168,6 +2356,11 @@ public enum SSKProtoError: Error {
|
|||
self.type = type
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -2246,6 +2439,11 @@ public enum SSKProtoError: Error {
|
|||
proto.nullMessage = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoVerified? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoVerified {
|
||||
let wrapper = try SSKProtoVerified.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -2289,6 +2487,11 @@ public enum SSKProtoError: Error {
|
|||
self.destination = destination
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -2343,6 +2546,11 @@ public enum SSKProtoError: Error {
|
|||
proto.expirationStartTimestamp = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoSyncMessageSent? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoSyncMessageSent {
|
||||
let wrapper = try SSKProtoSyncMessageSent.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -2386,6 +2594,11 @@ public enum SSKProtoError: Error {
|
|||
self.message = message
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -2432,6 +2645,11 @@ public enum SSKProtoError: Error {
|
|||
proto.isComplete = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoSyncMessageContacts? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoSyncMessageContacts {
|
||||
let wrapper = try SSKProtoSyncMessageContacts.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -2455,6 +2673,11 @@ public enum SSKProtoError: Error {
|
|||
self.blob = blob
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -2497,6 +2720,11 @@ public enum SSKProtoError: Error {
|
|||
proto.blob = valueParam.proto
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoSyncMessageGroups? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoSyncMessageGroups {
|
||||
let wrapper = try SSKProtoSyncMessageGroups.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -2516,6 +2744,11 @@ public enum SSKProtoError: Error {
|
|||
self.blob = blob
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -2568,6 +2801,11 @@ public enum SSKProtoError: Error {
|
|||
proto.numbers = unwrappedItems
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoSyncMessageBlocked? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoSyncMessageBlocked {
|
||||
let wrapper = try SSKProtoSyncMessageBlocked.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -2584,6 +2822,11 @@ public enum SSKProtoError: Error {
|
|||
self.proto = proto
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -2650,6 +2893,11 @@ public enum SSKProtoError: Error {
|
|||
proto.type = SSKProtoSyncMessageRequestTypeUnwrap(valueParam)
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoSyncMessageRequest? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoSyncMessageRequest {
|
||||
let wrapper = try SSKProtoSyncMessageRequest.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -2666,6 +2914,11 @@ public enum SSKProtoError: Error {
|
|||
self.type = type
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -2712,6 +2965,11 @@ public enum SSKProtoError: Error {
|
|||
proto.timestamp = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoSyncMessageRead? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoSyncMessageRead {
|
||||
let wrapper = try SSKProtoSyncMessageRead.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -2732,6 +2990,11 @@ public enum SSKProtoError: Error {
|
|||
self.timestamp = timestamp
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -2780,6 +3043,11 @@ public enum SSKProtoError: Error {
|
|||
proto.readReceipts = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoSyncMessageConfiguration? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoSyncMessageConfiguration {
|
||||
let wrapper = try SSKProtoSyncMessageConfiguration.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -2799,6 +3067,11 @@ public enum SSKProtoError: Error {
|
|||
self.proto = proto
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -2877,6 +3150,11 @@ public enum SSKProtoError: Error {
|
|||
proto.padding = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoSyncMessage? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoSyncMessage {
|
||||
let wrapper = try SSKProtoSyncMessage.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -2952,6 +3230,11 @@ public enum SSKProtoError: Error {
|
|||
self.configuration = configuration
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -3091,6 +3374,11 @@ public enum SSKProtoError: Error {
|
|||
proto.height = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoAttachmentPointer? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoAttachmentPointer {
|
||||
let wrapper = try SSKProtoAttachmentPointer.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -3185,6 +3473,11 @@ public enum SSKProtoError: Error {
|
|||
self.id = id
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -3283,6 +3576,11 @@ public enum SSKProtoError: Error {
|
|||
proto.avatar = valueParam.proto
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoGroupContext? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoGroupContext {
|
||||
let wrapper = try SSKProtoGroupContext.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -3324,6 +3622,11 @@ public enum SSKProtoError: Error {
|
|||
self.avatar = avatar
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -3382,6 +3685,11 @@ public enum SSKProtoError: Error {
|
|||
proto.length = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoContactDetailsAvatar? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoContactDetailsAvatar {
|
||||
let wrapper = try SSKProtoContactDetailsAvatar.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -3411,6 +3719,11 @@ public enum SSKProtoError: Error {
|
|||
self.proto = proto
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -3475,6 +3788,11 @@ public enum SSKProtoError: Error {
|
|||
proto.expireTimer = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoContactDetails? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoContactDetails {
|
||||
let wrapper = try SSKProtoContactDetails.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -3549,6 +3867,11 @@ public enum SSKProtoError: Error {
|
|||
self.verified = verified
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -3607,6 +3930,11 @@ public enum SSKProtoError: Error {
|
|||
proto.length = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoGroupDetailsAvatar? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoGroupDetailsAvatar {
|
||||
let wrapper = try SSKProtoGroupDetailsAvatar.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -3636,6 +3964,11 @@ public enum SSKProtoError: Error {
|
|||
self.proto = proto
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
@ -3706,6 +4039,11 @@ public enum SSKProtoError: Error {
|
|||
proto.color = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> SSKProtoGroupDetails? {
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SSKProtoGroupDetails {
|
||||
let wrapper = try SSKProtoGroupDetails.parseProto(proto)
|
||||
return wrapper
|
||||
|
@ -3767,6 +4105,11 @@ public enum SSKProtoError: Error {
|
|||
self.avatar = avatar
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
|
|
|
@ -282,6 +282,7 @@ struct SignalServiceProtos_CallMessage {
|
|||
|
||||
/// Signal-iOS renamed the description field to avoid
|
||||
/// conflicts with [NSObject description].
|
||||
/// @required
|
||||
var sessionDescription: String {
|
||||
get {return _sessionDescription ?? String()}
|
||||
set {_sessionDescription = newValue}
|
||||
|
@ -316,6 +317,7 @@ struct SignalServiceProtos_CallMessage {
|
|||
|
||||
/// Signal-iOS renamed the description field to avoid
|
||||
/// conflicts with [NSObject description].
|
||||
/// @required
|
||||
var sessionDescription: String {
|
||||
get {return _sessionDescription ?? String()}
|
||||
set {_sessionDescription = newValue}
|
||||
|
@ -348,6 +350,7 @@ struct SignalServiceProtos_CallMessage {
|
|||
/// Clears the value of `id`. Subsequent reads from it will return its default value.
|
||||
mutating func clearID() {self._id = nil}
|
||||
|
||||
/// @required
|
||||
var sdpMid: String {
|
||||
get {return _sdpMid ?? String()}
|
||||
set {_sdpMid = newValue}
|
||||
|
@ -357,6 +360,7 @@ struct SignalServiceProtos_CallMessage {
|
|||
/// Clears the value of `sdpMid`. Subsequent reads from it will return its default value.
|
||||
mutating func clearSdpMid() {self._sdpMid = nil}
|
||||
|
||||
/// @required
|
||||
var sdpMlineIndex: UInt32 {
|
||||
get {return _sdpMlineIndex ?? 0}
|
||||
set {_sdpMlineIndex = newValue}
|
||||
|
@ -366,6 +370,7 @@ struct SignalServiceProtos_CallMessage {
|
|||
/// Clears the value of `sdpMlineIndex`. Subsequent reads from it will return its default value.
|
||||
mutating func clearSdpMlineIndex() {self._sdpMlineIndex = nil}
|
||||
|
||||
/// @required
|
||||
var sdp: String {
|
||||
get {return _sdp ?? String()}
|
||||
set {_sdp = newValue}
|
||||
|
|
Loading…
Reference in New Issue