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

**URL:** <https://forum.kinopio.club/t/when-ios-app-is-offline-the-loading-screen-is-longer-than-it-needs-to-be/1241>\
**Category:** Fixed or Completed\
**Tags:** lucas\
**Created:** [January 23, 2024, 3:09pm UTC](https://forum.kinopio.club/t/when-ios-app-is-offline-the-loading-screen-is-longer-than-it-needs-to-be/1241 "2024-01-23T15:09:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pirijan](https://forum.kinopio.club/user_avatar/forum.kinopio.club/pirijan/32/7_2.png) [@pirijan](https://forum.kinopio.club/u/pirijan)\
**Post date:** [January 23, 2024, 3:09pm UTC](https://forum.kinopio.club/t/when-ios-app-is-offline-the-loading-screen-is-longer-than-it-needs-to-be/1241/1 "2024-01-23T15:09:30Z")

</div>

as seen on [https://pketh.org/images/2024/offline/offline2.mp4](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

---

<div class="post-metadata">

**Author:** ![lucas](https://forum.kinopio.club/user_avatar/forum.kinopio.club/lucas/32/1851_2.png) [@lucas](https://forum.kinopio.club/u/lucas)\
**Post date:** [January 23, 2024, 9:52pm UTC](https://forum.kinopio.club/t/when-ios-app-is-offline-the-loading-screen-is-longer-than-it-needs-to-be/1241/2 "2024-01-23T21:52:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pirijan](https://forum.kinopio.club/user_avatar/forum.kinopio.club/pirijan/32/7_2.png) [@pirijan](https://forum.kinopio.club/u/pirijan)\
**Post date:** [January 24, 2024, 5:21pm UTC](https://forum.kinopio.club/t/when-ios-app-is-offline-the-loading-screen-is-longer-than-it-needs-to-be/1241/4 "2024-01-24T17:21:24Z")

</div>

from [Window: load event - Web APIs | MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event)

> 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](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.

---

<div class="post-metadata">

**Author:** ![lucas](https://forum.kinopio.club/user_avatar/forum.kinopio.club/lucas/32/1851_2.png) [@lucas](https://forum.kinopio.club/u/lucas)\
**Post date:** [January 31, 2024, 6:18am UTC](https://forum.kinopio.club/t/when-ios-app-is-offline-the-loading-screen-is-longer-than-it-needs-to-be/1241/5 "2024-01-31T06:18:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pirijan](https://forum.kinopio.club/user_avatar/forum.kinopio.club/pirijan/32/7_2.png) [@pirijan](https://forum.kinopio.club/u/pirijan)\
**Post date:** [January 31, 2024, 2:30pm UTC](https://forum.kinopio.club/t/when-ios-app-is-offline-the-loading-screen-is-longer-than-it-needs-to-be/1241/6 "2024-01-31T14:30:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pirijan](https://forum.kinopio.club/user_avatar/forum.kinopio.club/pirijan/32/7_2.png) [@pirijan](https://forum.kinopio.club/u/pirijan)\
**Post date:** [January 31, 2024, 2:31pm UTC](https://forum.kinopio.club/t/when-ios-app-is-offline-the-loading-screen-is-longer-than-it-needs-to-be/1241/7 "2024-01-31T14:31:21Z")

</div>

i think having a 500ms minimum delay is totally fine

---

<div class="post-metadata">

**Author:** ![lucas](https://forum.kinopio.club/user_avatar/forum.kinopio.club/lucas/32/1851_2.png) [@lucas](https://forum.kinopio.club/u/lucas)\
**Post date:** [February 1, 2024, 8:06am UTC](https://forum.kinopio.club/t/when-ios-app-is-offline-the-loading-screen-is-longer-than-it-needs-to-be/1241/8 "2024-02-01T08:06:21Z")

</div>

Submitted to App Store Review ✅
