🔧 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()) if (delegate())
delegate()->NotificationAction(action_index_); delegate()->NotificationAction(action_index_);
this->LogAction("clicked"); this->LogAction("button clicked");
} }
void CocoaNotification::LogAction(const char* action) { void CocoaNotification::LogAction(const char* action) {

View file

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

View file

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