This is an automated email from the ASF dual-hosted git repository.

erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git


The following commit(s) were added to refs/heads/master by this push:
     new 930a5e6c fix(statusbar): Fix status bar on iPhone Duo (#1733)
930a5e6c is described below

commit 930a5e6c36c5226f73131e6ef7850a6d13ee1c43
Author: Darryl Pogue <[email protected]>
AuthorDate: Mon Oct 12 22:33:50 2026 -0700

    fix(statusbar): Fix status bar on iPhone Duo (#1733)
---
 CordovaLib/Classes/Public/CDVViewController.m | 62 +++++++++++++++++++++++----
 1 file changed, 53 insertions(+), 9 deletions(-)

diff --git a/CordovaLib/Classes/Public/CDVViewController.m 
b/CordovaLib/Classes/Public/CDVViewController.m
index a168ea49..f5dc521a 100644
--- a/CordovaLib/Classes/Public/CDVViewController.m
+++ b/CordovaLib/Classes/Public/CDVViewController.m
@@ -39,17 +39,20 @@ static UIColor *defaultBackgroundColor(void) {
     id <CDVCommandDelegate> _commandDelegate;
     NSMutableDictionary<NSString *, CDVPlugin *> *_pluginObjects;
     NSMutableDictionary<NSString *, NSString *> *_pluginsMap;
-    CDVCommandQueue* _commandQueue;
+    CDVCommandQueue *_commandQueue;
     UIColor *_backgroundColor;
     UIColor *_splashBackgroundColor;
     UIColor *_statusBarBackgroundColor;
     UIColor *_statusBarWebViewColor;
     UIColor *_statusBarDefaultColor;
     BOOL _statusBarHidden;
-    CDVSettingsDictionary* _settings;
+    CDVSettingsDictionary *_settings;
+    NSArray<NSLayoutConstraint *> *_topStatusBarConstraints;
+    NSArray<NSLayoutConstraint *> *_leftStatusBarConstraints;
+    NSArray<NSLayoutConstraint *> *_rightStatusBarConstraints;
 }
 
-@property (nonatomic, readwrite, strong) NSMutableArray* startupPluginNames;
+@property (nonatomic, readwrite, strong) NSMutableArray *startupPluginNames;
 @property (nonatomic, readwrite, strong) UIView *launchView;
 @property (nonatomic, readwrite, strong) UIView *statusBarBackgroundView;
 @property (readwrite, assign) BOOL initialized;
@@ -449,6 +452,30 @@ static UIColor *defaultBackgroundColor(void) {
 
 -(void)viewWillLayoutSubviews
 {
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 270100
+    if (@available(iOS 27.1, *)) {
+        if (self.traitCollection.verticalBarEdge == UIVerticalBarEdgeLeading) {
+            [NSLayoutConstraint 
deactivateConstraints:_topStatusBarConstraints];
+            [NSLayoutConstraint 
deactivateConstraints:_rightStatusBarConstraints];
+
+            [NSLayoutConstraint activateConstraints:_leftStatusBarConstraints];
+        } else if (self.traitCollection.verticalBarEdge == 
UIVerticalBarEdgeTrailing) {
+            [NSLayoutConstraint 
deactivateConstraints:_topStatusBarConstraints];
+            [NSLayoutConstraint 
deactivateConstraints:_leftStatusBarConstraints];
+
+            [NSLayoutConstraint 
activateConstraints:_rightStatusBarConstraints];
+        } else {
+            [NSLayoutConstraint 
deactivateConstraints:_rightStatusBarConstraints];
+            [NSLayoutConstraint 
deactivateConstraints:_leftStatusBarConstraints];
+            [NSLayoutConstraint activateConstraints:_topStatusBarConstraints];
+        }
+    }
+    else
+#endif
+    {
+        [NSLayoutConstraint activateConstraints:_topStatusBarConstraints];
+    }
+
     [super viewWillLayoutSubviews];
     [[NSNotificationCenter defaultCenter] postNotification:[NSNotification 
notificationWithName:CDVViewWillLayoutSubviewsNotification object:nil]];
 }
@@ -699,6 +726,7 @@ static UIColor *defaultBackgroundColor(void) {
     webViewBounds.origin = self.view.bounds.origin;
 
     UIView* view = [[UIView alloc] initWithFrame:webViewBounds];
+    view.accessibilityIdentifier = @"LaunchView";
     view.translatesAutoresizingMaskIntoConstraints = NO;
     view.alpha = 0;
 
@@ -759,15 +787,31 @@ static UIColor *defaultBackgroundColor(void) {
 
     self.statusBarBackgroundView = [[UIView alloc] init];
     self.statusBarBackgroundView.translatesAutoresizingMaskIntoConstraints = 
NO;
+    self.statusBarBackgroundView.accessibilityIdentifier = 
@"StatusBarBackground";
+    self.statusBarBackgroundView.hidden = YES;
 
     [self.view addSubview:self.statusBarBackgroundView];
 
-    [self.statusBarBackgroundView.leadingAnchor 
constraintEqualToAnchor:self.view.leadingAnchor].active = YES;
-    [self.statusBarBackgroundView.trailingAnchor 
constraintEqualToAnchor:self.view.trailingAnchor].active = YES;
-    [self.statusBarBackgroundView.topAnchor 
constraintEqualToAnchor:self.view.topAnchor].active = YES;
-    [self.statusBarBackgroundView.bottomAnchor 
constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor].active = YES;
-
-    self.statusBarBackgroundView.hidden = YES;
+    _topStatusBarConstraints = @[
+        [self.statusBarBackgroundView.leadingAnchor 
constraintEqualToAnchor:self.view.leadingAnchor],
+        [self.statusBarBackgroundView.trailingAnchor 
constraintEqualToAnchor:self.view.trailingAnchor],
+        [self.statusBarBackgroundView.topAnchor 
constraintEqualToAnchor:self.view.topAnchor],
+        [self.statusBarBackgroundView.bottomAnchor 
constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor]
+    ];
+
+    _leftStatusBarConstraints = @[
+        [self.statusBarBackgroundView.leadingAnchor 
constraintEqualToAnchor:self.view.leadingAnchor],
+        [self.statusBarBackgroundView.trailingAnchor 
constraintEqualToAnchor:self.view.safeAreaLayoutGuide.leadingAnchor],
+        [self.statusBarBackgroundView.topAnchor 
constraintEqualToAnchor:self.view.topAnchor],
+        [self.statusBarBackgroundView.bottomAnchor 
constraintEqualToAnchor:self.view.bottomAnchor]
+    ];
+
+    _rightStatusBarConstraints = @[
+        [self.statusBarBackgroundView.leadingAnchor 
constraintEqualToAnchor:self.view.safeAreaLayoutGuide.trailingAnchor],
+        [self.statusBarBackgroundView.trailingAnchor 
constraintEqualToAnchor:self.view.trailingAnchor],
+        [self.statusBarBackgroundView.topAnchor 
constraintEqualToAnchor:self.view.topAnchor],
+        [self.statusBarBackgroundView.bottomAnchor 
constraintEqualToAnchor:self.view.bottomAnchor]
+    ];
 #endif
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to