Skip to content

Commit

Permalink
stores: shared/RootStore made not singleton
Browse files Browse the repository at this point in the history
Closes: #16247
  • Loading branch information
micieslak committed Oct 3, 2024
1 parent c8c27c6 commit eb1b422
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
4 changes: 1 addition & 3 deletions monitoring/MonitorEntryPoint.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -315,8 +314,7 @@ Component {
onClicked: {
const roots = [
applicationWindow,
WalletStores.RootStore,
SharedStores.RootStore
WalletStores.RootStore
]

let obj = null
Expand Down
29 changes: 16 additions & 13 deletions ui/app/mainui/AppMain.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand All @@ -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
Expand Down Expand Up @@ -409,7 +412,7 @@ Item {
Popups {
id: popups

sharedRootStore: RootStore
sharedRootStore: appMain.sharedRootStore
popupParent: appMain
rootStore: appMain.rootStore
communityTokensStore: appMain.communityTokensStore
Expand Down Expand Up @@ -1352,7 +1355,7 @@ Item {
restoreMode: Binding.RestoreBindingOrValue
}

sharedRootStore: RootStore
sharedRootStore: appMain.sharedRootStore
rootStore: ChatStores.RootStore {
contactsStore: appMain.rootStore.contactStore
communityTokensStore: appMain.communityTokensStore
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1882,7 +1885,7 @@ Item {

sourceComponent: WalletPopups.AddEditSavedAddressPopup {
store: WalletStores.RootStore
sharedRootStore: RootStore
sharedRootStore: appMain.sharedRootStore
flatNetworks: WalletStores.RootStore.filteredFlatModel

onClosed: {
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions ui/imports/shared/stores/RootStore.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
pragma Singleton

import QtQuick 2.15
import utils 1.0

Expand Down
2 changes: 1 addition & 1 deletion ui/imports/shared/stores/qmldir
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit eb1b422

Please sign in to comment.