Problem/Motivation
We want to add Google Firebase notifications to the app. So I am creating this issue to make the code available for anyone to fiddle around with. It's work in progress, so don't be harsh please ;-)
Background
We are creating a pwa. I tried both this module (pwa), combined with the pf_notifications module and the advanced_pwa module.
For both modules I did not really like the notifications part. I could not get it to work steadyly (off course this is my lack of expertise).
So then I decided to go for this module because I can use it without notification stuff, but just use it for the manifest and service handler. I added an (undocumented, but there are more of them in the module ;-) ) hook to modify the service worker and add the notification stuff.
The sending of notifications I am not shure I want that in this module. I have the Firebase_php module running and that works quite well. But that's for another day.
Update
Because the submodule was getting too specific, I removed it. The basic features are available in de demo module in the zip file. The only thing that is changed in de base module is the added hook to alter the service worker, which I think is a good addition.
Status
Add new submodule for the notifications- Add hook to expand the service worker
The firebase service worker has to come from a specific url: /firebase-messaging-sw.js. The url is altered with a route to serve the service worker from this location.Added cspell words and eslint ignore fileWhen a user accepts the push messages, the token is saved to the database.
| Comment | File | Size | Author |
|---|
Issue fork pwa-3481782
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
joshahubbers commentedComment #4
joshahubbers commentedComment #5
joshahubbers commented#3481485: Upload app icon results in error is included in this patch
Comment #6
joshahubbers commentedBack to working on this... please mind this is work in progress. F.e. in the current patch we show the token of the browser in the frontend to allow us to easily send test messages. ;-) Just so you know the current status.
Comment #7
joshahubbers commentedComment #8
joshahubbers commentedI removed the module from this commit, as I think you mostly want to customize what exactly happens there, and not everything is generic enough.
I add the module as zip for reference.
Example module
So what this patch does:
What it does not do (see how to do it in the example module):
Comment #9
joshahubbers commentedComment #10
anybodyGreat wor @joshahubbers thank you!!
Comment #12
anybody