Cards you can see through, a splash that waits, and iOS launch screens
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
**The transparency was there and invisible.** `--glass` was a near-black at 55% alpha, and a dark film over a dark background reads as solid no matter what the alpha says — so the cards looked exactly as opaque as before. It is 34% now, the family tint weighs a little more (14%) and the blur is 10px instead of 16: heavy blur flattens the backdrop into one colour, which hides the very thing that is supposed to show through. The opaque `@supports` fallback is gone as well. It was copied from the tab bar, where it is right — the bar floats over scrolling text — and it is wrong here: a card sits in the page flow and the only thing behind it is the aura. On any device that took that branch, the cards were solid by construction. **The splash now waits, which is what a launch screen does.** It stays until the boot is finished, with a floor of 1.1s so it can actually be read (a warm boot takes milliseconds, and a splash that lasts that long is a flicker) and a ceiling of 6s so a request that never answers cannot hold anybody behind a photograph — their workouts are already local. The mark pulses slowly while it waits, so it looks like a screen that is loading rather than a photograph that is stuck. **The long white is iOS, before any of our code runs.** The deployed HTML already carries the aura's base colour inline, so what is left is the installed web app's own launch screen: iOS paints it before the page exists, and without an `apple-touch-startup-image` that matches the device it paints nothing. Fourteen entries now cover the phone and tablet sizes the app is opened on, cropped from the same photograph (each device fetches only its own). build-app-icons.mjs fails when the sizes it generates and the sizes index.html links disagree, because a missing entry is the blank screen this exists to remove.
This commit is contained in:
1 parent
3908dc524a
commit
9e580c4794
20 files changed
+150
-41
No files matched your search
@@ -22,11 +22,16 @@ vi.mock('./lib/back.js', () => ({ initBackButton: async () => () => {} }))
|
||||
vi.mock('./lib/push.js', () => ({ syncPushSubscription: async () => {} }))
|
||||
|
||||
const { default: App } = await import('./App.jsx')
|
||||
const { useStore } = await import('./store/useStore.js')
|
||||
|
||||
let host, root
|
||||
beforeEach(() => {
|
||||
globalThis.IS_REACT_ACT_ENVIRONMENT = true
|
||||
localStorage.clear()
|
||||
// The store is a module singleton, so it carries state from one test into the next: `ready` is
|
||||
// left true by whichever test booted first, and a test about a boot that never finishes has to
|
||||
// start from a boot that has not finished. `user` goes too, or "signed in" means nothing here.
|
||||
useStore.setState({ ready: false, user: null })
|
||||
host = document.createElement('div')
|
||||
document.body.appendChild(host)
|
||||
root = createRoot(host)
|
||||
@@ -42,24 +47,36 @@ describe('the app shell', () => {
|
||||
expect(host.querySelector('img.boot-logo')?.getAttribute('src')).toBe('logo.png')
|
||||
})
|
||||
|
||||
it('gets past the launch screen and paints a screen', async () => {
|
||||
it('stays long enough to be seen, then gets out of the way', async () => {
|
||||
await act(async () => { root.render(<App />) })
|
||||
// Wait out the 500ms floor, then let boot() settle.
|
||||
// Past a warm boot, which finishes in milliseconds — and past the 500ms a flicker would have
|
||||
// ended at. The floor is the whole point: this screen has to be readable, not a flash.
|
||||
await act(async () => { await new Promise(r => setTimeout(r, 600)) })
|
||||
expect(host.querySelector('.boot-splash')).toBeTruthy()
|
||||
// Once the floor is up and boot has finished, the app takes over.
|
||||
await act(async () => { await new Promise(r => setTimeout(r, 700)) })
|
||||
expect(host.querySelector('.boot-splash')).toBeNull()
|
||||
// Something real is on screen — the login door for a device with no profile. The assertion is
|
||||
// deliberately loose: the point is that the tree rendered, not which screen it chose.
|
||||
expect(host.textContent.trim().length).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
it('keeps local data visible when boot is slow, instead of holding the splash', async () => {
|
||||
// A signed-in device whose boot never finishes (bad network): the splash covers the first half
|
||||
// second and then gets out of the way, because the local copy is the whole point of offline.
|
||||
localStorage.setItem('gym_user', JSON.stringify({ id: 'u1', name: 'Test' }))
|
||||
it('keeps local data behind a boot that never finishes, but not forever', async () => {
|
||||
// A signed-in device on a network that answers nothing. The splash holds while the app is
|
||||
// loading — that is what a launch screen does — and the ceiling is what stops it becoming a
|
||||
// screen you cannot get past: the workouts are already in local storage.
|
||||
useStore.setState({ user: { id: 'u1', name: 'Test' }, ready: false })
|
||||
const api = (await import('./lib/api.js')).api
|
||||
api.mockImplementation(() => new Promise(() => {})) // never resolves
|
||||
api.mockImplementation(() => new Promise(() => {}))
|
||||
// Fake timers from BEFORE the render: the component's two timeouts are scheduled on mount, and
|
||||
// installing them afterwards leaves those on the real clock, so advancing the fake one moves
|
||||
// nothing. (Learned by watching this test fail with the splash still up.)
|
||||
vi.useFakeTimers()
|
||||
await act(async () => { root.render(<App />) })
|
||||
await act(async () => { await new Promise(r => setTimeout(r, 600)) })
|
||||
await act(async () => { vi.advanceTimersByTime(1300) })
|
||||
expect(host.querySelector('.boot-splash')).toBeTruthy() // still loading, still showing it
|
||||
// ...and the ceiling releases it, six seconds in. Driving that with fake timers is why this
|
||||
// test takes milliseconds instead of six seconds.
|
||||
await act(async () => { vi.advanceTimersByTime(6000) })
|
||||
expect(host.querySelector('.boot-splash')).toBeNull()
|
||||
vi.useRealTimers()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user