From 539103223819d3bb06907af7fb8c321b5b4a5b32 Mon Sep 17 00:00:00 2001 From: reuk Date: Mon, 1 Jul 2024 17:51:25 +0100 Subject: [PATCH] Platform: Remove compatibility checks for iOS 11 --- .../juce_audio_plugin_client_AUv3.mm | 8 +- .../accessibility/juce_Accessibility_ios.mm | 105 ++++++++---------- .../native/juce_FileChooser_ios.mm | 3 +- .../native/juce_Windowing_ios.mm | 21 +--- .../native/juce_WebBrowserComponent_mac.mm | 2 +- .../juce_video/native/juce_CameraDevice_ios.h | 63 ++++------- 6 files changed, 77 insertions(+), 125 deletions(-) diff --git a/modules/juce_audio_plugin_client/juce_audio_plugin_client_AUv3.mm b/modules/juce_audio_plugin_client/juce_audio_plugin_client_AUv3.mm index f314187dc3..dd857f90d9 100644 --- a/modules/juce_audio_plugin_client/juce_audio_plugin_client_AUv3.mm +++ b/modules/juce_audio_plugin_client/juce_audio_plugin_client_AUv3.mm @@ -547,7 +547,7 @@ public: hostMusicalContextCallback = [au musicalContextBlock]; hostTransportStateCallback = [au transportStateBlock]; - if (@available (macOS 10.13, iOS 11.0, *)) + if (@available (macOS 10.13, *)) midiOutputEventBlock = [au MIDIOutputEventBlock]; reset(); @@ -853,7 +853,7 @@ private: addMethod (@selector (supportsMPE), [] (id self, SEL) { return _this (self)->getSupportsMPE() ? YES : NO; }); JUCE_END_IGNORE_WARNINGS_GCC_LIKE - if (@available (macOS 10.13, iOS 11.0, *)) + if (@available (macOS 10.13, *)) addMethod (@selector (MIDIOutputNames), [] (id self, SEL) { return _this (self)->getMIDIOutputNames(); }); //============================================================================== @@ -875,7 +875,7 @@ private: #endif //============================================================================== - if (@available (macOS 10.13, iOS 11.0, *)) + if (@available (macOS 10.13, *)) { addMethod (@selector (supportedViewConfigurations:), [] (id self, SEL, NSArray* configs) { @@ -1585,7 +1585,7 @@ private: // send MIDI #if JucePlugin_ProducesMidiOutput - if (@available (macOS 10.13, iOS 11.0, *)) + if (@available (macOS 10.13, *)) { if (auto midiOut = midiOutputEventBlock) for (const auto metadata : midiMessages) diff --git a/modules/juce_gui_basics/native/accessibility/juce_Accessibility_ios.mm b/modules/juce_gui_basics/native/accessibility/juce_Accessibility_ios.mm index 2b6e25ad95..21538ae777 100644 --- a/modules/juce_gui_basics/native/accessibility/juce_Accessibility_ios.mm +++ b/modules/juce_gui_basics/native/accessibility/juce_Accessibility_ios.mm @@ -128,76 +128,62 @@ private: return nil; }); - if (@available (iOS 11.0, *)) + addMethod (@selector (accessibilityDataTableCellElementForRow:column:), [] (id self, SEL, NSUInteger row, NSUInteger column) -> id { - addMethod (@selector (accessibilityDataTableCellElementForRow:column:), [] (id self, SEL, NSUInteger row, NSUInteger column) -> id + if (auto* tableHandler = detail::AccessibilityHelpers::getEnclosingHandlerWithInterface (getHandler (self), &AccessibilityHandler::getTableInterface)) + if (auto* tableInterface = tableHandler->getTableInterface()) + if (auto* cellHandler = tableInterface->getCellHandler ((int) row, (int) column)) + if (auto* parent = getAccessibleParent (cellHandler)) + return static_cast (parent->getNativeImplementation()); + + return nil; + }); + + addMethod (@selector (accessibilityRowCount), getAccessibilityRowCount); + addMethod (@selector (accessibilityColumnCount), getAccessibilityColumnCount); + + addMethod (@selector (accessibilityHeaderElementsForColumn:), [] (id self, SEL, NSUInteger column) -> NSArray* + { + if (auto* tableHandler = detail::AccessibilityHelpers::getEnclosingHandlerWithInterface (getHandler (self), &AccessibilityHandler::getTableInterface)) { - if (auto* tableHandler = detail::AccessibilityHelpers::getEnclosingHandlerWithInterface (getHandler (self), &AccessibilityHandler::getTableInterface)) - if (auto* tableInterface = tableHandler->getTableInterface()) - if (auto* cellHandler = tableInterface->getCellHandler ((int) row, (int) column)) - if (auto* parent = getAccessibleParent (cellHandler)) - return static_cast (parent->getNativeImplementation()); - - return nil; - }); - - addMethod (@selector (accessibilityRowCount), getAccessibilityRowCount); - addMethod (@selector (accessibilityColumnCount), getAccessibilityColumnCount); - - addMethod (@selector (accessibilityHeaderElementsForColumn:), [] (id self, SEL, NSUInteger column) -> NSArray* - { - if (auto* tableHandler = detail::AccessibilityHelpers::getEnclosingHandlerWithInterface (getHandler (self), &AccessibilityHandler::getTableInterface)) + if (auto* tableInterface = tableHandler->getTableInterface()) { - if (auto* tableInterface = tableHandler->getTableInterface()) + if (auto* header = tableInterface->getHeaderHandler()) { - if (auto* header = tableInterface->getHeaderHandler()) + if (isPositiveAndBelow (column, header->getChildren().size())) { - if (isPositiveAndBelow (column, header->getChildren().size())) - { - auto* result = [NSMutableArray new]; - [result addObject: static_cast (header->getChildren()[(size_t) column]->getNativeImplementation())]; - return result; - } + auto* result = [NSMutableArray new]; + [result addObject: static_cast (header->getChildren()[(size_t) column]->getNativeImplementation())]; + return result; } } } + } - return nullptr; - }); + return nullptr; + }); - addProtocol (@protocol (UIAccessibilityContainerDataTable)); + addProtocol (@protocol (UIAccessibilityContainerDataTable)); - addMethod (@selector (accessibilityContainerType), [] (id self, SEL) -> NSInteger + addMethod (@selector (accessibilityContainerType), [] (id self, SEL) -> NSInteger + { + if (auto* handler = getHandler (self)) { - if (auto* handler = getHandler (self)) + if (handler->getTableInterface() != nullptr) + return UIAccessibilityContainerTypeDataTable; + + const auto handlerRole = handler->getRole(); + + if (handlerRole == AccessibilityRole::popupMenu + || handlerRole == AccessibilityRole::list + || handlerRole == AccessibilityRole::tree) { - if (handler->getTableInterface() != nullptr) - { - if (@available (iOS 11.0, *)) - return UIAccessibilityContainerTypeDataTable; - - return 1; // UIAccessibilityContainerTypeDataTable - } - - const auto handlerRole = handler->getRole(); - - if (handlerRole == AccessibilityRole::popupMenu - || handlerRole == AccessibilityRole::list - || handlerRole == AccessibilityRole::tree) - { - if (@available (iOS 11.0, *)) - return UIAccessibilityContainerTypeList; - - return 2; // UIAccessibilityContainerTypeList - } + return UIAccessibilityContainerTypeList; } + } - if (@available (iOS 11.0, *)) - return UIAccessibilityContainerTypeNone; - - return 0; // UIAccessibilityContainerTypeNone - }); - } + return UIAccessibilityContainerTypeNone; + }); registerClass(); } @@ -511,12 +497,9 @@ private: addProtocol (@protocol (UITextInput)); } - if (@available (iOS 11.0, *)) - { - addMethod (@selector (accessibilityRowRange), getAccessibilityRowIndexRange); - addMethod (@selector (accessibilityColumnRange), getAccessibilityColumnIndexRange); - addProtocol (@protocol (UIAccessibilityContainerDataTableCell)); - } + addMethod (@selector (accessibilityRowRange), getAccessibilityRowIndexRange); + addMethod (@selector (accessibilityColumnRange), getAccessibilityColumnIndexRange); + addProtocol (@protocol (UIAccessibilityContainerDataTableCell)); addIvar ("container"); diff --git a/modules/juce_gui_basics/native/juce_FileChooser_ios.mm b/modules/juce_gui_basics/native/juce_FileChooser_ios.mm index 84f2dc6222..b9d7a466f9 100644 --- a/modules/juce_gui_basics/native/juce_FileChooser_ios.mm +++ b/modules/juce_gui_basics/native/juce_FileChooser_ios.mm @@ -218,8 +218,7 @@ private: { controller.reset ([[FileChooserControllerClass alloc] initWithDocumentTypes: utTypeArray inMode: UIDocumentPickerModeOpen]); - if (@available (iOS 11.0, *)) - [controller.get() setAllowsMultipleSelection: (flags & FileBrowserComponent::canSelectMultipleItems) != 0]; + [controller.get() setAllowsMultipleSelection: (flags & FileBrowserComponent::canSelectMultipleItems) != 0]; } [controller.get() setDelegate: delegate.get()]; diff --git a/modules/juce_gui_basics/native/juce_Windowing_ios.mm b/modules/juce_gui_basics/native/juce_Windowing_ios.mm index 464d5fbec4..ceae2d463d 100644 --- a/modules/juce_gui_basics/native/juce_Windowing_ios.mm +++ b/modules/juce_gui_basics/native/juce_Windowing_ios.mm @@ -625,22 +625,11 @@ static Rectangle getRecommendedWindowBounds() static BorderSize getSafeAreaInsets (float masterScale) { - if (@available (iOS 11.0, *)) - { - UIEdgeInsets safeInsets = TemporaryWindow().window.safeAreaInsets; - return detail::WindowingHelpers::roundToInt (BorderSize { safeInsets.top, - safeInsets.left, - safeInsets.bottom, - safeInsets.right }.multipliedBy (1.0 / (double) masterScale)); - } - - JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations") - auto statusBarSize = [UIApplication sharedApplication].statusBarFrame.size; - JUCE_END_IGNORE_WARNINGS_GCC_LIKE - - auto statusBarHeight = jmin (statusBarSize.width, statusBarSize.height); - - return { roundToInt (statusBarHeight / masterScale), 0, 0, 0 }; + UIEdgeInsets safeInsets = TemporaryWindow().window.safeAreaInsets; + return detail::WindowingHelpers::roundToInt (BorderSize { safeInsets.top, + safeInsets.left, + safeInsets.bottom, + safeInsets.right }.multipliedBy (1.0 / (double) masterScale)); } //============================================================================== diff --git a/modules/juce_gui_extra/native/juce_WebBrowserComponent_mac.mm b/modules/juce_gui_extra/native/juce_WebBrowserComponent_mac.mm index fbc0765d78..e00ebde534 100644 --- a/modules/juce_gui_extra/native/juce_WebBrowserComponent_mac.mm +++ b/modules/juce_gui_extra/native/juce_WebBrowserComponent_mac.mm @@ -835,7 +835,7 @@ public: [[config.get() userContentController] addUserScript:script.get()]; - if (@available (macOS 10.13, iOS 11.0, *)) + if (@available (macOS 10.13, *)) { if (browserOptions.getResourceProvider() != nullptr) [config.get() setURLSchemeHandler:webViewDelegate.get() forURLScheme:@"juce"]; diff --git a/modules/juce_video/native/juce_CameraDevice_ios.h b/modules/juce_video/native/juce_CameraDevice_ios.h index f815011ecc..6daf0379fb 100644 --- a/modules/juce_video/native/juce_CameraDevice_ios.h +++ b/modules/juce_video/native/juce_CameraDevice_ios.h @@ -154,8 +154,7 @@ private: [deviceTypes.get() addObject: AVCaptureDeviceTypeBuiltInDualCamera]; - if (@available (iOS 11.1, *)) - [deviceTypes.get() addObject: AVCaptureDeviceTypeBuiltInTrueDepthCamera]; + [deviceTypes.get() addObject: AVCaptureDeviceTypeBuiltInTrueDepthCamera]; auto discoverySession = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes: deviceTypes.get() mediaType: AVMediaTypeVideo @@ -208,12 +207,9 @@ private: JUCE_CAMERA_LOG ("Device type: " + nsStringToJuce (device.deviceType)); JUCE_CAMERA_LOG ("Locking focus with custom lens position supported: " + String ((int)device.lockingFocusWithCustomLensPositionSupported)); - 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)); - } + 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)); JUCE_CAMERA_LOG ("Capture formats start-------------------"); for (AVCaptureDeviceFormat* format in device.formats) @@ -275,11 +271,8 @@ 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 (@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)); - } + 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)); } static String getHighResStillImgDimensionsString (CMVideoDimensions d) @@ -663,34 +656,30 @@ private: JUCE_CAMERA_LOG ("Lens stabilization during bracketed capture supported: " + String ((int) photoOutput.lensStabilizationDuringBracketedCaptureSupported)); JUCE_CAMERA_LOG ("Live photo capture supported: " + String ((int) photoOutput.livePhotoCaptureSupported)); + typesString.clear(); - if (@available (iOS 11.0, *)) - { - typesString.clear(); + for (AVFileType type in photoOutput.availablePhotoFileTypes) + typesString << nsStringToJuce (type) << " "; - for (AVFileType type in photoOutput.availablePhotoFileTypes) - typesString << nsStringToJuce (type) << " "; + JUCE_CAMERA_LOG ("Available photo file types: " + typesString); - JUCE_CAMERA_LOG ("Available photo file types: " + typesString); + typesString.clear(); - typesString.clear(); + for (AVFileType type in photoOutput.availableRawPhotoFileTypes) + typesString << nsStringToJuce (type) << " "; - for (AVFileType type in photoOutput.availableRawPhotoFileTypes) - typesString << nsStringToJuce (type) << " "; + JUCE_CAMERA_LOG ("Available RAW photo file types: " + typesString); - JUCE_CAMERA_LOG ("Available RAW photo file types: " + typesString); + typesString.clear(); - typesString.clear(); + for (AVFileType type in photoOutput.availableLivePhotoVideoCodecTypes) + typesString << nsStringToJuce (type) << " "; - for (AVFileType type in photoOutput.availableLivePhotoVideoCodecTypes) - typesString << nsStringToJuce (type) << " "; + JUCE_CAMERA_LOG ("Available live photo video codec types: " + typesString); - JUCE_CAMERA_LOG ("Available live photo video codec types: " + typesString); - - JUCE_CAMERA_LOG ("Dual camera dual photo delivery supported: " + String ((int) photoOutput.dualCameraDualPhotoDeliverySupported)); - JUCE_CAMERA_LOG ("Camera calibration data delivery supported: " + String ((int) photoOutput.cameraCalibrationDataDeliverySupported)); - JUCE_CAMERA_LOG ("Depth data delivery supported: " + String ((int) photoOutput.depthDataDeliverySupported)); - } + JUCE_CAMERA_LOG ("Dual camera dual photo delivery supported: " + String ((int) photoOutput.dualCameraDualPhotoDeliverySupported)); + JUCE_CAMERA_LOG ("Camera calibration data delivery supported: " + String ((int) photoOutput.cameraCalibrationDataDeliverySupported)); + JUCE_CAMERA_LOG ("Depth data delivery supported: " + String ((int) photoOutput.depthDataDeliverySupported)); return; } @@ -731,14 +720,7 @@ private: addMethod (@selector (captureOutput:didCapturePhotoForResolvedSettings:), didCaptureForSettings); addMethod (@selector (captureOutput:didFinishCaptureForResolvedSettings:error:), didFinishCaptureForSettings); - if (@available (iOS 11.0, *)) - { - addMethod (@selector (captureOutput:didFinishProcessingPhoto:error:), didFinishProcessingPhoto); - } - else - { - addMethod (@selector (captureOutput:didFinishProcessingPhotoSampleBuffer:previewPhotoSampleBuffer:resolvedSettings:bracketSettings:error:), didFinishProcessingPhotoSampleBuffer); - } + addMethod (@selector (captureOutput:didFinishProcessingPhoto:error:), didFinishProcessingPhoto); addIvar ("owner"); @@ -772,7 +754,6 @@ private: JUCE_CAMERA_LOG ("didFinishCaptureForSettings(), error = " + errorString); } - API_AVAILABLE (ios (11.0)) static void didFinishProcessingPhoto (id self, SEL, AVCapturePhotoOutput*, AVCapturePhoto* capturePhoto, NSError* error) { getOwner (self).takingPicture = false;