Problem/Motivation
Currently, the manifest functionality can NOT be used without the service worker being activated. The service worker itself only provides the offline functionality of the app and isn't a core feature of a PWA. It also isn't one of the 'install criterias' for a PWA (anymore): https://web.dev/install-criteria/#criteria (Atleast for chrome).
And at last, there are currently quite a few problems with the service worker implementation inside this module (see #3377120: [META][pwa_service_worker] Refactor 'pwa_service_worker' implementations and flaws).
Steps to reproduce
Proposed resolution
Decouple service worker from manifest through a dedicated "service worker submodule"
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork pwa-3388800
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
grevil commentedAlright, this should be all done now. After running "drush updb" I still get an apparent manifest.json schema error, but after clearing all cashes it's not there anymore.
Should we find the right caches to clear on update hook? Or let the user run it himself?
Furthermore, we still need to clear the old service worker inside our update hook.
But this can be reviewed already. 🙂
Comment #4
anybodyThanks @Grevil, this wasn't a simple task, but looks really really good!
Due to the many changes I wasn't able to compare every single line, but I trust you made the changes very carefully and took the time to test everything. Once you're sure it' fine, let's merge this one in and make some final tests with the dev version.
Afterwards, let's release 2.1.0-alpha1
Comment #5
anybodyComment #6
grevil commentedOk, I understood the service worker cache version now, pretty smart!
So basically the cache version of the service worker is generated by the integer set in the configuration + the "version" from the info.yml. Meaning the old service worker will discard itself on update!! :)
We should also manually reset the cache version config to 1 on every update! So the admins can up them manually and don't have to start from their old cache version!
Now we only need to clear the correct caches for the manifest.
Comment #7
grevil commentedAlright, all done. As internally discussed with @Anybody, we'll simply flush all caches on update, since it would take too long, to pin point the correct caches to clear here. Final review pls! :)
Comment #8
anybodyComment #10
anybodyMERGED! Great!