From 4576a75388a4127a307278dc1632cba2cc034313 Mon Sep 17 00:00:00 2001 From: reuk Date: Mon, 1 Jul 2024 17:07:57 +0100 Subject: [PATCH] Platform: Remove compatibility checks for macOS 10.7 --- .../native/juce_PushNotifications_mac.cpp | 41 +++++++------------ 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/modules/juce_gui_extra/native/juce_PushNotifications_mac.cpp b/modules/juce_gui_extra/native/juce_PushNotifications_mac.cpp index 0e3bb9d1e7..5086abbc01 100644 --- a/modules/juce_gui_extra/native/juce_PushNotifications_mac.cpp +++ b/modules/juce_gui_extra/native/juce_PushNotifications_mac.cpp @@ -367,41 +367,30 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate void requestPermissionsWithSettings (const PushNotifications::Settings& settingsToUse) { - if (@available (macOS 10.7, *)) + settings = settingsToUse; + + NSRemoteNotificationType types = NSUInteger ((bool) settings.allowBadge); + + if (@available (macOS 10.8, *)) { - settings = settingsToUse; - - NSRemoteNotificationType types = NSUInteger ((bool) settings.allowBadge); - - if (@available (macOS 10.8, *)) - { - types |= (NSUInteger) ((settings.allowSound ? NSRemoteNotificationTypeSound : 0) - | (settings.allowAlert ? NSRemoteNotificationTypeAlert : 0)); - } - - [[NSApplication sharedApplication] registerForRemoteNotificationTypes: types]; + types |= (NSUInteger) ((settings.allowSound ? NSRemoteNotificationTypeSound : 0) + | (settings.allowAlert ? NSRemoteNotificationTypeAlert : 0)); } + + [[NSApplication sharedApplication] registerForRemoteNotificationTypes: types]; } void requestSettingsUsed() { - if (@available (macOS 10.7, *)) - { - settings.allowBadge = [NSApplication sharedApplication].enabledRemoteNotificationTypes & NSRemoteNotificationTypeBadge; + settings.allowBadge = [NSApplication sharedApplication].enabledRemoteNotificationTypes & NSRemoteNotificationTypeBadge; - if (@available (macOS 10.8, *)) - { - settings.allowSound = [NSApplication sharedApplication].enabledRemoteNotificationTypes & NSRemoteNotificationTypeSound; - settings.allowAlert = [NSApplication sharedApplication].enabledRemoteNotificationTypes & NSRemoteNotificationTypeAlert; - } - - owner.listeners.call ([&] (Listener& l) { l.notificationSettingsReceived (settings); }); - } - else + if (@available (macOS 10.8, *)) { - // no settings available - owner.listeners.call ([] (Listener& l) { l.notificationSettingsReceived ({}); }); + settings.allowSound = [NSApplication sharedApplication].enabledRemoteNotificationTypes & NSRemoteNotificationTypeSound; + settings.allowAlert = [NSApplication sharedApplication].enabledRemoteNotificationTypes & NSRemoteNotificationTypeAlert; } + + owner.listeners.call ([&] (Listener& l) { l.notificationSettingsReceived (settings); }); } bool areNotificationsEnabled() const { return true; }