This is an automated email from the ASF dual-hosted git repository.
dpogue 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 25486db2 fix(visionOS): Fix CordovaLib visionOS errors (#1665)
25486db2 is described below
commit 25486db2491740765a0e927de18fdb2ee798663c
Author: Darryl Pogue <[email protected]>
AuthorDate: Wed Jun 10 21:47:02 2026 -0700
fix(visionOS): Fix CordovaLib visionOS errors (#1665)
While testing the minimum version stuff, I discovered that CordovaLib
wasn't compiling for visionOS due to some of the status bar code (since
visionOS doesn't have a status bar). Although we don't really treat
visionOS as a supported target platform, it's nice to have it not be
broken.
Wrap the status bar code in conditionals so that we don't run that code
on visionOS. The other spots where we try to set the background colour
of the status bar are safe because self.statusBar will be nil and it's
safe to send messages to nil.
---
CordovaLib/Classes/Public/CDVViewController.m | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/CordovaLib/Classes/Public/CDVViewController.m
b/CordovaLib/Classes/Public/CDVViewController.m
index 7db2ee36..f5d6877d 100644
--- a/CordovaLib/Classes/Public/CDVViewController.m
+++ b/CordovaLib/Classes/Public/CDVViewController.m
@@ -577,20 +577,24 @@ static UIColor *defaultBackgroundColor(void) {
- (void)scrollViewDidChangeAdjustedContentInset:(UIScrollView *)scrollView
{
+#ifndef TARGET_OS_VISION
if (self.webView.hidden) {
self.statusBar.hidden = true;
return;
}
self.statusBar.hidden = (scrollView.contentInsetAdjustmentBehavior ==
UIScrollViewContentInsetAdjustmentNever);
+#endif
}
+#ifndef TARGET_OS_VISION
- (BOOL)prefersStatusBarHidden
{
// The CDVStatusBar plugin overrides this in a category extension, and
// should bypass this implementation entirely
return self.statusBar.alpha < 0.0001f;
}
+#endif
#pragma mark - View Setup
@@ -727,6 +731,7 @@ static UIColor *defaultBackgroundColor(void) {
- (void)createStatusBarView
{
+#ifndef TARGET_OS_VISION
// If cordova-plugin-statusbar is loaded, we'll let it handle the status
// bar to avoid introducing conflict
if (NSClassFromString(@"CDVStatusBar") != nil)
@@ -743,6 +748,7 @@ static UIColor *defaultBackgroundColor(void) {
[self.statusBar.bottomAnchor
constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor].active = YES;
self.statusBar.hidden = YES;
+#endif
}
- (void)loadStartPage
@@ -883,8 +889,10 @@ static UIColor *defaultBackgroundColor(void) {
- (void)showStatusBar:(BOOL)visible
{
+#ifndef TARGET_OS_VISION
[self.statusBar setAlpha:(visible ? 1 : 0)];
[self setNeedsStatusBarAppearanceUpdate];
+#endif
}
- (void)parseSettingsWithParser:(id <NSXMLParserDelegate>)delegate
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]