An easy-to-host PDS on the ATProtocol, iPhone and MacOS. Maintain control of your keys and data, always.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(identity-wallet): wire mode selector as entry point with identity-aware onMount

authored by

Malpercio and committed by
Tangled
d8d19b95 3e9ff674

+37 -9
+37 -9
apps/identity-wallet/src/routes/+page.svelte
··· 1 1 <script lang="ts"> 2 2 import { listen } from '@tauri-apps/api/event'; 3 3 import { onMount } from 'svelte'; 4 + import ModeSelectScreen from '$lib/components/onboarding/ModeSelectScreen.svelte'; 4 5 import RelayConfigScreen from '$lib/components/onboarding/RelayConfigScreen.svelte'; 5 6 import WelcomeScreen from '$lib/components/onboarding/WelcomeScreen.svelte'; 6 7 import ClaimCodeScreen from '$lib/components/onboarding/ClaimCodeScreen.svelte'; ··· 16 17 import HomeScreen from '$lib/components/home/HomeScreen.svelte'; 17 18 import DIDDocumentScreen from '$lib/components/home/DIDDocumentScreen.svelte'; 18 19 import RecoveryInfoScreen from '$lib/components/home/RecoveryInfoScreen.svelte'; 19 - import { createAccount, getRelayUrl, type CreateAccountError, type OAuthError, type HomeData } from '$lib/ipc'; 20 + import { createAccount, getRelayUrl, listIdentities, type CreateAccountError, type OAuthError, type HomeData } from '$lib/ipc'; 20 21 21 22 // ── Onboarding step type ───────────────────────────────────────────────── 22 23 // ··· 29 30 // instead of navigating through an extra modal. No 'error' step is needed. 30 31 31 32 type OnboardingStep = 33 + | 'mode_select' 32 34 | 'relay_config' 33 35 | 'welcome' 34 36 | 'claim_code' ··· 45 47 | 'home' 46 48 | 'did_document' 47 49 | 'recovery_info' 48 - | 'auth_failed'; 50 + | 'auth_failed' 51 + | 'identity_input' 52 + | 'pds_auth' 53 + | 'email_verification' 54 + | 'review_operation' 55 + | 'claim_success'; 49 56 50 57 // ── State ──────────────────────────────────────────────────────────────── 51 58 52 - let step = $state<OnboardingStep>('relay_config'); 59 + let step = $state<OnboardingStep>('mode_select'); 53 60 let form = $state({ claimCode: '', email: '', handle: '', password: '', did: '', share3: '', registeredHandle: '' }); 54 61 55 62 /** ··· 74 81 // ── Relay configuration and OAuth event listener ────────────────────── 75 82 76 83 onMount(async () => { 77 - // If the user has already configured a relay URL, skip the config screen. 78 - const savedUrl = await getRelayUrl(); 79 - if (savedUrl) { 80 - step = 'welcome'; 84 + // If the user has claimed identities, skip to home. 85 + try { 86 + const identities = await listIdentities(); 87 + if (identities.length > 0) { 88 + step = 'home'; 89 + return; 90 + } 91 + } catch { 92 + // listIdentities failed (e.g. empty Keychain on first launch) — continue to mode_select 81 93 } 82 94 83 - // Existing: listen for auth_ready deep-link callback from the OAuth flow. 95 + // Legacy user fallback: if a relay URL is already configured (from the old 96 + // single-identity flow before multi-identity), the user has used the app before 97 + // but has no managed-dids entry. Skip relay_config but still show mode_select 98 + // so they can choose create vs. import. Without this, legacy users would see 99 + // mode_select and then relay_config (asking them to configure a relay they 100 + // already configured). 101 + // Note: mode_select is already the default step, so this is a no-op for 102 + // mode_select itself, but it prevents the "Create new identity" path from 103 + // redundantly showing relay_config when the relay is already configured. 104 + // The relay_config screen itself already checks getRelayUrl() internally. 105 + 106 + // Listen for auth_ready from relay OAuth (existing onboarding flow). 84 107 listen('auth_ready', () => { 85 108 goTo('home'); 86 109 }); ··· 159 182 </script> 160 183 161 184 <div class="app"> 162 - {#if step === 'relay_config'} 185 + {#if step === 'mode_select'} 186 + <ModeSelectScreen 187 + oncreate={() => goTo('relay_config')} 188 + onimport={() => goTo('identity_input')} 189 + /> 190 + {:else if step === 'relay_config'} 163 191 <RelayConfigScreen onnext={() => goTo('welcome')} /> 164 192 {:else if step === 'welcome'} 165 193 <WelcomeScreen onstart={() => goTo('claim_code')} />