summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2015-09-03 16:01:14 (GMT)
committerTobias Markmann <tm@ayena.de>2015-09-03 16:20:31 (GMT)
commitbe6aa6e81b44be67518731d67bb2b72268d351e8 (patch)
treeeaa06c5bf303e627db91f869adba0611da393255 /SwifTools/Notifier/NotificationCenterNotifierDelegate.mm
parentb6ffd5a332b6b21fdba9937fa3a0274556a09cdf (diff)
downloadswift-be6aa6e81b44be67518731d67bb2b72268d351e8.zip
swift-be6aa6e81b44be67518731d67bb2b72268d351e8.tar.bz2
Initial support for OS X Notification Center
This implements basic support for OS X Notification Center notifications with simple banner notifications showing type, contact and message/presence information. A click on the notification opens the chat view to the contact. The Notification Center backend will be used on OS X if the Growl notification backend is not used. This code requires OS X version 10.8 or later. Test-Information: Tested presence and message notifications between multiple Swift accounts and instances on OS X 10.9.5. Change-Id: I7b9e2132cab25e086e0912191562cad8f4cbae38
Diffstat (limited to 'SwifTools/Notifier/NotificationCenterNotifierDelegate.mm')
-rw-r--r--SwifTools/Notifier/NotificationCenterNotifierDelegate.mm26
1 files changed, 26 insertions, 0 deletions
diff --git a/SwifTools/Notifier/NotificationCenterNotifierDelegate.mm b/SwifTools/Notifier/NotificationCenterNotifierDelegate.mm
new file mode 100644
index 0000000..617619c
--- /dev/null
+++ b/SwifTools/Notifier/NotificationCenterNotifierDelegate.mm
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#import "SwifTools/Notifier/NotificationCenterNotifierDelegate.h"
+
+#include <string>
+
+#include <SwifTools/Cocoa/CocoaUtil.h>
+#include <SwifTools/Notifier/NotificationCenterNotifier.h>
+
+@implementation NotificationCenterNotifierDelegate
+
+using namespace Swift;
+
+@synthesize notifier;
+
+- (void)userNotificationCenter:(NSUserNotificationCenter *) center didActivateNotification:(NSUserNotification *)notification {
+ (void)center;
+ std::string identifier = NS2STDSTRING(notification.identifier);
+ notifier->handleUserNotificationActivated(identifier);
+}
+
+@end