From a22b23e335be3f75630384601ad984be4a27daaa Mon Sep 17 00:00:00 2001 From: reuk Date: Tue, 19 Jul 2022 13:58:11 +0100 Subject: [PATCH] iOS: Remove iOS 11 preprocessor checks The current minimum-supported Xcode (10.1) includes the iOS 12.1 SDK, so APIs from iOS 10 will always be available. --- .../AU/juce_AUv3_Wrapper.mm | 32 ++++++------------- modules/juce_core/native/juce_mac_Files.mm | 2 -- .../accessibility/juce_ios_Accessibility.mm | 8 ----- .../native/juce_ios_UIViewComponentPeer.mm | 2 -- .../native/juce_ios_Windowing.mm | 2 -- .../juce_video/native/juce_ios_CameraDevice.h | 8 ----- 6 files changed, 9 insertions(+), 45 deletions(-) diff --git a/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm b/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm index 4b049b32e0..e3957f205e 100644 --- a/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm +++ b/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm @@ -37,12 +37,6 @@ #define JUCE_AUV3_MIDI_EVENT_LIST_SUPPORTED 1 #endif -#if (JUCE_IOS && defined (__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0) \ - || (JUCE_MAC && defined (MAC_OS_X_VERSION_10_13) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_13) - #define JUCE_AUV3_MIDI_OUTPUT_SUPPORTED 1 - #define JUCE_AUV3_VIEW_CONFIG_SUPPORTED 1 -#endif - #ifndef __OBJC2__ #error AUv3 needs Objective-C 2 support (compile with 64-bit) #endif @@ -202,12 +196,11 @@ public: } //============================================================================== - #if JUCE_AUV3_VIEW_CONFIG_SUPPORTED - JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wunguarded-availability", "-Wunguarded-availability-new") + API_AVAILABLE (macos (10.13), ios (11.0)) virtual NSIndexSet* getSupportedViewConfigurations (NSArray*) = 0; + + API_AVAILABLE (macos (10.13), ios (11.0)) virtual void selectViewConfiguration (AUAudioUnitViewConfiguration*) = 0; - JUCE_END_IGNORE_WARNINGS_GCC_LIKE - #endif private: struct Class : public ObjCClass @@ -253,10 +246,8 @@ private: addMethod (@selector (supportsMPE), getSupportsMPE); JUCE_END_IGNORE_WARNINGS_GCC_LIKE - #if JUCE_AUV3_MIDI_OUTPUT_SUPPORTED if (@available (macOS 10.13, iOS 11.0, *)) addMethod (@selector (MIDIOutputNames), getMIDIOutputNames); - #endif //============================================================================== addMethod (@selector (internalRenderBlock), getInternalRenderBlock); @@ -273,13 +264,11 @@ private: addMethod (@selector (setContextName:), setContextName); //============================================================================== - #if JUCE_AUV3_VIEW_CONFIG_SUPPORTED if (@available (macOS 10.13, iOS 11.0, *)) { addMethod (@selector (supportedViewConfigurations:), getSupportedViewConfigurations); addMethod (@selector (selectViewConfiguration:), selectViewConfiguration); } - #endif registerClass(); } @@ -388,12 +377,11 @@ private: static void setContextName (id self, SEL, NSString* str) { return _this (self)->setContextName (str); } //============================================================================== - #if JUCE_AUV3_VIEW_CONFIG_SUPPORTED - JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wunguarded-availability", "-Wunguarded-availability-new") + API_AVAILABLE (macos (10.13), ios (11.0)) static NSIndexSet* getSupportedViewConfigurations (id self, SEL, NSArray* configs) { return _this (self)->getSupportedViewConfigurations (configs); } + + API_AVAILABLE (macos (10.13), ios (11.0)) static void selectViewConfiguration (id self, SEL, AUAudioUnitViewConfiguration* config) { _this (self)->selectViewConfiguration (config); } - JUCE_END_IGNORE_WARNINGS_GCC_LIKE - #endif }; static JuceAudioUnitv3Base* create (AUAudioUnit*, AudioComponentDescription, AudioComponentInstantiationOptions, NSError**); @@ -883,8 +871,7 @@ public: } //============================================================================== - #if JUCE_AUV3_VIEW_CONFIG_SUPPORTED - JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wunguarded-availability", "-Wunguarded-availability-new") + API_AVAILABLE (macos (10.13), ios (11.0)) NSIndexSet* getSupportedViewConfigurations (NSArray* configs) override { auto supportedViewIndecies = [[NSMutableIndexSet alloc] init]; @@ -917,12 +904,11 @@ public: return [supportedViewIndecies autorelease]; } + API_AVAILABLE (macos (10.13), ios (11.0)) void selectViewConfiguration (AUAudioUnitViewConfiguration* config) override { processorHolder->viewConfiguration.reset (new AudioProcessorHolder::ViewConfig { [config width], [config height], [config hostHasController] == YES }); } - JUCE_END_IGNORE_WARNINGS_GCC_LIKE - #endif struct ScopedKeyChange { @@ -1640,7 +1626,7 @@ private: processBlock (audioBuffer.getBuffer (frameCount), midiMessages); // send MIDI - #if JucePlugin_ProducesMidiOutput && JUCE_AUV3_MIDI_OUTPUT_SUPPORTED + #if JucePlugin_ProducesMidiOutput if (@available (macOS 10.13, iOS 11.0, *)) { if (auto midiOut = midiOutputEventBlock) diff --git a/modules/juce_core/native/juce_mac_Files.mm b/modules/juce_core/native/juce_mac_Files.mm index 433eada7b3..dcee53f11a 100644 --- a/modules/juce_core/native/juce_mac_Files.mm +++ b/modules/juce_core/native/juce_mac_Files.mm @@ -285,7 +285,6 @@ bool File::moveToTrash() const JUCE_AUTORELEASEPOOL { - #if JUCE_MAC || (JUCE_IOS && (defined (__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0)) if (@available (macOS 10.8, iOS 11.0, *)) { NSError* error = nil; @@ -293,7 +292,6 @@ bool File::moveToTrash() const resultingItemURL: nil error: &error]; } - #endif #if JUCE_IOS return deleteFile(); diff --git a/modules/juce_gui_basics/native/accessibility/juce_ios_Accessibility.mm b/modules/juce_gui_basics/native/accessibility/juce_ios_Accessibility.mm index b971c170de..5874ad3e0b 100644 --- a/modules/juce_gui_basics/native/accessibility/juce_ios_Accessibility.mm +++ b/modules/juce_gui_basics/native/accessibility/juce_ios_Accessibility.mm @@ -37,10 +37,6 @@ static void juceFreeAccessibilityPlatformSpecificData (UIAccessibilityElement* e namespace juce { -#if defined (__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0 - #define JUCE_IOS_CONTAINER_API_AVAILABLE 1 -#endif - #define JUCE_NATIVE_ACCESSIBILITY_INCLUDED 1 template struct Signature; @@ -123,7 +119,6 @@ private: return nil; }); - #if JUCE_IOS_CONTAINER_API_AVAILABLE if (@available (iOS 11.0, *)) { addMethod (@selector (accessibilityDataTableCellElementForRow:column:), [] (id self, SEL, NSUInteger row, NSUInteger column) -> id @@ -194,7 +189,6 @@ private: return 0; // UIAccessibilityContainerTypeNone }); } - #endif registerClass(); } @@ -507,14 +501,12 @@ private: addProtocol (@protocol (UITextInput)); } - #if JUCE_IOS_CONTAINER_API_AVAILABLE if (@available (iOS 11.0, *)) { addMethod (@selector (accessibilityRowRange), getAccessibilityRowIndexRange); addMethod (@selector (accessibilityColumnRange), getAccessibilityColumnIndexRange); addProtocol (@protocol (UIAccessibilityContainerDataTableCell)); } - #endif addIvar ("container"); diff --git a/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm index 48eeafd7a1..0f77a428e0 100644 --- a/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm @@ -575,12 +575,10 @@ MultiTouchMapper UIViewComponentPeer::currentTouches; return [[[NSBundle mainBundle] objectForInfoDictionaryKey: @"UIStatusBarHidden"] boolValue]; } -#if defined (__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0 - (BOOL) prefersHomeIndicatorAutoHidden { return isKioskModeView (self); } -#endif - (UIStatusBarStyle) preferredStatusBarStyle { diff --git a/modules/juce_gui_basics/native/juce_ios_Windowing.mm b/modules/juce_gui_basics/native/juce_ios_Windowing.mm index a64237c121..f5f03c32ed 100644 --- a/modules/juce_gui_basics/native/juce_ios_Windowing.mm +++ b/modules/juce_gui_basics/native/juce_ios_Windowing.mm @@ -791,7 +791,6 @@ static Rectangle getRecommendedWindowBounds() static BorderSize getSafeAreaInsets (float masterScale) { - #if defined (__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0 if (@available (iOS 11.0, *)) { UIEdgeInsets safeInsets = TemporaryWindow().window.safeAreaInsets; @@ -800,7 +799,6 @@ static BorderSize getSafeAreaInsets (float masterScale) safeInsets.bottom, safeInsets.right } / (double) masterScale); } - #endif JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations") auto statusBarSize = [UIApplication sharedApplication].statusBarFrame.size; diff --git a/modules/juce_video/native/juce_ios_CameraDevice.h b/modules/juce_video/native/juce_ios_CameraDevice.h index 93c0ad1c6f..97a48c5a2a 100644 --- a/modules/juce_video/native/juce_ios_CameraDevice.h +++ b/modules/juce_video/native/juce_ios_CameraDevice.h @@ -208,14 +208,12 @@ private: JUCE_CAMERA_LOG ("Locking focus with custom lens position supported: " + String ((int)device.lockingFocusWithCustomLensPositionSupported)); } - #if defined (__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0 if (@available (iOS 11.0, *)) { JUCE_CAMERA_LOG ("Min available video zoom factor: " + String (device.minAvailableVideoZoomFactor)); JUCE_CAMERA_LOG ("Max available video zoom factor: " + String (device.maxAvailableVideoZoomFactor)); JUCE_CAMERA_LOG ("Dual camera switch over video zoom factor: " + String (device.dualCameraSwitchOverVideoZoomFactor)); } - #endif JUCE_CAMERA_LOG ("Capture formats start-------------------"); for (AVCaptureDeviceFormat* format in device.formats) @@ -280,13 +278,11 @@ private: JUCE_CAMERA_LOG ("Cinematic video stabilization supported: " + String ((int) [format isVideoStabilizationModeSupported: AVCaptureVideoStabilizationModeCinematic])); JUCE_CAMERA_LOG ("Auto video stabilization supported: " + String ((int) [format isVideoStabilizationModeSupported: AVCaptureVideoStabilizationModeAuto])); - #if defined (__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0 if (@available (iOS 11.0, *)) { JUCE_CAMERA_LOG ("Min zoom factor for depth data delivery: " + String (format.videoMinZoomFactorForDepthDataDelivery)); JUCE_CAMERA_LOG ("Max zoom factor for depth data delivery: " + String (format.videoMaxZoomFactorForDepthDataDelivery)); } - #endif } static String getHighResStillImgDimensionsString (CMVideoDimensions d) @@ -688,7 +684,6 @@ private: JUCE_CAMERA_LOG ("Live photo capture supported: " + String ((int) photoOutput.livePhotoCaptureSupported)); - #if defined (__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0 if (@available (iOS 11.0, *)) { typesString.clear(); @@ -716,7 +711,6 @@ private: JUCE_CAMERA_LOG ("Camera calibration data delivery supported: " + String ((int) photoOutput.cameraCalibrationDataDeliverySupported)); JUCE_CAMERA_LOG ("Depth data delivery supported: " + String ((int) photoOutput.depthDataDeliverySupported)); } - #endif return; } @@ -758,13 +752,11 @@ private: addMethod (@selector (captureOutput:didCapturePhotoForResolvedSettings:), didCaptureForSettings); addMethod (@selector (captureOutput:didFinishCaptureForResolvedSettings:error:), didFinishCaptureForSettings); - #if defined (__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0 if (@available (iOS 11.0, *)) { addMethod (@selector (captureOutput:didFinishProcessingPhoto:error:), didFinishProcessingPhoto); } else - #endif { addMethod (@selector (captureOutput:didFinishProcessingPhotoSampleBuffer:previewPhotoSampleBuffer:resolvedSettings:bracketSettings:error:), didFinishProcessingPhotoSampleBuffer); }