Modify fyne package -os web to generate a PWA with empty service worker, update package unit tests #5098
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
Using fyne package -os web creates an index.html that cannot be installed as a PWA.
Modified the packager to include a manifest.json, service-worker.js and update index.html to run the service-worker.js. This allows installing the PWA using the browser. The resulting PWA is a binary for the target platform that is generated by the browser itself. Of course, it still runs a captive browser in the application.
The proposed fix has an empty service-worker.js, which allows installing the PWA but the functions normally performed by the service worker, such as caching data and support for updates is not included in this enhancement. Adding a functional service worker requires consideration for what makes sense to support when running a WASM payload in a browser. This enhancement makes it possible for someone in the future to craft functional service worker based on features it should support. It will likely need someone expert in the construction of service workers for browser to design and implement.
Fixes #5097
Checklist:
Where applicable: