Skip to content

feat: Implement display nft media #1893

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

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from
Draft

Conversation

tommasini
Copy link
Contributor

@tommasini tommasini commented Oct 24, 2023

References

relates to: https://github.com/MetaMask/mobile-planning/issues/1166

This PR aims to solve the implementation of display nft media being a user preference.
It adds a handling error when the proxy or our third party fails, giving the possibility for the client to show a fallback image instead.

@metamask/preferences-controller

  • BREAKING: changed name of openSeaEnabled state property to displayNftMedia
  • BREAKING: changed name of setOpenSeaEnabled function to setDisplayNftMedia, this function is responsbile to update the value of displayNftMedia state property

@metamask/assets-controller/NftController

  • ADDED: Added error handling when fetch from third parties or the chain fails
    This property was added in order to register if the fetch from third parties, open sea, the chain, or our proxy fails and we can avoid keep calling to update it, avoiding a loop that way,
    This error can assume the value of 'Opensea import error', 'URI import error' and 'Both import failed'.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

@tommasini tommasini requested a review from a team as a code owner October 24, 2023 11:05
@tommasini tommasini mentioned this pull request Oct 24, 2023
3 tasks
@Gudahtt
Copy link
Member

Gudahtt commented Nov 9, 2023

Could you update the PR to describe the error scenarios meant to be covered here? It wasn't totally clear from the linked planning issue (which seemed to be about a larger feature, not focused on error handling)

i.e. What is the "display NFT media" feature, and how does this PR relate to it? What problems are these changes meant to solve?

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updates look good! I can re-review once conflicts are resolved

Gudahtt
Gudahtt previously approved these changes Nov 24, 2023
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

const hasIpfsTokenURI = tokenURI.startsWith('ipfs://');

if (hasIpfsTokenURI && !isIpfsGatewayEnabled) {
if (!displayNftMedia && !isIpfsGatewayEnabled) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This can be removed as well, as it's covered by the next block

@Gudahtt
Copy link
Member

Gudahtt commented Nov 24, 2023

Ah, it looks like at least one test is still failing

@tommasini tommasini requested a review from a team as a code owner February 19, 2024 12:36
@tommasini
Copy link
Contributor Author

tommasini commented Feb 19, 2024

This PR needs to be recreated on main with the code with this latest commit having the needed for the displayNftMedia feature on this repo.

Able to revert the commits that were wrong on this PR

@tommasini tommasini marked this pull request as draft February 19, 2024 21:41
…obal coverage be reached by 0.12 percent"

This reverts commit f6d05a9.
…obal coverage be reached by 0.12 percent"

This reverts commit f4be49e.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants