GithubHelp home page GithubHelp logo

Offline install issue about vamigaweb HOT 31 CLOSED

mithrendal avatar mithrendal commented on July 22, 2024
Offline install issue

from vamigaweb.

Comments (31)

Vweber73 avatar Vweber73 commented on July 22, 2024 1

When you feel it's ready! :)

from vamigaweb.

mithrendal avatar mithrendal commented on July 22, 2024 1

Yes. I did and will do change the versions without and with version management a couple of times. In order to test a smooth migration for the regular version in mind.

Hard to test otherwise. Testing phase will finished today or tomorrow…

from vamigaweb.

mithrendal avatar mithrendal commented on July 22, 2024

@Vweber73

  1. could you test vc64web.github.io whether you see the issue there too ?
  2. could you test vAmigaWeb.github.io on your iPodTouch or iPad ?

can you post the message which pops up ?

from vamigaweb.

Vweber73 avatar Vweber73 commented on July 22, 2024

Hi,

  1. On my Z3 In flight mode no problem to start vc64, even after closing all app's, but...the same thing with vAmigaWeb ! It seems that the failure on startup is not systematic, that sometimes everything is cached ok.
  2. On my ipod touch in flight mode, first startup of vAmigaWeb is ok. Closing the app and restart gave the error attached.
    Cheers
    Capture d’écran   2022-05-25 à 12 59 33

from vamigaweb.

mithrendal avatar mithrendal commented on July 22, 2024

2.On my ipod touch in flight mode, first startup of vAmigaWeb is ok. Closing the app and restart gave the error attached.

do you remember when did you turn WLAN off ? Was it after the first startup?

from vamigaweb.

mithrendal avatar mithrendal commented on July 22, 2024

Why I am asking this is because it seems that vAmigaWeb has a wrong implementation of the service workers lifecycle...

there is a lifycycle which is describe here https://flaviocopes.com/service-workers/#activation

it explicitely says

The Install stage
If the browser determines that a service worker is outdated or has never been registered before, it will proceed to install it.

self.addEventListener('install', (event) => {
  //...
});
This is a good event to prepare the Service Worker to be used, by initializing a cache, and cache the App Shell and static assets using the Cache API.

what does our service worker ?

vAmigaWeb/sw.js

Lines 4 to 7 in 1024a74

self.addEventListener('install', evt => {
console.log('service worker installed');
});

correct nothing... it does not fill the cache ...

then after install of the new service worker i.e. after the app has been closed or reloaded activation stage begins ...

The activation stage is the third step, once the service worker has been successfully registered and installed.
...
It cannot interact with pages already loaded, which means the service worker is only useful on the second time the user interacts with the app, or reloads one of the pages already open.

A good use case for this event is to cleanup old caches and things associated with the old version but unused in the new version of the service worker.

now see look at what we do in activation 🙄

vAmigaWeb/sw.js

Lines 9 to 20 in 1024a74

self.addEventListener('activate', evt => {
console.log('service worker activated');
evt.waitUntil(
caches.keys().then(keys => {
console.log('deleting cache files:'+keys);
return Promise.all(keys
.map(key => caches.delete(key))
);
})
);
});

we delete the old existing version and have nothing in cache after this event .... we rely that the following fetch events will fill the new version into the cache automatically

under which circumstances is vAmigaWeb not offline capable ?

  1. you start vAmigaWeb -> there is a new version on the server
  2. it detects this and fires the install event -> we do nothing
  3. you close the app
  4. turn on flight mode / offline
  5. start the app -> new service worker activates -> deletes caches
  6. wants to load new version from server -> booom!

that means vAmigaWeb is offline capable as long there is no new version on the server ... when there is a new version on the server it will install it after the current app has been closed and reopened .. the button "update installation" does fill the old cache because the new service worker has not been activated yet ... so when clicking "update installation" manually it will install this twice

from vamigaweb.

Vweber73 avatar Vweber73 commented on July 22, 2024

I don't remember if I started vAmigaWeb a first time before switching off WLAN... maybe...
I tried again: I closed the app (which was on the error page I sent), switched WLAN off (it was on again), and started vAmigaWeb again: same error...
I switched WLAN off, came back to the app, booted fine. I closed the app, switched WLAN off, started vAmigaWeb, this time it booted fine.

Does it help ?

from vamigaweb.

mithrendal avatar mithrendal commented on July 22, 2024

I switched WLAN off, came back to the app, booted fine. I closed the app, switched WLAN off, started vAmigaWeb, this time it booted fine.

you mean the first off is an on right ?

if yes , then yes that helped ... and from now on vAmigaWeb is offline capable on your iPod touch until we publish a new version again ...

okay we can fix this by implementing the PWA install event correctly ...

