8#include <Cocoa/Cocoa.h>
9#import <objc/runtime.h>
13- (NSString *)__bundleIdentifier {
14 if (self == [NSBundle mainBundle]) {
15 return @"org.bitcoinabc.BitcoinABC-Qt";
17 return [
self __bundleIdentifier];
23 const QString &text) {
25 if (this->hasUserNotificationCenterSupport()) {
26 NSUserNotification *userNotification =
27 [[NSUserNotification alloc] init];
28 userNotification.title = title.toNSString();
29 userNotification.informativeText = text.toNSString();
30 [[NSUserNotificationCenter defaultUserNotificationCenter]
31 deliverNotification:userNotification];
32 [userNotification release];
37 Class possibleClass = NSClassFromString(
@"NSUserNotificationCenter");
40 if (possibleClass != nil) {
51 Class aPossibleClass = objc_getClass(
"NSBundle");
56 method_exchangeImplementations(
57 class_getInstanceMethod(aPossibleClass,
58 @selector(bundleIdentifier)),
59 class_getInstanceMethod(aPossibleClass,
60 @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