From da8c5fdcb41b2be9eac08d2b6515ca2dfe83b5fa Mon Sep 17 00:00:00 2001 From: reuk Date: Mon, 1 Jul 2024 17:09:48 +0100 Subject: [PATCH] Platform: Remove compatibility checks for macOS 10.8 --- modules/juce_core/native/juce_Files_mac.mm | 36 ++++--------------- .../native/juce_NSViewComponentPeer_mac.mm | 9 ++--- .../native/juce_PushNotifications_mac.cpp | 14 +++----- 3 files changed, 13 insertions(+), 46 deletions(-) diff --git a/modules/juce_core/native/juce_Files_mac.mm b/modules/juce_core/native/juce_Files_mac.mm index 8ea95ef894..96fa367635 100644 --- a/modules/juce_core/native/juce_Files_mac.mm +++ b/modules/juce_core/native/juce_Files_mac.mm @@ -297,33 +297,10 @@ bool File::moveToTrash() const JUCE_AUTORELEASEPOOL { - if (@available (macOS 10.8, iOS 11.0, *)) - { - NSError* error = nil; - return [[NSFileManager defaultManager] trashItemAtURL: createNSURLFromFile (*this) - resultingItemURL: nil - error: &error]; - } - - #if JUCE_IOS - return deleteFile(); - #else - [[NSWorkspace sharedWorkspace] recycleURLs: [NSArray arrayWithObject: createNSURLFromFile (*this)] - completionHandler: nil]; - - // recycleURLs is async, so we need to block until it has finished. We can't use a - // run-loop here because it'd dispatch unexpected messages, so have to do this very - // nasty bodge. But this is only needed for support of pre-10.8 versions. - for (int retries = 100; --retries >= 0;) - { - if (! exists()) - return true; - - Thread::sleep (5); - } - - return false; - #endif + NSError* error = nil; + return [[NSFileManager defaultManager] trashItemAtURL: createNSURLFromFile (*this) + resultingItemURL: nil + error: &error]; } } @@ -534,9 +511,8 @@ void File::addToDock() const File File::getContainerForSecurityApplicationGroupIdentifier (const String& appGroup) { - if (@available (macOS 10.8, *)) - if (auto* url = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier: juceStringToNS (appGroup)]) - return File (nsStringToJuce ([url path])); + if (auto* url = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier: juceStringToNS (appGroup)]) + return File (nsStringToJuce ([url path])); return File(); } diff --git a/modules/juce_gui_basics/native/juce_NSViewComponentPeer_mac.mm b/modules/juce_gui_basics/native/juce_NSViewComponentPeer_mac.mm index aed337e313..89226b14b8 100644 --- a/modules/juce_gui_basics/native/juce_NSViewComponentPeer_mac.mm +++ b/modules/juce_gui_basics/native/juce_NSViewComponentPeer_mac.mm @@ -220,12 +220,9 @@ public: if ((windowStyleFlags & ComponentPeer::windowRequiresSynchronousCoreGraphicsRendering) == 0) { - if (@available (macOS 10.8, *)) - { - [view setWantsLayer: YES]; - [view setLayerContentsRedrawPolicy: NSViewLayerContentsRedrawDuringViewResize]; - [view layer].drawsAsynchronously = YES; - } + [view setWantsLayer: YES]; + [view setLayerContentsRedrawPolicy: NSViewLayerContentsRedrawDuringViewResize]; + [view layer].drawsAsynchronously = YES; } #if JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS diff --git a/modules/juce_gui_extra/native/juce_PushNotifications_mac.cpp b/modules/juce_gui_extra/native/juce_PushNotifications_mac.cpp index 5086abbc01..e3906f60e6 100644 --- a/modules/juce_gui_extra/native/juce_PushNotifications_mac.cpp +++ b/modules/juce_gui_extra/native/juce_PushNotifications_mac.cpp @@ -371,11 +371,8 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate NSRemoteNotificationType types = NSUInteger ((bool) settings.allowBadge); - if (@available (macOS 10.8, *)) - { - types |= (NSUInteger) ((settings.allowSound ? NSRemoteNotificationTypeSound : 0) - | (settings.allowAlert ? NSRemoteNotificationTypeAlert : 0)); - } + types |= (NSUInteger) ((settings.allowSound ? NSRemoteNotificationTypeSound : 0) + | (settings.allowAlert ? NSRemoteNotificationTypeAlert : 0)); [[NSApplication sharedApplication] registerForRemoteNotificationTypes: types]; } @@ -384,11 +381,8 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate { settings.allowBadge = [NSApplication sharedApplication].enabledRemoteNotificationTypes & NSRemoteNotificationTypeBadge; - if (@available (macOS 10.8, *)) - { - settings.allowSound = [NSApplication sharedApplication].enabledRemoteNotificationTypes & NSRemoteNotificationTypeSound; - settings.allowAlert = [NSApplication sharedApplication].enabledRemoteNotificationTypes & NSRemoteNotificationTypeAlert; - } + settings.allowSound = [NSApplication sharedApplication].enabledRemoteNotificationTypes & NSRemoteNotificationTypeSound; + settings.allowAlert = [NSApplication sharedApplication].enabledRemoteNotificationTypes & NSRemoteNotificationTypeAlert; owner.listeners.call ([&] (Listener& l) { l.notificationSettingsReceived (settings); }); }