CR: intercell spacing dicated by ConversationViewItem

pull/1/head
Michael Kirk 7 years ago
parent 3e1c1ab6ca
commit c81799169e

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

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

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

Loading…
Cancel
Save