feat: Set macOS notification close button title#11654
Conversation
767b3a0 to
6f2c60b
Compare
alexeykuzmin
left a comment
There was a problem hiding this comment.
Shouldn't the whole feature be placed under the #if defined(OS_MACOSX) condition?
let n = new electron.Notification({
title: 'Notification',
closeButtonText: 'Dismiss 😀', // It does support some emoji
})@sethlu Can you please add a test that |
|
@alexeykuzmin Thanks for reviewing! This change set introduces a new member to the existing |
| prototype->SetClassName(mate::StringToV8(isolate, "Notification")); | ||
| mate::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate()) | ||
| .MakeDestroyable() | ||
| auto _(mate::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())); |
There was a problem hiding this comment.
Not sure of a better way to do this while keeping the items in order?
I wasn't thinking about optimization, but about explicitly saying "these parts of code are Mac-specific".
You are more than welcome to create a new file ) |
Would cd01eec address this? The feature's intended for macOS; historical additions to the Notifications API aren't so sensitive with the platform settings?
I'll probably address that in a separate PR since the entire Notification submodule needs its tests--probably only checking if the values are passed correctly to the electron lib? |
Looks good to me, but I would like to have someone else to review this too. |
I just means that we risk to get some stuff broken in the master ) |
I think we should discuss this more, not sure that I like the idea of pulling out these properties of Notification to be just on macOS. For instance there are PR's / WIP's to implement actions / replies on Windows. I'm all for being clear on where features are noops / implemented but the OS specific parts of |
MarshallOfSound
left a comment
There was a problem hiding this comment.
requesting to discuss
|
To further explain my point above the |
|
@MarshallOfSound That's a good point. I think it's probably better to have those options all available in @alexeykuzmin What do you think? |
That's why I think that we should have OS checks in the |
This goes against how most of our current API's work afaik, OS specific getters and setters exist most of the time on all platforms but only take affect on some. This is so that you can write JS code for all platforms without doing platform checks. I.e. I as a user shouldn't have to do a |
|
@MarshallOfSound Maybe it's a good way to use API, if we have platform-specific properties, ok. |
adb196a to
878c561
Compare
|
@MarshallOfSound @alexeykuzmin I've just reverted the platform-specific code changes. |
|
@sethlu Looks good to me. Already approved. |
36703ac to
38d2845
Compare

🍎 This addition allows developers to set custom & localized title for macOS notifications.
Resolves: #11594
With the following config:
NSUserNotificationAlertStyleset toalertinInfo.plistof the app bundleUsing the following script:
Screenshot: