From 900abf2367f7137352765b38eb9fe3f6892e5f91 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Fri, 6 Jul 2018 15:11:01 -0600 Subject: [PATCH] CR: simplify --- .../Cells/OWSMessageBubbleView.m | 2 +- .../Cells/OWSQuotedMessageView.m | 22 +++++-------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m index 36d5b851f..033bc4aef 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m @@ -578,7 +578,7 @@ NS_ASSUME_NONNULL_BEGIN if (self.viewItem.senderName) { return UIRectCornerAllCorners; } else { - return self.sharpCorners & UIRectCornerAllCorners; + return self.sharpCorners | UIRectCornerBottomLeft | UIRectCornerBottomRight; } } diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m index 142656e16..cbf552d28 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m @@ -172,20 +172,19 @@ NS_ASSUME_NONNULL_BEGIN const CGFloat topRightRounding = (sharpCorners & UIRectCornerTopRight) ? sharpCornerRadius : wideCornerRadius; - // bottom corners are always sharp - const CGFloat bottomRightRounding = sharpCornerRadius; - const CGFloat bottomLeftRounding = sharpCornerRadius; + const CGFloat bottomRightRounding + = (sharpCorners & UIRectCornerBottomRight) ? sharpCornerRadius : wideCornerRadius; + const CGFloat bottomLeftRounding + = (sharpCorners & UIRectCornerBottomLeft) ? sharpCornerRadius : wideCornerRadius; - const CGFloat topAngle = 3.0f * M_PI / 2.0f; + const CGFloat topAngle = 3.0f * M_PI_2; const CGFloat rightAngle = 0.0f; - const CGFloat bottomAngle = M_PI / 2.0f; + const CGFloat bottomAngle = M_PI_2; const CGFloat leftAngle = M_PI; // starting just to the right of the top left corner and working clockwise [bezierPath moveToPoint:CGPointMake(bubbleLeft + topLeftRounding, bubbleTop)]; - // top line - [bezierPath addLineToPoint:CGPointMake(bubbleRight - topRightRounding, bubbleTop)]; // top right corner [bezierPath addArcWithCenter:CGPointMake(bubbleRight - topRightRounding, bubbleTop + topRightRounding) @@ -194,9 +193,6 @@ NS_ASSUME_NONNULL_BEGIN endAngle:rightAngle clockwise:true]; - // right line - [bezierPath addLineToPoint:CGPointMake(bubbleRight, bubbleBottom - bottomRightRounding)]; - // bottom right corner [bezierPath addArcWithCenter:CGPointMake(bubbleRight - bottomRightRounding, bubbleBottom - bottomRightRounding) @@ -205,9 +201,6 @@ NS_ASSUME_NONNULL_BEGIN endAngle:bottomAngle clockwise:true]; - // bottom line - [bezierPath addLineToPoint:CGPointMake(bubbleLeft + bottomLeftRounding, bubbleBottom)]; - // bottom left corner [bezierPath addArcWithCenter:CGPointMake(bubbleLeft + bottomLeftRounding, bubbleBottom - bottomLeftRounding) radius:bottomLeftRounding @@ -215,9 +208,6 @@ NS_ASSUME_NONNULL_BEGIN endAngle:leftAngle clockwise:true]; - // left line - [bezierPath addLineToPoint:CGPointMake(bubbleLeft, bubbleTop + topLeftRounding)]; - // top left corner [bezierPath addArcWithCenter:CGPointMake(bubbleLeft + topLeftRounding, bubbleTop + topLeftRounding) radius:topLeftRounding