From 6b0a5c978e56637ee83cfdd3aeb6f7cd58102f42 Mon Sep 17 00:00:00 2001 From: yoshisuga Date: Tue, 22 Aug 2023 11:55:59 -1000 Subject: [PATCH] tvOS: Add target conditionals to fix tvOS build (#15637) * Add target conditionals to fix tvOS build * Use TARGET_OS_IOS for iOS --- pkg/apple/HelperBar/CocoaView+HelperBar.swift | 2 ++ ui/drivers/cocoa/cocoa_common.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/pkg/apple/HelperBar/CocoaView+HelperBar.swift b/pkg/apple/HelperBar/CocoaView+HelperBar.swift index 483e428b91..3c7d58a427 100644 --- a/pkg/apple/HelperBar/CocoaView+HelperBar.swift +++ b/pkg/apple/HelperBar/CocoaView+HelperBar.swift @@ -50,6 +50,7 @@ extension CocoaView: HelperBarActionDelegate { } func orientationLockButtonTapped() { + #if TARGET_OS_IOS shouldLockCurrentInterfaceOrientation.toggle() if shouldLockCurrentInterfaceOrientation { let currentOrientation = UIApplication.shared.windows.first?.windowScene?.interfaceOrientation ?? UIInterfaceOrientation.portrait @@ -58,6 +59,7 @@ extension CocoaView: HelperBarActionDelegate { if #available(iOS 16, *) { setNeedsUpdateOfSupportedInterfaceOrientations() } + #endif } var isKeyboardEnabled: Bool { diff --git a/ui/drivers/cocoa/cocoa_common.h b/ui/drivers/cocoa/cocoa_common.h index eadcd7546a..13cb0d5c59 100644 --- a/ui/drivers/cocoa/cocoa_common.h +++ b/ui/drivers/cocoa/cocoa_common.h @@ -68,8 +68,10 @@ @property(nonatomic,strong) UIView *helperBarView; #endif +#if TARGET_OS_IOS @property(readwrite) BOOL shouldLockCurrentInterfaceOrientation; @property(readwrite) UIInterfaceOrientation lockInterfaceOrientation; +#endif + (CocoaView*)get; @end