From f6931cbc71124f7652887657d1db2334d860cfa5 Mon Sep 17 00:00:00 2001 From: Nuo Xu Date: Thu, 23 Nov 2023 06:35:21 -0800 Subject: [PATCH] Fix brave/brave-ios#8463: Only display NFTs after user updates any NFT's visibility status (brave/brave-ios#8470) after NFT status chanegd, the re-computation needs to apply on only NFTs. --- Sources/BraveWallet/Crypto/Stores/NFTStore.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Sources/BraveWallet/Crypto/Stores/NFTStore.swift b/Sources/BraveWallet/Crypto/Stores/NFTStore.swift index b8d48837ce38..277a893fbbe5 100644 --- a/Sources/BraveWallet/Crypto/Stores/NFTStore.swift +++ b/Sources/BraveWallet/Crypto/Stores/NFTStore.swift @@ -590,7 +590,21 @@ public class NFTStore: ObservableObject, WalletObserverStore { let selectedAccounts = self.filters.accounts.filter(\.isSelected).map(\.model) let selectedNetworks = self.filters.networks.filter(\.isSelected).map(\.model) let userVisibleAssets = self.assetManager.getAllUserAssetsInNetworkAssetsByVisibility(networks: selectedNetworks, visible: true) + .map { networkAssets in + NetworkAssets( + network: networkAssets.network, + tokens: networkAssets.tokens.filter { $0.isNft || $0.isErc721 }, + sortOrder: networkAssets.sortOrder + ) + } let userHiddenAssets = self.assetManager.getAllUserAssetsInNetworkAssetsByVisibility(networks: selectedNetworks, visible: false) + .map { networkAssets in + NetworkAssets( + network: networkAssets.network, + tokens: networkAssets.tokens.filter { $0.isNft || $0.isErc721 }, + sortOrder: networkAssets.sortOrder + ) + } let unionedSpamNFTs = computeSpamNFTs( selectedNetworks: selectedNetworks, selectedAccounts: selectedAccounts,