feat: On macOS, Closing Notifications Triggers the 'close' Event (#13306)

* feat(macOS): implement NotificationDismissed() for Cocoa

* feat(macOS): emit NotificationDismissed() when closing "Alert" notifications

* feat(macOS): emit NotificationDismissed() when closing "Banner" notifications

* fix(macos): Remove calls to private APIs from MAS builds (github.com/electron/electron/pull/13306)
This commit is contained in:
Sidney 2018-08-13 13:09:25 +02:00 committed by Samuel Attard
parent c0959bd534
commit 23541b5b2a
3 changed files with 32 additions and 0 deletions

View file

@ -156,6 +156,13 @@ void CocoaNotification::NotificationActivated(
this->LogAction("button clicked");
}
void CocoaNotification::NotificationDismissed() {
if (delegate())
delegate()->NotificationClosed();
this->LogAction("dismissed");
}
void CocoaNotification::LogAction(const char* action) {
if (getenv("ELECTRON_DEBUG_NOTIFICATIONS")) {
NSString* identifier = [notification_ valueForKey:@"identifier"];