From d5218cf4d9c743612e02ab4789ebe5ab5c7c391d Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Mon, 2 Apr 2018 17:19:08 -0400 Subject: [PATCH 1/2] Simplify bubble edge. --- .../ConversationView/Cells/OWSBubbleView.m | 33 +++++++++++-------- .../src/ViewControllers/HomeViewController.m | 9 +++++ 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSBubbleView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSBubbleView.m index 33a74a10a..c8f3acf69 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSBubbleView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSBubbleView.m @@ -175,27 +175,32 @@ const CGFloat kBubbleTextVInset = 10.f; [bezierPath addQuadCurveToPoint:CGPointMake(bubbleRight, bubbleTop + kBubbleVRounding) controlPoint:CGPointMake(bubbleRight, bubbleTop)]; [bezierPath addLineToPoint:CGPointMake(bubbleRight, bubbleBottom - kBubbleVRounding)]; - [bezierPath addQuadCurveToPoint:CGPointMake(bubbleRight - kBubbleHRounding, bubbleBottom) - controlPoint:CGPointMake(bubbleRight, bubbleBottom)]; - [bezierPath addLineToPoint:CGPointMake(bubbleLeft + kBubbleHRounding, bubbleBottom)]; - [bezierPath addQuadCurveToPoint:CGPointMake(bubbleLeft, bubbleBottom - kBubbleVRounding) - controlPoint:CGPointMake(bubbleLeft, bubbleBottom)]; - [bezierPath addLineToPoint:CGPointMake(bubbleLeft, bubbleTop + kBubbleVRounding)]; - [bezierPath addQuadCurveToPoint:CGPointMake(bubbleLeft + kBubbleHRounding, bubbleTop) - controlPoint:CGPointMake(bubbleLeft, bubbleTop)]; - if (!hideTail) { + if (hideTail) { + [bezierPath addQuadCurveToPoint:CGPointMake(bubbleRight - kBubbleHRounding, bubbleBottom) + controlPoint:CGPointMake(bubbleRight, bubbleBottom)]; + } else { // Thorn Tip CGPoint thornTip = CGPointMake(size.width + 1, size.height); - CGPoint thornA = CGPointMake(bubbleRight - kBubbleHRounding * 0.5f, bubbleBottom - kBubbleVRounding); CGPoint thornB = CGPointMake(bubbleRight, bubbleBottom - kBubbleVRounding); - [bezierPath moveToPoint:thornTip]; - [bezierPath addQuadCurveToPoint:thornA controlPoint:CGPointMake(thornA.x, bubbleBottom)]; - [bezierPath addLineToPoint:thornB]; + // Approximate intersection of the thorn and the bubble edge. + CGPoint thornPrime + = CGPointMake(bubbleRight - kBubbleHRounding * 0.25f, bubbleBottom - kBubbleVRounding * 0.25f); + CGPoint thornPrimeA = CGPointMake(thornPrime.x, bubbleBottom - kBubbleVRounding * 0.08f); + [bezierPath addQuadCurveToPoint:thornTip controlPoint:CGPointMake(thornB.x, bubbleBottom)]; - [bezierPath addLineToPoint:thornTip]; + [bezierPath addQuadCurveToPoint:thornPrime controlPoint:thornPrimeA]; + [bezierPath addQuadCurveToPoint:CGPointMake(bubbleRight - kBubbleHRounding, bubbleBottom) + controlPoint:thornPrimeA]; } + [bezierPath addLineToPoint:CGPointMake(bubbleLeft + kBubbleHRounding, bubbleBottom)]; + [bezierPath addQuadCurveToPoint:CGPointMake(bubbleLeft, bubbleBottom - kBubbleVRounding) + controlPoint:CGPointMake(bubbleLeft, bubbleBottom)]; + [bezierPath addLineToPoint:CGPointMake(bubbleLeft, bubbleTop + kBubbleVRounding)]; + [bezierPath addQuadCurveToPoint:CGPointMake(bubbleLeft + kBubbleHRounding, bubbleTop) + controlPoint:CGPointMake(bubbleLeft, bubbleTop)]; + // Horizontal Flip If Necessary BOOL shouldFlip = isOutgoing == isRTL; if (shouldFlip) { diff --git a/Signal/src/ViewControllers/HomeViewController.m b/Signal/src/ViewControllers/HomeViewController.m index 1f95eb20a..3a6bc2ea1 100644 --- a/Signal/src/ViewControllers/HomeViewController.m +++ b/Signal/src/ViewControllers/HomeViewController.m @@ -284,6 +284,15 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; } [self updateBarButtonItems]; + + dispatch_async(dispatch_get_main_queue(), ^{ + NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; + TSThread *thread = [self threadForIndexPath:indexPath]; + if (!thread) { + return; + } + [self presentThread:thread keyboardOnViewAppearing:NO callOnViewAppearing:NO]; + }); } - (void)viewDidAppear:(BOOL)animated From 20387f27e68ca3f461f0d4aee5b418b73898e0ea Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Mon, 2 Apr 2018 17:20:42 -0400 Subject: [PATCH 2/2] Simplify bubble edge. --- Signal/src/ViewControllers/HomeViewController.m | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Signal/src/ViewControllers/HomeViewController.m b/Signal/src/ViewControllers/HomeViewController.m index 3a6bc2ea1..1f95eb20a 100644 --- a/Signal/src/ViewControllers/HomeViewController.m +++ b/Signal/src/ViewControllers/HomeViewController.m @@ -284,15 +284,6 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; } [self updateBarButtonItems]; - - dispatch_async(dispatch_get_main_queue(), ^{ - NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; - TSThread *thread = [self threadForIndexPath:indexPath]; - if (!thread) { - return; - } - [self presentThread:thread keyboardOnViewAppearing:NO callOnViewAppearing:NO]; - }); } - (void)viewDidAppear:(BOOL)animated