feat(@desktop/wallet): Refresh recipients model (#12298)

This commit is contained in:
Cuteivist 2023-10-03 12:48:47 +02:00 committed by GitHub
parent 7cb1746c84
commit 7d852c3565
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 3 deletions

View File

@ -365,11 +365,12 @@ QtObject:
self.chainIds = chainIds
self.status.setIsFilterDirty(true)
self.status.emitFilterChainsChanged()
self.updateAssetsIdentities()
proc updateRecipientsModel*(self: Controller) {.slot.} =
self.status.setLoadingRecipients(true)
let res = backend_activity.getRecipientsAsync(self.requestId, 0, FETCH_RECIPIENTS_BATCH_COUNT_DEFAULT)
let res = backend_activity.getRecipientsAsync(self.requestId, self.chainIds, self.addresses, 0, FETCH_RECIPIENTS_BATCH_COUNT_DEFAULT)
if res.error != nil or res.result.kind != JBool:
self.status.setLoadingRecipients(false)
error "error fetching recipients: ", res.error, "; kind ", res.result.kind
@ -381,7 +382,7 @@ QtObject:
proc loadMoreRecipients(self: Controller) {.slot.} =
self.status.setLoadingRecipients(true)
let res = backend_activity.getRecipientsAsync(self.requestId, self.recipientsModel.getCount(), FETCH_RECIPIENTS_BATCH_COUNT_DEFAULT)
let res = backend_activity.getRecipientsAsync(self.requestId, self.chainIds, self.addresses, self.recipientsModel.getCount(), FETCH_RECIPIENTS_BATCH_COUNT_DEFAULT)
if res.error != nil:
self.status.setLoadingRecipients(false)
error "error fetching more recipient entries: ", res.error

View File

@ -27,6 +27,11 @@ QtObject:
proc delete*(self: Status) =
self.QObject.delete
proc filterChainsChanged*(self: Status) {.signal.}
proc emitFilterChainsChanged*(self: Status) =
self.filterChainsChanged()
proc loadingDataChanged*(self: Status) {.signal.}
proc setLoadingData*(self: Status, loadingData: bool) =

View File

@ -507,6 +507,8 @@ proc fromJson*(e: JsonNode, T: typedesc[GetRecipientsResponse]): GetRecipientsRe
rpc(getRecipientsAsync, "wallet"):
requestId: int32
chainIDs: seq[int]
addresses: seq[string]
offset: int
limit: int

View File

@ -47,6 +47,8 @@ ColumnLayout {
if (RootStore.transactionActivityStatus.isFilterDirty) {
WalletStores.RootStore.currentActivityFiltersStore.applyAllFilters()
}
WalletStores.RootStore.currentActivityFiltersStore.updateRecipientsModel()
}
Connections {
@ -55,6 +57,9 @@ ColumnLayout {
function onIsFilterDirtyChanged() {
RootStore.updateTransactionFilter()
}
function onFilterChainsChanged() {
WalletStores.RootStore.currentActivityFiltersStore.updateRecipientsModel()
}
}
QtObject {

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit bd6f9b098b018aba59d89d40343e4aee09e0531e
Subproject commit cff96f99e0997b3f3197eecf7b568f7c2e42cac1