klembot / twinejs

Twine, a tool for telling interactive, nonlinear stories
https://twinery.org
GNU General Public License v3.0
2.02k stars 301 forks source link

Add PWA functionality #1505

Closed gdbing closed 5 months ago

gdbing commented 8 months ago

Describe the bug.

https://twinery.org/reference/en/getting-started/installing.html#ios-browsers

The policy it enforces that if a week passes where you do not visit a web site, Safari will erase all of its storage. This means that if you do not use Twine for a week, everything you create in it will be lost.

The one exception to this policy is if you add a web site to your Home Screen. Sites that are added as Home Screen shortcuts will not have their storage deleted.

This is not accurate, it is not enough to add a web site to the Home Screen, only progressive web apps are exempted from the 7 day cache limit.

Either twinery.org needs to be updated to fulfill the PWA requirements (web app manifest, service worker) or this page should be updated, and the MacOS browser warning should be applied to iOS browsers as well.

Steps to reproduce:

Expected behavior:

Additional context on this problem.

No response

Twine version number

2.8.1

Does this problem occur with the web version of Twine or the desktop app?

Web

What operating system does this problem occur on?

iOS

If this problem is occurring with the web version of Twine, what browser does it occur on?

Safari

Presubmission checklist

klembot commented 8 months ago

Thanks for reporting this! I'm going to try to repro the problem myself and, assuming I see the same issue, we should fix this. You checked the box that you would like to work on code for this... what did you have in mind?

klembot commented 8 months ago

I wasn't able to repro this; after adding Twine to my home screen on my phone and waiting 12 days, it still had my story. That said, it seems reasonable enough to add basic PWA functionality, so I'll make this an enhancement request.

gdbing commented 8 months ago

You checked the box that you would like to work on code for this... what did you have in mind?

When i checked that box I had been poking around and investigating PWAs and was thinking I might try putting together a bare bones manifest and service worker to make twine function as a web app.

I’ve been sidetracked by some other projects though, so I’m no actively working on that at the moment, but if I turn my attention back towards it I’ll comment here

klembot commented 7 months ago

FWIW, my first guess is to try using vite-plugin-pwa since all we want is to cache assets so it can run offline.

david-donachie commented 6 months ago

I wasn't able to repro this; after adding Twine to my home screen on my phone and waiting 12 days, it still had my story. That said, it seems reasonable enough to add basic PWA functionality, so I'll make this an enhancement request.

It seems quite variable. General "received wisdom" is that you can't guarantee local storage being persisted past 7 days, but it doesn't seem to be a hard cap.