Skip to content

fix(onboarding): wallet name prompt + drop simplified backup (Telegram 3, 4)#274

Merged
RaheemJnr merged 1 commit into
mainfrom
fix/onboarding-consistency
May 22, 2026
Merged

fix(onboarding): wallet name prompt + drop simplified backup (Telegram 3, 4)#274
RaheemJnr merged 1 commit into
mainfrom
fix/onboarding-consistency

Conversation

@RaheemJnr
Copy link
Copy Markdown
Owner

@RaheemJnr RaheemJnr commented May 22, 2026

Summary

Two consistency complaints from the Telegram report.

# Reported Severity
3 First-wallet creation hardcodes the name; second wallet asks MED
4 First-wallet asks for mnemonic verify; second-wallet path skips it MED

What's fixed

Bug 3 — name prompt parity

`OnboardingScreen` now shows an AlertDialog asking for the wallet name before tapping into the wallet generation flow. Default value is "My Wallet" so a user who just hits Create gets the same behavior as before. `OnboardingViewModel.createNewWallet` accepts the name with a fallback to "My Wallet" if the field is blank.

Adds the same name surface that AddWalletScreen already presents for subsequent wallets.

Bug 4 — backup verify parity

`NavGraph.onNewMnemonicWalletCreated` (the AddWallet → "New Wallet" path) used `Screen.MnemonicBackup.createRoute(simplified = true)` which routed to a single-screen display-only flow. The flag now passes `simplified = false` so the user goes through the same 3-step display → verify → success flow as first-wallet onboarding.

The `simplified` flag itself is kept on `MnemonicBackup` because the screen still uses it for the post-import path that doesn't need a verify step (the user confirmed the phrase on import). No other call sites pass `simplified = true`.

Test plan

  • `./gradlew :app:compileDebugKotlin -x cargoBuild` BUILD SUCCESSFUL
  • `./gradlew :app:testDebugUnitTest -x cargoBuild` BUILD SUCCESSFUL
  • Manual: fresh install → onboarding → tap "Create New Wallet" → name dialog opens → submit → mnemonic backup shows the 3-step flow including verify
  • Manual: existing install with 1 wallet → Wallets → FAB → "New Wallet" → mnemonic backup shows the same 3-step flow (was display-only before)

Refs Telegram bug report (Radoslav, 2026-05-21)

Summary by CodeRabbit

  • New Features

    • Name wallets during creation instead of using defaults.
    • Parent wallet preselection when adding new wallets.
    • Added safety protection preventing deletion of the last wallet on device.
  • Improvements

    • New wallet backup flow now uses comprehensive multi-step process like initial setup.

Review Change Stack

@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pocket-node Ready Ready Preview, Comment May 22, 2026 9:53am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

Warning

Rate limit exceeded

@RaheemJnr has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 18 minutes and 35 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bd4b20db-b79f-46e0-b8a9-b808dcc47db9

📥 Commits

Reviewing files that changed from the base of the PR and between 86130fa and fc95717.

📒 Files selected for processing (3)
  • android/app/src/main/java/com/rjnr/pocketnode/ui/navigation/NavGraph.kt
  • android/app/src/main/java/com/rjnr/pocketnode/ui/screens/onboarding/OnboardingScreen.kt
  • android/app/src/main/java/com/rjnr/pocketnode/ui/screens/onboarding/OnboardingViewModel.kt
📝 Walkthrough

Walkthrough

This PR adds three wallet management enhancements: a naming step in onboarding before wallet creation, optional parent wallet preselection in the add-wallet navigation flow, and safety checks to prevent deletion of the device's only wallet or auto-switch before deleting an active wallet.

Changes

Wallet Management Enhancements

