Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
fixed. Hide/unhide NFTs in groups then change display type collected/…
Browse files Browse the repository at this point in the history
…hidden doesnt load correctly.
  • Loading branch information
nuo-xu committed Oct 23, 2023
1 parent 286ef22 commit 14667d2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Sources/BraveWallet/Crypto/Stores/NFTStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -554,12 +554,21 @@ public class NFTStore: ObservableObject, WalletObserverStore {
let selectedNetworks = self.filters.networks.filter(\.isSelected).map(\.model)
let userVisibleAssets = self.assetManager.getAllUserAssetsInNetworkAssetsByVisibility(networks: selectedNetworks, visible: true)
let userHiddenAssets = self.assetManager.getAllUserAssetsInNetworkAssetsByVisibility(networks: selectedNetworks, visible: false)
let spamNFTs = computeSpamNFTs(
let unionedSpamNFTs = computeSpamNFTs(
selectedNetworks: selectedNetworks,
selectedAccounts: selectedAccounts,
simpleHashSpamNFTs: simpleHashSpamNFTs
)
let allNetworkAssets = userVisibleAssets + userHiddenAssets + spamNFTs
var allNetworkAssets: [NetworkAssets] = []
for networkAssets in userVisibleAssets {
let hiddenAssets = userHiddenAssets.first(where: {
$0.network.chainId == networkAssets.network.chainId && $0.network.coin == networkAssets.network.coin
})?.tokens ?? []
let spamNFTs = unionedSpamNFTs.first(where: {
$0.network.chainId == networkAssets.network.chainId && $0.network.coin == networkAssets.network.coin
})?.tokens ?? []
allNetworkAssets.append(.init(network: networkAssets.network, tokens: networkAssets.tokens + hiddenAssets + spamNFTs, sortOrder: networkAssets.sortOrder))
}
userNFTGroups = buildNFTGroupModels(
groupBy: filters.groupBy,
allUserAssets: allNetworkAssets,
Expand Down

0 comments on commit 14667d2

Please sign in to comment.