Skip to content

Commit

Permalink
fallback to token.logo as the image url when wallet fails to load ima…
Browse files Browse the repository at this point in the history
…ge using the url from metadata
  • Loading branch information
nuo-xu committed Jan 6, 2025
1 parent b4c21dc commit 1a96252
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion ios/brave-ios/Sources/BraveWallet/Crypto/NFT/NFTView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

import BraveCore
import BraveUI
import DesignSystem
import Preferences
import SwiftUI
Expand Down Expand Up @@ -70,7 +71,19 @@ struct NFTView: View {
Group {
if let urlString = nftViewModel.nftMetadata?.image {
NFTImageView(urlString: urlString) {
LoadingNFTView(shimmer: false)
if let url = URL(string: nftViewModel.token.logo) {
WebImageReader(url: url) { image in
if let image = image {
Image(uiImage: image)
.resizable()
.aspectRatio(contentMode: .fit)
} else {
LoadingNFTView(shimmer: false)
}
}
} else {
LoadingNFTView(shimmer: false)
}
}
} else {
LoadingNFTView(shimmer: false)
Expand Down

0 comments on commit 1a96252

Please # to comment.