Fix building on older macOS SDK
This commit is contained in:
parent
d9631cdedd
commit
5a5e264ca3
1 changed files with 9 additions and 0 deletions
|
|
@ -9,6 +9,7 @@
|
|||
#include "state.h"
|
||||
#include "cleanup.h"
|
||||
#include "monotonic.h"
|
||||
#include <Availability.h>
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#ifndef KITTY_USE_DEPRECATED_MACOS_NOTIFICATION_API
|
||||
|
|
@ -464,6 +465,7 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center
|
|||
if (body) content.body = @(body);
|
||||
if (subtitle) content.subtitle = @(subtitle);
|
||||
content.sound = [UNNotificationSound defaultSound];
|
||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000
|
||||
switch (urgency) {
|
||||
case 0:
|
||||
content.interruptionLevel = UNNotificationInterruptionLevelPassive;
|
||||
|
|
@ -472,6 +474,13 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center
|
|||
default:
|
||||
content.interruptionLevel = UNNotificationInterruptionLevelActive;
|
||||
}
|
||||
#else
|
||||
if ([content respondsToSelector:@selector(interruptionLevel)]) {
|
||||
NSUInteger level = 1;
|
||||
if (urgency == 0) level = 0; else if (urgency == 2) level = 3;
|
||||
[content setValue:@(level) forKey:@"interruptionLevel"];
|
||||
}
|
||||
#endif
|
||||
// Deliver the notification
|
||||
static unsigned long counter = 1;
|
||||
UNNotificationRequest* request = [
|
||||
|
|
|
|||
Loading…
Reference in a new issue