Rework and unify the system messages.

// FREEBIE
pull/1/head
Matthew Chen 7 years ago
parent 459c6c6ed4
commit a013a7206e

@ -171,14 +171,6 @@
45C0DC1F1E69011F00E04C47 /* UIStoryboard+OWS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45C0DC1D1E69011F00E04C47 /* UIStoryboard+OWS.swift */; };
45C681B71D305A580050903A /* OWSCall.m in Sources */ = {isa = PBXBuildFile; fileRef = 45C681B61D305A580050903A /* OWSCall.m */; };
45C681B81D305A580050903A /* OWSCall.m in Sources */ = {isa = PBXBuildFile; fileRef = 45C681B61D305A580050903A /* OWSCall.m */; };
45C681BC1D305C080050903A /* OWSCallCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 45C681BA1D305C080050903A /* OWSCallCollectionViewCell.m */; };
45C681BD1D305C080050903A /* OWSCallCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 45C681BA1D305C080050903A /* OWSCallCollectionViewCell.m */; };
45C681C41D305C9E0050903A /* OWSCallCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 45C681C01D305C9E0050903A /* OWSCallCollectionViewCell.xib */; };
45C681C51D305C9E0050903A /* OWSCallCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 45C681C01D305C9E0050903A /* OWSCallCollectionViewCell.xib */; };
45C681C61D305C9E0050903A /* OWSDisplayedMessageCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 45C681C21D305C9E0050903A /* OWSDisplayedMessageCollectionViewCell.m */; };
45C681C71D305C9E0050903A /* OWSDisplayedMessageCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 45C681C21D305C9E0050903A /* OWSDisplayedMessageCollectionViewCell.m */; };
45C681C81D305C9E0050903A /* OWSDisplayedMessageCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 45C681C31D305C9E0050903A /* OWSDisplayedMessageCollectionViewCell.xib */; };
45C681C91D305C9E0050903A /* OWSDisplayedMessageCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 45C681C31D305C9E0050903A /* OWSDisplayedMessageCollectionViewCell.xib */; };
45C9DEB81DF4E35A0065CA84 /* WebRTCCallMessageHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45C9DEB71DF4E35A0065CA84 /* WebRTCCallMessageHandler.swift */; };
45C9DEB91DF4E35A0065CA84 /* WebRTCCallMessageHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45C9DEB71DF4E35A0065CA84 /* WebRTCCallMessageHandler.swift */; };
45CB2FA81CB7146C00E1B343 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 45CB2FA71CB7146C00E1B343 /* Launch Screen.storyboard */; };
@ -598,12 +590,6 @@
45C0DC1D1E69011F00E04C47 /* UIStoryboard+OWS.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIStoryboard+OWS.swift"; sourceTree = "<group>"; };
45C681B51D305A580050903A /* OWSCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSCall.h; sourceTree = "<group>"; };
45C681B61D305A580050903A /* OWSCall.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSCall.m; sourceTree = "<group>"; };
45C681B91D305C080050903A /* OWSCallCollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSCallCollectionViewCell.h; sourceTree = "<group>"; };
45C681BA1D305C080050903A /* OWSCallCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSCallCollectionViewCell.m; sourceTree = "<group>"; };
45C681C01D305C9E0050903A /* OWSCallCollectionViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = OWSCallCollectionViewCell.xib; sourceTree = "<group>"; };
45C681C11D305C9E0050903A /* OWSDisplayedMessageCollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSDisplayedMessageCollectionViewCell.h; sourceTree = "<group>"; };
45C681C21D305C9E0050903A /* OWSDisplayedMessageCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSDisplayedMessageCollectionViewCell.m; sourceTree = "<group>"; };
45C681C31D305C9E0050903A /* OWSDisplayedMessageCollectionViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = OWSDisplayedMessageCollectionViewCell.xib; sourceTree = "<group>"; };
45C9DEB71DF4E35A0065CA84 /* WebRTCCallMessageHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebRTCCallMessageHandler.swift; sourceTree = "<group>"; };
45CB2FA71CB7146C00E1B343 /* Launch Screen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = "Launch Screen.storyboard"; path = "Signal/src/util/Launch Screen.storyboard"; sourceTree = SOURCE_ROOT; };
45CD81EE1DC030E7004C9430 /* AccountManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountManager.swift; sourceTree = "<group>"; };
@ -1373,14 +1359,8 @@
3453D8E91EC0D4ED003F9E6F /* OWSAlerts.swift */,
34F308A01ECB469700BB7697 /* OWSBezierPathView.h */,
34F308A11ECB469700BB7697 /* OWSBezierPathView.m */,
45C681B91D305C080050903A /* OWSCallCollectionViewCell.h */,
45C681BA1D305C080050903A /* OWSCallCollectionViewCell.m */,
45C681C01D305C9E0050903A /* OWSCallCollectionViewCell.xib */,
459311FA1D75C948008DD4F0 /* OWSDeviceTableViewCell.h */,
459311FB1D75C948008DD4F0 /* OWSDeviceTableViewCell.m */,
45C681C11D305C9E0050903A /* OWSDisplayedMessageCollectionViewCell.h */,
45C681C21D305C9E0050903A /* OWSDisplayedMessageCollectionViewCell.m */,
45C681C31D305C9E0050903A /* OWSDisplayedMessageCollectionViewCell.xib */,
450873C91D9D86F4006B54F2 /* OWSExpirableMessageView.h */,
450873C11D9D5149006B54F2 /* OWSExpirationTimerView.h */,
450873C21D9D5149006B54F2 /* OWSExpirationTimerView.m */,
@ -1868,7 +1848,6 @@
45F2B1971D9CA207000D2C69 /* OWSIncomingMessageCollectionViewCell.xib in Resources */,
AD83FF421A73426500B5C81A /* audio_play_button.png in Resources */,
45F2B1981D9CA207000D2C69 /* OWSOutgoingMessageCollectionViewCell.xib in Resources */,
45C681C41D305C9E0050903A /* OWSCallCollectionViewCell.xib in Resources */,
34330A5C1E787A9800DF2FB9 /* dripicons-v2.ttf in Resources */,
B633C5C41A1D190B0059AC12 /* mute_on@2x.png in Resources */,
B633C5CE1A1D190B0059AC12 /* quit@2x.png in Resources */,
@ -1878,7 +1857,6 @@
B633C59D1A1D190B0059AC12 /* endcall@2x.png in Resources */,
FC5CDF391A3393DD00B47253 /* error_white@2x.png in Resources */,
B633C5D21A1D190B0059AC12 /* savephoto@2x.png in Resources */,
45C681C81D305C9E0050903A /* OWSDisplayedMessageCollectionViewCell.xib in Resources */,
3448BFD11EDF0EA7005B2D69 /* MessagesViewController.xib in Resources */,
B10C9B611A7049EC00ECA2BF /* play_icon.png in Resources */,
AD83FF401A73426500B5C81A /* audio_pause_button_blue@2x.png in Resources */,
@ -1920,8 +1898,6 @@
buildActionMask = 2147483647;
files = (
B660F6D41C29868000687D6E /* whisperFake.cer in Resources */,
45C681C91D305C9E0050903A /* OWSDisplayedMessageCollectionViewCell.xib in Resources */,
45C681C51D305C9E0050903A /* OWSCallCollectionViewCell.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -2148,7 +2124,6 @@
3472229F1EB22FFE00E53955 /* AddToGroupViewController.m in Sources */,
45666F561D9B2827008FE134 /* OWSScrubbingLogFormatter.m in Sources */,
45C0DC1E1E69011F00E04C47 /* UIStoryboard+OWS.swift in Sources */,
45C681C61D305C9E0050903A /* OWSDisplayedMessageCollectionViewCell.m in Sources */,
34F3089F1ECA580B00BB7697 /* OWSUnreadIndicatorCell.m in Sources */,
34B3F8861E8DF1700035BE1A /* NotificationSettingsOptionsViewController.m in Sources */,
459B1C671ED480BB00506A04 /* MarkIdentityAsSeenJob.swift in Sources */,
@ -2235,7 +2210,6 @@
45666F7E1D9C0814008FE134 /* OWSDatabaseMigrationRunner.m in Sources */,
4579431E1E7C8CE9008ED0C0 /* Pastelog.m in Sources */,
34B3F8941E8DF1710035BE1A /* SignalsViewController.m in Sources */,
45C681BC1D305C080050903A /* OWSCallCollectionViewCell.m in Sources */,
76EB058818170B33006006FC /* PropertyListPreferences.m in Sources */,
34330A611E788EA900DF2FB9 /* AttachmentUploadView.m in Sources */,
34B3F87D1E8DF1700035BE1A /* FullImageViewController.m in Sources */,
@ -2277,13 +2251,11 @@
458E383A1D6699FA0094BD24 /* OWSDeviceProvisioningURLParserTest.m in Sources */,
452D1EE81DCA90D100A57EC4 /* MesssagesBubblesSizeCalculatorTest.swift in Sources */,
45BFFFA91D898AF0004A12A7 /* OWSStaleNotificationObserver.m in Sources */,
45C681C71D305C9E0050903A /* OWSDisplayedMessageCollectionViewCell.m in Sources */,
451DE9FE1DC1A28200810E42 /* SyncPushTokensJob.swift in Sources */,
45F170AF1E2F0393003FC1F2 /* CallAudioSessionTest.swift in Sources */,
34B3F8991E8DF1B90035BE1A /* TSMessageAdapterTest.m in Sources */,
456F6E231E24133500FD2210 /* Platform.swift in Sources */,
45843D201D2236B30013E85A /* OWSContactsSearcher.m in Sources */,
45C681BD1D305C080050903A /* OWSCallCollectionViewCell.m in Sources */,
45AE48521E0732D6004D96C2 /* TurnServerInfo.swift in Sources */,
450873C41D9D5149006B54F2 /* OWSExpirationTimerView.m in Sources */,
453D28BB1D332DB100D523F0 /* OWSMessagesBubblesSizeCalculator.m in Sources */,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 50 KiB

@ -4,7 +4,6 @@
#import "OWSMessagesBubblesSizeCalculator.h"
#import "OWSCall.h"
#import "OWSDisplayedMessageCollectionViewCell.h"
#import "OWSSystemMessageCell.h"
#import "OWSUnreadIndicatorCell.h"
#import "TSGenericAttachmentAdapter.h"

@ -16,12 +16,10 @@
#import "NewGroupViewController.h"
#import "OWSAudioAttachmentPlayer.h"
#import "OWSCall.h"
#import "OWSCallCollectionViewCell.h"
#import "OWSContactsManager.h"
#import "OWSConversationSettingsTableViewController.h"
#import "OWSConversationSettingsViewDelegate.h"
#import "OWSDisappearingMessagesJob.h"
#import "OWSDisplayedMessageCollectionViewCell.h"
#import "OWSExpirableMessageView.h"
#import "OWSIncomingMessageCollectionViewCell.h"
#import "OWSMessageCollectionViewCell.h"
@ -421,18 +419,12 @@ typedef enum : NSUInteger {
- (void)registerCustomMessageNibs
{
[self.collectionView registerNib:[OWSCallCollectionViewCell nib]
forCellWithReuseIdentifier:[OWSCallCollectionViewCell cellReuseIdentifier]];
[self.collectionView registerClass:[OWSSystemMessageCell class]
forCellWithReuseIdentifier:[OWSSystemMessageCell cellReuseIdentifier]];
[self.collectionView registerClass:[OWSUnreadIndicatorCell class]
forCellWithReuseIdentifier:[OWSUnreadIndicatorCell cellReuseIdentifier]];
[self.collectionView registerNib:[OWSDisplayedMessageCollectionViewCell nib]
forCellWithReuseIdentifier:[OWSDisplayedMessageCollectionViewCell cellReuseIdentifier]];
self.outgoingCellIdentifier = [OWSOutgoingMessageCollectionViewCell cellReuseIdentifier];
[self.collectionView registerNib:[OWSOutgoingMessageCollectionViewCell nib]
forCellWithReuseIdentifier:[OWSOutgoingMessageCollectionViewCell cellReuseIdentifier]];
@ -1460,8 +1452,6 @@ typedef enum : NSUInteger {
JSQMessagesCollectionViewCell *cell;
switch (message.messageType) {
case TSCallAdapter: {
// OWSCall *call = (OWSCall *)message;
// cell = [self loadCallCellForCall:call atIndexPath:indexPath];
cell = [self loadSystemMessageCell:indexPath interaction:message.interaction];
break;
}
@ -1575,53 +1565,6 @@ typedef enum : NSUInteger {
return cell;
}
//- (OWSCallCollectionViewCell *)loadCallCellForCall:(OWSCall *)call atIndexPath:(NSIndexPath *)indexPath
//{
// OWSCallCollectionViewCell *callCell =
// [self.collectionView dequeueReusableCellWithReuseIdentifier:[OWSCallCollectionViewCell cellReuseIdentifier]
// forIndexPath:indexPath];
//
// NSString *text = call.date != nil ? [call text] : call.senderDisplayName;
// NSString *allText = call.date != nil ? [text stringByAppendingString:[call dateText]] : text;
//
// UIFont *boldFont = [UIFont fontWithName:@"HelveticaNeue-Medium" size:12.0f];
// NSMutableAttributedString *attributedText =
// [[NSMutableAttributedString alloc] initWithString:allText attributes:@{ NSFontAttributeName : boldFont }];
// if ([call date] != nil) {
// // Not a group meta message
// UIFont *regularFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:12.0f];
// const NSRange range = NSMakeRange([text length], [[call dateText] length]);
// [attributedText setAttributes:@{ NSFontAttributeName : regularFont } range:range];
// }
// callCell.textView.text = nil;
// callCell.textView.attributedText = attributedText;
//
// callCell.textView.textAlignment = NSTextAlignmentCenter;
// callCell.textView.textColor = [UIColor ows_materialBlueColor];
// callCell.layer.shouldRasterize = YES;
// callCell.layer.rasterizationScale = [UIScreen mainScreen].scale;
//
// // Disable text selectability. Specifying this in prepareForReuse/awakeFromNib was not sufficient.
// callCell.textView.userInteractionEnabled = NO;
// callCell.textView.selectable = NO;
//
// return callCell;
//}
- (OWSDisplayedMessageCollectionViewCell *)loadDisplayedMessageCollectionViewCellForIndexPath:(NSIndexPath *)indexPath
{
OWSDisplayedMessageCollectionViewCell *messageCell = [self.collectionView
dequeueReusableCellWithReuseIdentifier:[OWSDisplayedMessageCollectionViewCell cellReuseIdentifier]
forIndexPath:indexPath];
messageCell.layer.shouldRasterize = YES;
messageCell.layer.rasterizationScale = [UIScreen mainScreen].scale;
messageCell.textView.textColor = [UIColor darkGrayColor];
messageCell.cellTopLabel.attributedText = [self.collectionView.dataSource collectionView:self.collectionView
attributedTextForCellTopLabelAtIndexPath:indexPath];
return messageCell;
}
//- (OWSDisplayedMessageCollectionViewCell *)loadInfoMessageCellForMessage:(TSMessageAdapter *)infoMessage
// atIndexPath:(NSIndexPath *)indexPath
//{
@ -1653,47 +1596,10 @@ typedef enum : NSUInteger {
// return infoCell;
//}
//- (OWSSystemMessageCell *)loadErrorMessageCell:(NSIndexPath *)indexPath interaction:(TSInteraction *)interaction
//// ForMessage:(TSMessageAdapter *)errorMessage
//// atIndexPath:(NSIndexPath *)indexPath
//{
// OWSAssert(indexPath);
// OWSAssert(interaction);
// // OWSAssert([interaction isKindOfClass:[TSUnreadIndicatorInteraction class]]);
//
// // TSUnreadIndicatorInteraction *unreadIndicator = (TSUnreadIndicatorInteraction *)interaction;
//
// OWSSystemMessageCell *cell =
// [self.collectionView dequeueReusableCellWithReuseIdentifier:[OWSSystemMessageCell cellReuseIdentifier]
// forIndexPath:indexPath];
// cell.interaction = interaction;
// [cell configure];
//
// return cell;
//
// // OWSDisplayedMessageCollectionViewCell *errorCell =
// // [self loadDisplayedMessageCollectionViewCellForIndexPath:indexPath];
// // errorCell.textView.text = [errorMessage text];
// //
// // // Disable text selectability. Specifying this in prepareForReuse/awakeFromNib was not sufficient.
// // errorCell.textView.userInteractionEnabled = NO;
// // errorCell.textView.selectable = NO;
// //
// // errorCell.messageBubbleContainerView.layer.borderColor = [[UIColor ows_errorMessageBorderColor] CGColor];
// // errorCell.headerImageView.image = [UIImage imageNamed:@"error_white"];
// //
// // return errorCell;
//}
- (OWSSystemMessageCell *)loadSystemMessageCell:(NSIndexPath *)indexPath interaction:(TSInteraction *)interaction
// ForMessage:(TSMessageAdapter *)errorMessage
// atIndexPath:(NSIndexPath *)indexPath
{
OWSAssert(indexPath);
OWSAssert(interaction);
// OWSAssert([interaction isKindOfClass:[TSUnreadIndicatorInteraction class]]);
// TSUnreadIndicatorInteraction *unreadIndicator = (TSUnreadIndicatorInteraction *)interaction;
OWSSystemMessageCell *cell =
[self.collectionView dequeueReusableCellWithReuseIdentifier:[OWSSystemMessageCell cellReuseIdentifier]
@ -1702,19 +1608,6 @@ typedef enum : NSUInteger {
[cell configure];
return cell;
// OWSDisplayedMessageCollectionViewCell *errorCell =
// [self loadDisplayedMessageCollectionViewCellForIndexPath:indexPath];
// errorCell.textView.text = [errorMessage text];
//
// // Disable text selectability. Specifying this in prepareForReuse/awakeFromNib was not sufficient.
// errorCell.textView.userInteractionEnabled = NO;
// errorCell.textView.selectable = NO;
//
// errorCell.messageBubbleContainerView.layer.borderColor = [[UIColor ows_errorMessageBorderColor] CGColor];
// errorCell.headerImageView.image = [UIImage imageNamed:@"error_white"];
//
// return errorCell;
}
#pragma mark - Adjusting cell label heights

@ -40,10 +40,6 @@ NS_ASSUME_NONNULL_BEGIN
return [OWSTableSection
sectionWithTitle:@"Messages"
items:@[
[OWSTableItem itemWithTitle:@"Create all system messages"
actionBlock:^{
[DebugUIMessages createSystemMessagesInThread:thread];
}],
[OWSTableItem itemWithTitle:@"Send 10 messages (1/sec.)"
actionBlock:^{
[DebugUIMessages sendTextMessage:10 thread:thread];
@ -126,22 +122,60 @@ NS_ASSUME_NONNULL_BEGIN
actionBlock:^{
[DebugUIMessages sendMediaAttachments:100 thread:thread];
}],
[OWSTableItem itemWithTitle:@"Create all system messages"
actionBlock:^{
[DebugUIMessages createSystemMessagesInThread:thread];
}],
[OWSTableItem itemWithTitle:@"Send 10 text and system messages"
actionBlock:^{
[DebugUIMessages sendTextAndSystemMessages:10 thread:thread];
}],
[OWSTableItem itemWithTitle:@"Send 100 text and system messages"
actionBlock:^{
[DebugUIMessages sendTextAndSystemMessages:100 thread:thread];
}],
[OWSTableItem itemWithTitle:@"Send 1,000 text and system messages"
actionBlock:^{
[DebugUIMessages sendTextAndSystemMessages:1000 thread:thread];
}],
]];
}
+ (void)sendTextMessage:(int)counter thread:(TSThread *)thread
+ (void)sendTextMessageInThread:(TSThread *)thread counter:(int)counter
{
NSArray<NSString *> *randomTexts = @[
@"Lorem ipsum dolor sit amet, consectetur adipiscing elit. ",
@"Lorem ipsum dolor sit amet, consectetur adipiscing elit. "
@"Suspendisse rutrum, nulla vitae pretium hendrerit, tellus "
@"turpis pharetra libero, vitae sodales tortor ante vel sem.",
@"In a time of universal deceit - telling the truth is a revolutionary act.",
@"If you want a vision of the future, imagine a boot stamping on a human face - forever.",
@"Who controls the past controls the future. Who controls the present controls the past.",
@"All animals are equal, but some animals are more equal than others.",
@"War is peace. Freedom is slavery. Ignorance is strength.",
@"All the war-propaganda, all the screaming and lies and hatred, comes invariably from people who are not "
@"fighting.",
@"Political language. . . is designed to make lies sound truthful and murder respectable, and to give an "
@"appearance of solidity to pure wind.",
@"The nationalist not only does not disapprove of atrocities committed by his own side, but he has a "
@"remarkable capacity for not even hearing about them.",
@"Every generation imagines itself to be more intelligent than the one that went before it, and wiser than the "
@"one that comes after it.",
@"War against a foreign country only happens when the moneyed classes think they are going to profit from it.",
];
NSString *randomText = randomTexts[(NSUInteger)arc4random_uniform((uint32_t)randomTexts.count)];
NSString *text = [[[@(counter) description] stringByAppendingString:@" "] stringByAppendingString:randomText];
OWSMessageSender *messageSender = [Environment getCurrent].messageSender;
[ThreadUtil sendMessageWithText:text inThread:thread messageSender:messageSender];
}
+ (void)sendTextMessage:(int)counter thread:(TSThread *)thread
{
if (counter < 1) {
return;
}
[ThreadUtil
sendMessageWithText:[[@(counter) description]
stringByAppendingString:@" Lorem ipsum dolor sit amet, consectetur adipiscing elit. "
@"Suspendisse rutrum, nulla vitae pretium hendrerit, tellus "
@"turpis pharetra libero, vitae sodales tortor ante vel sem."]
inThread:thread
messageSender:messageSender];
[self sendTextMessageInThread:thread counter:counter];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)1.f * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
[self sendTextMessage:counter - 1 thread:thread];
});
@ -518,35 +552,37 @@ NS_ASSUME_NONNULL_BEGIN
return [builder build];
}
+ (void)createSystemMessagesInThread:(TSThread *)thread
+ (NSArray<TSInteraction *> *)unsavedSystemMessagesInThread:(TSThread *)thread
{
OWSAssert(thread);
NSMutableArray<TSInteraction *> *result = [NSMutableArray new];
[[TSStorageManager sharedManager].dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
if ([thread isKindOfClass:[TSContactThread class]]) {
TSContactThread *contactThread = (TSContactThread *)thread;
[[[TSCall alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
withCallNumber:@"+19174054215"
callType:RPRecentCallTypeIncoming
inThread:contactThread] saveWithTransaction:transaction];
[[[TSCall alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
withCallNumber:@"+19174054215"
callType:RPRecentCallTypeOutgoing
inThread:contactThread] saveWithTransaction:transaction];
[[[TSCall alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
withCallNumber:@"+19174054215"
callType:RPRecentCallTypeMissed
inThread:contactThread] saveWithTransaction:transaction];
[[[TSCall alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
withCallNumber:@"+19174054215"
callType:RPRecentCallTypeOutgoingIncomplete
inThread:contactThread] saveWithTransaction:transaction];
[[[TSCall alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
withCallNumber:@"+19174054215"
callType:RPRecentCallTypeIncomingIncomplete
inThread:contactThread] saveWithTransaction:transaction];
[result addObject:[[TSCall alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
withCallNumber:@"+19174054215"
callType:RPRecentCallTypeIncoming
inThread:contactThread]];
[result addObject:[[TSCall alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
withCallNumber:@"+19174054215"
callType:RPRecentCallTypeOutgoing
inThread:contactThread]];
[result addObject:[[TSCall alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
withCallNumber:@"+19174054215"
callType:RPRecentCallTypeMissed
inThread:contactThread]];
[result addObject:[[TSCall alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
withCallNumber:@"+19174054215"
callType:RPRecentCallTypeOutgoingIncomplete
inThread:contactThread]];
[result addObject:[[TSCall alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
withCallNumber:@"+19174054215"
callType:RPRecentCallTypeIncomingIncomplete
inThread:contactThread]];
}
{
@ -555,11 +591,11 @@ NS_ASSUME_NONNULL_BEGIN
[[OWSDisappearingMessagesConfiguration alloc] initWithThreadId:thread.uniqueId
enabled:YES
durationSeconds:(uint32_t)[durationSeconds intValue]];
[[[OWSDisappearingConfigurationUpdateInfoMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
thread:thread
configuration:disappearingMessagesConfiguration
createdByRemoteName:@"Alice"]
saveWithTransaction:transaction];
[result addObject:[[OWSDisappearingConfigurationUpdateInfoMessage alloc]
initWithTimestamp:[NSDate ows_millisecondTimeStamp]
thread:thread
configuration:disappearingMessagesConfiguration
createdByRemoteName:@"Alice"]];
}
{
NSNumber *durationSeconds = [[OWSDisappearingMessagesConfiguration validDurationsSeconds] lastObject];
@ -567,54 +603,54 @@ NS_ASSUME_NONNULL_BEGIN
[[OWSDisappearingMessagesConfiguration alloc] initWithThreadId:thread.uniqueId
enabled:YES
durationSeconds:(uint32_t)[durationSeconds intValue]];
[[[OWSDisappearingConfigurationUpdateInfoMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
thread:thread
configuration:disappearingMessagesConfiguration
createdByRemoteName:@"Alice"]
saveWithTransaction:transaction];
[result addObject:[[OWSDisappearingConfigurationUpdateInfoMessage alloc]
initWithTimestamp:[NSDate ows_millisecondTimeStamp]
thread:thread
configuration:disappearingMessagesConfiguration
createdByRemoteName:@"Alice"]];
}
{
OWSDisappearingMessagesConfiguration *disappearingMessagesConfiguration =
[[OWSDisappearingMessagesConfiguration alloc] initWithThreadId:thread.uniqueId
enabled:NO
durationSeconds:0];
[[[OWSDisappearingConfigurationUpdateInfoMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
thread:thread
configuration:disappearingMessagesConfiguration
createdByRemoteName:@"Alice"]
saveWithTransaction:transaction];
[result addObject:[[OWSDisappearingConfigurationUpdateInfoMessage alloc]
initWithTimestamp:[NSDate ows_millisecondTimeStamp]
thread:thread
configuration:disappearingMessagesConfiguration
createdByRemoteName:@"Alice"]];
}
[[TSInfoMessage userNotRegisteredMessageInThread:thread] saveWithTransaction:transaction];
[result addObject:[TSInfoMessage userNotRegisteredMessageInThread:thread]];
[[[TSInfoMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:thread
messageType:TSInfoMessageTypeSessionDidEnd] saveWithTransaction:transaction];
[result addObject:[[TSInfoMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:thread
messageType:TSInfoMessageTypeSessionDidEnd]];
// TODO: customMessage?
[[[TSInfoMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:thread
messageType:TSInfoMessageTypeGroupUpdate] saveWithTransaction:transaction];
[result addObject:[[TSInfoMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:thread
messageType:TSInfoMessageTypeGroupUpdate]];
// TODO: customMessage?
[[[TSInfoMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:thread
messageType:TSInfoMessageTypeGroupQuit] saveWithTransaction:transaction];
[[TSErrorMessage missingSessionWithEnvelope:[self createEnvelopeForThread:thread] withTransaction:transaction]
saveWithTransaction:transaction];
[[TSErrorMessage invalidKeyExceptionWithEnvelope:[self createEnvelopeForThread:thread]
withTransaction:transaction] saveWithTransaction:transaction];
[[TSErrorMessage invalidVersionWithEnvelope:[self createEnvelopeForThread:thread] withTransaction:transaction]
saveWithTransaction:transaction];
[[TSInvalidIdentityKeyReceivingErrorMessage untrustedKeyWithEnvelope:[self createEnvelopeForThread:thread]
withTransaction:transaction]
saveWithTransaction:transaction];
[[TSErrorMessage corruptedMessageWithEnvelope:[self createEnvelopeForThread:thread] withTransaction:transaction]
saveWithTransaction:transaction];
[[[TSErrorMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:thread
failedMessageType:TSErrorMessageNonBlockingIdentityChange
recipientId:@"+19174054215"] saveWithTransaction:transaction];
[result addObject:[[TSInfoMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:thread
messageType:TSInfoMessageTypeGroupQuit]];
[result addObject:[TSErrorMessage missingSessionWithEnvelope:[self createEnvelopeForThread:thread]
withTransaction:transaction]];
[result addObject:[TSErrorMessage invalidKeyExceptionWithEnvelope:[self createEnvelopeForThread:thread]
withTransaction:transaction]];
[result addObject:[TSErrorMessage invalidVersionWithEnvelope:[self createEnvelopeForThread:thread]
withTransaction:transaction]];
[result addObject:[TSInvalidIdentityKeyReceivingErrorMessage
untrustedKeyWithEnvelope:[self createEnvelopeForThread:thread]
withTransaction:transaction]];
[result addObject:[TSErrorMessage corruptedMessageWithEnvelope:[self createEnvelopeForThread:thread]
withTransaction:transaction]];
[result addObject:[[TSErrorMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:thread
failedMessageType:TSErrorMessageNonBlockingIdentityChange
recipientId:@"+19174054215"]];
}];
@ -635,11 +671,51 @@ NS_ASSUME_NONNULL_BEGIN
signedPreKeyId:0
signedPreKeySignature:[self createRandomNSDataOfSize:16]
identityKey:[self createRandomNSDataOfSize:16]];
[[TSInvalidIdentityKeySendingErrorMessage untrustedKeyWithOutgoingMessage:outgoingMessage
inThread:thread
forRecipient:@"+19174054215"
preKeyBundle:preKeyBundle] save];
[result addObject:[TSInvalidIdentityKeySendingErrorMessage untrustedKeyWithOutgoingMessage:outgoingMessage
inThread:thread
forRecipient:@"+19174054215"
preKeyBundle:preKeyBundle]];
}
return result;
}
+ (void)createSystemMessagesInThread:(TSThread *)thread
{
OWSAssert(thread);
NSArray<TSInteraction *> *messages = [self unsavedSystemMessagesInThread:thread];
[[TSStorageManager sharedManager].dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
for (TSInteraction *message in messages) {
[message saveWithTransaction:transaction];
}
}];
}
+ (void)createSystemMessageInThread:(TSThread *)thread
{
OWSAssert(thread);
NSArray<TSInteraction *> *messages = [self unsavedSystemMessagesInThread:thread];
TSInteraction *message = messages[(NSUInteger)arc4random_uniform((uint32_t)messages.count)];
[[TSStorageManager sharedManager].dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
[message saveWithTransaction:transaction];
}];
}
+ (void)sendTextAndSystemMessages:(int)counter thread:(TSThread *)thread
{
if (counter < 1) {
return;
}
if (arc4random_uniform(2) == 0) {
[self sendTextMessageInThread:thread counter:counter];
} else {
[self createSystemMessageInThread:thread];
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)1.f * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
[self sendTextAndSystemMessages:counter - 1 thread:thread];
});
}
@end

@ -21,8 +21,6 @@
@property (nonatomic) SystemSoundID newMessageSound;
@property (nonatomic, readonly) NSMutableDictionary<NSString *, UILocalNotification *> *currentNotifications;
@property (nonatomic, readonly) NotificationType notificationPreviewType;
//@property (nonatomic, readonly) NSMutableArray *recentErrorTimestamps;
//@property (nonatomic, readonly) NSMutableArray *recentIncomingMessageTimestamps;
@end
@ -38,8 +36,6 @@
}
_currentNotifications = [NSMutableDictionary new];
// _recentErrorTimestamps = [NSMutableArray new];
// _recentIncomingMessageTimestamps = [NSMutableArray new];
NSURL *newMessageURL = [[NSBundle mainBundle] URLForResource:@"NewMessage" withExtension:@"aifc"];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)newMessageURL, &_newMessageSound);
@ -262,18 +258,6 @@
}
}
//- (BOOL)addNotificationTimestamp:(NSMutableArray *)timestamps
//{
// OWSAssert(timestamps);
//
// [timestamps addObject:[NSDate date]];
//
// // Cull old timestamps.
// const CGFloat kThrottlingDuration = 5.f;
//}
//_recentErrorTimestamps = [NSMutableArray new];
//_recentIncomingMessageTimestamps = [NSMutableArray new];
#pragma mark - Util
- (NotificationType)notificationPreviewType

@ -1,18 +0,0 @@
// Created by Dylan Bourgeois on 20/11/14.
// Portions Copyright (c) 2014 Open Whisper Systems. All rights reserved.
#import <UIKit/UIKit.h>
#import <JSQMessagesViewController/JSQMessagesCollectionViewCell.h>
@interface OWSCallCollectionViewCell : JSQMessagesCollectionViewCell
@property (weak, nonatomic, readonly) JSQMessagesLabel *cellLabel;
@property (weak, nonatomic, readonly) UIImageView *outgoingCallImageView;
@property (weak, nonatomic, readonly) UIImageView *incomingCallImageView;
#pragma mark - Class methods
+ (UINib *)nib;
+ (NSString *)cellReuseIdentifier;
@end

@ -1,51 +0,0 @@
// Created by Dylan Bourgeois on 20/11/14.
// Portions Copyright (c) 2014 Open Whisper Systems. All rights reserved.
#import "OWSCallCollectionViewCell.h"
#import "UIColor+OWS.h"
#import <JSQMessagesViewController/JSQMessagesCollectionViewLayoutAttributes.h>
#import <JSQMessagesViewController/UIView+JSQMessages.h>
@interface OWSCallCollectionViewCell ()
@property (weak, nonatomic) IBOutlet JSQMessagesLabel *cellLabel;
@property (weak, nonatomic) IBOutlet UIImageView *outgoingCallImageView;
@property (weak, nonatomic) IBOutlet UIImageView *incomingCallImageView;
@end
@implementation OWSCallCollectionViewCell
#pragma mark - Class Methods
+ (UINib *)nib
{
return [UINib nibWithNibName:NSStringFromClass([self class]) bundle:[NSBundle mainBundle]];
}
+ (NSString *)cellReuseIdentifier
{
return NSStringFromClass([self class]);
}
#pragma mark - Initializer
- (void)awakeFromNib
{
[super awakeFromNib];
self.textView.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:12.0f];
[self setTranslatesAutoresizingMaskIntoConstraints:NO];
}
- (void)prepareForReuse
{
[super prepareForReuse];
}
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
// override superclass with no-op which resets our attributed font on layout.
}
@end

@ -1,72 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="Efo-Hk-7Hw" customClass="OWSCallCollectionViewCell">
<rect key="frame" x="0.0" y="0.0" width="320" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="320" height="20"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ErD-Uv-aKj">
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="o2l-Ms-1mk">
<frame key="frameInset" minX="293" width="20" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="78L-mQ-gEo"/>
<constraint firstAttribute="width" constant="20" id="olH-5o-XyR"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="H8m-r4-eEC">
<frame key="frameInset" minX="7" width="20" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="Qay-jM-aBk"/>
<constraint firstAttribute="width" constant="20" id="RpE-jJ-cYX"/>
</constraints>
</imageView>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" text="You called Joe" textAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="R85-fN-3GC" customClass="JSQMessagesCellTextView">
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="105-nv-5Fw"/>
</constraints>
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption1"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="H8m-r4-eEC" firstAttribute="leading" secondItem="ErD-Uv-aKj" secondAttribute="leading" constant="6" id="8pe-Zh-bRn"/>
<constraint firstItem="R85-fN-3GC" firstAttribute="top" secondItem="ErD-Uv-aKj" secondAttribute="top" id="US4-6n-Kmr"/>
<constraint firstItem="o2l-Ms-1mk" firstAttribute="leading" secondItem="R85-fN-3GC" secondAttribute="trailing" id="WKY-HI-dAT"/>
<constraint firstAttribute="trailing" secondItem="o2l-Ms-1mk" secondAttribute="trailing" constant="6" id="ZFy-4i-25N"/>
<constraint firstItem="R85-fN-3GC" firstAttribute="centerX" secondItem="ErD-Uv-aKj" secondAttribute="centerX" id="app-de-yA3"/>
<constraint firstAttribute="bottom" secondItem="R85-fN-3GC" secondAttribute="bottom" id="dyS-Re-6e7"/>
<constraint firstItem="H8m-r4-eEC" firstAttribute="trailing" secondItem="R85-fN-3GC" secondAttribute="leading" id="m7j-ui-ZMI"/>
</constraints>
</view>
</subviews>
</view>
<constraints>
<constraint firstAttribute="bottom" secondItem="ErD-Uv-aKj" secondAttribute="bottom" id="5rh-PH-WZl"/>
<constraint firstItem="ErD-Uv-aKj" firstAttribute="top" secondItem="Efo-Hk-7Hw" secondAttribute="top" id="TGa-7F-Fiw"/>
<constraint firstItem="ErD-Uv-aKj" firstAttribute="leading" secondItem="Efo-Hk-7Hw" secondAttribute="leading" id="fnH-V7-ocW"/>
<constraint firstAttribute="trailing" secondItem="ErD-Uv-aKj" secondAttribute="trailing" id="nlh-Ve-1Sm"/>
</constraints>
<size key="customSize" width="320" height="20"/>
<connections>
<outlet property="incomingCallImageView" destination="H8m-r4-eEC" id="hVW-Ng-BnU"/>
<outlet property="messageBubbleContainerView" destination="ErD-Uv-aKj" id="WSq-Wd-61K"/>
<outlet property="outgoingCallImageView" destination="o2l-Ms-1mk" id="Q5m-uX-80H"/>
<outlet property="textView" destination="R85-fN-3GC" id="Hry-eB-f6P"/>
</connections>
<point key="canvasLocation" x="219" y="435"/>
</collectionViewCell>
</objects>
</document>

@ -1,14 +0,0 @@
// Created by Dylan Bourgeois on 29/11/14.
// Copyright (c) 2014 Hexed Bits. All rights reserved.
// Portions Copyright (c) 2016 Open Whisper Systems. All rights reserved.
#import <JSQMessagesViewController/JSQMessagesCollectionViewCell.h>
#import <UIKit/UIKit.h>
extern const CGFloat OWSDisplayedMessageCellMinimumHeight;
@interface OWSDisplayedMessageCollectionViewCell : JSQMessagesCollectionViewCell
@property (weak, nonatomic, readonly) UIImageView *headerImageView;
@end

@ -1,57 +0,0 @@
// Created by Dylan Bourgeois on 29/11/14.
// Copyright (c) 2014 Hexed Bits. All rights reserved.
// Portions Copyright (c) 2016 Open Whisper Systems. All rights reserved.
#import "OWSDisplayedMessageCollectionViewCell.h"
#import "UIFont+OWS.h"
#import <JSQMessagesViewController/UIView+JSQMessages.h>
const CGFloat OWSDisplayedMessageCellMinimumHeight = 70.0;
@interface OWSDisplayedMessageCollectionViewCell ()
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *cellTopLabelHeightConstraint;
@property (weak, nonatomic) IBOutlet UIImageView *headerImageView;
@end
@implementation OWSDisplayedMessageCollectionViewCell
#pragma mark - Class Methods
+ (UINib *)nib
{
return [UINib nibWithNibName:NSStringFromClass([self class]) bundle:[NSBundle mainBundle]];
}
+ (NSString *)cellReuseIdentifier
{
return NSStringFromClass([self class]);
}
#pragma mark - Initializer
- (void)awakeFromNib
{
[super awakeFromNib];
[self setTranslatesAutoresizingMaskIntoConstraints:NO];
self.backgroundColor = [UIColor whiteColor];
self.messageBubbleContainerView.layer.borderColor = [[UIColor lightGrayColor] CGColor];
self.messageBubbleContainerView.layer.borderWidth = 0.75f;
self.messageBubbleContainerView.layer.cornerRadius = 5.0f;
self.textView.font = [UIFont ows_infoMessageFont];
self.textView.textColor = [UIColor darkGrayColor];
}
#pragma mark - Collection view cell
- (void)prepareForReuse
{
[super prepareForReuse];
self.textView.text = nil;
}
@end

@ -1,77 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<capability name="Alignment constraints with different attributes" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="eMU-z2-CzM" customClass="OWSDisplayedMessageCollectionViewCell">
<rect key="frame" x="0.0" y="0.0" width="320" height="90"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="320" height="90"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="cell top label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gcR-Rk-KDC" userLabel="Cell top label" customClass="JSQMessagesLabel">
<color key="backgroundColor" red="0.66666666666666663" green="0.66666666666666663" blue="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="ckj-xD-FJI"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qCf-bs-dBd" userLabel="Bubble container">
<subviews>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" text="Lorem ipsum dolor sit er elit lamet" textAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="gbd-vF-h3e" customClass="JSQMessagesCellTextView">
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleSubhead"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="gbd-vF-h3e" secondAttribute="trailing" constant="6" id="WME-2Q-rFT"/>
<constraint firstItem="gbd-vF-h3e" firstAttribute="top" secondItem="qCf-bs-dBd" secondAttribute="top" constant="6" id="Zee-be-E6m"/>
<constraint firstAttribute="bottom" secondItem="gbd-vF-h3e" secondAttribute="bottom" id="aCy-5N-gI4"/>
<constraint firstItem="gbd-vF-h3e" firstAttribute="leading" secondItem="qCf-bs-dBd" secondAttribute="leading" constant="6" id="wL5-SN-GFl"/>
</constraints>
</view>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="warning_white.png" translatesAutoresizingMaskIntoConstraints="NO" id="ePO-Cy-jUE">
<constraints>
<constraint firstAttribute="height" constant="35" id="Llx-81-oyV"/>
<constraint firstAttribute="width" constant="35" id="Nth-3D-Wo9"/>
</constraints>
</imageView>
</subviews>
</view>
<constraints>
<constraint firstItem="ePO-Cy-jUE" firstAttribute="top" secondItem="gcR-Rk-KDC" secondAttribute="bottom" id="1yH-xH-np2"/>
<constraint firstAttribute="trailing" secondItem="qCf-bs-dBd" secondAttribute="trailing" id="F3T-1l-nCg"/>
<constraint firstItem="gcR-Rk-KDC" firstAttribute="leading" secondItem="eMU-z2-CzM" secondAttribute="leading" id="Jfv-yk-atD"/>
<constraint firstItem="qCf-bs-dBd" firstAttribute="leading" secondItem="eMU-z2-CzM" secondAttribute="leading" id="OzF-VM-85V"/>
<constraint firstAttribute="bottom" secondItem="qCf-bs-dBd" secondAttribute="bottom" id="PNq-zm-usq"/>
<constraint firstItem="qCf-bs-dBd" firstAttribute="top" secondItem="ePO-Cy-jUE" secondAttribute="centerY" constant="4" id="UzU-DS-8WZ"/>
<constraint firstAttribute="trailing" secondItem="gcR-Rk-KDC" secondAttribute="trailing" id="ba7-8G-AEb"/>
<constraint firstItem="ePO-Cy-jUE" firstAttribute="centerX" secondItem="eMU-z2-CzM" secondAttribute="centerX" id="qtQ-mS-o6z"/>
<constraint firstItem="gcR-Rk-KDC" firstAttribute="top" secondItem="eMU-z2-CzM" secondAttribute="top" id="u1D-wy-0VO"/>
</constraints>
<size key="customSize" width="320" height="55"/>
<connections>
<outlet property="cellTopLabel" destination="gcR-Rk-KDC" id="Ogk-hD-ge8"/>
<outlet property="cellTopLabelHeightConstraint" destination="ckj-xD-FJI" id="wBH-pQ-Wc7"/>
<outlet property="headerImageView" destination="ePO-Cy-jUE" id="4uq-2C-V7U"/>
<outlet property="messageBubbleContainerView" destination="qCf-bs-dBd" id="WMx-Di-LZG"/>
<outlet property="textView" destination="gbd-vF-h3e" id="Ynt-WC-VrK"/>
</connections>
<point key="canvasLocation" x="219" y="433"/>
</collectionViewCell>
</objects>
<resources>
<image name="warning_white.png" width="100" height="100"/>
</resources>
</document>

@ -61,7 +61,7 @@
- (UIColor *)iconColorForInteraction:(TSInteraction *)interaction
{
// "Phone" and "Shield" icons have a lot of "ink" so they
// "Phone", "Shield" and "Hourglass" icons have a lot of "ink" so they
// are less dark for balance.
if ([interaction isKindOfClass:[TSErrorMessage class]]) {
switch (((TSErrorMessage *)self.interaction).errorType) {
@ -90,6 +90,7 @@
case TSInfoMessageTypeGroupQuit:
break;
case TSInfoMessageTypeDisappearingMessagesUpdate:
return [UIColor colorWithRGBHex:0x404040];
break;
}
} else if ([interaction isKindOfClass:[TSCall class]]) {
@ -173,7 +174,7 @@
+ (CGFloat)hMargin
{
return 30.f;
return 25.f;
}
+ (CGFloat)topVMargin
@ -188,7 +189,7 @@
+ (CGFloat)hSpacing
{
return 8.f;
return 7.f;
}
+ (CGFloat)iconSize
@ -203,7 +204,9 @@
CGFloat maxTitleWidth = (self.contentView.width
- ([OWSSystemMessageCell hMargin] * 2.f + [OWSSystemMessageCell hSpacing] + [OWSSystemMessageCell iconSize]));
CGSize titleSize = [self.titleLabel sizeThatFits:CGSizeMake(maxTitleWidth, CGFLOAT_MAX)];
self.imageView.frame = CGRectMake(round([OWSSystemMessageCell hMargin]),
CGFloat contentWidth = ([OWSSystemMessageCell iconSize] + [OWSSystemMessageCell hSpacing] + titleSize.width);
self.imageView.frame = CGRectMake(round((self.contentView.width - contentWidth) * 0.5f),
round((self.contentView.height - [OWSSystemMessageCell iconSize]) * 0.5f),
[OWSSystemMessageCell iconSize],
[OWSSystemMessageCell iconSize]);

@ -29,13 +29,6 @@ NS_ASSUME_NONNULL_BEGIN
missingUnseenSafetyNumberChangeCount:(NSUInteger)missingUnseenSafetyNumberChangeCount
{
self = [super initWithTimestamp:timestamp inThread:thread];
// self = [super initWithTimestamp:timestamp
// inThread:thread
// messageBody:nil
// attachmentIds:@[]
// expiresInSeconds:0
// expireStartedAt:0];
// - (instancetype)initWithTimestamp:(uint64_t)timestamp inThread:(TSThread *)thread;
if (!self) {
return self;

Loading…
Cancel
Save