Respond to CR.

pull/1/head
Matthew Chen 7 years ago
parent 783bf5b81c
commit 411d5a3b4f

@ -160,7 +160,9 @@ NS_ASSUME_NONNULL_BEGIN
[stackView autoPinLeadingToSuperviewMarginWithInset:self.iconHMargin]; [stackView autoPinLeadingToSuperviewMarginWithInset:self.iconHMargin];
[stackView autoPinTrailingToSuperviewMarginWithInset:self.iconHMargin]; [stackView autoPinTrailingToSuperviewMarginWithInset:self.iconHMargin];
[stackView autoVCenterInSuperview]; [stackView autoVCenterInSuperview];
// NOTE: It's critical that we pin to the superview top and bottom _edge_ and not _margin_. // Ensure that the cell's contents never overflow the cell bounds.
// We pin pin to the superview _edge_ and not _margin_ for the purposes
// of overflow, so that changes to the margins do not trip these safe guards.
[stackView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:0 relation:NSLayoutRelationGreaterThanOrEqual]; [stackView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:0 relation:NSLayoutRelationGreaterThanOrEqual];
[stackView autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:0 relation:NSLayoutRelationGreaterThanOrEqual]; [stackView autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:0 relation:NSLayoutRelationGreaterThanOrEqual];

@ -203,7 +203,7 @@ NS_ASSUME_NONNULL_BEGIN
case OWSMessageCellType_OversizeTextMessage: case OWSMessageCellType_OversizeTextMessage:
case OWSMessageCellType_GenericAttachment: case OWSMessageCellType_GenericAttachment:
case OWSMessageCellType_DownloadingAttachment: case OWSMessageCellType_DownloadingAttachment:
case OWSMessageCellType_ShareContact: case OWSMessageCellType_ContactShare:
return YES; return YES;
case OWSMessageCellType_StillImage: case OWSMessageCellType_StillImage:
case OWSMessageCellType_AnimatedImage: case OWSMessageCellType_AnimatedImage:
@ -228,7 +228,7 @@ NS_ASSUME_NONNULL_BEGIN
case OWSMessageCellType_Video: case OWSMessageCellType_Video:
// Is there a caption? // Is there a caption?
return self.hasBodyText; return self.hasBodyText;
case OWSMessageCellType_ShareContact: case OWSMessageCellType_ContactShare:
return NO; return NO;
} }
} }
@ -331,8 +331,8 @@ NS_ASSUME_NONNULL_BEGIN
bodyMediaView = [self loadViewForDownloadingAttachment]; bodyMediaView = [self loadViewForDownloadingAttachment];
bodyMediaViewHasGreedyWidth = YES; bodyMediaViewHasGreedyWidth = YES;
break; break;
case OWSMessageCellType_ShareContact: case OWSMessageCellType_ContactShare:
bodyMediaView = [self loadViewForShareContact]; bodyMediaView = [self loadViewForContactShare];
bodyMediaViewHasGreedyWidth = YES; bodyMediaViewHasGreedyWidth = YES;
break; break;
} }
@ -792,7 +792,7 @@ NS_ASSUME_NONNULL_BEGIN
return customView; return customView;
} }
- (UIView *)loadViewForShareContact - (UIView *)loadViewForContactShare
{ {
OWSAssert(self.viewItem.contactShare); OWSAssert(self.viewItem.contactShare);
@ -930,7 +930,7 @@ NS_ASSUME_NONNULL_BEGIN
return CGSizeMake(maxMessageWidth, [OWSGenericAttachmentView bubbleHeight]); return CGSizeMake(maxMessageWidth, [OWSGenericAttachmentView bubbleHeight]);
case OWSMessageCellType_DownloadingAttachment: case OWSMessageCellType_DownloadingAttachment:
return CGSizeMake(200, 90); return CGSizeMake(200, 90);
case OWSMessageCellType_ShareContact: case OWSMessageCellType_ContactShare:
return CGSizeMake(maxMessageWidth, [OWSContactShareView bubbleHeight]); return CGSizeMake(maxMessageWidth, [OWSContactShareView bubbleHeight]);
} }
} }
@ -1052,7 +1052,7 @@ NS_ASSUME_NONNULL_BEGIN
if (self.cellType == OWSMessageCellType_DownloadingAttachment) { if (self.cellType == OWSMessageCellType_DownloadingAttachment) {
return NO; return NO;
} }
if (self.cellType == OWSMessageCellType_ShareContact) { if (self.cellType == OWSMessageCellType_ContactShare) {
// TODO: Handle this case. // TODO: Handle this case.
return NO; return NO;
} }
@ -1202,7 +1202,7 @@ NS_ASSUME_NONNULL_BEGIN
} }
break; break;
} }
case OWSMessageCellType_ShareContact: case OWSMessageCellType_ContactShare:
// TODO: // TODO:
break; break;
} }

