diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m index 50d0b0830c..389c95ae3f 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m @@ -151,8 +151,8 @@ NS_ASSUME_NONNULL_BEGIN [self.contentView addSubview:self.headerView]; [self.viewConstraints addObjectsFromArray:@[ [self.headerView autoSetDimension:ALDimensionHeight toSize:headerHeight], - [self.headerView autoPinLeadingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterLeading], - [self.headerView autoPinTrailingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterTrailing], + [self.headerView autoPinEdgeToSuperviewEdge:ALEdgeLeading], + [self.headerView autoPinEdgeToSuperviewEdge:ALEdgeTrailing], [self.headerView autoPinEdgeToSuperviewEdge:ALEdgeTop], [self.messageBubbleView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:self.headerView], ]]; diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageHeaderView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageHeaderView.m index cd1ab807d6..ee637bf3b1 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageHeaderView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageHeaderView.m @@ -93,8 +93,8 @@ const CGFloat OWSMessageHeaderViewDateHeaderVMargin = 23; [self.strokeView autoSetDimension:ALDimensionHeight toSize:strokeThickness], [self.stackView autoPinEdgeToSuperviewEdge:ALEdgeTop], - [self.stackView autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:conversationStyle.fullWidthGutterLeading], - [self.stackView autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:conversationStyle.fullWidthGutterTrailing], + [self.stackView autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:conversationStyle.headerGutterLeading], + [self.stackView autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:conversationStyle.headerGutterTrailing] ]; } @@ -170,7 +170,7 @@ const CGFloat OWSMessageHeaderViewDateHeaderVMargin = 23; CGFloat strokeThickness = [self strokeThicknessWithViewItem:viewItem]; result.height += strokeThickness; - CGFloat maxTextWidth = conversationStyle.fullWidthContentWidth; + CGFloat maxTextWidth = conversationStyle.headerViewContentWidth; CGSize titleSize = [self.titleLabel sizeThatFits:CGSizeMake(maxTextWidth, CGFLOAT_MAX)]; result.height += titleSize.height + self.stackView.spacing; diff --git a/SignalMessaging/utils/ConversationStyle.swift b/SignalMessaging/utils/ConversationStyle.swift index e13b6e8cbe..7cbbdf3117 100644 --- a/SignalMessaging/utils/ConversationStyle.swift +++ b/SignalMessaging/utils/ConversationStyle.swift @@ -23,17 +23,28 @@ public class ConversationStyle: NSObject { @objc public var gutterLeading: CGFloat = 0 @objc public var gutterTrailing: CGFloat = 0 + + @objc public var headerGutterLeading: CGFloat = 28 + @objc public var headerGutterTrailing: CGFloat = 28 + // These are the gutters used by "full width" views - // like "date headers" and "unread indicator". + // like "contact offer" and "info message". @objc public var fullWidthGutterLeading: CGFloat = 0 @objc public var fullWidthGutterTrailing: CGFloat = 0 + @objc public var errorGutterTrailing: CGFloat = 0 - // viewWidth - (gutterLeading + gutterTrailing) - @objc public var contentWidth: CGFloat = 0 + @objc public var contentWidth: CGFloat { + return viewWidth - (gutterLeading + gutterTrailing) + } - // viewWidth - (gutterfullWidthGutterLeadingLeading + fullWidthGutterTrailing) - @objc public var fullWidthContentWidth: CGFloat = 0 + @objc public var fullWidthContentWidth: CGFloat { + return viewWidth - (fullWidthGutterLeading + fullWidthGutterTrailing) + } + + @objc public var headerViewContentWidth: CGFloat { + return viewWidth - (headerGutterLeading + headerGutterTrailing) + } @objc public var maxMessageWidth: CGFloat = 0 @@ -88,12 +99,10 @@ public class ConversationStyle: NSObject { } fullWidthGutterLeading = 16 fullWidthGutterTrailing = 16 + headerGutterLeading = 28 + headerGutterTrailing = 28 errorGutterTrailing = 16 - contentWidth = viewWidth - (gutterLeading + gutterTrailing) - - fullWidthContentWidth = viewWidth - (fullWidthGutterLeading + fullWidthGutterTrailing) - maxMessageWidth = floor(contentWidth - 32) let messageTextFont = UIFont.ows_dynamicTypeBody