MatthieuLemoine / electron-push-receiver

A module to bring Web Push support to Electron allowing it to receive notifications from Firebase Cloud Messaging (FCM).
https://medium.com/@MatthieuLemoine/my-journey-to-bring-web-push-support-to-node-and-electron-ce70eea1c0b0
MIT License
191 stars 62 forks source link

How do i unregister device on logout? #47

Open KeithNdhlovu opened 4 years ago

KeithNdhlovu commented 4 years ago

Hi, thanks for the great work that you have put into this.

I have implemented the electron-push-receiver on my sample app, and it works like a charm. I was wondering however if there is a functionality to be able to unregister the device, for example, when a user logs out of the app they should not receive push notifications.


// This is how to do it when using the service worker on web
navigator.serviceWorker.getRegistrations().then(registrations => {
   map(registrations, registration => {
      registration.unregister()
   })
})

I also understand that its not that big of a deal because not a lot of people logout of their app just to keep it open and not close it entirely, because once they do close the app they wont receive push notifications.

omerkhan8 commented 4 years ago

@KeithNdhlovu did you found any workaround to this?

KeithNdhlovu commented 4 years ago

@omerkhan8 Sadly i was unable to get a workaround, i just left it stale at the moment, since its not much of a bother