From e34d529620d3f69515cacfe836c148e086740f97 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 3 Feb 2017 12:28:11 -0500 Subject: [PATCH] Prevent system edge swipe gestures from showing/hiding call controls. // FREEBIE --- Signal/src/views/OWSAnyTouchGestureRecognizer.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Signal/src/views/OWSAnyTouchGestureRecognizer.m b/Signal/src/views/OWSAnyTouchGestureRecognizer.m index 228710152..3e4d7b827 100644 --- a/Signal/src/views/OWSAnyTouchGestureRecognizer.m +++ b/Signal/src/views/OWSAnyTouchGestureRecognizer.m @@ -57,6 +57,16 @@ return NO; } + // Ignore touches that start near the top or bottom edge of the screen; + // they may be a system edge swipe gesture. + CGFloat distanceToTopEdge = MAX(0, location.y); + CGFloat distanceToBottomEdge = MAX(0, self.view.bounds.size.height - location.y); + CGFloat distanceToNearestEdge = MIN(distanceToTopEdge, distanceToBottomEdge); + CGFloat kSystemEdgeSwipeTolerance = 50.f; + if (distanceToNearestEdge < kSystemEdgeSwipeTolerance) { + return NO; + } + return YES; }