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.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;

@ -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"

Loading…
Cancel
Save