Tweak message layout.

pull/1/head
Matthew Chen 7 years ago
parent 27cc9668cd
commit ebb89ed1fd

@ -77,7 +77,6 @@ NS_ASSUME_NONNULL_BEGIN
self.footerLabel.hidden = YES; self.footerLabel.hidden = YES;
[self.messageBubbleView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:self.dateHeaderLabel]; [self.messageBubbleView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:self.dateHeaderLabel];
[self.footerView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:self.messageBubbleView];
[self.footerView autoPinEdgeToSuperviewEdge:ALEdgeBottom]; [self.footerView autoPinEdgeToSuperviewEdge:ALEdgeBottom];
[self.footerView autoPinWidthToSuperview]; [self.footerView autoPinWidthToSuperview];
@ -270,13 +269,11 @@ NS_ASSUME_NONNULL_BEGIN
} }
} }
- (CGFloat)footerHeight - (BOOL)showFooter
{ {
BOOL showFooter = NO; BOOL showFooter = NO;
BOOL hasExpirationTimer = self.message.shouldStartExpireTimer; if (self.message.shouldStartExpireTimer) {
if (hasExpirationTimer) {
showFooter = YES; showFooter = YES;
} else if (self.isOutgoing) { } else if (self.isOutgoing) {
showFooter = !self.viewItem.shouldHideRecipientStatus; showFooter = !self.viewItem.shouldHideRecipientStatus;
@ -286,7 +283,21 @@ NS_ASSUME_NONNULL_BEGIN
showFooter = NO; 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 - (void)updateFooter
@ -313,11 +324,17 @@ NS_ASSUME_NONNULL_BEGIN
!attributedText) { !attributedText) {
self.footerLabel.hidden = YES; self.footerLabel.hidden = YES;
[self.viewConstraints addObjectsFromArray:@[ [self.viewConstraints addObjectsFromArray:@[
[self.footerView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:self.messageBubbleView],
[self.footerView autoSetDimension:ALDimensionHeight toSize:0], [self.footerView autoSetDimension:ALDimensionHeight toSize:0],
]]; ]];
return; return;
} }
[self.footerView autoPinEdge:ALEdgeTop
toEdge:ALEdgeBottom
ofView:self.messageBubbleView
withOffset:self.footerVSpacing];
if (hasExpirationTimer) { if (hasExpirationTimer) {
uint64_t expirationTimestamp = message.expiresAt; uint64_t expirationTimestamp = message.expiresAt;
uint32_t expiresInSeconds = message.expiresInSeconds; uint32_t expiresInSeconds = message.expiresInSeconds;
@ -388,7 +405,10 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(cellSize.width > 0 && cellSize.height > 0); OWSAssert(cellSize.width > 0 && cellSize.height > 0);
cellSize.height += self.dateHeaderHeight; cellSize.height += self.dateHeaderHeight;
cellSize.height += self.footerHeight; if (self.showFooter) {
cellSize.height += self.footerVSpacing;
cellSize.height += self.footerHeight;
}
if (self.shouldHaveFailedSendBadge) { if (self.shouldHaveFailedSendBadge) {
cellSize.width += self.failedSendBadgeSize; cellSize.width += self.failedSendBadgeSize;

@ -188,6 +188,7 @@ NS_ASSUME_NONNULL_BEGIN
UIView *quoteStripView = [UIView containerView]; UIView *quoteStripView = [UIView containerView];
quoteStripView.backgroundColor = self.highlightColor; quoteStripView.backgroundColor = self.highlightColor;
quoteStripView.userInteractionEnabled = NO; quoteStripView.userInteractionEnabled = NO;
quoteStripView.layer.cornerRadius = self.quotedReplyStripeRounding;
[stripeAndTextContainer addSubview:quoteStripView]; [stripeAndTextContainer addSubview:quoteStripView];
[quoteStripView autoPinHeightToSuperview]; [quoteStripView autoPinHeightToSuperview];
[quoteStripView autoPinLeadingToSuperviewMargin]; [quoteStripView autoPinLeadingToSuperviewMargin];
@ -426,7 +427,6 @@ NS_ASSUME_NONNULL_BEGIN
return 8.f; return 8.f;
} }
// TODO:
- (CGFloat)quotedAuthorBottomSpacing - (CGFloat)quotedAuthorBottomSpacing
{ {
return 3.f; return 3.f;
@ -444,7 +444,12 @@ NS_ASSUME_NONNULL_BEGIN
- (CGFloat)quotedReplyStripeVExtension - (CGFloat)quotedReplyStripeVExtension
{ {
return 8.f; return 4.f;
}
- (CGFloat)quotedReplyStripeRounding
{
return 1.f;
} }
// The spacing between the vertical "quoted reply stripe" // The spacing between the vertical "quoted reply stripe"

Loading…
Cancel
Save