from vamigaweb.

Vweber73 avatar Vweber73 commented on July 22, 2024

Yes, sorry i meant "ON".
Great news ! same on my Z3 ? New version out ?
Cheers

from vamigaweb.

mithrendal avatar mithrendal commented on July 22, 2024

No new version out. What do you mean with „same on my z3“? Do you mean that once we move the installation from fetch to installation event whether that fixes it too on the z3 then the answer is yes 😀

from vamigaweb.

Vweber73 avatar Vweber73 commented on July 22, 2024

I thought you said you fixed the problem for iOS, but not necessarily for Android.

from vamigaweb.

mithrendal avatar mithrendal commented on July 22, 2024

Yes it is platform independent. I screwed up the PWA livecycle … when I correctly implement it then it should be ok

for now it is only partial offline capable 😬

from vamigaweb.

Vweber73 avatar Vweber73 commented on July 22, 2024

Got it, thanks !

from vamigaweb.

mithrendal avatar mithrendal commented on July 22, 2024

for reference a how to guide for implementing updates which are controlled by the user instead of automatic

https://whatwebcando.today/articles/handling-service-worker-updates/

from vamigaweb.

Vweber73 avatar Vweber73 commented on July 22, 2024

Interesting, thanks !

from vamigaweb.

mithrendal avatar mithrendal commented on July 22, 2024

That is a receipt for me how I have to change the installation process…

from vamigaweb.

mithrendal avatar mithrendal commented on July 22, 2024

Hi just wanted to report that I am on my journey of making the "offline" installation process more transparent to the user.

Here are two screen shots which did ...

first when a new version is available it will report this with a toaster message to the user and let him decide whether to install or skip ...

image

the second screen shot shows that in the settings dialog there is now information about what is currently installed

image

I also like to try whether it is maybe possible to switch between several installed versions ... this way also older snapshots would be still playable...

from vamigaweb.

Vweber73 avatar Vweber73 commented on July 22, 2024

Hi,
Excellent, many thanks!
It seems there is no new version online yet?
Cheers

from vamigaweb.

mithrendal avatar mithrendal commented on July 22, 2024

no ... I don't dare to push it to uat.... It is still so alpha...

should I dare it?

from vamigaweb.

mithrendal avatar mithrendal commented on July 22, 2024

development version on my mac does not delete older installations anymore and can therefore activate different versions of vAmigaWeb ... solving thereby the "broken snapshot on upgrade to new version" problem ...

image

see here three different versions are installed ...

image

the list of installed versions would become too big over time, no? 🙄

how to design the deletion of older versions 🤔? hmm.... lets think about it tomorrow 😴

from vamigaweb.

Vweber73 avatar Vweber73 commented on July 22, 2024

I personnally don't require several versions installed at one time :) but if the feature is there, why not, thanks!
Cheers

from vamigaweb.

mithrendal avatar mithrendal commented on July 22, 2024

image

I will put it to uat now....

when you got an older version without installation management then it will enforce the upgrade as usual ... once you are on the newer version ... everything will be completely transparent ... and off line mode should work reliably ...

from vamigaweb.

Vweber73 avatar Vweber73 commented on July 22, 2024

Excellent, thanks!
First time I tried I got this... But I relaunched and it was OK. Only a one off problem?
Screenshot_20220705-232935_Chrome

from vamigaweb.

mithrendal avatar mithrendal commented on July 22, 2024

yes me too ... just pushed a bugfix

from vamigaweb.

Vweber73 avatar Vweber73 commented on July 22, 2024

Great!

from vamigaweb.

mithrendal avatar mithrendal commented on July 22, 2024

I did reatart the app a few times without clicking “update installation” and it gives me this

F6C5FBC8-F9FA-4FC5-B1AE-DA0F095FC425

Looks as it does work on iOS 😎

from vamigaweb.

Vweber73 avatar Vweber73 commented on July 22, 2024

Works well on my side! And doesn't even break my snapshots :)

from vamigaweb.

mithrendal avatar mithrendal commented on July 22, 2024

No because the core is still the same 😂

now we can upgrade to beta3 soon without fear. Because we can always go back in history 😎

from vamigaweb.

Vweber73 avatar Vweber73 commented on July 22, 2024

Fantastic job! Thanks and cheers

from vamigaweb.

Vweber73 avatar Vweber73 commented on July 22, 2024

Hi,
Today the uat version was back to prior the versions management feature. I upgraded and this version was restored, but without letting me install previous versions as before. The version is dated yesterday, has anything changed?
Cheers

from vamigaweb.

mithrendal avatar mithrendal commented on July 22, 2024

998C1CD5-D184-48EE-BD90-4AB74FEE16FE

new version out. Uat and regular 😎

from vamigaweb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.