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:
parent
4c9808d1a1
commit
4f80100234
|
@ -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
|
||||
|
|
|
@ -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)")
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
extern const NSUInteger kMin2FAPinLength;
|
||||
extern const NSUInteger kMax2FAPinLength;
|
||||
extern NSString *const TappedStatusBarNotification;
|
||||
|
||||
@interface ViewControllerUtils : NSObject
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
NSString *const TappedStatusBarNotification = @"TappedStatusBarNotification";
|
||||
|
||||
const NSUInteger kMin2FAPinLength = 4;
|
||||
const NSUInteger kMax2FAPinLength = 16;
|
||||
|
||||
|
|
Loading…
Reference in New Issue