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 fefb9316 fix: proper macro check for `TARGET_OS_VISION` (#1667)
fefb9316 is described below
commit fefb93161a2cdf72b3edab4b6838161570e09f2a
Author: Manuel Beck <[email protected]>
AuthorDate: Sat Jun 20 08:40:36 2026 +0200
fix: proper macro check for `TARGET_OS_VISION` (#1667)
* fix: proper macro check for `TARGET_OS_VISION`
- `TARGET_OS_VISION` is defined by Appleās headers as a macro with a value,
so `#ifndef TARGET_OS_VISION` is the wrong test. On iPhone it is typically
defined as 0, which still makes `#ifndef` false. That means the guarded code
gets excluded even though you are not on visionOS.
- Test the macro by `#if !TARGET_OS_VISION` instead of `#ifndef
TARGET_OS_VISION`
- Generated-By: GPT-5.3-Codex
* Safer macro handling for TARGET_OSes
---------
Co-authored-by: Darryl Pogue <[email protected]>
---
CordovaLib/Classes/Public/CDVViewController.m | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/CordovaLib/Classes/Public/CDVViewController.m
b/CordovaLib/Classes/Public/CDVViewController.m
index f5d6877d..b2dc5714 100644
--- a/CordovaLib/Classes/Public/CDVViewController.m
+++ b/CordovaLib/Classes/Public/CDVViewController.m
@@ -403,7 +403,7 @@ static UIColor *defaultBackgroundColor(void) {
{
[super viewDidAppear:animated];
-#if TARGET_OS_MACCATALYST
+#if defined(TARGET_OS_MACCATALYST) && TARGET_OS_MACCATALYST
BOOL hideTitlebar = [self.settings
cordovaBoolSettingForKey:@"HideDesktopTitlebar" defaultValue:NO];
if (hideTitlebar) {
UIWindowScene *scene = self.view.window.windowScene;
@@ -577,7 +577,7 @@ static UIColor *defaultBackgroundColor(void) {
- (void)scrollViewDidChangeAdjustedContentInset:(UIScrollView *)scrollView
{
-#ifndef TARGET_OS_VISION
+#if !defined(TARGET_OS_VISION) || !TARGET_OS_VISION
if (self.webView.hidden) {
self.statusBar.hidden = true;
return;
@@ -587,7 +587,7 @@ static UIColor *defaultBackgroundColor(void) {
#endif
}
-#ifndef TARGET_OS_VISION
+#if !defined(TARGET_OS_VISION) || !TARGET_OS_VISION
- (BOOL)prefersStatusBarHidden
{
// The CDVStatusBar plugin overrides this in a category extension, and
@@ -731,7 +731,7 @@ static UIColor *defaultBackgroundColor(void) {
- (void)createStatusBarView
{
-#ifndef TARGET_OS_VISION
+#if !defined(TARGET_OS_VISION) || !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)
@@ -889,7 +889,7 @@ static UIColor *defaultBackgroundColor(void) {
- (void)showStatusBar:(BOOL)visible
{
-#ifndef TARGET_OS_VISION
+#if !defined(TARGET_OS_VISION) || !TARGET_OS_VISION
[self.statusBar setAlpha:(visible ? 1 : 0)];
[self setNeedsStatusBarAppearanceUpdate];
#endif
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]