From ebb89ed1fdd42a435618d2325b9763c602b85444 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Tue, 10 Apr 2018 10:31:59 -0400 Subject: [PATCH] Tweak message layout. --- .../ConversationView/Cells/OWSMessageCell.m | 34 +++++++++++++++---- .../Cells/OWSQuotedMessageView.m | 9 +++-- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m index 6382649c8..9053f69f4 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m @@ -77,7 +77,6 @@ NS_ASSUME_NONNULL_BEGIN self.footerLabel.hidden = YES; [self.messageBubbleView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:self.dateHeaderLabel]; - [self.footerView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:self.messageBubbleView]; [self.footerView autoPinEdgeToSuperviewEdge:ALEdgeBottom]; [self.footerView autoPinWidthToSuperview]; @@ -270,13 +269,11 @@ NS_ASSUME_NONNULL_BEGIN } } -- (CGFloat)footerHeight +- (BOOL)showFooter { BOOL showFooter = NO; - BOOL hasExpirationTimer = self.message.shouldStartExpireTimer; - - if (hasExpirationTimer) { + if (self.message.shouldStartExpireTimer) { showFooter = YES; } else if (self.isOutgoing) { showFooter = !self.viewItem.shouldHideRecipientStatus; @@ -286,7 +283,21 @@ NS_ASSUME_NONNULL_BEGIN showFooter = NO; } - return (showFooter ? (CGFloat)ceil(MAX(kExpirationTimerViewSize, self.footerLabel.font.lineHeight)) : 0.f); + return showFooter; +} + +- (CGFloat)footerHeight +{ + if (!self.showFooter) { + return 0.f; + } + + return ceil(MAX(kExpirationTimerViewSize, self.footerLabel.font.lineHeight)); +} + +- (CGFloat)footerVSpacing +{ + return 1.f; } - (void)updateFooter @@ -313,11 +324,17 @@ NS_ASSUME_NONNULL_BEGIN !attributedText) { self.footerLabel.hidden = YES; [self.viewConstraints addObjectsFromArray:@[ + [self.footerView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:self.messageBubbleView], [self.footerView autoSetDimension:ALDimensionHeight toSize:0], ]]; return; } + [self.footerView autoPinEdge:ALEdgeTop + toEdge:ALEdgeBottom + ofView:self.messageBubbleView + withOffset:self.footerVSpacing]; + if (hasExpirationTimer) { uint64_t expirationTimestamp = message.expiresAt; uint32_t expiresInSeconds = message.expiresInSeconds; @@ -388,7 +405,10 @@ NS_ASSUME_NONNULL_BEGIN OWSAssert(cellSize.width > 0 && cellSize.height > 0); cellSize.height += self.dateHeaderHeight; - cellSize.height += self.footerHeight; + if (self.showFooter) { + cellSize.height += self.footerVSpacing; + cellSize.height += self.footerHeight; + } if (self.shouldHaveFailedSendBadge) { cellSize.width += self.failedSendBadgeSize; diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m index cdfc5437c..be41b18b8 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m @@ -188,6 +188,7 @@ NS_ASSUME_NONNULL_BEGIN UIView *quoteStripView = [UIView containerView]; quoteStripView.backgroundColor = self.highlightColor; quoteStripView.userInteractionEnabled = NO; + quoteStripView.layer.cornerRadius = self.quotedReplyStripeRounding; [stripeAndTextContainer addSubview:quoteStripView]; [quoteStripView autoPinHeightToSuperview]; [quoteStripView autoPinLeadingToSuperviewMargin]; @@ -426,7 +427,6 @@ NS_ASSUME_NONNULL_BEGIN return 8.f; } -// TODO: - (CGFloat)quotedAuthorBottomSpacing { return 3.f; @@ -444,7 +444,12 @@ NS_ASSUME_NONNULL_BEGIN - (CGFloat)quotedReplyStripeVExtension { - return 8.f; + return 4.f; +} + +- (CGFloat)quotedReplyStripeRounding +{ + return 1.f; } // The spacing between the vertical "quoted reply stripe"