macOS: Clear stale native notifications on 10.9+. (#5601)

This commit is contained in:
Ted Stein 2017-01-18 05:51:00 -08:00 committed by John Maguire
parent b463e63dde
commit 69cddf70ef
1 changed files with 8 additions and 0 deletions

View File

@ -17,6 +17,7 @@
#include "osd.h"
#import <Foundation/NSProcessInfo.h>
#import <Foundation/NSUserNotification.h>
#include <QBuffer>
@ -36,6 +37,13 @@ void SendNotificationCenterMessage(NSString* title, NSString* subtitle) {
[notification setTitle:title];
[notification setSubtitle:subtitle];
if ([[NSProcessInfo processInfo]
isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){
.majorVersion = 10,
.minorVersion = 9,
.patchVersion = 0}]) {
[notification_center removeAllDeliveredNotifications];
}
[notification_center deliverNotification:notification];
}