diff --git a/frontend/src/components/PhoneSetupAssistant.contract.test.ts b/frontend/src/components/PhoneSetupAssistant.contract.test.ts index 98054a9..29437f8 100644 --- a/frontend/src/components/PhoneSetupAssistant.contract.test.ts +++ b/frontend/src/components/PhoneSetupAssistant.contract.test.ts @@ -17,7 +17,9 @@ describe('PhoneSetupAssistant contract', () => { expect(source).toContain('WALLPAPER_IDS') expect(source).toContain('setAllAppNotifications') expect(source).toContain('appStore.claimApp') - expect(source).toContain('phone.completeSetup()') + expect(source).toContain('await phone.completeSetup()') + expect(source).toContain(':disabled="setupCompleteBusy"') + expect(source).toContain("phone.t('Setup.ready.saveFailed')") }) it('persists progress and supports resuming or moving backward', () => { diff --git a/frontend/src/components/PhoneSetupAssistant.vue b/frontend/src/components/PhoneSetupAssistant.vue index 06c39f0..f19b8fc 100644 --- a/frontend/src/components/PhoneSetupAssistant.vue +++ b/frontend/src/components/PhoneSetupAssistant.vue @@ -53,6 +53,8 @@ const passcodeLength = ref<4 | 6>(phone.security.length === 4 ? 4 : 6) const notificationsEnabled = ref(true) const notificationSounds = ref(true) const selectedApps = ref(['banking', 'garage', 'skyride']) +const setupCompleteBusy = ref(false) +const setupCompleteError = ref('') const setupApps = ( ['banking', 'garage', 'skyride', 'citymarkt', 'picstagram', 'snake'] as const @@ -204,8 +206,16 @@ function choosePasscodeLength(length: 4 | 6): void { passcodeResetKey.value += 1 } -function finish(): void { - phone.completeSetup() +async function finish(): Promise { + if (setupCompleteBusy.value) return + setupCompleteBusy.value = true + setupCompleteError.value = '' + const completed = await phone.completeSetup() + setupCompleteBusy.value = false + if (!completed) { + setupCompleteError.value = phone.t('Setup.ready.saveFailed') + return + } emit('complete') } @@ -794,12 +804,29 @@ function skipSetupForDevelopment(): void { }} - {{ - phone.t('Setup.ready.enter') - }} + + + {{ phone.t('Setup.ready.enter') }} + +