fix(add-money): stop pushing Coinbase email verification twice#1096
Merged
Conversation
The add-money deposit sheet's Coinbase selection was consumed by two handlers that both navigated to verification: presentDepositOptions (which runs its own email/phone gate) and SwapViewModel's persistent purchaseMethodController.selections collector, whose Coinbase branch ran the email gate and dispatched OnVerificationNeeded before bailing on the missing purchase amount. - SwapViewModel: bail on the missing amount before the email gate, so the collector ignores the amount-less deposit-sheet selection and leaves presentDepositOptions as the sole handler. - InternalPurchaseMethodController: resolve the email the same way as CoinbaseOnRampController.resolveEmail() (verified email only when the flag is on, any entered email otherwise) so the pre-emptive gate agrees with the purchase-time check and doesn't verify an already-verified user.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The email verification screen is pushed twice when adding money via Coinbase / Google Pay.
Root cause
Picking Coinbase from the add-money deposit sheet emits one
_selectionsvalue that two handlers act on, and both navigate to verification:InternalPurchaseMethodController.presentDepositOptionsruns its own email/phone gate and returnsAppRoute.Verification→ navigate.SwapViewModel's persistentpurchaseMethodController.selectionscollector — its Coinbase branch ran the email gate and dispatchedOnVerificationNeeded(a second navigation) before bailing on the missingpurchaseAmount.The deposit-sheet selection is
PaymentAction.Plainwith no amount; the real purchase carries an amount. The collector was reacting to a selection it shouldn't handle — the same "shared controller also emits for the deposit sheet" trap the currency-creator already guards against.Fix
SwapViewModel— move thepurchaseAmount ?: returnbail to the top of the Coinbase branch, before the email gate. The collector now ignores the amount-less deposit-sheet selection, leavingpresentDepositOptionsas the sole handler → one push.InternalPurchaseMethodController— resolve the email the same way asCoinbaseOnRampController.resolveEmail()(verified email only when the flag is on, any entered email otherwise). The pre-emptive gate previously forced verification whenever the flag was on — even for an already-verified user — and disagreed with the purchase-time check.