-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: create nft auto detection modal and remove nft polling logic (#9857
) ## **Description** This PR removes any code that triggers polling on NftDetectionController. Calling `detectNfts()` function is now only triggered when the user clicks on the NFT tab. It also Enables NFTDetection by default for new users. >[!NOTE] > this PR has an asset-cpntroller patch from this [core PR #4281](MetaMask/core#4281) > This patch keeps NFTDetection controller extending the polling controller while the PR makes it extend BaseController but it makes sure the polling is not triggered anymore in the client code. > It will be fully updated in newer versions of assets-controllers > I removed what triggers the `start()` of the polling, and now instead, mobile calls `detectNfts()` directly. > Then i made updates on the fct `getOwnerNfts` so that it only fetches information for a specific cursor instead of looping through all user nfts. > The loop is now being done inside the `detectNfts()` fct, and we basically fetch the first page of NFTs and save it to state so its available to clients to view. **New functionalities highlight:** _1- Enable NFT autodetection by default to new users. 2- Old users who have the NFT autodetection off will see the new NFT detection modal to encourage them to enable the modal. 3- When users click on the banner notice, they are no longer directed to settings and instead we enable the NFT detection after they click on “enable nft autodetection” and we show the Toast. We wanted to reduce friction and we removed that redirection to settings. 4- The code should not do any of the 3mins polling in the background anymore._ ## **Related issues** Related: MetaMask/core#4281 ## **Manual testing steps** 1. Import MM application 2. Go to settings => Security and privacy and you should see that the NFT detection is enabled. 3. Go back to home page and click on NFT tab; you should be able to see your NFTs being added. 4. Switch to another account that has NFTs 5. Click on NFTs tab and you should also see your NFTs being added to sate. 6. Go to settings => Security and privacy and turn OFF the NFT detection toggle. 7. You should see a new modal. Clicking on "allow" button should re-enable the NFT detection toggle. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** https://github.com/MetaMask/metamask-mobile/assets/10994169/83e86852-3455-4b7c-bfc6-a658dc20c1b0 ### **After** Testing a fresh wallet import: https://github.com/MetaMask/metamask-mobile/assets/10994169/331668b1-3a27-493f-a648-3568e4ba67c2 Testing an upgrade scenario: First build on main, where you should see the NFT auto detection disabled by default if the user did not enable it Then build on this PR: You should see the new NFT detection modal and clicking on `allow` button should enable the NFT detection in the settings. https://github.com/MetaMask/metamask-mobile/assets/10994169/6bcb77f5-13ef-429e-a1f5-4d907145ee30 NFT detection banner with new Toast: https://github.com/MetaMask/metamask-mobile/assets/10994169/2f7465c0-4c42-409b-bfe4-ed70d9e1ca2c ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --------- Co-authored-by: MetaMask Bot <[email protected]> Co-authored-by: metamaskbot <[email protected]> Co-authored-by: sethkfman <[email protected]> Co-authored-by: Nico MASSART <[email protected]>
- Loading branch information
1 parent
107b16f
commit ba76567
Showing
30 changed files
with
1,635 additions
and
54 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
const RefreshTestId = 'refreshControl'; | ||
|
||
export default RefreshTestId; | ||
export const RefreshTestId = 'refreshControl'; | ||
export const SpinnerTestId = 'spinner'; |
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
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
Oops, something went wrong.