From 05f73ebf781a7ba38e3bcc98304fff91d1c03ce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Cie=C5=9Blak?= Date: Wed, 2 Oct 2024 23:02:57 +0200 Subject: [PATCH] stores: shared/RootStore made not singleton Closes: #16247 --- monitoring/MonitorEntryPoint.qml | 4 +--- ui/app/mainui/AppMain.qml | 29 ++++++++++++++------------ ui/imports/shared/stores/RootStore.qml | 2 -- ui/imports/shared/stores/qmldir | 2 +- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/monitoring/MonitorEntryPoint.qml b/monitoring/MonitorEntryPoint.qml index 230388b1b5..e656be4b67 100644 --- a/monitoring/MonitorEntryPoint.qml +++ b/monitoring/MonitorEntryPoint.qml @@ -6,7 +6,6 @@ import Monitoring 1.0 import Qt.labs.settings 1.0 import AppLayouts.Wallet.stores 1.0 as WalletStores -import shared.stores 1.0 as SharedStores Component { @@ -315,8 +314,7 @@ Component { onClicked: { const roots = [ applicationWindow, - WalletStores.RootStore, - SharedStores.RootStore + WalletStores.RootStore ] let obj = null diff --git a/ui/app/mainui/AppMain.qml b/ui/app/mainui/AppMain.qml index 752020b5f9..4edc29b76c 100644 --- a/ui/app/mainui/AppMain.qml +++ b/ui/app/mainui/AppMain.qml @@ -23,7 +23,7 @@ import shared.panels 1.0 import shared.popups 1.0 import shared.popups.keycard 1.0 import shared.status 1.0 -import shared.stores 1.0 +import shared.stores 1.0 as SharedStores import shared.popups.send 1.0 as SendPopups import shared.popups.send.views 1.0 import shared.stores.send 1.0 @@ -55,6 +55,9 @@ Item { id: appMain property alias appLayout: appLayout + + readonly property SharedStores.RootStore sharedRootStore: SharedStores.RootStore {} + property AppStores.RootStore rootStore: AppStores.RootStore { profileSectionStore.sendModalPopup: sendModal } @@ -67,13 +70,13 @@ Item { } property ChatStores.CreateChatPropertiesStore createChatPropertiesStore: ChatStores.CreateChatPropertiesStore {} property ActivityCenterStore activityCenterStore: ActivityCenterStore {} - property NetworkConnectionStore networkConnectionStore: NetworkConnectionStore {} - property CommunityTokensStore communityTokensStore: CommunityTokensStore {} + property SharedStores.NetworkConnectionStore networkConnectionStore: SharedStores.NetworkConnectionStore {} + property SharedStores.CommunityTokensStore communityTokensStore: SharedStores.CommunityTokensStore {} property CommunitiesStore communitiesStore: CommunitiesStore {} readonly property WalletStores.TokensStore tokensStore: WalletStores.RootStore.tokensStore readonly property WalletStores.WalletAssetsStore walletAssetsStore: WalletStores.RootStore.walletAssetsStore readonly property WalletStores.CollectiblesStore walletCollectiblesStore: WalletStores.RootStore.collectiblesStore - readonly property CurrenciesStore currencyStore: CurrenciesStore {} + readonly property SharedStores.CurrenciesStore currencyStore: SharedStores.CurrenciesStore {} readonly property TransactionStore transactionStore: TransactionStore { walletAssetStore: appMain.walletAssetsStore tokensStore: appMain.tokensStore @@ -409,7 +412,7 @@ Item { Popups { id: popups - sharedRootStore: RootStore + sharedRootStore: appMain.sharedRootStore popupParent: appMain rootStore: appMain.rootStore communityTokensStore: appMain.communityTokensStore @@ -1352,7 +1355,7 @@ Item { restoreMode: Binding.RestoreBindingOrValue } - sharedRootStore: RootStore + sharedRootStore: appMain.sharedRootStore rootStore: ChatStores.RootStore { contactsStore: appMain.rootStore.contactStore communityTokensStore: appMain.communityTokensStore @@ -1400,7 +1403,7 @@ Item { asynchronous: true sourceComponent: WalletLayout { objectName: "walletLayoutReal" - sharedRootStore: RootStore + sharedRootStore: appMain.sharedRootStore store: appMain.rootStore contactsStore: appMain.rootStore.profileSectionStore.contactsStore communitiesStore: appMain.communitiesStore @@ -1421,7 +1424,7 @@ Item { active: appView.currentIndex === Constants.appViewStackIndex.profile asynchronous: true sourceComponent: ProfileLayout { - sharedRootStore: RootStore + sharedRootStore: appMain.sharedRootStore store: appMain.rootStore.profileSectionStore globalStore: appMain.rootStore systemPalette: appMain.sysPalette @@ -1511,7 +1514,7 @@ Item { communitiesStore: appMain.communitiesStore communitySettingsDisabled: !chatLayoutComponent.isManageCommunityEnabledInAdvanced && (production && appMain.rootStore.profileSectionStore.walletStore.areTestNetworksEnabled) - sharedRootStore: RootStore + sharedRootStore: appMain.sharedRootStore rootStore: ChatStores.RootStore { contactsStore: appMain.rootStore.contactStore communityTokensStore: appMain.communityTokensStore @@ -1556,7 +1559,7 @@ Item { anchors.rightMargin - anchors.leftMargin : 0 sourceComponent: CreateChatView { - sharedRootStore: RootStore + sharedRootStore: appMain.sharedRootStore rootStore: ChatStores.RootStore { contactsStore: appMain.rootStore.contactStore communityTokensStore: appMain.communityTokensStore @@ -1882,7 +1885,7 @@ Item { sourceComponent: WalletPopups.AddEditSavedAddressPopup { store: WalletStores.RootStore - sharedRootStore: RootStore + sharedRootStore: appMain.sharedRootStore flatNetworks: WalletStores.RootStore.filteredFlatModel onClosed: { @@ -2141,7 +2144,7 @@ Item { controller: WalletStores.RootStore.dappsConnectorController wcService: Global.walletConnectService walletStore: WalletStores.RootStore - store: DAppsStore { + store: SharedStores.DAppsStore { controller: WalletStores.RootStore.walletConnectController } loginType: appMain.rootStore.loginType @@ -2168,7 +2171,7 @@ Item { userUID: appMain.rootStore.profileSectionStore.profileStore.pubkey projectId: WalletStores.RootStore.appSettings.walletConnectProjectID } - store: DAppsStore { + store: SharedStores.DAppsStore { controller: WalletStores.RootStore.walletConnectController } walletRootStore: WalletStores.RootStore diff --git a/ui/imports/shared/stores/RootStore.qml b/ui/imports/shared/stores/RootStore.qml index 6c1a04839c..6efd814ab3 100644 --- a/ui/imports/shared/stores/RootStore.qml +++ b/ui/imports/shared/stores/RootStore.qml @@ -1,5 +1,3 @@ -pragma Singleton - import QtQuick 2.15 import utils 1.0 diff --git a/ui/imports/shared/stores/qmldir b/ui/imports/shared/stores/qmldir index 25db99462a..52b2f98df9 100644 --- a/ui/imports/shared/stores/qmldir +++ b/ui/imports/shared/stores/qmldir @@ -7,6 +7,6 @@ GifStore 1.0 GifStore.qml MetricsStore 1.0 MetricsStore.qml NetworkConnectionStore 1.0 NetworkConnectionStore.qml PermissionsStore 1.0 PermissionsStore.qml +RootStore 1.0 RootStore.qml TokenBalanceHistoryStore 1.0 TokenBalanceHistoryStore.qml TokenMarketValuesStore 1.0 TokenMarketValuesStore.qml -singleton RootStore 1.0 RootStore.qml