feat: skip Choose Payment Method view if not other option#4096
feat: skip Choose Payment Method view if not other option#4096ajaysehwal wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request centralizes payment method row construction and navigation logic into a new utility file, ChoosePaymentMethodUtils.ts, and refactors EcashSwipeableRow, LightningSwipeableRow, OnchainSwipeableRow, and PaymentMethodList to utilize these shared helpers. It also implements an auto-skip feature in ChoosePaymentMethod.tsx that automatically navigates when only one selectable payment method is available. Reviewer feedback suggests further refactoring to unify error handling for asynchronous navigation, enhancing type safety by replacing any with specific interfaces, and adding logging or alerts to prevent silent failures in navigation logic.
| useReplace: boolean, | ||
| variant: 'lightning' | 'ecash' | ||
| ): Promise<void> { | ||
| const params: any = lnurlParams || (await getlnurlParams(lightning ?? '')); |
There was a problem hiding this comment.
| BackendUtils.supportsCashuWallet() && | ||
| settingsStore.settings?.ecash?.enableCashu; | ||
|
|
||
| const onLnurlp = (data: { callback?: string }) => { |
| return; | ||
| } | ||
| if (row.layer === 'Lightning address') { | ||
| if (!ctx.lightningAddress) return; |
There was a problem hiding this comment.
3529b00 to
45c7530
Compare
b75f80e to
afea119
Compare
afea119 to
03e6b53
Compare
Description
Please enter a description and screenshots, if appropriate, of the work covered in this PR
This PR removes duplicate Lightning / LNURL / lightning-address / ecash payment routing from the swipeable row components, moves list building and navigation into utils/ChoosePaymentMethodUtils.ts, and replaces the Choose Payment Method screen when exactly one payment method row is selectable (so users are not shown a pointless picker)
Test Plan
syncStore.isSyncingguard.This pull request is categorized as a:
Checklist
yarn run tscand made sure my code compiles correctlyyarn run lintand made sure my code didn’t contain any problematic patternsyarn run prettierand made sure my code is formatted correctlyyarn run testand made sure all of the tests passTesting
If you modified or added a utility file, did you add new unit tests?
I have tested this PR on the following platforms (please specify OS version and phone model/VM):
I have tested this PR with the following types of nodes (please specify node version and API version where appropriate):
On-device
Remote
Locales
Third Party Dependencies and Packages
yarnafter this PR is merged inpackage.jsonandyarn.lockhave been properly updatedOther: