fix(wallet): Hide loading when selected account is loaded (#14435)

This commit is contained in:
Cuteivist 2024-05-13 13:00:02 +02:00 committed by GitHub
parent 73cee9eebf
commit 5fbc262dec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 1 deletions

View File

@ -45,3 +45,6 @@ method getCollectibleGroupByCollection*(self: AccessInterface): bool {.base.} =
method toggleCollectibleGroupByCollection*(self: AccessInterface): bool {.base.} =
raise newException(ValueError, "No implementation available")
method setSelectedAccount*(self: AccessInterface, address: string) {.base.} =
raise newException(ValueError, "No implementation available")

View File

@ -78,6 +78,9 @@ method viewDidLoad*(self: Module) =
self.moduleLoaded = true
self.delegate.allCollectiblesModuleDidLoad()
method setSelectedAccount*(self: Module, address: string) =
self.collectiblesController.setSelectedAccount(address)
method getAllCollectiblesModel*(self: Module): collectibles_model.Model =
return self.collectiblesController.getModel()

View File

@ -236,6 +236,7 @@ proc setKeypairOperabilityForObservedAccount(self: Module, address: string) =
method setFilterAddress*(self: Module, address: string) =
self.setKeypairOperabilityForObservedAccount(address)
self.filter.setAddress(address)
self.allCollectiblesModule.setSelectedAccount(address)
self.overviewModule.setIsAllAccounts(false)
self.view.setAddressFilters(address)
self.notifyFilterChanged()
@ -243,6 +244,7 @@ method setFilterAddress*(self: Module, address: string) =
method setFilterAllAddresses*(self: Module) =
self.view.setKeypairOperabilityForObservedAccount("")
self.filter.setAddresses(self.getWalletAddressesNotHidden())
self.allCollectiblesModule.setSelectedAccount("")
self.view.setAddressFilters(self.filter.addresses.join(":"))
self.overviewModule.setIsAllAccounts(true)
self.notifyFilterChanged()

View File

@ -38,6 +38,7 @@ QtObject:
addresses: seq[string]
chainIds: seq[int]
selectedAddress: string
filter: backend_collectibles.CollectibleFilter
ownershipStatus: Table[string, Table[int, OwnershipStatus]] # Table[address][chainID] -> OwnershipStatus
@ -70,7 +71,7 @@ QtObject:
# Otherwise, if any address+chainID is updating, then the whole model is updating
# Otherwise, the model is idle
for address, statusPerChainID in self.ownershipStatus.pairs:
if not self.addresses.contains(address):
if not self.addresses.contains(address) or (self.selectedAddress != "" and self.selectedAddress != address):
continue
for chainID, status in statusPerChainID:
if not self.chainIds.contains(chainID):
@ -284,6 +285,10 @@ QtObject:
signalConnect(result.model, "loadMoreItems()", result, "onModelLoadMoreItems()")
proc setSelectedAccount*(self: Controller, address: string) =
self.selectedAddress = address
self.checkModelState()
proc setFilterAddressesAndChains*(self: Controller, addresses: seq[string], chainIds: seq[int]) =
if chainIds == self.chainIds and addresses == self.addresses:
return