CR: intercell spacing dicated by ConversationViewItem

This commit is contained in:
Michael Kirk 2018-07-10 10:00:50 -06:00
parent 3e1c1ab6ca
commit c81799169e
3 changed files with 7 additions and 8 deletions

View file

@ -8,6 +8,8 @@
NS_ASSUME_NONNULL_BEGIN
extern const CGFloat OWSMessageCellDateHeaderVMargin;
@interface OWSMessageCell : ConversationViewCell
@property (nonatomic, readonly) OWSMessageBubbleView *messageBubbleView;

View file

@ -9,6 +9,8 @@
NS_ASSUME_NONNULL_BEGIN
const CGFloat OWSMessageCellDateHeaderVMargin = 23;
@interface OWSMessageCell ()
// The nullable properties are created as needed.
@ -59,7 +61,7 @@ NS_ASSUME_NONNULL_BEGIN
self.dateHeaderLabel.textColor = [UIColor ows_light60Color];
self.dateHeaderView = [UIView new];
self.dateHeaderView.layoutMargins = UIEdgeInsetsMake(self.dateHeaderVMargin, 0, self.dateHeaderVMargin, 0);
self.dateHeaderView.layoutMargins = UIEdgeInsetsMake(0, 0, OWSMessageCellDateHeaderVMargin, 0);
[self.dateHeaderView addSubview:self.dateHeaderLabel];
[self.dateHeaderLabel autoPinToSuperviewMargins];
@ -385,16 +387,11 @@ NS_ASSUME_NONNULL_BEGIN
return cellSize;
}
- (CGFloat)dateHeaderVMargin
{
return 23.f;
}
- (CGFloat)dateHeaderHeight
{
if (self.viewItem.shouldShowDate) {
CGFloat textHeight = self.dateHeaderFont.lineHeight;
return (CGFloat)ceil(textHeight + self.dateHeaderVMargin * 2);
return (CGFloat)ceil(textHeight + OWSMessageCellDateHeaderVMargin);
} else {
return 0.f;
}

View file

@ -261,7 +261,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
}
if (self.shouldShowDate) {
return 0;
return OWSMessageCellDateHeaderVMargin;
}
// "Bubble Collapse". Adjacent messages with the same author should be close together.