8#import <objc/runtime.h>
9#include <Cocoa/Cocoa.h>
13- (NSString *)__bundleIdentifier
15 if (self == [NSBundle mainBundle]) {
16 return @"org.bitcoinfoundation.Bitcoin-Qt";
18 return [
self __bundleIdentifier];
26 if(this->hasUserNotificationCenterSupport()) {
27 NSUserNotification* userNotification = [[NSUserNotification alloc] init];
28 userNotification.title = title.toNSString();
29 userNotification.informativeText = text.toNSString();
30 [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification: userNotification];
31 [userNotification release];
37 Class possibleClass = NSClassFromString(
@"NSUserNotificationCenter");
40 if(possibleClass!=nil) {
53 Class aPossibleClass = objc_getClass(
"NSBundle");
57 method_exchangeImplementations(class_getInstanceMethod(aPossibleClass,
@selector(bundleIdentifier)),
58 class_getInstanceMethod(aPossibleClass,
@selector(__bundleIdentifier)));
Macintosh-specific notification handler (supports UserNotificationCenter).
bool hasUserNotificationCenterSupport()
check if OS can handle UserNotifications
static MacNotificationHandler * instance()
void showNotification(const QString &title, const QString &text)
shows a macOS 10.8+ UserNotification in the UserNotificationCenter
static MacDockIconHandler * s_instance