fix(wallet): Refresh receiver preferred chain ids (#15712)

This commit is contained in:
Cuteivist 2024-07-24 21:19:39 +02:00 committed by GitHub
parent 2175311c86
commit 30b88377c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 1 deletions

View File

@ -152,3 +152,15 @@ QtObject:
if cmpIgnoreCase(item.address(), address) == 0 and item.walletType != "watch":
return true
return false
proc onPreferredSharingChainsUpdated*(self: Model, address, prodPreferredChainIds, testPreferredChainIds: string) =
var i = 0
for item in self.items.mitems:
if address == item.address:
item.prodPreferredChainIds = prodPreferredChainIds
item.testPreferredChainIds = testPreferredChainIds
let index = self.createIndex(i, 0, nil)
defer: index.delete
self.dataChanged(index, index, @[ModelRole.PreferredSharingChainIds.int])
break
i.inc

View File

@ -70,6 +70,10 @@ method load*(self: Module) =
self.controller.init()
self.view.load()
self.events.on(SIGNAL_WALLET_ACCOUNT_PREFERRED_SHARING_CHAINS_UPDATED) do(e: Args):
let args = AccountArgs(e)
self.view.onPreferredSharingChainsUpdated(args.account.keyUid, args.account.address, args.account.prodPreferredChainIds, args.account.testPreferredChainIds)
method isLoaded*(self: Module): bool =
return self.moduleLoaded

View File

@ -68,4 +68,7 @@ QtObject:
self.delegate.updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance)
proc getWalletAccountAsJson*(self: View, address: string): string {.slot.} =
return $self.delegate.getWalletAccountAsJson(address)
return $self.delegate.getWalletAccountAsJson(address)
proc onPreferredSharingChainsUpdated*(self: View, keyUid, address, prodPreferredChainIds, testPreferredChainIds: string) =
self.accounts.onPreferredSharingChainsUpdated(address, prodPreferredChainIds, testPreferredChainIds)