|
|
|
|
@ -8,6 +8,7 @@
|
|
|
|
|
#import "OWSTableViewController.h"
|
|
|
|
|
#import "ThreadUtil.h"
|
|
|
|
|
#import <SignalServiceKit/Cryptography.h>
|
|
|
|
|
#import <SignalServiceKit/NSDate+OWS.h>
|
|
|
|
|
#import <SignalServiceKit/OWSDynamicOutgoingMessage.h>
|
|
|
|
|
#import <SignalServiceKit/SecurityUtils.h>
|
|
|
|
|
#import <SignalServiceKit/TSGroupThread.h>
|
|
|
|
|
@ -48,6 +49,15 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
return [NSData new];
|
|
|
|
|
}];
|
|
|
|
|
}]];
|
|
|
|
|
[items addObject:[OWSTableItem itemWithTitle:@"Send random noise message"
|
|
|
|
|
actionBlock:^{
|
|
|
|
|
[DebugUIStress
|
|
|
|
|
sendStressMessage:thread
|
|
|
|
|
block:^(SignalRecipient *recipient) {
|
|
|
|
|
NSUInteger contentLength = arc4random_uniform(32);
|
|
|
|
|
return [Cryptography generateRandomBytes:contentLength];
|
|
|
|
|
}];
|
|
|
|
|
}]];
|
|
|
|
|
[items addObject:[OWSTableItem itemWithTitle:@"Send no payload message"
|
|
|
|
|
actionBlock:^{
|
|
|
|
|
[DebugUIStress sendStressMessage:thread block:^(SignalRecipient *recipient) {
|
|
|
|
|
@ -64,19 +74,350 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
return [[contentBuilder build] data];
|
|
|
|
|
}];
|
|
|
|
|
}]];
|
|
|
|
|
[items addObject:[OWSTableItem itemWithTitle:@"Send random null message"
|
|
|
|
|
[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];
|
|
|
|
|
OWSSignalServiceProtosNullMessageBuilder *nullMessageBuilder = [OWSSignalServiceProtosNullMessageBuilder new];
|
|
|
|
|
NSUInteger contentLength = arc4random_uniform(32);
|
|
|
|
|
nullMessageBuilder.padding = [Cryptography generateRandomBytes:contentLength];
|
|
|
|
|
contentBuilder.nullMessage = [nullMessageBuilder build];
|
|
|
|
|
// contentBuilder.dataMessage = [self buildDataMessage:recipient.recipientId];
|
|
|
|
|
return [[contentBuilder build] data];
|
|
|
|
|
}];
|
|
|
|
|
[DebugUIStress
|
|
|
|
|
sendStressMessage:thread
|
|
|
|
|
block:^(SignalRecipient *recipient) {
|
|
|
|
|
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
|
|
|
|
[OWSSignalServiceProtosContentBuilder new];
|
|
|
|
|
OWSSignalServiceProtosDataMessageBuilder *dataBuilder =
|
|
|
|
|
[OWSSignalServiceProtosDataMessageBuilder new];
|
|
|
|
|
dataBuilder.body = @" ";
|
|
|
|
|
[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) {
|
|
|
|
|
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 normal text data message"
|
|
|
|
|
actionBlock:^{
|
|
|
|
|
[DebugUIStress
|
|
|
|
|
sendStressMessage:thread
|
|
|
|
|
block:^(SignalRecipient *recipient) {
|
|
|
|
|
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
|
|
|
|
[OWSSignalServiceProtosContentBuilder new];
|
|
|
|
|
OWSSignalServiceProtosDataMessageBuilder *dataBuilder =
|
|
|
|
|
[OWSSignalServiceProtosDataMessageBuilder new];
|
|
|
|
|
dataBuilder.body = @"alice";
|
|
|
|
|
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder
|
|
|
|
|
thread:thread];
|
|
|
|
|
contentBuilder.dataMessage = [dataBuilder build];
|
|
|
|
|
return [[contentBuilder build] data];
|
|
|
|
|
}];
|
|
|
|
|
}]];
|
|
|
|
|
[items addObject:[OWSTableItem itemWithTitle:@"Send N text messages with same timestamp"
|
|
|
|
|
actionBlock:^{
|
|
|
|
|
uint64_t timestamp = [NSDate ows_millisecondTimeStamp];
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
[DebugUIStress
|
|
|
|
|
sendStressMessage:thread
|
|
|
|
|
timestamp:timestamp
|
|
|
|
|
block:^(SignalRecipient *recipient) {
|
|
|
|
|
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
|
|
|
|
[OWSSignalServiceProtosContentBuilder new];
|
|
|
|
|
OWSSignalServiceProtosDataMessageBuilder *dataBuilder =
|
|
|
|
|
[OWSSignalServiceProtosDataMessageBuilder new];
|
|
|
|
|
dataBuilder.body = [NSString stringWithFormat:@"%@ %d",
|
|
|
|
|
[NSUUID UUID].UUIDString,
|
|
|
|
|
i];
|
|
|
|
|
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder
|
|
|
|
|
thread:thread];
|
|
|
|
|
contentBuilder.dataMessage = [dataBuilder build];
|
|
|
|
|
return [[contentBuilder build] data];
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
}]];
|
|
|
|
|
[items addObject:[OWSTableItem
|
|
|
|
|
itemWithTitle:@"Send text message with current timestamp"
|
|
|
|
|
actionBlock:^{
|
|
|
|
|
uint64_t timestamp = [NSDate ows_millisecondTimeStamp];
|
|
|
|
|
[DebugUIStress
|
|
|
|
|
sendStressMessage:thread
|
|
|
|
|
timestamp:timestamp
|
|
|
|
|
block:^(SignalRecipient *recipient) {
|
|
|
|
|
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
|
|
|
|
[OWSSignalServiceProtosContentBuilder new];
|
|
|
|
|
OWSSignalServiceProtosDataMessageBuilder *dataBuilder =
|
|
|
|
|
[OWSSignalServiceProtosDataMessageBuilder new];
|
|
|
|
|
dataBuilder.body =
|
|
|
|
|
[[NSUUID UUID].UUIDString stringByAppendingString:@" now"];
|
|
|
|
|
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder thread:thread];
|
|
|
|
|
contentBuilder.dataMessage = [dataBuilder build];
|
|
|
|
|
return [[contentBuilder build] data];
|
|
|
|
|
}];
|
|
|
|
|
}]];
|
|
|
|
|
[items addObject:[OWSTableItem
|
|
|
|
|
itemWithTitle:@"Send text message with future timestamp"
|
|
|
|
|
actionBlock:^{
|
|
|
|
|
uint64_t timestamp = [NSDate ows_millisecondTimeStamp];
|
|
|
|
|
timestamp += kHourInMs;
|
|
|
|
|
[DebugUIStress
|
|
|
|
|
sendStressMessage:thread
|
|
|
|
|
timestamp:timestamp
|
|
|
|
|
block:^(SignalRecipient *recipient) {
|
|
|
|
|
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
|
|
|
|
[OWSSignalServiceProtosContentBuilder new];
|
|
|
|
|
OWSSignalServiceProtosDataMessageBuilder *dataBuilder =
|
|
|
|
|
[OWSSignalServiceProtosDataMessageBuilder new];
|
|
|
|
|
dataBuilder.body =
|
|
|
|
|
[[NSUUID UUID].UUIDString stringByAppendingString:@" now"];
|
|
|
|
|
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder thread:thread];
|
|
|
|
|
contentBuilder.dataMessage = [dataBuilder build];
|
|
|
|
|
return [[contentBuilder build] data];
|
|
|
|
|
}];
|
|
|
|
|
}]];
|
|
|
|
|
[items addObject:[OWSTableItem
|
|
|
|
|
itemWithTitle:@"Send text message with past timestamp"
|
|
|
|
|
actionBlock:^{
|
|
|
|
|
uint64_t timestamp = [NSDate ows_millisecondTimeStamp];
|
|
|
|
|
timestamp -= kHourInMs;
|
|
|
|
|
[DebugUIStress
|
|
|
|
|
sendStressMessage:thread
|
|
|
|
|
timestamp:timestamp
|
|
|
|
|
block:^(SignalRecipient *recipient) {
|
|
|
|
|
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
|
|
|
|
[OWSSignalServiceProtosContentBuilder new];
|
|
|
|
|
OWSSignalServiceProtosDataMessageBuilder *dataBuilder =
|
|
|
|
|
[OWSSignalServiceProtosDataMessageBuilder new];
|
|
|
|
|
dataBuilder.body =
|
|
|
|
|
[[NSUUID UUID].UUIDString stringByAppendingString:@" now"];
|
|
|
|
|
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder thread:thread];
|
|
|
|
|
contentBuilder.dataMessage = [dataBuilder build];
|
|
|
|
|
return [[contentBuilder build] data];
|
|
|
|
|
}];
|
|
|
|
|
}]];
|
|
|
|
|
[items addObject:[OWSTableItem itemWithTitle:@"Send N text messages with same timestamp"
|
|
|
|
|
actionBlock:^{
|
|
|
|
|
OWSSignalServiceProtosContentBuilder *contentBuilder =
|
|
|
|
|
[OWSSignalServiceProtosContentBuilder new];
|
|
|
|
|
OWSSignalServiceProtosDataMessageBuilder *dataBuilder =
|
|
|
|
|
[OWSSignalServiceProtosDataMessageBuilder new];
|
|
|
|
|
dataBuilder.body = @"alice";
|
|
|
|
|
contentBuilder.dataMessage = [dataBuilder build];
|
|
|
|
|
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder thread:thread];
|
|
|
|
|
NSData *data = [[contentBuilder build] data];
|
|
|
|
|
|
|
|
|
|
uint64_t timestamp = [NSDate ows_millisecondTimeStamp];
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
[DebugUIStress sendStressMessage:thread
|
|
|
|
|
timestamp:timestamp
|
|
|
|
|
block:^(SignalRecipient *recipient) {
|
|
|
|
|
return data;
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
}]];
|
|
|
|
|
[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];
|
|
|
|
|
}];
|
|
|
|
|
}]];
|
|
|
|
|
[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];
|
|
|
|
|
}];
|
|
|
|
|
}]];
|
|
|
|
|
[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];
|
|
|
|
|
}];
|
|
|
|
|
}]];
|
|
|
|
|
[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];
|
|
|
|
|
}];
|
|
|
|
|
}]];
|
|
|
|
|
[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];
|
|
|
|
|
}];
|
|
|
|
|
}]];
|
|
|
|
|
|
|
|
|
|
if ([thread isKindOfClass:[TSGroupThread class]]) {
|
|
|
|
|
TSGroupThread *groupThread = (TSGroupThread *)thread;
|
|
|
|
|
[items addObject:[OWSTableItem itemWithTitle:@"Hallucinate twin group"
|
|
|
|
|
@ -87,6 +428,22 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
return [OWSTableSection sectionWithTitle:self.name items:items];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ (void)ensureGroupOfDataBuilder:(OWSSignalServiceProtosDataMessageBuilder *)dataBuilder thread:(TSThread *)thread
|
|
|
|
|
{
|
|
|
|
|
OWSAssert(dataBuilder);
|
|
|
|
|
OWSAssert(thread);
|
|
|
|
|
|
|
|
|
|
if (![thread isKindOfClass:[TSGroupThread class]]) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TSGroupThread *groupThread = (TSGroupThread *)thread;
|
|
|
|
|
OWSSignalServiceProtosGroupContextBuilder *groupBuilder = [OWSSignalServiceProtosGroupContextBuilder new];
|
|
|
|
|
[groupBuilder setType:OWSSignalServiceProtosGroupContextTypeDeliver];
|
|
|
|
|
[groupBuilder setId:groupThread.groupModel.groupId];
|
|
|
|
|
[dataBuilder setGroup:groupBuilder.build];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ (void)sendStressMessage:(TSOutgoingMessage *)message
|
|
|
|
|
{
|
|
|
|
|
OWSAssert(message);
|
|
|
|
|
@ -106,9 +463,20 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
{
|
|
|
|
|
OWSAssert(thread);
|
|
|
|
|
OWSAssert(block);
|
|
|
|
|
|
|
|
|
|
OWSDynamicOutgoingMessage *message = [[OWSDynamicOutgoingMessage alloc] initWithBlock:block inThread:thread];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OWSDynamicOutgoingMessage *message = [[OWSDynamicOutgoingMessage alloc] initWithBlock:block thread:thread];
|
|
|
|
|
|
|
|
|
|
[self sendStressMessage:message];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ (void)sendStressMessage:(TSThread *)thread timestamp:(uint64_t)timestamp block:(DynamicOutgoingMessageBlock)block
|
|
|
|
|
{
|
|
|
|
|
OWSAssert(thread);
|
|
|
|
|
OWSAssert(block);
|
|
|
|
|
|
|
|
|
|
OWSDynamicOutgoingMessage *message =
|
|
|
|
|
[[OWSDynamicOutgoingMessage alloc] initWithBlock:block timestamp:timestamp thread:thread];
|
|
|
|
|
|
|
|
|
|
[self sendStressMessage:message];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|