Avoid installed app handoff screen
This commit is contained in:
29
src/App.vue
29
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) => {
|
||||
<p v-if="pwaInstallMessage" class="validation-message rounded border border-white/15 bg-white/5 p-3 text-sm text-white/70">
|
||||
Open the L484 app icon on your homescreen. Signup will continue at name entry.
|
||||
</p>
|
||||
<button v-if="pwaInstallMessage" class="primary-action w-full" type="button" @click="openInstalledApp">
|
||||
Open app
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-if="signupStep === 2" class="space-y-4">
|
||||
|
||||
Reference in New Issue
Block a user