nw.js icon indicating copy to clipboard operation
nw.js copied to clipboard

OSX Native Notifications don't display on packaged app

Open gpetrov opened this issue 8 years ago • 15 comments

The chrome.notification.create displays fine when we run our app directly on NWJS. But when we package it, rename the main app file and sign it all, the notifications do not display any more.

There is no error or anything - the chrome.notification.create just don't display any popup in the MacOS Notification center.

I tried --enable-features=NativeNotifications and also checked the info.plist for any difference but nothing helps. When the app is packaged and installed in the Applications - the notifications just don't show.

Is there some special security setting or something for the MacOS that we are missing @rogerwang ? Also we renamed the main app but not the nwjs Helper.

NWJS Version : 0.28.2 Operating System : Mac OSX 10.12.6

We would really like to take advantage of the new native notification on MacOS so hope this can be resolved soon.

gpetrov avatar Apr 15 '18 08:04 gpetrov

Any idea what might be causing this @rogerwang ? Otherwise we are stuck to use old nwjs version prior the osx native notifications integration and will really hate this...

gpetrov avatar Apr 22 '18 07:04 gpetrov

Will see it soon.

On Sun, Apr 22, 2018, 3:38 PM George Petrov [email protected] wrote:

Any idea what might be causing this @rogerwang https://github.com/rogerwang ? Otherwise we are stuck to use old nwjs version prior the osx native notifications integration and will really hate this...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nwjs/nw.js/issues/6568#issuecomment-383362063, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKGGboAgcYZ-OFKilDOf7KNuLZvMIkmks5trDNogaJpZM4TVZPV .

rogerwang avatar Apr 22 '18 08:04 rogerwang

Could you please provide a minimal sample that you packed?

rogerwang avatar Apr 22 '18 08:04 rogerwang

well here is the full app, could't strip it down, but it is free anyway:

you can just install it from the DMG and then with finder in Applications explore the app contents. Hope you can see the packaging error or missing stuff

gpetrov avatar Apr 22 '18 09:04 gpetrov

How to use it? It quits after showing this dialog. screen shot 2018-04-23 at 10 17 44 am

rogerwang avatar Apr 23 '18 02:04 rogerwang

@Christywl could you please try to reproduce this with a minimal example?

rogerwang avatar Apr 23 '18 02:04 rogerwang

@rogerwang it works together with Adobe Dreamweaver - it manages its extensions. So it is looking for Dreamweaver.

But I thought you don't need to start it - just explore the app package contents and info.plist it is difficult also the replicate the current push messaging flow

I suspect that there is something because of the renaming of nwjs to the new app name (DMXzone Extension Manager)

gpetrov avatar Apr 23 '18 07:04 gpetrov

If I don't start it how should I reproduce you bug? And a minimal sample should be more productive.

rogerwang avatar Apr 23 '18 07:04 rogerwang

Agree - will make a minimal example

gpetrov avatar Apr 23 '18 08:04 gpetrov

@rogerwang - ok found the problem when making the minimal example :)

It was the requireInteraction flag in the chrome.notifications.create call! If the flag is set the messages don't appear in the final mac app. See https://developer.chrome.com/apps/notifications

maybe the flag is useless anyway as the native mac notifications are controlled by the NSUserNotificationAlertStyle option in the Info.plist but maybe NWJS should privide a way to override the setting through this flag? and not just not displaying the messages ... https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html

Here is the minimal example app: https://www.dmxzone.com/beta/Test-Push-Notifications-Mac-1.0.0.dmg

Source code: https://www.dmxzone.com/beta/push_notifications.zip

gpetrov avatar Apr 23 '18 10:04 gpetrov

Small update: also you should'n include --enable-features=NativeNotifications as then the notifications won't popup on Windows any more. Seems it is an old setting anyway and not needed on OSX

gpetrov avatar Apr 23 '18 15:04 gpetrov

With the source code, it works fine on Mac OS X with nwjs-sdk-v0.30.0. But if I install the dmg app, 'Send Push Notification with requireInteraction' doesn't work, the notification doesn't display.

Christywl avatar Apr 24 '18 00:04 Christywl

I can confirm I am having the same problem. If I include "requireInteraction", it simply won't show on my mac.

paulobarcelos avatar Nov 08 '18 18:11 paulobarcelos

Same here, as soon as "requireInteraction" is specified the notifications are not shown anymore

monema75 avatar Jan 14 '19 16:01 monema75

Can confirm this on mojave, nwjs 36.

haviduck avatar Feb 01 '19 01:02 haviduck