Skip to content

Commit

Permalink
Update CDVInAppBrowserNavigationController.m
Browse files Browse the repository at this point in the history
  • Loading branch information
edskeizer committed Nov 18, 2019
1 parent 9a15737 commit 01f1b5e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/ios/CDVInAppBrowserNavigationController.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ Licensed to the Apache Software Foundation (ASF) under one

@implementation CDVInAppBrowserNavigationController : UINavigationController

- (BOOL)hasTopNotch {
if (@available(iOS 11.0, *)) {
return [[[UIApplication sharedApplication] delegate] window].safeAreaInsets.top > 20.0;
}

return NO;
}

- (void) dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion {
if ( self.presentedViewController) {
[super dismissViewControllerAnimated:flag completion:completion];
Expand All @@ -32,7 +40,11 @@ - (void) dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))com
- (void) viewDidLoad {

CGRect statusBarFrame = [self invertFrameIfNeeded:[UIApplication sharedApplication].statusBarFrame];
statusBarFrame.size.height = STATUSBAR_HEIGHT;
if ([self hasTopNotch]) {
statusBarFrame.size.height = 44;
} else {
statusBarFrame.size.height = STATUSBAR_HEIGHT;
}
// simplified from: http://stackoverflow.com/a/25669695/219684

UIToolbar* bgToolbar = [[UIToolbar alloc] initWithFrame:statusBarFrame];
Expand Down

0 comments on commit 01f1b5e

Please sign in to comment.