Tapping on status bar returns to call

We want to render the return-to-call banner behind the status bar, so
the user can see the system clock, etc.

But normally, doing so would mean we wouldn't receive touches in the top
20px of the screen.

// FREEBIE
This commit is contained in:
Michael Kirk 2018-05-18 09:37:59 -04:00 committed by Matthew Chen
parent 4c9808d1a1
commit 4f80100234
4 changed files with 23 additions and 0 deletions

View File

@ -1162,4 +1162,17 @@ static NSTimeInterval launchStartedAt;
[AppUpdateNag.sharedInstance showAppUpgradeNagIfNecessary];
}
#pragma mark - status bar touches
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesBegan:touches withEvent:event];
CGPoint location = [[[event allTouches] anyObject] locationInView:[self window]];
CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
if (CGRectContainsPoint(statusBarFrame, location)) {
DDLogDebug(@"%@ touched status bar", self.logTag);
[[NSNotificationCenter defaultCenter] postNotificationName:TappedStatusBarNotification object:nil];
}
}
@end

View File

@ -17,6 +17,7 @@ public class ReturnToCallViewController: UIViewController {
let returnToCallLabel = UILabel()
public func startAnimating() {
NotificationCenter.default.addObserver(self, selector: #selector(didTapStatusBar(notification:)), name: .TappedStatusBar, object: nil)
self.returnToCallLabel.layer.removeAllAnimations()
self.returnToCallLabel.alpha = 1
UIView.animate(withDuration: 1,
@ -27,6 +28,7 @@ public class ReturnToCallViewController: UIViewController {
}
public func stopAnimating() {
NotificationCenter.default.removeObserver(self, name: .TappedStatusBar, object: nil)
self.returnToCallLabel.layer.removeAllAnimations()
}
@ -56,6 +58,11 @@ public class ReturnToCallViewController: UIViewController {
self.delegate?.returnToCallWasTapped(self)
}
@objc
public func didTapStatusBar(notification: Notification) {
self.delegate?.returnToCallWasTapped(self)
}
override public func viewWillLayoutSubviews() {
Logger.debug("\(self.logTag) in \(#function)")

View File

@ -8,6 +8,7 @@ NS_ASSUME_NONNULL_BEGIN
extern const NSUInteger kMin2FAPinLength;
extern const NSUInteger kMax2FAPinLength;
extern NSString *const TappedStatusBarNotification;
@interface ViewControllerUtils : NSObject

View File

@ -11,6 +11,8 @@
NS_ASSUME_NONNULL_BEGIN
NSString *const TappedStatusBarNotification = @"TappedStatusBarNotification";
const NSUInteger kMin2FAPinLength = 4;
const NSUInteger kMax2FAPinLength = 16;