Page MenuHomePhabricator

[Cashtab] Better switch mgmt in send token
ClosedPublic

Authored by bytesofman on Apr 11 2024, 23:05.

Details

Reviewers
emack
Group Reviewers
Restricted Project
Commits
rABCe091229ef3a0: [Cashtab] Better switch mgmt in send token
Summary

T3528

For send token, we only want one token feature enabled at a time. We will be adding more token features for different token types, and it is already a bit of a mess to manually turn off "all the other switches" every time a switch comes on.

Standardize the approach so it will be easier to add NFT features.

Test Plan

npm test

Diff Detail

Repository
rABC Bitcoin ABC
Branch
useffect-switch-mgmt
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 28500
Build 56541: Build Diffcashtab-tests
Build 56540: arc lint + arc unit

Event Timeline

emack requested changes to this revision.Apr 12 2024, 01:05
emack added a subscriber: emack.

This is already the behavior in prod isn't it? Toggling another send token function will disable all others.

This revision now requires changes to proceed.Apr 12 2024, 01:05

This is already the behavior in prod isn't it? Toggling another send token function will disable all others.

Yes -- but it is implemented badly. Adding any switch means you need to update the handleToggle method of every other switch.

Before I start adding switches for NFTs, want this to be easier to manage.

After this diff, they all take the same method.

The added test is confirming we keep expected behavior.

This revision is now accepted and ready to land.Apr 12 2024, 04:23