Open nenadalm opened 1 day ago
Thanks for the input. I've looked a bit at this, since I was fairly certain I had supported and tested this already.
After re-testing, I am able to reproduce the issue, only if I have not recently opened the app, and enabled flightmode before I opened it. If I open the app with internet connection, close it, enable flight mode, and re-open the app, it works. Seems to be an issue with the caching policy on the current hosting solution (Github Pages).
https://github.com/orgs/community/discussions/11884 Found an open issue about this, where it seems GH pages has a cache-lifetime of 10 minutes, that I will put up as a blocker for this issue.
I currently do not have plans to switch hosting services, since I do not want to maintain a server and/or pay for hosting. Though who know what I feel like doing next year. I've gotten tons of IRL feedback to add a hiscores feature, which would also require some server-validation logic for POSTs.
BUT, this should be fairly easy to host on any server for private caching, since it's just a static website with standard structure. So I encourage you to set up hosting on a private server somewhere, for you and your friends to enjoy better offline support.
I think the github pages caches shouldn't be a problem. I have a few of my pwas like backgammon (https://github.com/nenadalm/backgammon/blob/master/resources/private/worker.js) there and I don't experience such issue. I cache every asset in my service worker.
It looks like caching is not working (tested in Chrome) due to missing files:
hmm, you might be right. I'll take a closer look after work. On first glance it looks like the the serviceworker script does not use the generated-names for assets. I have another TODO for fixing bundling and deployment, so I might try hitting two birds with one stone
PWA currently doesn't work offline:
since it seems it doesn't communicate with any server, it would be nice if it was possible to play offline.