From e566bfc4efc45a350f29dfa55b4ffce08668e475 Mon Sep 17 00:00:00 2001 From: Dorian Date: Fri, 15 May 2026 17:25:15 -0500 Subject: [PATCH] Avoid installed app handoff screen --- public/manifest.webmanifest | 6 ++++++ public/sw.js | 2 +- src/App.vue | 29 +++++++++++++++-------------- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/public/manifest.webmanifest b/public/manifest.webmanifest index 4a60871..358ce22 100644 --- a/public/manifest.webmanifest +++ b/public/manifest.webmanifest @@ -11,6 +11,12 @@ "background_color": "#000000", "theme_color": "#000000", "gcm_sender_id": "103953800507", + "protocol_handlers": [ + { + "protocol": "web+l484", + "url": "/?signup=continue&launch=%s" + } + ], "icons": [ { "src": "/images/app-icon-192.png", diff --git a/public/sw.js b/public/sw.js index f74680e..bb493ce 100644 --- a/public/sw.js +++ b/public/sw.js @@ -1,4 +1,4 @@ -const CACHE_NAME = 'l484-pwa-v9' +const CACHE_NAME = 'l484-pwa-v10' const APP_SHELL = [ '/', '/manifest.webmanifest', diff --git a/src/App.vue b/src/App.vue index bb83213..fef4cd8 100644 --- a/src/App.vue +++ b/src/App.vue @@ -369,14 +369,12 @@ const canContinue = computed(() => { return true }) const pwaInstallTitle = computed(() => { - if (pwaInstallMessage.value) return 'Open the L484 app' if (isPwaStandalone.value) return 'PWA installed' if (installPlatform.value === 'ios') return 'Install L484 on iPhone' if (installPlatform.value === 'android') return 'Install L484 on Android' return 'Install L484 on this device' }) const pwaInstallCopy = computed(() => { - if (pwaInstallMessage.value) return 'Continue signup in the installed app. It will start at name entry.' if (installPlatform.value === 'ios') return 'Use Safari, tap Share, then Add to Home Screen. Reopen L484 from the new app icon to continue signup.' return 'Press Install app to open the browser install prompt.' }) @@ -787,10 +785,9 @@ const handleBeforeInstallPrompt = (event) => { const handlePwaInstalled = () => { deferredInstallPrompt.value = null - signupStep.value = 1 saveSignupDraft(2) - pwaInstallMessage.value = 'Installed. Open L484 from your homescreen to continue.' refreshPwaStandalone() + openInstalledApp() } const handlePwaInstallPrimary = async () => { @@ -809,9 +806,8 @@ const handlePwaInstallPrimary = async () => { await promptEvent.prompt() const choice = await promptEvent.userChoice.catch(() => null) if (choice?.outcome === 'accepted') { - signupStep.value = 1 saveSignupDraft(2) - pwaInstallMessage.value = 'Installed. Open L484 from your homescreen to continue.' + openInstalledApp() return } formError.value = 'Install L484 before continuing signup.' @@ -819,9 +815,8 @@ const handlePwaInstallPrimary = async () => { } if (installPlatform.value === 'desktop' || installPlatform.value === 'android') { - signupStep.value = 1 saveSignupDraft(2) - pwaInstallMessage.value = 'L484 may already be installed on this device. Open the installed app to finish signup.' + openInstalledApp() return } @@ -829,9 +824,18 @@ const handlePwaInstallPrimary = async () => { } const openInstalledApp = () => { - signupStep.value = 2 - saveSignupDraft() - window.location.href = '/?signup=continue' + saveSignupDraft(2) + let didLeave = false + const fallback = window.setTimeout(() => { + if (didLeave) return + signupStep.value = 2 + }, 900) + const markLeave = () => { + didLeave = true + window.clearTimeout(fallback) + } + window.addEventListener('pagehide', markLeave, { once: true }) + window.location.href = 'web+l484://signup' } const startSignup = async () => { @@ -3508,9 +3512,6 @@ watch(mobileMenuOpen, (open) => {

Open the L484 app icon on your homescreen. Signup will continue at name entry.

-