Layer / File(s) Summary
Named wallet creation in onboarding
android/app/src/main/java/com/rjnr/pocketnode/ui/screens/onboarding/OnboardingScreen.kt, android/app/src/main/java/com/rjnr/pocketnode/ui/screens/onboarding/OnboardingViewModel.kt
Onboarding now gates wallet creation behind a "Name your wallet" dialog. OnboardingScreen adds dialog state for visibility and user input, with confirm triggering createNewWallet(pendingWalletName). OnboardingViewModel.createNewWallet(name) accepts a wallet name parameter, trims empty submissions, and passes it to repository creation.
Parent wallet preselection in add-wallet flow
android/app/src/main/java/com/rjnr/pocketnode/ui/navigation/NavGraph.kt, android/app/src/main/java/com/rjnr/pocketnode/ui/screens/wallet/AddWalletViewModel.kt, android/app/src/main/java/com/rjnr/pocketnode/ui/screens/wallet/AddWalletScreen.kt, android/app/src/main/java/com/rjnr/pocketnode/ui/screens/wallet/WalletManagerScreen.kt
Screen.AddWallet route now accepts an optional parentId query argument and provides a createRoute(parentId) helper. AddWalletViewModel reads parentId from SavedStateHandle and pre-selects matching root wallets. AddWalletScreen skips the mode picker and jumps directly to the HD Sub-Account form when a parent is pre-selected. WalletManagerScreen callback now accepts parentId and passes it during navigation.
Safe active wallet deletion
android/app/src/main/java/com/rjnr/pocketnode/ui/screens/wallet/WalletSettingsViewModel.kt, android/app/src/main/res/values/strings.xml
confirmDelete() now detects if the target wallet is active and either auto-switches to a sibling wallet (preferring top-level wallets) before deletion, or blocks deletion entirely if it is the only wallet and displays an error message directing users to "Forgot PIN".

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • RaheemJnr/pocket-node#76: Introduces multi-wallet navigation and view model foundation that this PR extends with optional parentId routing for HD sub-account preselection.
  • RaheemJnr/pocket-node#80: Modifies the same Screen.AddWallet route and wallet manager flow; this PR adds parent wallet preselection to that same navigation contract.
  • RaheemJnr/pocket-node#53: Updates MnemonicBackupScreen behavior; this PR changes post-create mnemonic wallet routing to use the same 3-step backup flow (simplified = false) that affects the backup screen integration.

Poem

🐰 In wallets deep and names to keep,
A parent guides through choices steep,
When deletion looms, we gently turn,
To safer shores—there's much to learn!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: adding a wallet name prompt to onboarding and removing the simplified backup flow, matching the PR's core objectives.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/onboarding-consistency

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
android/app/src/main/java/com/rjnr/pocketnode/ui/screens/onboarding/OnboardingViewModel.kt (1)

69-85: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Guard against duplicate wallet-creation requests.

Line 69 can be triggered multiple times while a previous request is in flight, which can create duplicate wallets. Add an early loading guard in createNewWallet.

