node-notifier icon indicating copy to clipboard operation
node-notifier copied to clipboard

No onClick in windows 10 action center after time-out

Open fsykes87 opened this issue 4 years ago • 7 comments

I can get the notifications to fire and can be clicked which opens another window displaying a message.

issues after notification timeout and is in the action center:

  • When clicked in the notification center the notification disappears and does not open the window.

  • nothing is registered in the console.


`notifier.on("click",`  function(notifierObject, options, event) {
            if(options.myCustomAction) {
              options.myCustomAction()
            }
        
          // Triggers if `wait: true` and user clicks notification
          var request = new sql.Request();
          let username = userName;
              request.query("update alerts.dbo.groupmessages set isRead = 1\
                                where pk = '"+ recordset.recordset[i].pk + "'\
                                and userFK = (select pk from alerts.dbo.users where username = '"+ username + "')\
                                and groupFK = (select groupFK from alerts.dbo.users where username = '"+ username + "')", function (err, recordset) {
                if (err) throw err
                console.log(err, recordset, 'User shit');
              });          
              
             

              function createWindow() {
                // Create the browser window.
                win = new BrowserWindow({
                  width: 400,
                  height: 400,
                  frame: false,
                  webPreferences: {
                    nodeIntegration: true
                  }
                });
                // and load the index.html of the app.
                ejse.data('message', recordset.recordset[i].message);
                win.loadFile('index.ejs')
              }
              createWindow();
              
            });
        });
      });
    
    Promise.all(promiseArr)
      .then(allRes => {
        console.log("all good===>>>", allRes);
      })
      .catch(err => console.log("somethign went wwrong", err));
  }
};```

fsykes87 avatar Apr 14 '20 00:04 fsykes87

I have the same issue. Seems that if the timeout is the first event to be fired, subsequent events are ignored.

joaomgcd avatar Jul 03 '20 15:07 joaomgcd

Same issue here. The same behavior applies when dismissing the notification and clicking the notification or any actions in notification-center.

I'm using SnoreToast (have not yet switched to custom appId and the other stuff).

skonrad avatar Jul 20 '20 02:07 skonrad

Timeout is defined as the amount of time that node-notifier will wait for action. This means it will stop listening if the timeout is exceeded. This might be a consistency issue with a memory leak for Notification Center in macOS and be a non-issue with Windows, but I believe this is where this feature stems from. But essentially, it's a feature not a bug. Although you can argue the feature is limiting, but as I said, IIRC it's due to macOS and trying to patch cross-platform behavior..

mikaelbr avatar Aug 10 '20 20:08 mikaelbr

Yo, was there any update to this? It's kinda inconvenient to not be able to click on toasts after they've timed out

YoJames20192 avatar Jul 31 '21 22:07 YoJames20192

Not that I know of. Have you tried with the latest version of electron?

On Sat, Jul 31, 2021, 3:07 PM YoJames20192 @.***> wrote:

Yo, was there any update to this? It's kinda inconvenient to not be able to click on toasts after they've timed out

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mikaelbr/node-notifier/issues/324#issuecomment-890409164, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHM3MFSRQFR2LWV6EGB43YDT2RXZPANCNFSM4MHKJBCA .

fsykes87 avatar Jul 31 '21 22:07 fsykes87

The same issue persists with node-notifier and electron 16.0.7. Native Electron notifications by itself has the same issue. Managed to do it with powertoast but there's trick.

In Windows Toast 'launch' parameter should be a valid protocol type. Like for example: https://google.com. You can create your own custom URI scheme and get launched with some parameter. Electron supports it out of the box.

Standard Electron notification options has "toastXml" that you can use to fully customize notification if you're on Windows. So you can build your own custom toast without the need of extra libraries like node-notifier or powertoast.

sherlock1982 avatar Jan 28 '22 08:01 sherlock1982

I understand that the issue (feature) is related to macOS. However, we require the underlying 'behavior' while not needing the particular 'feature' itself. Our objective is to have the ability to disable this specific 'feature' when necessary. If this is not on the project's agenda, I would appreciate any recommendations for alternatives to node-notifier.

yuis-ice avatar Jul 22 '23 13:07 yuis-ice