Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement PWA extension #1685

Open
Daltz333 opened this issue Jan 24, 2022 · 6 comments
Open

Implement PWA extension #1685

Daltz333 opened this issue Jan 24, 2022 · 6 comments
Labels
Extension Needs an extension created/added

Comments

@Daltz333
Copy link
Member

It would be totally awesome and cool to create an extension that turns Sphinx websites into PWA for offline use on mobile devices.

Basically, we should automatically add the necessary resources to our manifest.json. Then generate the relative metadata in the meta data of the various pages on the site.

@Daltz333 Daltz333 added the Extension Needs an extension created/added label Jan 24, 2022
@Daltz333
Copy link
Member Author

Currently @ItayZiv and myself are investigating this. Lots of research necessary. We can use this issue to write down development notes.

@Daltz333
Copy link
Member Author

Daltz333 commented Jan 24, 2022

Reference regarding caching for offline: https://www.simicart.com/blog/pwa-offline/
Reference regarding caching with multiple pages: https://stackoverflow.com/questions/45028343/pwa-with-multiple-pages

Possibly need to display splash screen while the PWA caches the site.

@ItayZiv
Copy link
Contributor

ItayZiv commented Jan 24, 2022

The biggest problem would be the cache size, the entire website currently is a bit over 100MB.
One possible solution is to cache all the images in a smaller resolution (possibly only on mobile) but even so, that might not be enough for some devices.
Regarding the 50MB limit on iOS: https://stackoverflow.com/questions/50093856/overcoming-the-50-mib-limitation-on-pwa-cache-for-ios

The other problem would be having the script to register the service worker on each page (might need a small sphinx extension)

@Daltz333
Copy link
Member Author

Daltz333 commented Jan 24, 2022

Yeah. I definitely think we need a sphinx extension. Ideally this can scale past frc-docs and we can have the extension automatically generate the manifest.json and inject the service work into the pages (with config overrides). We can do something quick and dirty for now inside the frc-docs repo for development, and then scale it into a sphinx extension later.

@TheTripleV
Copy link
Member

On size, if we switch from [source or responsive] to just webps, remove all the downloads, and minify the html (which I thought we already did), the whole package should come down to ~45mb which is just under the PWA limit of 50-52 MB, so pushing it.

To decrease service worker storage even more, all images can be stored in Indexeddb and be fetched on page load.

@Daltz333
Copy link
Member Author

Daltz333 commented Jan 24, 2022

@TheTripleV the 50mb limit only applies on iOS < 13. After that, it's half of available storage. We are just moving forward without the concern of storage for now. If it's easier, we just don't support iOS < 13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Extension Needs an extension created/added
Projects
None yet
Development

No branches or pull requests

3 participants