stores: walletSection usages moved from shared/RootStore to wallet/RootStore
This commit is contained in:
parent
3c6ea3be43
commit
1b3a4cf955
|
@ -118,7 +118,7 @@ Item {
|
||||||
RootStore.lastReloadTimestamp * 1000) : ""
|
RootStore.lastReloadTimestamp * 1000) : ""
|
||||||
tooltip.text: qsTr("Last refreshed %1").arg(lastReloadTimeFormated)
|
tooltip.text: qsTr("Last refreshed %1").arg(lastReloadTimeFormated)
|
||||||
|
|
||||||
onClicked: RootStore.walletSectionInst.reloadAccountTokens()
|
onClicked: RootStore.reloadAccountTokens()
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: throttleTimer
|
id: throttleTimer
|
||||||
|
|
|
@ -34,6 +34,8 @@ QtObject {
|
||||||
readonly property string signingPhrase: walletSectionInst.signingPhrase
|
readonly property string signingPhrase: walletSectionInst.signingPhrase
|
||||||
readonly property string mnemonicBackedUp: walletSectionInst.isMnemonicBackedUp
|
readonly property string mnemonicBackedUp: walletSectionInst.isMnemonicBackedUp
|
||||||
|
|
||||||
|
readonly property var transactionActivityStatus: walletSectionInst.activityController.status
|
||||||
|
|
||||||
/* This property holds networks currently selected in the Wallet Main layout */
|
/* This property holds networks currently selected in the Wallet Main layout */
|
||||||
readonly property var networkFilters: networksModule.enabledChainIds
|
readonly property var networkFilters: networksModule.enabledChainIds
|
||||||
readonly property var networkFiltersArray: networkFilters.split(":").filter(Boolean).map(Number)
|
readonly property var networkFiltersArray: networkFilters.split(":").filter(Boolean).map(Number)
|
||||||
|
@ -110,6 +112,11 @@ QtObject {
|
||||||
readonly property bool isAccountTokensReloading: walletSectionInst.isAccountTokensReloading
|
readonly property bool isAccountTokensReloading: walletSectionInst.isAccountTokensReloading
|
||||||
readonly property double lastReloadTimestamp: walletSectionInst.lastReloadTimestamp
|
readonly property double lastReloadTimestamp: walletSectionInst.lastReloadTimestamp
|
||||||
|
|
||||||
|
readonly property var historyTransactions: walletSectionInst.activityController.model
|
||||||
|
readonly property bool loadingHistoryTransactions: walletSectionInst.activityController.status.loadingData
|
||||||
|
readonly property bool newDataAvailable: walletSectionInst.activityController.status.newDataAvailable
|
||||||
|
readonly property bool isNonArchivalNode: walletSectionInst.isNonArchivalNode
|
||||||
|
|
||||||
signal savedAddressAddedOrUpdated(added: bool, name: string, address: string, errorMsg: string)
|
signal savedAddressAddedOrUpdated(added: bool, name: string, address: string, errorMsg: string)
|
||||||
signal savedAddressDeleted(name: string, address: string, errorMsg: string)
|
signal savedAddressDeleted(name: string, address: string, errorMsg: string)
|
||||||
|
|
||||||
|
@ -585,4 +592,38 @@ QtObject {
|
||||||
}
|
}
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resetActivityData() {
|
||||||
|
root.walletSectionInst.activityController.resetActivityData()
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateTransactionFilterIfDirty() {
|
||||||
|
if (root.transactionActivityStatus.isFilterDirty)
|
||||||
|
root.walletSectionInst.activityController.updateFilter()
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTxDetails() {
|
||||||
|
return root.walletSectionInst.activityDetailsController.activityDetails
|
||||||
|
}
|
||||||
|
|
||||||
|
function fetchTxDetails(txID) {
|
||||||
|
root.walletSectionInst.activityController.fetchTxDetails(txID)
|
||||||
|
root.walletSectionInst.activityDetailsController.fetchExtraTxDetails()
|
||||||
|
}
|
||||||
|
|
||||||
|
function fetchDecodedTxData(txHash, input) {
|
||||||
|
root.walletSectionInst.fetchDecodedTxData(txHash, input)
|
||||||
|
}
|
||||||
|
|
||||||
|
function fetchMoreTransactions() {
|
||||||
|
if (root.historyTransactions.count === 0
|
||||||
|
|| !root.historyTransactions.hasMore
|
||||||
|
|| root.loadingHistoryTransactions)
|
||||||
|
return
|
||||||
|
root.walletSectionInst.activityController.loadMoreItems()
|
||||||
|
}
|
||||||
|
|
||||||
|
function reloadAccountTokens() {
|
||||||
|
root.walletSectionInst.reloadAccountTokens()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ Item {
|
||||||
onDetailsChanged: {
|
onDetailsChanged: {
|
||||||
if (!!d.details && !!d.details.input && d.details.input !== "0x") {
|
if (!!d.details && !!d.details.input && d.details.input !== "0x") {
|
||||||
d.loadingInputDate = true
|
d.loadingInputDate = true
|
||||||
root.rootStore.fetchDecodedTxData(d.details.txHashOut, d.details.input)
|
WalletStores.RootStore.fetchDecodedTxData(d.details.txHashOut, d.details.input)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: root.rootStore.walletSectionInst
|
target: WalletStores.RootStore.walletSectionInst
|
||||||
function onTxDecoded(txHash: string, dataDecoded: string) {
|
function onTxDecoded(txHash: string, dataDecoded: string) {
|
||||||
if (!d.isTransactionValid || (d.isDetailsValid && txHash !== d.details.txHashOut))
|
if (!d.isTransactionValid || (d.isDetailsValid && txHash !== d.details.txHashOut))
|
||||||
return
|
return
|
||||||
|
|
|
@ -11,7 +11,6 @@ QtObject {
|
||||||
property var profileSectionModuleInst: profileSectionModule
|
property var profileSectionModuleInst: profileSectionModule
|
||||||
property var privacyModule: profileSectionModuleInst.privacyModule
|
property var privacyModule: profileSectionModuleInst.privacyModule
|
||||||
property var userProfileInst: !!Global.userProfile? Global.userProfile : null
|
property var userProfileInst: !!Global.userProfile? Global.userProfile : null
|
||||||
property var walletSectionInst: Global.appIsReady && !!walletSection? walletSection : null
|
|
||||||
property var appSettingsInst: Global.appIsReady && !!appSettings? appSettings : null
|
property var appSettingsInst: Global.appIsReady && !!appSettings? appSettings : null
|
||||||
property var accountSensitiveSettings: Global.appIsReady && !!localAccountSensitiveSettings? localAccountSensitiveSettings : null
|
property var accountSensitiveSettings: Global.appIsReady && !!localAccountSensitiveSettings? localAccountSensitiveSettings : null
|
||||||
property real volume: !!appSettingsInst ? appSettingsInst.volume * 0.01 : 0.5
|
property real volume: !!appSettingsInst ? appSettingsInst.volume * 0.01 : 0.5
|
||||||
|
@ -23,19 +22,8 @@ QtObject {
|
||||||
|
|
||||||
property CurrenciesStore currencyStore: CurrenciesStore {}
|
property CurrenciesStore currencyStore: CurrenciesStore {}
|
||||||
|
|
||||||
readonly property var transactionActivityStatus: Global.appIsReady ? walletSectionInst.activityController.status : null
|
|
||||||
|
|
||||||
property var historyTransactions: Global.appIsReady? walletSectionInst.activityController.model : null
|
|
||||||
readonly property bool loadingHistoryTransactions: Global.appIsReady && walletSectionInst.activityController.status.loadingData
|
|
||||||
readonly property bool newDataAvailable: Global.appIsReady && walletSectionInst.activityController.status.newDataAvailable
|
|
||||||
property bool isNonArchivalNode: Global.appIsReady && walletSectionInst.isNonArchivalNode
|
|
||||||
|
|
||||||
property TokenMarketValuesStore marketValueStore: TokenMarketValuesStore {}
|
property TokenMarketValuesStore marketValueStore: TokenMarketValuesStore {}
|
||||||
|
|
||||||
function resetActivityData() {
|
|
||||||
walletSectionInst.activityController.resetActivityData()
|
|
||||||
}
|
|
||||||
|
|
||||||
property var flatNetworks: networksModule.flatNetworks
|
property var flatNetworks: networksModule.flatNetworks
|
||||||
|
|
||||||
function setNeverAskAboutUnfurlingAgain(value) {
|
function setNeverAskAboutUnfurlingAgain(value) {
|
||||||
|
@ -49,30 +37,4 @@ QtObject {
|
||||||
function getPasswordStrengthScore(password) {
|
function getPasswordStrengthScore(password) {
|
||||||
return root.privacyModule.getPasswordStrengthScore(password);
|
return root.privacyModule.getPasswordStrengthScore(password);
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchMoreTransactions() {
|
|
||||||
if (RootStore.historyTransactions.count === 0
|
|
||||||
|| !RootStore.historyTransactions.hasMore
|
|
||||||
|| loadingHistoryTransactions)
|
|
||||||
return
|
|
||||||
walletSectionInst.activityController.loadMoreItems()
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateTransactionFilterIfDirty() {
|
|
||||||
if (transactionActivityStatus.isFilterDirty)
|
|
||||||
walletSectionInst.activityController.updateFilter()
|
|
||||||
}
|
|
||||||
|
|
||||||
function fetchDecodedTxData(txHash, input) {
|
|
||||||
walletSectionInst.fetchDecodedTxData(txHash, input)
|
|
||||||
}
|
|
||||||
|
|
||||||
function fetchTxDetails(txID) {
|
|
||||||
walletSectionInst.activityController.fetchTxDetails(txID)
|
|
||||||
walletSectionInst.activityDetailsController.fetchExtraTxDetails()
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTxDetails() {
|
|
||||||
return walletSectionInst.activityDetailsController.activityDetails
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (RootStore.transactionActivityStatus.isFilterDirty) {
|
if (root.walletRootStore.transactionActivityStatus.isFilterDirty) {
|
||||||
root.walletRootStore.currentActivityFiltersStore.applyAllFilters()
|
root.walletRootStore.currentActivityFiltersStore.applyAllFilters()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,10 +66,10 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: RootStore.transactionActivityStatus
|
target: root.walletRootStore.transactionActivityStatus
|
||||||
enabled: root.visible
|
enabled: root.visible
|
||||||
function onIsFilterDirtyChanged() {
|
function onIsFilterDirtyChanged() {
|
||||||
RootStore.updateTransactionFilterIfDirty()
|
root.walletRootStore.updateTransactionFilterIfDirty()
|
||||||
}
|
}
|
||||||
function onFilterChainsChanged() {
|
function onFilterChainsChanged() {
|
||||||
root.walletRootStore.currentActivityFiltersStore.updateCollectiblesModel()
|
root.walletRootStore.currentActivityFiltersStore.updateCollectiblesModel()
|
||||||
|
@ -89,7 +89,7 @@ ColumnLayout {
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
readonly property bool isInitialLoading: RootStore.loadingHistoryTransactions && transactionListRoot.count === 0
|
readonly property bool isInitialLoading: root.walletRootStore.loadingHistoryTransactions && transactionListRoot.count === 0
|
||||||
|
|
||||||
readonly property int loadingSectionWidth: 56
|
readonly property int loadingSectionWidth: 56
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ ColumnLayout {
|
||||||
|
|
||||||
function openTxDetails(txID) {
|
function openTxDetails(txID) {
|
||||||
// Prevent opening details when loading, that will invalidate the model data
|
// Prevent opening details when loading, that will invalidate the model data
|
||||||
if (RootStore.loadingHistoryTransactions) {
|
if (root.walletRootStore.loadingHistoryTransactions) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ ColumnLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.alignment: Qt.AlignTop
|
Layout.alignment: Qt.AlignTop
|
||||||
Layout.topMargin: root.firstItemOffset
|
Layout.topMargin: root.firstItemOffset
|
||||||
visible: RootStore.isNonArchivalNode
|
visible: root.walletRootStore.isNonArchivalNode
|
||||||
text: qsTr("Status Desktop is connected to a non-archival node. Transaction history may be incomplete.")
|
text: qsTr("Status Desktop is connected to a non-archival node. Transaction history may be incomplete.")
|
||||||
font.pixelSize: Style.current.primaryTextFontSize
|
font.pixelSize: Style.current.primaryTextFontSize
|
||||||
color: Style.current.danger
|
color: Style.current.danger
|
||||||
|
@ -204,7 +204,7 @@ ColumnLayout {
|
||||||
if (d.openTxDetails(d.openTxDetailsHash)) {
|
if (d.openTxDetails(d.openTxDetailsHash)) {
|
||||||
d.openTxDetailsHash = ""
|
d.openTxDetailsHash = ""
|
||||||
} else {
|
} else {
|
||||||
RootStore.fetchMoreTransactions()
|
root.walletRootStore.fetchMoreTransactions()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ ColumnLayout {
|
||||||
model: SortFilterProxyModel {
|
model: SortFilterProxyModel {
|
||||||
id: txModel
|
id: txModel
|
||||||
|
|
||||||
sourceModel: RootStore.historyTransactions
|
sourceModel: root.walletRootStore.historyTransactions
|
||||||
|
|
||||||
// LocaleUtils is not accessable from inside expression, but local function works
|
// LocaleUtils is not accessable from inside expression, but local function works
|
||||||
property var daysTo: (d1, d2) => LocaleUtils.daysTo(d1, d2)
|
property var daysTo: (d1, d2) => LocaleUtils.daysTo(d1, d2)
|
||||||
|
@ -267,16 +267,17 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: RootStore
|
target: root.walletRootStore
|
||||||
|
|
||||||
function onLoadingHistoryTransactionsChanged() {
|
function onLoadingHistoryTransactionsChanged() {
|
||||||
// Calling timer instead directly to not cause binding loop
|
// Calling timer instead directly to not cause binding loop
|
||||||
if (!RootStore.loadingHistoryTransactions)
|
if (!root.walletRootStore.loadingHistoryTransactions)
|
||||||
fetchMoreTimer.start()
|
fetchMoreTimer.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function tryFetchMoreTransactions() {
|
function tryFetchMoreTransactions() {
|
||||||
if (d.isInitialLoading || !footerItem || !RootStore.historyTransactions.hasMore)
|
if (d.isInitialLoading || !footerItem || !root.walletRootStore.historyTransactions.hasMore)
|
||||||
return
|
return
|
||||||
const footerYPosition = footerItem.height / contentHeight
|
const footerYPosition = footerItem.height / contentHeight
|
||||||
if (footerYPosition >= 1.0) {
|
if (footerYPosition >= 1.0) {
|
||||||
|
@ -285,7 +286,7 @@ ColumnLayout {
|
||||||
|
|
||||||
// On startup, first loaded ListView will have heightRatio equal 0
|
// On startup, first loaded ListView will have heightRatio equal 0
|
||||||
if (footerYPosition + visibleArea.yPosition + visibleArea.heightRatio > 1.0) {
|
if (footerYPosition + visibleArea.yPosition + visibleArea.heightRatio > 1.0) {
|
||||||
RootStore.fetchMoreTransactions()
|
root.walletRootStore.fetchMoreTransactions()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,8 +305,8 @@ ColumnLayout {
|
||||||
|
|
||||||
text: qsTr("New transactions")
|
text: qsTr("New transactions")
|
||||||
|
|
||||||
visible: RootStore.newDataAvailable && !RootStore.loadingHistoryTransactions
|
visible: root.walletRootStore.newDataAvailable && !root.walletRootStore.loadingHistoryTransactions
|
||||||
onClicked: RootStore.resetActivityData()
|
onClicked: root.walletRootStore.resetActivityData()
|
||||||
|
|
||||||
icon.name: "arrow-up"
|
icon.name: "arrow-up"
|
||||||
|
|
||||||
|
@ -389,8 +390,8 @@ ColumnLayout {
|
||||||
root.walletRootStore.addressWasShown(delegateMenu.transaction.recipient)
|
root.walletRootStore.addressWasShown(delegateMenu.transaction.recipient)
|
||||||
}
|
}
|
||||||
|
|
||||||
RootStore.fetchTxDetails(delegateMenu.transaction.id)
|
root.walletRootStore.fetchTxDetails(delegateMenu.transaction.id)
|
||||||
let detailsObj = RootStore.getTxDetails()
|
let detailsObj = root.walletRootStore.getTxDetails()
|
||||||
let detailsString = delegateMenu.transactionDelegate.getDetailsString(detailsObj)
|
let detailsString = delegateMenu.transactionDelegate.getDetailsString(detailsObj)
|
||||||
ClipboardUtils.setText(detailsString)
|
ClipboardUtils.setText(detailsString)
|
||||||
}
|
}
|
||||||
|
@ -516,7 +517,7 @@ ColumnLayout {
|
||||||
id: footerComp
|
id: footerComp
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: footerColumn
|
id: footerColumn
|
||||||
readonly property bool allActivityLoaded: !RootStore.historyTransactions.hasMore && transactionListRoot.count !== 0
|
readonly property bool allActivityLoaded: !root.walletRootStore.historyTransactions.hasMore && transactionListRoot.count !== 0
|
||||||
width: root.width
|
width: root.width
|
||||||
spacing: d.isInitialLoading ? 6 : 12
|
spacing: d.isInitialLoading ? 6 : 12
|
||||||
|
|
||||||
|
@ -544,7 +545,7 @@ ColumnLayout {
|
||||||
const delegateHeight = 64 + footerColumn.spacing
|
const delegateHeight = 64 + footerColumn.spacing
|
||||||
if (d.isInitialLoading) {
|
if (d.isInitialLoading) {
|
||||||
return Math.floor(transactionListRoot.height / delegateHeight)
|
return Math.floor(transactionListRoot.height / delegateHeight)
|
||||||
} else if (RootStore.historyTransactions.hasMore) {
|
} else if (root.walletRootStore.historyTransactions.hasMore) {
|
||||||
return Math.max(3, Math.floor(transactionListRoot.height / delegateHeight) - 3)
|
return Math.max(3, Math.floor(transactionListRoot.height / delegateHeight) - 3)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue