Page MenuHomePhabricator

[Cashtab] Enable wallet switching from Home screen
Changes PlannedPublic

Authored by emack on Dec 16 2023, 13:58.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Summary

T3364

This isn't a complete duplication of the wallet switching function from Configure.js because it is intended as a "Quick Switch" that does not come with the bells and whistles of editing wallet, adding wallet to contacts or deletion options that you see in Configure.js. For all of that the user can go to the Saved Wallet section in Configure.js.

image.png (646×669 px, 106 KB)

A key design decision made here to not extend this quick switch to the Send, Receive, Airdrop, Swap, Sign/Verify components. This is because of the need to refresh the saved wallets from indexDB into state whenever the active wallet is changed from outside of Home.js. This check is initialized upon component load thus adding this across all screens will create unnecessary lag when the user is navigating between screens in Cashtab.

Further optimization can be made by moving these wallet info headers into a standalone exportable component, but that is a larger refactor that can follow once the design decision above is validated via this diff.

Test Plan
  • npm test
  • npm start
  • Use a wallet with at least 1 saved wallet and ensure the Switch Wallet Collapse component is rendered on the Home screen and displays the saved wallet with correct balance
  • Switch to the Saved wallet and ensure all wallet contexts are updated
  • Create a fresh new wallet on incognito mode and ensure the Switch Wallet Collapse component is not rendered on the Home screen
  • Create another new wallet on this same incognito session and ensure the Switch Wallet Collapse is now displayed showing this new wallet as a saved wallet
  • npm run extension and ensure the Switch Wallet Collapse is rendered in the extension

Diff Detail

Repository
rABC Bitcoin ABC
Branch
homeWalletSwitch
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 25984
Build 51542: Build Diffcashtab-tests
Build 51541: arc lint + arc unit

Event Timeline

emack requested review of this revision.Dec 16 2023, 13:58

Bad UX to have this collapse for "Switch wallet"

There should only be one thing that the user interacts with for renaming / switching wallet.

Overall this is a cool feature but seems to be adding technical debt. Now we have two wallet switching methods in two different places implemented in two different ways. If the way wallet switching is done in Configure.js is not portable, mb this needs to be fixed first.

This revision now requires changes to proceed.Dec 19 2023, 20:54

If the way wallet switching is done in Configure.js is not portable, mb this needs to be fixed first.

ok I'll look into moving wallet switching logic into a standalone component that can be re-used/imported throughout the app.

emack planned changes to this revision.Mar 2 2024, 13:33