When ios app is offline the loading screen is longer than it needs to be

as seen on https://pketh.org/images/2024/offline/offline2.mp4 , after tapping the app icon the loading screen is visible for about 4 seconds. If I open up kinopio in the browser while offline, the app is available almost instantly. Is this delay hardcoded? Would it help if I sent a postmessage when the space is loaded? cc @lucas

1 Like

I agree that it takes unexpectedly long, especially now that everything should be available offline. I am currently not aware of any hard-coded delay.

The launch screen should disappear after the load event from window.

I will try to find out why it takes so long.

2 Likes

from Window: load event - Web APIs | MDN

The load event is fired when the whole page has loaded, including all dependent resources such as stylesheets, scripts, iframes, and images

waiting on assets like vids to finish downloading and script methods that probably timeout when offline might theoretically cause the delay.

the next release (https://github.com/kinopio-club/kinopio-client/pulls) , also adds an explicit restoreSpaceComplete postmessage:
window.webkit.messageHandlers['restoreSpaceComplete'].postMessage(true)

so you can listen for this instead of window.load . it’ll be more accurate bc it’ll fire when the space data is loaded either from local cache or remotely.

1 Like

I added an event handler for restoreSpaceComplete and it seems to have a positive effect because it fires way before the load event.

I implemented a 500 ms delay for the animation before, to prevent white flashes from the underlying webview. I tried to remove it, but even when listening for restoreSpaceComplete white flashes appear. Will leave the delay at 500 ms for now.

An updated version can be found on TestFlight.

2 Likes

ya it’s way faster and seems bug free in my testing. ship it :smiley:

2 Likes

i think having a 500ms minimum delay is totally fine

1 Like

Submitted to App Store Review :white_check_mark:

2 Likes