diff options
| -rw-r--r-- | SwifTools/Notifier/NotificationCenterNotifier.mm | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/SwifTools/Notifier/NotificationCenterNotifier.mm b/SwifTools/Notifier/NotificationCenterNotifier.mm index df092ff..28cacb6 100644 --- a/SwifTools/Notifier/NotificationCenterNotifier.mm +++ b/SwifTools/Notifier/NotificationCenterNotifier.mm | |||
| @@ -51,10 +51,15 @@ NotificationCenterNotifier::~NotificationCenterNotifier() { | |||
| 51 | [[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate: nil]; | 51 | [[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate: nil]; |
| 52 | p->callbacksForNotifications.clear(); | 52 | p->callbacksForNotifications.clear(); |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | void NotificationCenterNotifier::showMessage(Type type, const std::string& subject, const std::string& description, const boost::filesystem::path& picture, boost::function<void ()> callback) { | 55 | void NotificationCenterNotifier::showMessage(Type type, const std::string& subject, const std::string& description, const boost::filesystem::path& picture, boost::function<void ()> callback) { |
| 56 | std::vector<Notifier::Type> defaultTypes = getDefaultTypes(); | ||
| 57 | if (std::find(defaultTypes.begin(), defaultTypes.end(), type) == defaultTypes.end()) { | ||
| 58 | return; | ||
| 59 | } | ||
| 60 | |||
| 56 | NSUserNotification* notification = [[NSUserNotification alloc] init]; | 61 | NSUserNotification* notification = [[NSUserNotification alloc] init]; |
| 57 | notification.title = STD2NSSTRING(typeToString(type)); | 62 | notification.title = STD2NSSTRING(typeToString(type)); |
| 58 | notification.subtitle = STD2NSSTRING(subject); | 63 | notification.subtitle = STD2NSSTRING(subject); |
| 59 | notification.informativeText = STD2NSSTRING(description); | 64 | notification.informativeText = STD2NSSTRING(description); |
| 60 | notification.contentImage = [[NSImage alloc] initWithContentsOfFile: STD2NSSTRING(picture.string())]; | 65 | notification.contentImage = [[NSImage alloc] initWithContentsOfFile: STD2NSSTRING(picture.string())]; |
Swift