From 24c4c4c098fed0f21c70168f938af65a2bd2ea52 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 29 Jun 2018 12:49:23 -0400 Subject: [PATCH] Respond to CR. --- .../ConversationView/Cells/OWSMessageCell.m | 7 ++++++- .../ConversationView/Cells/OWSUnreadIndicatorCell.m | 8 +++++--- SignalMessaging/categories/UIView+OWS.h | 2 ++ SignalMessaging/categories/UIView+OWS.m | 5 +++++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m index fde03e540..9da6dfdbd 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m @@ -249,6 +249,11 @@ NS_ASSUME_NONNULL_BEGIN [self.dateHeaderView autoPinTrailingToSuperviewMarginWithInset:self.conversationStyle.gutterTrailing], [self.dateHeaderView autoPinEdgeToSuperviewEdge:ALEdgeTop], + // 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 @@ -365,7 +370,7 @@ NS_ASSUME_NONNULL_BEGIN - (CGFloat)dateHeaderStrokeThickness { - return 1.f / UIScreen.mainScreen.scale; + return CGHairlineWidth(); } - (CGFloat)dateHeaderBottomMargin diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSUnreadIndicatorCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSUnreadIndicatorCell.m index 0a8c701a9..578e55aa3 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSUnreadIndicatorCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSUnreadIndicatorCell.m @@ -103,8 +103,10 @@ NS_ASSUME_NONNULL_BEGIN self.layoutConstraints = @[ [self.stackView autoPinEdgeToSuperviewEdge:ALEdgeTop], [self.stackView autoPinEdgeToSuperviewEdge:ALEdgeBottom], - [self.stackView autoPinLeadingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterLeading], - [self.stackView autoPinTrailingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterTrailing], + [self.stackView autoPinEdgeToSuperviewEdge:ALEdgeLeading + withInset:self.conversationStyle.fullWidthGutterLeading], + [self.stackView autoPinEdgeToSuperviewEdge:ALEdgeTrailing + withInset:self.conversationStyle.fullWidthGutterTrailing], ]; } @@ -128,7 +130,7 @@ NS_ASSUME_NONNULL_BEGIN - (CGFloat)strokeThickness { - return 1.f / UIScreen.mainScreen.scale; + return CGHairlineWidth(); } - (CGSize)cellSizeWithTransaction:(YapDatabaseReadTransaction *)transaction diff --git a/SignalMessaging/categories/UIView+OWS.h b/SignalMessaging/categories/UIView+OWS.h index 68829583a..2cf35217f 100644 --- a/SignalMessaging/categories/UIView+OWS.h +++ b/SignalMessaging/categories/UIView+OWS.h @@ -170,4 +170,6 @@ CG_INLINE CGSize CGSizeMax(CGSize size1, CGSize size2) return CGSizeMake(MAX(size1.width, size2.width), MAX(size1.height, size2.height)); } +CGFloat CGHairlineWidth(); + NS_ASSUME_NONNULL_END diff --git a/SignalMessaging/categories/UIView+OWS.m b/SignalMessaging/categories/UIView+OWS.m index 63e796c01..b82f7dff7 100644 --- a/SignalMessaging/categories/UIView+OWS.m +++ b/SignalMessaging/categories/UIView+OWS.m @@ -542,4 +542,9 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value) @end +CGFloat CGHairlineWidth() +{ + return 1.f / UIScreen.mainScreen.scale; +} + NS_ASSUME_NONNULL_END