fix(demo): companion app skips the demo intro — lands straight on /login

When the demo build runs inside the Android companion WebView
(window.ArchipelagoNative bridge, detected via the existing
isCompanionApp()), all four IS_DEMO intro branch sites now skip the
typing splash and /onboarding/intro and route directly to /login, as if
the intro was already seen:
- App.vue root-boot replay request (companion never requests the splash)
- App.vue post-splash demo routing
- RootRedirect proceedToApp() and the server-up onMounted demo branch

The skip paths write nothing to localStorage/sessionStorage (RootRedirect
skips even its boot log() there), so the browser/PWA demo intro — which
replays on every fresh root boot — is byte-identical to before, and
non-demo builds short-circuit on IS_DEMO before isCompanionApp() runs.
Adds a small isCompanionApp() bridge-detection unit test (700 tests green).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
archipelago
2026-07-29 14:11:12 -04:00
co-authored by Claude Fable 5
parent b80e7c3487
commit d54517cf0b
3 changed files with 52 additions and 1 deletions
@@ -0,0 +1,29 @@
import { describe, it, expect, afterEach } from 'vitest'
import { isCompanionApp } from '../openExternal'
// isCompanionApp() is the single companion-detection source used to skip the
// demo intro (App.vue + RootRedirect.vue) and by appLauncher — it must be true
// iff the native shell injected window.ArchipelagoNative with openInApp.
type TestWindow = Window & { ArchipelagoNative?: unknown }
const w = window as TestWindow
afterEach(() => {
delete w.ArchipelagoNative
})
describe('isCompanionApp', () => {
it('is false in a plain browser/PWA (no bridge injected)', () => {
expect(isCompanionApp()).toBe(false)
})
it('is true when the native shell injected the bridge with openInApp', () => {
w.ArchipelagoNative = { openInApp: () => {} }
expect(isCompanionApp()).toBe(true)
})
it('is false when the bridge exists but lacks a callable openInApp', () => {
w.ArchipelagoNative = { openExternal: () => {} }
expect(isCompanionApp()).toBe(false)
})
})