🔧 More detailed macOS notification logging

This commit is contained in:
Felix Rieseberg 2017-12-13 10:31:59 -08:00
parent ffd85bfaac
commit 61ec8df418
3 changed files with 12 additions and 2 deletions

View file

@ -105,7 +105,7 @@ void CocoaNotification::NotificationButtonClicked() {
if (delegate())
delegate()->NotificationAction(action_index_);
this->LogAction("clicked");
this->LogAction("button clicked");
}
void CocoaNotification::LogAction(const char* action) {

View file

@ -28,13 +28,18 @@
- (void)userNotificationCenter:(NSUserNotificationCenter*)center
didActivateNotification:(NSUserNotification *)notif {
auto notification = presenter_->GetNotification(notif);
if (getenv("ELECTRON_DEBUG_NOTIFICATIONS")) {
NSLog(@"%s (%@)", "Cocoa notification activated", notif.identifier);
}
if (notification) {
if (notif.activationType == NSUserNotificationActivationTypeReplied) {
notification->NotificationReplied([notif.response.string UTF8String]);
} else if (notif.activationType == NSUserNotificationActivationTypeActionButtonClicked) {
notification->NotificationButtonClicked();
} else if (notif.activationType == NSUserNotificationActivationTypeContentsClicked) {
notification->NotificationClicked();
notification->NotificationClicked();
}
}
}

View file

@ -22,6 +22,11 @@ CocoaNotification* NotificationPresenterMac::GetNotification(
isEqual:ns_notification.identifier])
return native_notification;
}
if (getenv("ELECTRON_DEBUG_NOTIFICATIONS")) {
NSLog(@"%s \"%@\"", "Could not find cocoa notification for", ns_notification.identifier);
}
return nullptr;
}