You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by jc...@apache.org on 2017/09/22 18:21:55 UTC

cordova-plugin-statusbar git commit: CB-13311: (iOS) Statusbar does not overlay correctly on iPhone X

Repository: cordova-plugin-statusbar
Updated Branches:
  refs/heads/master ef5fb5b9e -> fff289c0b


CB-13311: (iOS) Statusbar does not overlay correctly on iPhone X

 This closes #87


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/commit/fff289c0
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/tree/fff289c0
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/diff/fff289c0

Branch: refs/heads/master
Commit: fff289c0b8a7d0eb5b94f06d8ace9733054185bd
Parents: ef5fb5b
Author: jcesarmobile <jc...@gmail.com>
Authored: Thu Sep 21 20:55:26 2017 +0200
Committer: Julio César <jc...@gmail.com>
Committed: Fri Sep 22 20:21:33 2017 +0200

----------------------------------------------------------------------
 src/ios/CDVStatusBar.m | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/blob/fff289c0/src/ios/CDVStatusBar.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVStatusBar.m b/src/ios/CDVStatusBar.m
index 58fbc29..f6b672e 100644
--- a/src/ios/CDVStatusBar.m
+++ b/src/ios/CDVStatusBar.m
@@ -449,6 +449,7 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
 -(void)resizeWebView
 {
     BOOL isIOS7 = (IsAtLeastiOSVersion(@"7.0"));
+    BOOL isIOS11 = (IsAtLeastiOSVersion(@"11.0"));
 
     if (isIOS7) {
         CGRect bounds = [self.viewController.view.window bounds];
@@ -472,8 +473,22 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
                 frame.origin.y = height > 0 ? height: 20;
             }
         } else {
-            // Even if overlay is used, we want to handle in-call/recording/hotspot larger status bar
-            frame.origin.y = height >= 20 ? height - 20 : 0;
+            if (isIOS11) {
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
+                if (@available(iOS 11.0, *)) {
+                    float safeAreaTop = self.webView.safeAreaInsets.top;
+                    if (height >= safeAreaTop && safeAreaTop >0) {
+                        // Sometimes when in-call/recording/hotspot larger status bar is present, the safeAreaTop is 40 but we want frame.origin.y to be 20
+                        frame.origin.y = safeAreaTop == 40 ? 20 : height - safeAreaTop;
+                    } else {
+                        frame.origin.y = 0;
+                    }
+                }
+#endif
+            } else {
+                // Even if overlay is used, we want to handle in-call/recording/hotspot larger status bar
+                frame.origin.y = height >= 20 ? height - 20 : 0;
+            }
         }
         frame.size.height -= frame.origin.y;
         self.webView.frame = frame;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org