This repository has been archived by the owner on May 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 440
Fix #4677: Prefill default buy/send/swap token if user comes from token details screen #4756
Merged
Conversation
This file contains 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
BraveWalletTests are failing. |
kylehickinson
suggested changes
Dec 21, 2021
Comment on lines
12
to
18
enum BuySendSwapDestination: Identifiable, CaseIterable, Equatable, Hashable { | ||
|
||
static var allCases: [BuySendSwapDestination] = [.buy(), .send(), .swap()] | ||
|
||
case buy(BraveWallet.ERCToken? = nil) | ||
case send(BraveWallet.ERCToken? = nil) | ||
case swap(BraveWallet.ERCToken? = nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If all of these take the same arg, it doesn't make sense to use an enum w/ associated value. Better to keep BuySendSwapDestination
the same and put it inside a container struct
i.e.
struct BuySendSwapDestination: Identifiable, Equatable, Hashable {
enum Kind: Identifiable, CaseIterable, Equatable, Hashable { case buy, send, swap }
var kind: Kind
var initialToken: BraveWallet.ERCToken?
var id: String { kind.id }
}
fixed the unit tests :) |
kylehickinson
suggested changes
Dec 21, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Maybe add some unit tests for prefilled tokens to ensure the selected tokens are correct.
- If a user taps "buy" from a token that doesn't exist in the buy list supported by Wyre don't we need some sort of validation there before setting it as the
selectedBuyToken
?
hey @kylehickinson
|
Brandon-T
suggested changes
Dec 21, 2021
nuo-xu
force-pushed
the
wallet-default-sell-token
branch
from
December 23, 2021 17:27
75924f7
to
b6b3554
Compare
kylehickinson
approved these changes
Jan 4, 2022
Needs test plan |
Test plan added |
Brandon-T
approved these changes
Jan 12, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This pull request fixes #4677
Submitter Checklist:
NSLocalizableString()
Test Plan:
Case 1:
Case 2:
Case 3:
Screenshots:
Reviewer Checklist:
QA/(Yes|No)
bug
/enhancement