-
Notifications
You must be signed in to change notification settings - Fork 885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix NFT visibility in BottomSheet fragment #20361
Conversation
Add extra parameter to NetworkUtils#findNetwork method in order to distinguish localhost chain Ids that can belong to ETH, SOL, or FIL. Without the extra parameter symbol, the method was producing wrong network info pointing always to Solana chain Id on localhost also for Ethereum and Filecoin.
} else if (mType == WalletCoinAdapter.AdapterType.SEND_ASSETS_LIST) { | ||
assert mSelectedNetwork != null; | ||
TokenUtils.getUserAssetsFiltered(mBraveWalletService, mSelectedNetwork, | ||
mSelectedNetwork.coin, TokenUtils.TokenType.ALL, tokens -> { | ||
_mAssetsResult.postValue(new AssetsResult( | ||
Arrays.asList(tokens), Collections.emptyList())); | ||
}); | ||
} else if (mType == WalletCoinAdapter.AdapterType.BUY_ASSETS_LIST) { | ||
TokenUtils.getBuyTokensFiltered(mBlockchainRegistry, mSelectedNetwork, | ||
TokenUtils.TokenType.ALL, tokens -> { | ||
_mAssetsResult.postValue(new AssetsResult( | ||
Arrays.asList(tokens), Collections.emptyList())); | ||
}); |
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.
SEND_ASSETS_LIST
and BUY_ASSETS_LIST
can be safely removed as they were never accessed: these parts now rely on WebUIs.
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.
++
We don't need to maintain anything or reinvent(as it is a bug). Token state is definitely handled on the core side, not on client side. This seems like a regression for assets/tokens, but NFT visibility is completely depends on About tokens visibility issue, It is working as expected for non-native tokens. The issue with native token visibility is that the native token always seems to be added by Stream.concat(Stream.of(nativeAsset), tokenStream); and that's why it is always visible. assets.webmAnyway, We will come back to these native changes/issues later if needed after completing webUI issues as priority. |
...omium/chrome/browser/crypto_wallet/fragments/EditVisibleAssetsBottomSheetDialogFragment.java
Show resolved
Hide resolved
Verification passed on Oppo Reno 5 with Android 13 running 1.61.3 x64 Nightly build
20361.mp4 |
* Uplift of #20361 (squashed) to beta * Fix NPE when accessing null network object --------- Co-authored-by: Simone Arpe <simon.arpe@gmail.com>
* Uplift of #20361 (squashed) to release * Fix NPE when accessing null network object --------- Co-authored-by: Simone Arpe <simon.arpe@gmail.com>
Resolves brave/brave-browser#31915
Resolves brave/brave-browser#33255
Details
Fixes an issue where NFTs listed in
EditVisibleAssetsBottomSheetDialogFragment
were always marked as visible.Screen recording showing the right behavior:
fix-NFT-visibility.mov
The approach used to mark an asset as visible or invisible is going to be rewritten soon.
The new way will leverage a WebUI based on Desktop implementation and will (probably) rely on the same persistency methods if compatible with Android.
Because we don't want to reinvent the wheel, the actual fix is just a simple check on the NFT data model returned from core API and is implemented by the commit 👉 357eaf4
After the transition to a WebUI the state will be handled on the client side and not from core.
Other Notable Changes
NetworkUtils#findNetwork
has been improved with a new parameter as localhost networks now can belong to FIL, SOL or ETH and on debug builds was returning wrong values.filterTokens
method: the filtering now uses Java streams, and it's (roughly) 50% faster as the previous logic was converting to/from array/list multiple times.TokenUtils
methods.Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run lint
,npm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan: