feat(@desktop/wallet): Fetch txs only when opening activity tab (#11360)
closses #11356
This commit is contained in:
parent
b710994bee
commit
00eee836ae
|
@ -183,6 +183,7 @@ QtObject:
|
||||||
|
|
||||||
proc updateFilter*(self: Controller) {.slot.} =
|
proc updateFilter*(self: Controller) {.slot.} =
|
||||||
self.status.setLoadingData(true)
|
self.status.setLoadingData(true)
|
||||||
|
self.status.setIsFilterDirty(false)
|
||||||
self.model.resetModel(@[])
|
self.model.resetModel(@[])
|
||||||
self.eventsHandler.updateSubscribedAddresses(self.addresses)
|
self.eventsHandler.updateSubscribedAddresses(self.addresses)
|
||||||
self.status.setNewDataAvailable(false)
|
self.status.setNewDataAvailable(false)
|
||||||
|
@ -387,7 +388,8 @@ QtObject:
|
||||||
QtProperty[QVariant] status:
|
QtProperty[QVariant] status:
|
||||||
read = getStatus
|
read = getStatus
|
||||||
|
|
||||||
|
|
||||||
proc globalFilterChanged*(self: Controller, addresses: seq[string], chainIds: seq[int]) =
|
proc globalFilterChanged*(self: Controller, addresses: seq[string], chainIds: seq[int]) =
|
||||||
self.setFilterAddresses(addresses)
|
self.setFilterAddresses(addresses)
|
||||||
self.setFilterChains(chainIds)
|
self.setFilterChains(chainIds)
|
||||||
self.updateFilter()
|
self.status.setIsFilterDirty(true)
|
|
@ -21,6 +21,8 @@ QtObject:
|
||||||
|
|
||||||
newDataAvailable: bool
|
newDataAvailable: bool
|
||||||
|
|
||||||
|
isFilterDirty: bool
|
||||||
|
|
||||||
proc setup(self: Status) =
|
proc setup(self: Status) =
|
||||||
self.QObject.setup
|
self.QObject.setup
|
||||||
|
|
||||||
|
@ -55,6 +57,7 @@ QtObject:
|
||||||
new(result, delete)
|
new(result, delete)
|
||||||
|
|
||||||
result.errorCode = backend_activity.ErrorCode.ErrorCodeSuccess
|
result.errorCode = backend_activity.ErrorCode.ErrorCodeSuccess
|
||||||
|
result.isFilterDirty = false
|
||||||
|
|
||||||
result.setup()
|
result.setup()
|
||||||
|
|
||||||
|
@ -112,3 +115,16 @@ QtObject:
|
||||||
QtProperty[bool] newDataAvailable:
|
QtProperty[bool] newDataAvailable:
|
||||||
read = getNewDataAvailable
|
read = getNewDataAvailable
|
||||||
notify = newDataAvailableChanged
|
notify = newDataAvailableChanged
|
||||||
|
|
||||||
|
proc isFilterDirtyChanged*(self: Status) {.signal.}
|
||||||
|
|
||||||
|
proc setIsFilterDirty*(self: Status, value: bool) =
|
||||||
|
self.isFilterDirty = value
|
||||||
|
self.isFilterDirtyChanged()
|
||||||
|
|
||||||
|
proc getIsFilterDirty*(self: Status): bool {.slot.} =
|
||||||
|
return self.isFilterDirty
|
||||||
|
|
||||||
|
QtProperty[bool] isFilterDirty:
|
||||||
|
read = getIsFilterDirty
|
||||||
|
notify = isFilterDirtyChanged
|
|
@ -9,7 +9,7 @@ type Filter* = ref object
|
||||||
allAddresses*: bool
|
allAddresses*: bool
|
||||||
|
|
||||||
proc initFilter*(
|
proc initFilter*(
|
||||||
controller: controller.Controller,
|
controller: controller.Controller
|
||||||
): Filter =
|
): Filter =
|
||||||
result = Filter()
|
result = Filter()
|
||||||
result.controller = controller
|
result.controller = controller
|
||||||
|
@ -56,6 +56,5 @@ proc removeAddress*(self: Filter, address: string) =
|
||||||
if ind > -1:
|
if ind > -1:
|
||||||
self.addresses.delete(ind)
|
self.addresses.delete(ind)
|
||||||
|
|
||||||
|
|
||||||
proc updateNetworks*(self: Filter) =
|
proc updateNetworks*(self: Filter) =
|
||||||
self.chainIds = self.controller.getEnabledChainIds()
|
self.chainIds = self.controller.getEnabledChainIds()
|
||||||
|
|
|
@ -40,6 +40,7 @@ QtObject {
|
||||||
property var historyTransactions: Global.appIsReady? walletSection.activityController.model : null
|
property var historyTransactions: Global.appIsReady? walletSection.activityController.model : null
|
||||||
readonly property bool loadingHistoryTransactions: Global.appIsReady && walletSection.activityController.status.loadingData
|
readonly property bool loadingHistoryTransactions: Global.appIsReady && walletSection.activityController.status.loadingData
|
||||||
readonly property bool newDataAvailable: Global.appIsReady && walletSection.activityController.status.newDataAvailable
|
readonly property bool newDataAvailable: Global.appIsReady && walletSection.activityController.status.newDataAvailable
|
||||||
|
readonly property bool isTransactionFilterDirty: Global.appIsReady && walletSection.activityController.status.isFilterDirty
|
||||||
property bool isNonArchivalNode: history ? history.isNonArchivalNode
|
property bool isNonArchivalNode: history ? history.isNonArchivalNode
|
||||||
: false
|
: false
|
||||||
property var marketValueStore: TokenMarketValuesStore{}
|
property var marketValueStore: TokenMarketValuesStore{}
|
||||||
|
@ -186,6 +187,11 @@ QtObject {
|
||||||
walletSection.activityController.loadMoreItems()
|
walletSection.activityController.loadMoreItems()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateTransactionFilter() {
|
||||||
|
if (isTransactionFilterDirty)
|
||||||
|
walletSection.activityController.updateFilter()
|
||||||
|
}
|
||||||
|
|
||||||
function hex2Eth(value) {
|
function hex2Eth(value) {
|
||||||
return globalUtils.hex2Eth(value)
|
return globalUtils.hex2Eth(value)
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,20 @@ ColumnLayout {
|
||||||
|
|
||||||
signal launchTransactionDetail(var transaction)
|
signal launchTransactionDetail(var transaction)
|
||||||
|
|
||||||
|
onVisibleChanged: {
|
||||||
|
if (visible) {
|
||||||
|
RootStore.updateTransactionFilter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: RootStore
|
||||||
|
enabled: root.visible
|
||||||
|
function onIsTransactionFilterDirtyChanged() {
|
||||||
|
RootStore.updateTransactionFilter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
readonly property bool isInitialLoading: RootStore.loadingHistoryTransactions && transactionListRoot.count === 0
|
readonly property bool isInitialLoading: RootStore.loadingHistoryTransactions && transactionListRoot.count === 0
|
||||||
|
@ -303,7 +317,7 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: RootStore.historyTransactions.hasMore || d.isInitialLoading ? 10 : 0
|
model: !noTxs.visible && (RootStore.historyTransactions.hasMore || d.isInitialLoading) ? 10 : 0
|
||||||
TransactionDelegate {
|
TransactionDelegate {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
rootStore: RootStore
|
rootStore: RootStore
|
||||||
|
|
Loading…
Reference in New Issue