diff options
| -rw-r--r-- | src/app.js | 23 | ||||
| -rw-r--r-- | src/features/names.js | 3 |
2 files changed, 24 insertions, 2 deletions
@@ -3232,6 +3232,15 @@ async function onbUpload(file) { return url; } +// Whether the wizard can offer Spending at all: an Ark-capable build on a +// network with the names registrar, for a full (signing) account. Elsewhere +// the offer would be a spinner that never resolves. +function canOfferSpending() { + const acc = activeAccount(); + if (!acc || acc.type !== 'full' || wallet.watchOnly) return false; + if (!featureHook('arkReady')) return false; + return featureHook('namesAvailable') === 'yes'; +} function onboardScreen() { if (!ui.onb) { let saved = null; @@ -3261,7 +3270,11 @@ function onboardScreen() { // Handled further down, where page()/title() exist. const arrived = activeAccount(); if (arrived && arrived.mnemonic && !arrived.seedSeen) o.step = 'backup'; - else { + else if (canOfferSpending()) { + // Before the home screen: one offer to set up Spending (a name and a + // payment address), with Not now a single tap away. + o.step = 'spend'; o.enterAddr = undefined; + } else { ui.onb = null; try { localStorage.removeItem(ONB_STEP_KEY); } catch {} // On-chain first: the wizard's promise is "your keys, your coins", and @@ -3383,6 +3396,7 @@ function onboardScreen() { const words = acc.mnemonic.split(' '); const done = () => { markSeedSeen(acc); + if (canOfferSpending()) { o.step = 'spend'; o.enterAddr = undefined; render(); return; } ui.onb = null; try { localStorage.removeItem(ONB_STEP_KEY); } catch {} ui.account = 'savings'; @@ -3401,6 +3415,7 @@ function onboardScreen() { // Later means later, not never: seedSeen stays false, so the wallet // keeps a quiet reminder until the phrase has actually been seen. h('button', { class: 'btn-ghost btn-block', onClick: () => { + if (canOfferSpending()) { o.step = 'spend'; o.enterAddr = undefined; render(); return; } ui.onb = null; try { localStorage.removeItem(ONB_STEP_KEY); } catch {} ui.account = 'savings'; @@ -3434,10 +3449,14 @@ function onboardScreen() { title(t('onbSpendTitle')), h('p', { class: 'muted', style: 'margin:0' }, t('onbSpendBody')), featureHook('namesClaimForm') || h('div', { class: 'row gap6', style: 'align-items:center' }, h('span', { class: 'spinner sm' }), h('span', { class: 'small muted' }, t('onbNameWait'))), - // Optional means optional: one tap back to the wallet, no questions. + // Optional means optional: one tap to the wallet, no questions — on + // Savings, the account that exists without any setup. h('button', { class: 'btn-ghost btn-block', onClick: () => { ui.onb = null; try { localStorage.removeItem(ONB_STEP_KEY); } catch {} + ui.account = 'savings'; + try { localStorage.setItem(ACCOUNT_KEY, 'savings'); } catch {} + ui.tab = 'history'; render(); } }, t('onbNotNow')), ]); diff --git a/src/features/names.js b/src/features/names.js index f05ac09..dd6f700 100644 --- a/src/features/names.js +++ b/src/features/names.js @@ -895,6 +895,9 @@ export function namesFeature(ctx) { // 'pending' while the restore/claim pass is still running — the wallet // screen holds spending-setup prompts until the name question is settled. namesSettled() { return checked ? 'yes' : 'pending'; }, + // the wizard offers Spending only where a name can be claimed — a word, + // not a boolean: featureHook reads a false answer as no answer at all + namesAvailable() { return available() ? 'yes' : 'no'; }, // A seed minted seconds ago has nothing to restore anywhere: don't make // the spending-setup ask wait out registrar round trips that only exist // for wallets with a history. The background claim still runs. |
