From d869afc3e4838c9c81c197d51315f6bfed659294 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Thu, 28 Jun 2018 13:55:04 -0400 Subject: [PATCH] Tweak break spacing. --- .../ConversationView/Cells/OWSMessageCell.m | 8 +++---- .../Cells/OWSUnreadIndicatorCell.m | 22 +++++++++++-------- .../ConversationView/ConversationViewItem.m | 6 ++--- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m index fba184f8f..3a3c2a215 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m @@ -64,10 +64,10 @@ NS_ASSUME_NONNULL_BEGIN [self.dateHeaderView addSubview:self.dateHeaderLabel]; [self.dateStrokeView autoPinWidthToSuperview]; + [self.dateStrokeView autoPinEdgeToSuperviewEdge:ALEdgeTop]; [self.dateStrokeView autoSetDimension:ALDimensionHeight toSize:1.f]; [self.dateHeaderLabel autoPinWidthToSuperview]; - [self.dateHeaderLabel autoVCenterInSuperview]; - [self.dateStrokeView autoPinEdge:ALEdgeBottom toEdge:ALEdgeTop ofView:self.dateHeaderLabel]; + [self.dateHeaderLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:self.dateStrokeView]; self.avatarView = [[AvatarImageView alloc] init]; [self.avatarView autoSetDimension:ALDimensionWidth toSize:self.avatarSize]; @@ -368,7 +368,7 @@ NS_ASSUME_NONNULL_BEGIN return cellSize; } -- (CGFloat)dateHeaderVSpacing +- (CGFloat)dateHeaderBottomMargin { return 24.f; } @@ -377,7 +377,7 @@ NS_ASSUME_NONNULL_BEGIN { if (self.viewItem.shouldShowDate) { CGFloat textHeight = MAX(self.dateHeaderDateFont.capHeight, self.dateHeaderTimeFont.capHeight); - return (CGFloat)ceil(textHeight + self.dateHeaderVSpacing * 2); + return (CGFloat)ceil(textHeight + self.dateHeaderBottomMargin); } else { return 0.f; } diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSUnreadIndicatorCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSUnreadIndicatorCell.m index 46ec6d38f..980675a43 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSUnreadIndicatorCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSUnreadIndicatorCell.m @@ -98,14 +98,15 @@ NS_ASSUME_NONNULL_BEGIN [NSLayoutConstraint deactivateConstraints:self.layoutConstraints]; self.layoutConstraints = @[ - [self.titleLabel autoVCenterInSuperview], - [self.titleLabel autoPinLeadingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterLeading], - [self.titleLabel autoPinTrailingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterTrailing], - - [self.strokeView autoPinEdge:ALEdgeBottom toEdge:ALEdgeTop ofView:self.titleLabel], + [self.strokeView autoPinEdgeToSuperviewEdge:ALEdgeTop], [self.strokeView autoPinLeadingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterLeading], [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 toEdge:ALEdgeBottom @@ -134,6 +135,11 @@ NS_ASSUME_NONNULL_BEGIN @"Messages that indicates that there are more unseen messages including safety number changes.")); } +- (CGFloat)strokeHeight +{ + return 1.f; +} + - (CGFloat)subtitleVSpacing { return 3.f; @@ -147,10 +153,8 @@ NS_ASSUME_NONNULL_BEGIN [self configureFonts]; - // TODO: offset. - CGFloat vOffset = 24.f; 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; self.subtitleLabel.text = [self subtitleForInteraction:interaction]; diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m b/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m index ab7062928..0928447a2 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m @@ -275,9 +275,9 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType) OWSAssert(previousLayoutItem); if (self.interaction.interactionType == OWSInteractionType_UnreadIndicator - || previousLayoutItem.interaction.interactionType == OWSInteractionType_UnreadIndicator) { - // The unread indicator has its own v-margins. - return 0.f; + || previousLayoutItem.interaction.interactionType == OWSInteractionType_UnreadIndicator + || self.shouldShowDate) { + return 20.f; } // "Bubble Collapse". Adjacent messages with the same author should be close together.