@ -17,7 +17,7 @@ typedef NS_ENUM(NSInteger, OWSMessageCellType) {
OWSMessageCellType_Video, OWSMessageCellType_Video,
OWSMessageCellType_GenericAttachment, OWSMessageCellType_GenericAttachment,
OWSMessageCellType_DownloadingAttachment, OWSMessageCellType_DownloadingAttachment,
OWSMessageCellType_ShareContact, OWSMessageCellType_ContactShare,
}; };
NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType); NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType);

@ -37,8 +37,8 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
return @"OWSMessageCellType_DownloadingAttachment"; return @"OWSMessageCellType_DownloadingAttachment";
case OWSMessageCellType_Unknown: case OWSMessageCellType_Unknown:
return @"OWSMessageCellType_Unknown"; return @"OWSMessageCellType_Unknown";
case OWSMessageCellType_ShareContact: case OWSMessageCellType_ContactShare:
return @"OWSMessageCellType_ShareContact"; return @"OWSMessageCellType_ContactShare";
} }
} }
@ -407,7 +407,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
TSMessage *message = (TSMessage *)self.interaction; TSMessage *message = (TSMessage *)self.interaction;
if (message.contactShare) { if (message.contactShare) {
self.contactShare = message.contactShare; self.contactShare = message.contactShare;
self.messageCellType = OWSMessageCellType_ShareContact; self.messageCellType = OWSMessageCellType_ContactShare;
return; return;
} }
TSAttachment *_Nullable attachment = [self firstAttachmentIfAnyOfMessage:message transaction:transaction]; TSAttachment *_Nullable attachment = [self firstAttachmentIfAnyOfMessage:message transaction:transaction];
@ -721,7 +721,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
OWSFail(@"%@ No text to copy", self.logTag); OWSFail(@"%@ No text to copy", self.logTag);
break; break;
} }
case OWSMessageCellType_ShareContact: { case OWSMessageCellType_ContactShare: {
// TODO: Implement copy contact. // TODO: Implement copy contact.
OWSFail(@"%@ Not implemented yet", self.logTag); OWSFail(@"%@ Not implemented yet", self.logTag);
break; break;
@ -735,7 +735,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
case OWSMessageCellType_Unknown: case OWSMessageCellType_Unknown:
case OWSMessageCellType_TextMessage: case OWSMessageCellType_TextMessage:
case OWSMessageCellType_OversizeTextMessage: case OWSMessageCellType_OversizeTextMessage:
case OWSMessageCellType_ShareContact: { case OWSMessageCellType_ContactShare: {
OWSFail(@"%@ No media to copy", self.logTag); OWSFail(@"%@ No media to copy", self.logTag);
break; break;
} }
@ -817,7 +817,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
case OWSMessageCellType_Unknown: case OWSMessageCellType_Unknown:
case OWSMessageCellType_TextMessage: case OWSMessageCellType_TextMessage:
case OWSMessageCellType_OversizeTextMessage: case OWSMessageCellType_OversizeTextMessage:
case OWSMessageCellType_ShareContact: case OWSMessageCellType_ContactShare:
return NO; return NO;
case OWSMessageCellType_StillImage: case OWSMessageCellType_StillImage:
case OWSMessageCellType_AnimatedImage: case OWSMessageCellType_AnimatedImage:
@ -840,7 +840,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
case OWSMessageCellType_Unknown: case OWSMessageCellType_Unknown:
case OWSMessageCellType_TextMessage: case OWSMessageCellType_TextMessage:
case OWSMessageCellType_OversizeTextMessage: case OWSMessageCellType_OversizeTextMessage:
case OWSMessageCellType_ShareContact: case OWSMessageCellType_ContactShare:
OWSFail(@"%@ Cannot save text data.", self.logTag); OWSFail(@"%@ Cannot save text data.", self.logTag);
break; break;
case OWSMessageCellType_StillImage: case OWSMessageCellType_StillImage:
@ -896,7 +896,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
case OWSMessageCellType_Unknown: case OWSMessageCellType_Unknown:
case OWSMessageCellType_TextMessage: case OWSMessageCellType_TextMessage:
case OWSMessageCellType_OversizeTextMessage: case OWSMessageCellType_OversizeTextMessage:
case OWSMessageCellType_ShareContact: case OWSMessageCellType_ContactShare:
return NO; return NO;
case OWSMessageCellType_StillImage: case OWSMessageCellType_StillImage:
case OWSMessageCellType_AnimatedImage: case OWSMessageCellType_AnimatedImage:

@ -97,7 +97,7 @@ NS_ASSUME_NONNULL_BEGIN
// Exemplary // Exemplary
[DebugUIMessages allFakeAction:thread], [DebugUIMessages allFakeAction:thread],
[DebugUIMessages allFakeBackDatedAction:thread], [DebugUIMessages allFakeBackDatedAction:thread],
[DebugUIMessages allShareContactAction:thread], [DebugUIMessages allContactShareAction:thread],
]]]; ]]];
[items addObjectsFromArray:@[ [items addObjectsFromArray:@[
@ -2658,7 +2658,7 @@ NS_ASSUME_NONNULL_BEGIN
[actions addObjectsFromArray:[self allFakeSequenceActions:thread includeLabels:includeLabels]]; [actions addObjectsFromArray:[self allFakeSequenceActions:thread includeLabels:includeLabels]];
[actions addObjectsFromArray:[self allFakeQuotedReplyActions:thread includeLabels:includeLabels]]; [actions addObjectsFromArray:[self allFakeQuotedReplyActions:thread includeLabels:includeLabels]];
[actions addObjectsFromArray:[self allFakeBackDatedActions:thread includeLabels:includeLabels]]; [actions addObjectsFromArray:[self allFakeBackDatedActions:thread includeLabels:includeLabels]];
[actions addObjectsFromArray:[self allShareContactActions:thread includeLabels:includeLabels]]; [actions addObjectsFromArray:[self allContactShareActions:thread includeLabels:includeLabels]];
return actions; return actions;
} }
@ -2902,7 +2902,7 @@ NS_ASSUME_NONNULL_BEGIN
typedef OWSContact * (^OWSContactBlock)(void); typedef OWSContact * (^OWSContactBlock)(void);
+ (DebugUIMessagesAction *)fakeShareContactMessageAction:(TSThread *)thread + (DebugUIMessagesAction *)fakeContactShareMessageAction:(TSThread *)thread
label:(NSString *)label label:(NSString *)label
contactBlock:(OWSContactBlock)contactBlock contactBlock:(OWSContactBlock)contactBlock
{ {
@ -2925,7 +2925,7 @@ typedef OWSContact * (^OWSContactBlock)(void);
}]; }];
} }
+ (NSArray<DebugUIMessagesAction *> *)allShareContactActions:(TSThread *)thread includeLabels:(BOOL)includeLabels + (NSArray<DebugUIMessagesAction *> *)allContactShareActions:(TSThread *)thread includeLabels:(BOOL)includeLabels
{ {
OWSAssert(thread); OWSAssert(thread);
@ -2937,7 +2937,7 @@ typedef OWSContact * (^OWSContactBlock)(void);
text:@"⚠️ Share Contact ⚠️"]]; text:@"⚠️ Share Contact ⚠️"]];
} }
[actions addObject:[self fakeShareContactMessageAction:thread [actions addObject:[self fakeContactShareMessageAction:thread
label:@"Name & Number" label:@"Name & Number"
contactBlock:^{ contactBlock:^{
OWSContact *contact = [OWSContact new]; OWSContact *contact = [OWSContact new];
@ -2950,7 +2950,7 @@ typedef OWSContact * (^OWSContactBlock)(void);
]; ];
return contact; return contact;
}]]; }]];
[actions addObject:[self fakeShareContactMessageAction:thread [actions addObject:[self fakeContactShareMessageAction:thread
label:@"Name & Email" label:@"Name & Email"
contactBlock:^{ contactBlock:^{
OWSContact *contact = [OWSContact new]; OWSContact *contact = [OWSContact new];
@ -2963,7 +2963,7 @@ typedef OWSContact * (^OWSContactBlock)(void);
]; ];
return contact; return contact;
}]]; }]];
[actions addObject:[self fakeShareContactMessageAction:thread [actions addObject:[self fakeContactShareMessageAction:thread
label:@"Complicated" label:@"Complicated"
contactBlock:^{ contactBlock:^{
OWSContact *contact = [OWSContact new]; OWSContact *contact = [OWSContact new];
@ -3027,12 +3027,12 @@ typedef OWSContact * (^OWSContactBlock)(void);
return actions; return actions;
} }
+ (DebugUIMessagesAction *)allShareContactAction:(TSThread *)thread + (DebugUIMessagesAction *)allContactShareAction:(TSThread *)thread
{ {
OWSAssert(thread); OWSAssert(thread);
return [DebugUIMessagesGroupAction allGroupActionWithLabel:@"All Fake Share Contact" return [DebugUIMessagesGroupAction allGroupActionWithLabel:@"All Fake Contact Shares"
subactions:[self allShareContactActions:thread includeLabels:YES]]; subactions:[self allContactShareActions:thread includeLabels:YES]];
} }
#pragma mark - #pragma mark -

@ -84,8 +84,8 @@ NS_ASSUME_NONNULL_BEGIN
[self.payloadView autoPinLeadingToTrailingEdgeOfView:self.avatarView offset:self.avatarHSpacing]; [self.payloadView autoPinLeadingToTrailingEdgeOfView:self.avatarView offset:self.avatarHSpacing];
[self.payloadView autoVCenterInSuperview]; [self.payloadView autoVCenterInSuperview];
// Ensure that the cell's contents never overflow the cell bounds. // Ensure that the cell's contents never overflow the cell bounds.
// // We pin pin to the superview _edge_ and not _margin_ for the purposes
// NOTE: It's critical that we pin to the superview top and bottom _edge_ and not _margin_. // of overflow, so that changes to the margins do not trip these safe guards.
[self.payloadView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:0 relation:NSLayoutRelationGreaterThanOrEqual]; [self.payloadView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:0 relation:NSLayoutRelationGreaterThanOrEqual];
[self.payloadView autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:0 relation:NSLayoutRelationGreaterThanOrEqual]; [self.payloadView autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:0 relation:NSLayoutRelationGreaterThanOrEqual];
// We pin the payloadView traillingEdge later, as part of the "Unread Badge" logic. // We pin the payloadView traillingEdge later, as part of the "Unread Badge" logic.

@ -748,7 +748,9 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
// Constrain to cell margins. // Constrain to cell margins.
[stackView autoPinEdgeToSuperviewMargin:ALEdgeLeading relation:NSLayoutRelationGreaterThanOrEqual]; [stackView autoPinEdgeToSuperviewMargin:ALEdgeLeading relation:NSLayoutRelationGreaterThanOrEqual];
[stackView autoPinEdgeToSuperviewMargin:ALEdgeTrailing relation:NSLayoutRelationGreaterThanOrEqual]; [stackView autoPinEdgeToSuperviewMargin:ALEdgeTrailing relation:NSLayoutRelationGreaterThanOrEqual];
// NOTE: It's critical that we pin to the superview top and bottom _edge_ and not _margin_. // Ensure that the cell's contents never overflow the cell bounds.
// We pin pin to the superview _edge_ and not _margin_ for the purposes
// of overflow, so that changes to the margins do not trip these safe guards.
[stackView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:0 relation:NSLayoutRelationGreaterThanOrEqual]; [stackView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:0 relation:NSLayoutRelationGreaterThanOrEqual];
[stackView autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:0 relation:NSLayoutRelationGreaterThanOrEqual]; [stackView autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:0 relation:NSLayoutRelationGreaterThanOrEqual];

@ -204,7 +204,7 @@ NS_ASSUME_NONNULL_BEGIN
_displayName = self.organizationName; _displayName = self.organizationName;
} }
if (_displayName.length < 1) { if (_displayName.length < 1) {
DDLogError(@"%@ could not derive a valid display name.", self.logTag); OWSProdLogAndFail(@"%@ could not derive a valid display name.", self.logTag);
} }
} }

Loading…
Cancel
Save