Avoid deprecation warning from Apple

Apparently Apple invent half-assed language extensions like @available
and then dont implement them properly
This commit is contained in:
Kovid Goyal 2021-11-20 06:08:30 +05:30
parent ae6318cb5a
commit 889f2fce6d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -231,7 +231,7 @@ cocoa_send_notification(PyObject *self UNUSED, PyObject *args) {
withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler { withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
UNNotificationPresentationOptions options = UNNotificationPresentationOptionSound; UNNotificationPresentationOptions options = UNNotificationPresentationOptionSound;
if (@available(macOS 11.0, *)) options |= UNNotificationPresentationOptionList | UNNotificationPresentationOptionBanner; if (@available(macOS 11.0, *)) options |= UNNotificationPresentationOptionList | UNNotificationPresentationOptionBanner;
else options |= UNNotificationPresentationOptionAlert; else options |= (1 << 2); // UNNotificationPresentationOptionAlert avoid deprecated warning
completionHandler(options); completionHandler(options);
} }