Show installed app handoff during signup
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const CACHE_NAME = 'l484-pwa-v8'
|
||||
const CACHE_NAME = 'l484-pwa-v9'
|
||||
const APP_SHELL = [
|
||||
'/',
|
||||
'/manifest.webmanifest',
|
||||
|
||||
18
src/App.vue
18
src/App.vue
@@ -369,12 +369,14 @@ 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.'
|
||||
})
|
||||
@@ -724,10 +726,10 @@ const clampSignupStep = (step) => {
|
||||
return Math.min(5, Math.max(0, Math.round(numericStep)))
|
||||
}
|
||||
|
||||
const saveSignupDraft = () => {
|
||||
const saveSignupDraft = (step = signupStep.value) => {
|
||||
if (currentMember.value || signupStep.value === 5) return
|
||||
localStorage.setItem(SIGNUP_DRAFT_KEY, JSON.stringify({
|
||||
step: clampSignupStep(signupStep.value),
|
||||
step: clampSignupStep(step),
|
||||
form: {
|
||||
fullName: form.fullName,
|
||||
email: form.email,
|
||||
@@ -785,8 +787,8 @@ const handleBeforeInstallPrompt = (event) => {
|
||||
|
||||
const handlePwaInstalled = () => {
|
||||
deferredInstallPrompt.value = null
|
||||
signupStep.value = 2
|
||||
saveSignupDraft()
|
||||
signupStep.value = 1
|
||||
saveSignupDraft(2)
|
||||
pwaInstallMessage.value = 'Installed. Open L484 from your homescreen to continue.'
|
||||
refreshPwaStandalone()
|
||||
}
|
||||
@@ -807,8 +809,8 @@ const handlePwaInstallPrimary = async () => {
|
||||
await promptEvent.prompt()
|
||||
const choice = await promptEvent.userChoice.catch(() => null)
|
||||
if (choice?.outcome === 'accepted') {
|
||||
signupStep.value = 2
|
||||
saveSignupDraft()
|
||||
signupStep.value = 1
|
||||
saveSignupDraft(2)
|
||||
pwaInstallMessage.value = 'Installed. Open L484 from your homescreen to continue.'
|
||||
return
|
||||
}
|
||||
@@ -817,8 +819,8 @@ const handlePwaInstallPrimary = async () => {
|
||||
}
|
||||
|
||||
if (installPlatform.value === 'desktop' || installPlatform.value === 'android') {
|
||||
signupStep.value = 2
|
||||
saveSignupDraft()
|
||||
signupStep.value = 1
|
||||
saveSignupDraft(2)
|
||||
pwaInstallMessage.value = 'L484 may already be installed on this device. Open the installed app to finish signup.'
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user