remove hairline

// FREEBIE
pull/1/head
Michael Kirk 7 years ago
parent f22cb48f85
commit 77e9533dc1

@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
// to always keep one around. // to always keep one around.
@property (nonatomic) OWSMessageBubbleView *messageBubbleView; @property (nonatomic) OWSMessageBubbleView *messageBubbleView;
@property (nonatomic) UIStackView *dateHeaderView; @property (nonatomic) UIView *dateHeaderView;
@property (nonatomic) UILabel *dateHeaderLabel; @property (nonatomic) UILabel *dateHeaderLabel;
@property (nonatomic) AvatarImageView *avatarView; @property (nonatomic) AvatarImageView *avatarView;
@property (nonatomic, nullable) UIImageView *sendFailureBadgeView; @property (nonatomic, nullable) UIImageView *sendFailureBadgeView;
@ -58,10 +58,10 @@ NS_ASSUME_NONNULL_BEGIN
self.dateHeaderLabel.textAlignment = NSTextAlignmentCenter; self.dateHeaderLabel.textAlignment = NSTextAlignmentCenter;
self.dateHeaderLabel.textColor = [UIColor ows_light60Color]; self.dateHeaderLabel.textColor = [UIColor ows_light60Color];
self.dateHeaderView = [[UIStackView alloc] initWithArrangedSubviews:@[ self.dateHeaderView = [UIView new];
self.dateHeaderLabel, self.dateHeaderView.layoutMargins = UIEdgeInsetsMake(self.dateHeaderVMargin, 0, self.dateHeaderVMargin, 0);
]]; [self.dateHeaderView addSubview:self.dateHeaderLabel];
self.dateHeaderView.axis = NSTextLayoutOrientationVertical; [self.dateHeaderLabel autoPinToSuperviewMargins];
self.avatarView = [[AvatarImageView alloc] init]; self.avatarView = [[AvatarImageView alloc] init];
[self.avatarView autoSetDimension:ALDimensionWidth toSize:self.avatarSize]; [self.avatarView autoSetDimension:ALDimensionWidth toSize:self.avatarSize];
@ -254,12 +254,12 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(self.conversationStyle); OWSAssert(self.conversationStyle);
if (self.viewItem.shouldShowDate) { if (self.viewItem.shouldShowDate) {
NSDate *date = self.viewItem.interaction.dateForSorting;
NSString *dateString = [DateUtil formatDateForConversationDateBreaks:date];
self.dateHeaderLabel.font = self.dateHeaderFont; self.dateHeaderLabel.font = self.dateHeaderFont;
self.dateHeaderLabel.textColor = self.conversationStyle.dateBreakTextColor; self.dateHeaderLabel.textColor = self.conversationStyle.dateBreakTextColor;
NSDate *date = self.viewItem.interaction.dateForSorting;
NSString *dateString = [DateUtil formatDateForConversationDateBreaks:date];
self.dateHeaderLabel.text = dateString; self.dateHeaderLabel.text = dateString;
[self.contentView addSubview:self.dateHeaderView]; [self.contentView addSubview:self.dateHeaderView];
@ -269,16 +269,7 @@ NS_ASSUME_NONNULL_BEGIN
[self.dateHeaderView [self.dateHeaderView
autoPinTrailingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterTrailing], autoPinTrailingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterTrailing],
[self.dateHeaderView autoPinEdgeToSuperviewEdge:ALEdgeTop], [self.dateHeaderView autoPinEdgeToSuperviewEdge:ALEdgeTop],
[self.messageBubbleView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:self.dateHeaderView],
// DO NOT pin to the bottom of dateHeaderView.
//
// Being a UIStackView, it doesn't reflect the spacing below the date
// header contents. Instead pin using dateHeaderHeight which includes
// the spacing.
[self.messageBubbleView autoPinEdge:ALEdgeTop
toEdge:ALEdgeTop
ofView:self.dateHeaderView
withOffset:self.dateHeaderHeight],
]]; ]];
} else { } else {
[self.viewConstraints addObjectsFromArray:@[ [self.viewConstraints addObjectsFromArray:@[
@ -289,7 +280,7 @@ NS_ASSUME_NONNULL_BEGIN
- (UIFont *)dateHeaderFont - (UIFont *)dateHeaderFont
{ {
return UIFont.ows_dynamicTypeCalloutFont; return UIFont.ows_dynamicTypeCaption1Font;
} }
#pragma mark - Avatar #pragma mark - Avatar
@ -394,21 +385,16 @@ NS_ASSUME_NONNULL_BEGIN
return cellSize; return cellSize;
} }
- (CGFloat)dateHeaderStrokeThickness - (CGFloat)dateHeaderVMargin
{ {
return CGHairlineWidth(); return 23.f;
}
- (CGFloat)dateHeaderBottomMargin
{
return 20.f;
} }
- (CGFloat)dateHeaderHeight - (CGFloat)dateHeaderHeight
{ {
if (self.viewItem.shouldShowDate) { if (self.viewItem.shouldShowDate) {
CGFloat textHeight = self.dateHeaderFont.capHeight; CGFloat textHeight = self.dateHeaderFont.lineHeight;
return (CGFloat)ceil(self.dateHeaderStrokeThickness + textHeight + self.dateHeaderBottomMargin); return (CGFloat)ceil(textHeight + self.dateHeaderVMargin * 2);
} else { } else {
return 0.f; return 0.f;
} }

@ -256,11 +256,14 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
OWSAssert(previousLayoutItem); OWSAssert(previousLayoutItem);
if (self.interaction.interactionType == OWSInteractionType_UnreadIndicator if (self.interaction.interactionType == OWSInteractionType_UnreadIndicator
|| previousLayoutItem.interaction.interactionType == OWSInteractionType_UnreadIndicator || previousLayoutItem.interaction.interactionType == OWSInteractionType_UnreadIndicator) {
|| self.shouldShowDate) {
return 20.f; return 20.f;
} }
if (self.shouldShowDate) {
return 0;
}
// "Bubble Collapse". Adjacent messages with the same author should be close together. // "Bubble Collapse". Adjacent messages with the same author should be close together.
if (self.interaction.interactionType == OWSInteractionType_IncomingMessage if (self.interaction.interactionType == OWSInteractionType_IncomingMessage
&& previousLayoutItem.interaction.interactionType == OWSInteractionType_IncomingMessage) { && previousLayoutItem.interaction.interactionType == OWSInteractionType_IncomingMessage) {

Loading…
Cancel
Save