Merge pull request #10709 from electron/fix-notification-actions-hs
Fix notification actions not working on High Sierra
This commit is contained in:
commit
4dc74776c1
2 changed files with 6 additions and 1 deletions
|
@ -13,6 +13,8 @@
|
|||
|
||||
namespace brightray {
|
||||
|
||||
int g_identifier_ = 1;
|
||||
|
||||
CocoaNotification::CocoaNotification(NotificationDelegate* delegate,
|
||||
NotificationPresenter* presenter)
|
||||
: Notification(delegate, presenter) {
|
||||
|
@ -29,6 +31,8 @@ void CocoaNotification::Show(const NotificationOptions& options) {
|
|||
[notification_ setTitle:base::SysUTF16ToNSString(options.title)];
|
||||
[notification_ setSubtitle:base::SysUTF16ToNSString(options.subtitle)];
|
||||
[notification_ setInformativeText:base::SysUTF16ToNSString(options.msg)];
|
||||
[notification_ setIdentifier:[NSString stringWithFormat:@"%s%d", "ElectronNotification", g_identifier_]];
|
||||
g_identifier_++;
|
||||
|
||||
if ([notification_ respondsToSelector:@selector(setContentImage:)] &&
|
||||
!options.icon.drawsNothing()) {
|
||||
|
|
|
@ -18,7 +18,8 @@ CocoaNotification* NotificationPresenterMac::GetNotification(
|
|||
NSUserNotification* ns_notification) {
|
||||
for (Notification* notification : notifications()) {
|
||||
auto native_notification = static_cast<CocoaNotification*>(notification);
|
||||
if ([native_notification->notification() isEqual:ns_notification])
|
||||
if ([native_notification->notification().identifier
|
||||
isEqual:ns_notification.identifier])
|
||||
return native_notification;
|
||||
}
|
||||
return nullptr;
|
||||
|
|
Loading…
Reference in a new issue