Repository navigation
fix(convert): disable Convert on Dollars when there is nothing to convert into - #973
Merged
Merged
Conversation
…vert into Converting out of Dollars needs another holding to buy into. With none, ConvertAmountViewModel's "largest other holding" fallback lands back on Dollars, so the flow would start a Dollars-for-Dollars convert. Android hit the same gap (Bugsnag 6ac36f88991833fd09434aad). The Dollars screen's Convert tile is now disabled unless the destination picker would list at least one entry. Both read the new Session.convertDestinations(from:rate:), which is balances(for:) minus the source, so a zero or non-displayable holding counts as nothing. Convert on other currencies' screens is unchanged: Dollars is always a destination there.
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.
Converting out of Dollars needs another holding to buy into. With none,
ConvertAmountViewModel's "largest other holding" fallback lands back on Dollars, so the flow would start a Dollars-for-Dollars convert. Android hit the same gap (Bugsnag6ac36f88991833fd09434aad).The Dollars screen's Convert tile is now disabled, not hidden and with no hint, unless the destination picker would list at least one entry. Both read the new
Session.convertDestinations(from:rate:), which isbalances(for:)minus the source. A zero-balance or non-displayable holding therefore leaves Convert disabled, including the stale zero row from the Android report.Balances come from the database synchronously in
Session.init, so there is no separate loading state: an empty list reads as no destination and the tile is disabled. The tile is also drawn only once the Dollars balance itself is present.Convert on other currencies' screens is unchanged, since Dollars is always a destination there.
Tests:
ConvertDestinationAvailabilityTestscovers Dollars only, Dollars plus a held currency (enabled, opens on that currency), a zero-balance other holding, no balances, and a non-Dollars screen.