When I open the url on an iphone via Safari, it does asks me to add to homescreen. The icons and splashscreens are also working. So far so good.
Now, when I make a change and deploy again. The standalone version doesn’t notify me to refresh it. But when I open the url on the same iphone device in safari, it does asks me to refresh the application.
Also, when the application starts in the mobile browser, it will perform an api request to get data (https://todo.thehangrycoder.now.sh/todo/). But when I open the standalone application, it looks like it doesn’t do the api request.
so I got a workaround (at least for the checking the version number).
I do an interval of 20 seconds to invoke the servic worker checkForUpdate() method.
This wil also reload the whole application (and get new api data). But when there is no new update, it will still not get new api data. Just found out that ios just saves the state of the standalone pwa application as is.
you have add conditions like set something like version, and in interval we check is version change? and if version is change it will call api to get new data, i change link you can check
yes … in the interval I call the angular service worker. It will check if there’s a change and will fire an event wich I’m already subcribed on.
This workaround is for ios because in standalone, after the 1st time you start and close the application, ios safari just saves the current application state. so the check will never be called by safari.
actually it will not “call new api data” … it will refresh the whole application and then the application will refetch the api data. a slight difference. because when there is no new change and you will open the application, the application won’t refetch the api data