Suggested fix
 fun createNewWallet(name: String = "My Wallet") {
+    if (_uiState.value.isLoading) return
     if (!canCreateV2BoundKey()) {
         _uiState.update {
             it.copy(
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@android/app/src/main/java/com/rjnr/pocketnode/ui/screens/onboarding/OnboardingViewModel.kt`
around lines 69 - 85, The createNewWallet function can be invoked while a
previous creation is in flight; add an early guard that checks the current
_uiState.value.isLoading and returns immediately if true to prevent duplicate
requests, then set isLoading synchronously before starting the coroutine (update
_uiState to isLoading = true prior to viewModelScope.launch) and wrap the
walletRepository.createWallet call in a try/finally inside the launched
coroutine to ensure _uiState.isLoading is cleared after success or error;
reference createNewWallet, _uiState, isLoading, viewModelScope.launch,
canCreateV2BoundKey, and walletRepository.createWallet when making these
changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@android/app/src/main/java/com/rjnr/pocketnode/ui/screens/wallet/WalletSettingsViewModel.kt`:
- Around line 170-209: The delete flow currently returns early in
requestDelete() for active wallets, making the auto-switch + delete branch in
WalletSettingsViewModel unreachable; change requestDelete() so it does not
return immediately when the wallet is active but instead invokes the existing
auto-switch logic (the block that computes candidates, checks for empty
candidates and updates _uiState with vm_error_delete_last_wallet, or calls
walletRepository.switchActiveWallet(next.walletId)) before continuing to show
the delete confirmation and perform the deletion; preserve the last-wallet guard
that sets showDeleteConfirm=false and the error UiMessage and ensure subsequent
deletion code runs after a successful switch.

---

Outside diff comments:
In
`@android/app/src/main/java/com/rjnr/pocketnode/ui/screens/onboarding/OnboardingViewModel.kt`:
- Around line 69-85: The createNewWallet function can be invoked while a
previous creation is in flight; add an early guard that checks the current
_uiState.value.isLoading and returns immediately if true to prevent duplicate
requests, then set isLoading synchronously before starting the coroutine (update
_uiState to isLoading = true prior to viewModelScope.launch) and wrap the
walletRepository.createWallet call in a try/finally inside the launched
coroutine to ensure _uiState.isLoading is cleared after success or error;
reference createNewWallet, _uiState, isLoading, viewModelScope.launch,
canCreateV2BoundKey, and walletRepository.createWallet when making these
changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c98c8d9b-8891-4d15-a66c-8886a0be44b8

📥 Commits

Reviewing files that changed from the base of the PR and between dc0e80b and 86130fa.

📒 Files selected for processing (8)
  • android/app/src/main/java/com/rjnr/pocketnode/ui/navigation/NavGraph.kt
  • android/app/src/main/java/com/rjnr/pocketnode/ui/screens/onboarding/OnboardingScreen.kt
  • android/app/src/main/java/com/rjnr/pocketnode/ui/screens/onboarding/OnboardingViewModel.kt
  • android/app/src/main/java/com/rjnr/pocketnode/ui/screens/wallet/AddWalletScreen.kt
  • android/app/src/main/java/com/rjnr/pocketnode/ui/screens/wallet/AddWalletViewModel.kt
  • android/app/src/main/java/com/rjnr/pocketnode/ui/screens/wallet/WalletManagerScreen.kt
  • android/app/src/main/java/com/rjnr/pocketnode/ui/screens/wallet/WalletSettingsViewModel.kt
  • android/app/src/main/res/values/strings.xml

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 86130fa0ea

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// accounts of other parents.
val next = candidates.firstOrNull { it.parentWalletId == null }
?: candidates.first()
walletRepository.switchActiveWallet(next.walletId)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Notify gateway after auto-switching active wallet

When confirmDelete() auto-switches away from the wallet being deleted, it only calls walletRepository.switchActiveWallet(...) and never triggers GatewayRepository.onActiveWalletChanged(...). In this codebase, other switch paths (e.g., HomeViewModel and WalletManagerViewModel) call both, because the gateway keeps its own active-wallet state for registration/sync. If this auto-switch path runs, the app can continue syncing/serving state for the old wallet even after it is deleted.

Useful? React with 👍 / 👎.

…ortcut (Telegram 3, 4)

Two consistency complaints from the Telegram report converging on
wallet creation.

Bug 3 (MED): the onboarding "Create New Wallet" path hardcoded the
wallet name to "My Wallet". Adding a second wallet from inside the
app went through AddWalletScreen which prompts for a name. Now
both surfaces prompt.

  - `OnboardingViewModel.createNewWallet` accepts a name (default
    "My Wallet" for callers that haven't been migrated).
  - `OnboardingScreen` shows an AlertDialog with a name TextField
    before kicking off creation. Cancelling closes the dialog and
    leaves onboarding state untouched.

Bug 4 (MED): adding a new parent wallet from inside the app
skipped the mnemonic-verify step that first-wallet creation has
always required. The cause was a `simplified = true` shortcut on
the AddWallet → "New Wallet" → MnemonicBackup nav, which made the
backup screen render a single display-only page instead of the
3-step display → verify → success flow.

  - `NavGraph.onNewMnemonicWalletCreated` now passes
    `simplified = false`. Both wallet-creation entry points run
    the verify step.

The `simplified` flag itself is kept on `MnemonicBackup` because
the screen still uses it for the "post-import" path that has no
user-supplied mnemonic to verify (the user just confirmed it on
import). No other call sites pass `simplified = true`.

Builds clean. Unit tests pass.

Refs Telegram bug report (Radoslav, 2026-05-21)
@RaheemJnr RaheemJnr force-pushed the fix/onboarding-consistency branch from e0882af to fc95717 Compare May 22, 2026 09:53
@RaheemJnr RaheemJnr merged commit 3c4edd7 into main May 22, 2026
7 checks passed
@RaheemJnr RaheemJnr deleted the fix/onboarding-consistency branch May 22, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant