From 63fb79abd67fea3c36c9448891e42e56f87eab0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Tinkl?= Date: Fri, 4 Oct 2024 12:04:59 +0200 Subject: [PATCH] fix(CurrencyStore): fix passing the CurrencyStore around - now that we no longer have them as singletons, just pass the one and only instance down from AppMain --- ui/app/AppLayouts/Chat/stores/RootStore.qml | 3 +-- ui/app/AppLayouts/Wallet/stores/RootStore.qml | 2 +- ui/app/AppLayouts/Wallet/views/RightTabView.qml | 1 + ui/app/mainui/AppMain.qml | 9 ++++++++- ui/imports/shared/stores/RootStore.qml | 2 +- ui/imports/shared/views/HistoryView.qml | 5 +++-- 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ui/app/AppLayouts/Chat/stores/RootStore.qml b/ui/app/AppLayouts/Chat/stores/RootStore.qml index b76844c44b..104c1c0e90 100644 --- a/ui/app/AppLayouts/Chat/stores/RootStore.qml +++ b/ui/app/AppLayouts/Chat/stores/RootStore.qml @@ -18,7 +18,7 @@ QtObject { property ContactsStore contactsStore property CommunityTokensStore communityTokensStore property WalletStore.RootStore walletStore - + property CurrenciesStore currencyStore property NetworkConnectionStore networkConnectionStore readonly property PermissionsStore permissionsStore: PermissionsStore { @@ -535,7 +535,6 @@ QtObject { // Needed for TX in chat for stickers and via contact readonly property var accounts: walletSectionAccounts.accounts property string currentCurrency: walletSection.currentCurrency - property CurrenciesStore currencyStore: CurrenciesStore {} property var savedAddressesModel: walletSectionSavedAddresses.model property var disabledChainIdsFromList: [] diff --git a/ui/app/AppLayouts/Wallet/stores/RootStore.qml b/ui/app/AppLayouts/Wallet/stores/RootStore.qml index 3c75b0a060..8c5bcd3dfa 100644 --- a/ui/app/AppLayouts/Wallet/stores/RootStore.qml +++ b/ui/app/AppLayouts/Wallet/stores/RootStore.qml @@ -432,7 +432,7 @@ QtObject { walletSectionAccounts.updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance) } - property SharedStores.CurrenciesStore currencyStore: SharedStores.CurrenciesStore {} + property SharedStores.CurrenciesStore currencyStore: SharedStores.CurrenciesStore {} // FIXME pass it down from AppMain instead of recreating it here function addressWasShown(address) { return d.mainModuleInst.addressWasShown(address) diff --git a/ui/app/AppLayouts/Wallet/views/RightTabView.qml b/ui/app/AppLayouts/Wallet/views/RightTabView.qml index 46810542aa..39176f20e5 100644 --- a/ui/app/AppLayouts/Wallet/views/RightTabView.qml +++ b/ui/app/AppLayouts/Wallet/views/RightTabView.qml @@ -427,6 +427,7 @@ RightTabBaseView { overview: RootStore.overview walletRootStore: RootStore communitiesStore: root.communitiesStore + currencyStore: root.sharedRootStore.currencyStore showAllAccounts: RootStore.showAllAccounts sendModal: root.sendModal filterVisible: filterButton.checked diff --git a/ui/app/mainui/AppMain.qml b/ui/app/mainui/AppMain.qml index 7fd9211f1b..577603cd8d 100644 --- a/ui/app/mainui/AppMain.qml +++ b/ui/app/mainui/AppMain.qml @@ -57,13 +57,16 @@ Item { property alias appLayout: appLayout - readonly property SharedStores.RootStore sharedRootStore: SharedStores.RootStore {} + readonly property SharedStores.RootStore sharedRootStore: SharedStores.RootStore { + currencyStore: appMain.currencyStore + } property AppStores.RootStore rootStore: AppStores.RootStore { profileSectionStore.sendModalPopup: sendModal } property ChatStores.RootStore rootChatStore: ChatStores.RootStore { contactsStore: appMain.rootStore.contactStore + currencyStore: appMain.currencyStore communityTokensStore: appMain.communityTokensStore emojiReactionsModel: appMain.rootStore.emojiReactionsModel openCreateChat: createChatView.opened @@ -1361,6 +1364,7 @@ Item { sharedRootStore: appMain.sharedRootStore rootStore: ChatStores.RootStore { contactsStore: appMain.rootStore.contactStore + currencyStore: appMain.currencyStore communityTokensStore: appMain.communityTokensStore emojiReactionsModel: appMain.rootStore.emojiReactionsModel openCreateChat: createChatView.opened @@ -1520,6 +1524,7 @@ Item { sharedRootStore: appMain.sharedRootStore rootStore: ChatStores.RootStore { contactsStore: appMain.rootStore.contactStore + currencyStore: appMain.currencyStore communityTokensStore: appMain.communityTokensStore emojiReactionsModel: appMain.rootStore.emojiReactionsModel openCreateChat: createChatView.opened @@ -1565,6 +1570,7 @@ Item { sharedRootStore: appMain.sharedRootStore rootStore: ChatStores.RootStore { contactsStore: appMain.rootStore.contactStore + currencyStore: appMain.currencyStore communityTokensStore: appMain.communityTokensStore emojiReactionsModel: appMain.rootStore.emojiReactionsModel openCreateChat: createChatView.opened @@ -1589,6 +1595,7 @@ Item { height: appView.height - _buttonSize * 2 store: ChatStores.RootStore { contactsStore: appMain.rootStore.contactStore + currencyStore: appMain.currencyStore communityTokensStore: appMain.communityTokensStore emojiReactionsModel: appMain.rootStore.emojiReactionsModel openCreateChat: createChatView.opened diff --git a/ui/imports/shared/stores/RootStore.qml b/ui/imports/shared/stores/RootStore.qml index 6efd814ab3..037766e237 100644 --- a/ui/imports/shared/stores/RootStore.qml +++ b/ui/imports/shared/stores/RootStore.qml @@ -17,7 +17,7 @@ QtObject { property bool neverAskAboutUnfurlingAgain: !!accountSensitiveSettings ? accountSensitiveSettings.neverAskAboutUnfurlingAgain : false property bool gifUnfurlingEnabled: !!accountSensitiveSettings ? accountSensitiveSettings.gifUnfurlingEnabled : false - property CurrenciesStore currencyStore: CurrenciesStore {} + required property CurrenciesStore currencyStore property TokenMarketValuesStore marketValueStore: TokenMarketValuesStore {} diff --git a/ui/imports/shared/views/HistoryView.qml b/ui/imports/shared/views/HistoryView.qml index 52975d5284..d160bbd2ef 100644 --- a/ui/imports/shared/views/HistoryView.qml +++ b/ui/imports/shared/views/HistoryView.qml @@ -34,6 +34,7 @@ ColumnLayout { property WalletStores.RootStore walletRootStore property CommunitiesStore communitiesStore + property CurrenciesStore currencyStore property bool showAllAccounts: false property bool displayValues: true property var sendModal @@ -490,7 +491,7 @@ ColumnLayout { modelData: transactionDelegate.model.activityEntry timeStampText: isModelDataValid ? LocaleUtils.formatRelativeTimestamp(modelData.timestamp * 1000, true) : "" flatNetworks: root.walletRootStore.flatNetworks - currenciesStore: RootStore.currencyStore + currenciesStore: root.currencyStore walletRootStore: root.walletRootStore showAllAccounts: root.showAllAccounts displayValues: root.displayValues @@ -555,7 +556,7 @@ ColumnLayout { Layout.fillWidth: true flatNetworks: root.walletRootStore.flatNetworks - currenciesStore: RootStore.currencyStore + currenciesStore: root.currencyStore walletRootStore: root.walletRootStore loading: true }