-
Notifications
You must be signed in to change notification settings - Fork 868
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
NFT pinning improvements #17983
NFT pinning improvements #17983
Conversation
A Storybook has been deployed to preview UI for the latest push |
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.
LGTM
pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>(); | ||
pref_change_registrar_->Init(pref_service_); | ||
pref_change_registrar_->Add( | ||
kAutoPinEnabled, | ||
base::BindRepeating(&BraveWalletAutoPinService::OnAutoPinStatusChanged, | ||
weak_ptr_factory_.GetWeakPtr())); | ||
base::Unretained(this))); |
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.
Needs another weak_ptr_factory for invalidating in OnAutoPinStatusChanged
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.
Fixed
auto intent = | ||
std::make_unique<IntentData>(token, Operation::kAdd, absl::nullopt); | ||
AddOrExecute(std::move(intent)); |
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.
No need in temp variable here and below
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.
Fixed
if (v->token == data->token && v->service == data->service && | ||
v->operation == data->operation) { | ||
return; | ||
} | ||
} | ||
if (current_ && current_->token == data->token && | ||
current_->service == data->service) { | ||
current_->service == data->service && | ||
current_->operation == data->operation) { |
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.
Duplicated equality check algorithm
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.
Fixed
|
||
if (data->operation == Operation::kAdd || | ||
data->operation == Operation::kValidate) { | ||
if (tokens_.find(data->token) == tokens_.end()) { |
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.
base::Contains
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.
Fixed
if (isNftAsset && selectedAsset && nftPinnable) { | ||
return getNftPinningStatus(selectedAsset) | ||
} | ||
return undefined | ||
}, [nftPinnable, isNftAsset, selectedAsset, nftPinningStatus]) | ||
}, [nftPinnable, isNftAsset, selectedAsset, nftPinningStatus, isAutoPinEnabled]) |
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.
nftPinningStatus is not referenced in useMemo body, need it here?
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.
getNftPinningStatus is dependent on nftPinningStatus i guess
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.
LGTM with minor issues to fix
A Storybook has been deployed to preview UI for the latest push |
A Storybook has been deployed to preview UI for the latest push |
A Storybook has been deployed to preview UI for the latest push |
Verification passed on
|
Uplift of #17983 (squashed) to beta
Update wallet NFT pinning state if setting changes
Resolves brave/brave-browser#29354
Don't show pinning status if autopin is disabled
Resolves brave/brave-browser#29553
Improve NFT pinning queue
Resolves brave/brave-browser#29551
Fixes pinning after wallet reset
brave/brave-browser#29207
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:
Automatically pin NFTs
settings doesn't update the IPFS banner on portfolio/nft page brave-browser#29354)NFT data is being pinned to your local IPFS node
on NFT details screen brave-browser#29553)