Merge branch 'charlesmchen/breakSpacing'

pull/1/head
Matthew Chen 7 years ago
commit a0810b1972

@ -64,10 +64,10 @@ NS_ASSUME_NONNULL_BEGIN
[self.dateHeaderView addSubview:self.dateHeaderLabel]; [self.dateHeaderView addSubview:self.dateHeaderLabel];
[self.dateStrokeView autoPinWidthToSuperview]; [self.dateStrokeView autoPinWidthToSuperview];
[self.dateStrokeView autoPinEdgeToSuperviewEdge:ALEdgeTop];
[self.dateStrokeView autoSetDimension:ALDimensionHeight toSize:1.f]; [self.dateStrokeView autoSetDimension:ALDimensionHeight toSize:1.f];
[self.dateHeaderLabel autoPinWidthToSuperview]; [self.dateHeaderLabel autoPinWidthToSuperview];
[self.dateHeaderLabel autoVCenterInSuperview]; [self.dateHeaderLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:self.dateStrokeView];
[self.dateStrokeView autoPinEdge:ALEdgeBottom toEdge:ALEdgeTop ofView:self.dateHeaderLabel];
self.avatarView = [[AvatarImageView alloc] init]; self.avatarView = [[AvatarImageView alloc] init];
[self.avatarView autoSetDimension:ALDimensionWidth toSize:self.avatarSize]; [self.avatarView autoSetDimension:ALDimensionWidth toSize:self.avatarSize];
@ -368,7 +368,7 @@ NS_ASSUME_NONNULL_BEGIN
return cellSize; return cellSize;
} }
- (CGFloat)dateHeaderVSpacing - (CGFloat)dateHeaderBottomMargin
{ {
return 24.f; return 24.f;
} }
@ -377,7 +377,7 @@ NS_ASSUME_NONNULL_BEGIN
{ {
if (self.viewItem.shouldShowDate) { if (self.viewItem.shouldShowDate) {
CGFloat textHeight = MAX(self.dateHeaderDateFont.capHeight, self.dateHeaderTimeFont.capHeight); CGFloat textHeight = MAX(self.dateHeaderDateFont.capHeight, self.dateHeaderTimeFont.capHeight);
return (CGFloat)ceil(textHeight + self.dateHeaderVSpacing * 2); return (CGFloat)ceil(textHeight + self.dateHeaderBottomMargin);
} else { } else {
return 0.f; return 0.f;
} }

@ -98,14 +98,15 @@ NS_ASSUME_NONNULL_BEGIN
[NSLayoutConstraint deactivateConstraints:self.layoutConstraints]; [NSLayoutConstraint deactivateConstraints:self.layoutConstraints];
self.layoutConstraints = @[ self.layoutConstraints = @[
[self.titleLabel autoVCenterInSuperview], [self.strokeView autoPinEdgeToSuperviewEdge:ALEdgeTop],
[self.titleLabel autoPinLeadingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterLeading],
[self.titleLabel autoPinTrailingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterTrailing],
[self.strokeView autoPinEdge:ALEdgeBottom toEdge:ALEdgeTop ofView:self.titleLabel],
[self.strokeView autoPinLeadingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterLeading], [self.strokeView autoPinLeadingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterLeading],
[self.strokeView autoPinTrailingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterTrailing], [self.strokeView autoPinTrailingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterTrailing],
[self.strokeView autoSetDimension:ALDimensionHeight toSize:1.f], [self.strokeView autoSetDimension:ALDimensionHeight toSize:self.strokeHeight],
[self.titleLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:self.strokeView],
[self.titleLabel autoPinEdgeToSuperviewEdge:ALEdgeTop],
[self.titleLabel autoPinLeadingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterLeading],
[self.titleLabel autoPinTrailingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterTrailing],
[self.subtitleLabel autoPinEdge:ALEdgeTop [self.subtitleLabel autoPinEdge:ALEdgeTop
toEdge:ALEdgeBottom toEdge:ALEdgeBottom
@ -134,6 +135,11 @@ NS_ASSUME_NONNULL_BEGIN
@"Messages that indicates that there are more unseen messages including safety number changes.")); @"Messages that indicates that there are more unseen messages including safety number changes."));
} }
- (CGFloat)strokeHeight
{
return 1.f;
}
- (CGFloat)subtitleVSpacing - (CGFloat)subtitleVSpacing
{ {
return 3.f; return 3.f;
@ -147,10 +153,8 @@ NS_ASSUME_NONNULL_BEGIN
[self configureFonts]; [self configureFonts];
// TODO: offset.
CGFloat vOffset = 24.f;
CGSize result CGSize result
= CGSizeMake(self.conversationStyle.fullWidthContentWidth, self.titleLabel.font.lineHeight + vOffset * 2); = CGSizeMake(self.conversationStyle.fullWidthContentWidth, self.strokeHeight + self.titleLabel.font.lineHeight);
TSUnreadIndicatorInteraction *interaction = (TSUnreadIndicatorInteraction *)self.viewItem.interaction; TSUnreadIndicatorInteraction *interaction = (TSUnreadIndicatorInteraction *)self.viewItem.interaction;
self.subtitleLabel.text = [self subtitleForInteraction:interaction]; self.subtitleLabel.text = [self subtitleForInteraction:interaction];

@ -275,9 +275,9 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
OWSAssert(previousLayoutItem); OWSAssert(previousLayoutItem);
if (self.interaction.interactionType == OWSInteractionType_UnreadIndicator if (self.interaction.interactionType == OWSInteractionType_UnreadIndicator
|| previousLayoutItem.interaction.interactionType == OWSInteractionType_UnreadIndicator) { || previousLayoutItem.interaction.interactionType == OWSInteractionType_UnreadIndicator
// The unread indicator has its own v-margins. || self.shouldShowDate) {
return 0.f; return 20.f;
} }
// "Bubble Collapse". Adjacent messages with the same author should be close together. // "Bubble Collapse". Adjacent messages with the same author should be close together.

Loading…
Cancel
Save