mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-18 01:27:25 +00:00
chore(Global): Remove FeatureFlags access via Global singleton
- rationale: do not save global state in a singleton, gather and propagate the values via FeatureFlagsStore Fixes #14697
This commit is contained in:
parent
20f30a52fd
commit
a7e74f3e00
@ -1,10 +0,0 @@
|
|||||||
// Mock of src/app/global/feature_flags.nim
|
|
||||||
import QtQuick 2.15
|
|
||||||
|
|
||||||
QtObject {
|
|
||||||
readonly property string contextPropertyName: "featureFlagsRootContextProperty"
|
|
||||||
|
|
||||||
//
|
|
||||||
// Silence warnings
|
|
||||||
readonly property bool dappsEnabled: true
|
|
||||||
}
|
|
@ -32,6 +32,9 @@ Item {
|
|||||||
property var networkConnectionStore
|
property var networkConnectionStore
|
||||||
property bool appMainVisible
|
property bool appMainVisible
|
||||||
|
|
||||||
|
property bool dappsEnabled
|
||||||
|
property bool swapEnabled
|
||||||
|
|
||||||
onAppMainVisibleChanged: {
|
onAppMainVisibleChanged: {
|
||||||
resetView()
|
resetView()
|
||||||
}
|
}
|
||||||
@ -215,6 +218,9 @@ Item {
|
|||||||
sendModal: root.sendModalPopup
|
sendModal: root.sendModalPopup
|
||||||
networkConnectionStore: root.networkConnectionStore
|
networkConnectionStore: root.networkConnectionStore
|
||||||
|
|
||||||
|
dappsEnabled: root.dappsEnabled
|
||||||
|
swapEnabled: root.swapEnabled
|
||||||
|
|
||||||
headerButton.text: RootStore.overview.ens || StatusQUtils.Utils.elideAndFormatWalletAddress(RootStore.overview.mixedcaseAddress)
|
headerButton.text: RootStore.overview.ens || StatusQUtils.Utils.elideAndFormatWalletAddress(RootStore.overview.mixedcaseAddress)
|
||||||
headerButton.visible: !RootStore.overview.isAllAccounts
|
headerButton.visible: !RootStore.overview.isAllAccounts
|
||||||
onLaunchShareAddressModal: Global.openShowQRPopup({
|
onLaunchShareAddressModal: Global.openShowQRPopup({
|
||||||
@ -292,6 +298,7 @@ Item {
|
|||||||
height: visible ? 61: implicitHeight
|
height: visible ? 61: implicitHeight
|
||||||
walletStore: RootStore
|
walletStore: RootStore
|
||||||
transactionStore: root.transactionStore
|
transactionStore: root.transactionStore
|
||||||
|
swapEnabled: root.swapEnabled
|
||||||
networkConnectionStore: root.networkConnectionStore
|
networkConnectionStore: root.networkConnectionStore
|
||||||
isCommunityOwnershipTransfer: footer.isHoldingSelected && footer.isOwnerCommunityCollectible
|
isCommunityOwnershipTransfer: footer.isHoldingSelected && footer.isOwnerCommunityCollectible
|
||||||
communityName: {
|
communityName: {
|
||||||
|
@ -25,6 +25,8 @@ Rectangle {
|
|||||||
property var networkConnectionStore
|
property var networkConnectionStore
|
||||||
required property TransactionStore transactionStore
|
required property TransactionStore transactionStore
|
||||||
|
|
||||||
|
property bool swapEnabled
|
||||||
|
|
||||||
// Community-token related properties:
|
// Community-token related properties:
|
||||||
required property bool isCommunityOwnershipTransfer
|
required property bool isCommunityOwnershipTransfer
|
||||||
property string communityName: ""
|
property string communityName: ""
|
||||||
@ -76,7 +78,7 @@ Rectangle {
|
|||||||
|
|
||||||
readonly property bool buyActionAvailable: !isCollectibleViewed
|
readonly property bool buyActionAvailable: !isCollectibleViewed
|
||||||
|
|
||||||
readonly property bool swapActionAvailable: Global.featureFlags.swapEnabled
|
readonly property bool swapActionAvailable: root.swapEnabled
|
||||||
&& !walletStore.overview.isWatchOnlyAccount
|
&& !walletStore.overview.isWatchOnlyAccount
|
||||||
&& walletStore.overview.canSend
|
&& walletStore.overview.canSend
|
||||||
&& !d.isCollectibleViewed
|
&& !d.isCollectibleViewed
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import QtQuick 2.13
|
import QtQuick 2.15
|
||||||
import QtQuick.Layouts 1.13
|
import QtQuick.Controls 2.15
|
||||||
|
import QtQuick.Layouts 1.15
|
||||||
import QtQml 2.15
|
import QtQml 2.15
|
||||||
|
|
||||||
import StatusQ 0.1
|
import StatusQ 0.1
|
||||||
@ -25,6 +26,8 @@ Item {
|
|||||||
property var store
|
property var store
|
||||||
property var walletStore
|
property var walletStore
|
||||||
|
|
||||||
|
property bool dappsEnabled
|
||||||
|
|
||||||
property alias headerButton: headerButton
|
property alias headerButton: headerButton
|
||||||
property alias networkFilter: networkFilter
|
property alias networkFilter: networkFilter
|
||||||
|
|
||||||
@ -134,7 +137,7 @@ Item {
|
|||||||
spacing: 8
|
spacing: 8
|
||||||
|
|
||||||
visible: !root.walletStore.showSavedAddresses
|
visible: !root.walletStore.showSavedAddresses
|
||||||
&& Global.featureFlags.dappsEnabled
|
&& root.dappsEnabled
|
||||||
&& Global.walletConnectService.isServiceAvailableForAddressSelection
|
&& Global.walletConnectService.isServiceAvailableForAddressSelection
|
||||||
enabled: !!Global.walletConnectService
|
enabled: !!Global.walletConnectService
|
||||||
|
|
||||||
|
@ -14,6 +14,9 @@ FocusScope {
|
|||||||
property var communitiesStore
|
property var communitiesStore
|
||||||
property var networkConnectionStore
|
property var networkConnectionStore
|
||||||
|
|
||||||
|
property bool dappsEnabled
|
||||||
|
property bool swapEnabled
|
||||||
|
|
||||||
property var sendModal
|
property var sendModal
|
||||||
|
|
||||||
property alias header: header
|
property alias header: header
|
||||||
@ -33,6 +36,7 @@ FocusScope {
|
|||||||
store: root.store
|
store: root.store
|
||||||
walletStore: RootStore
|
walletStore: RootStore
|
||||||
networkConnectionStore: root.networkConnectionStore
|
networkConnectionStore: root.networkConnectionStore
|
||||||
|
dappsEnabled: root.dappsEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
@ -219,7 +219,7 @@ RightTabBaseView {
|
|||||||
!RootStore.overview.isWatchOnlyAccount && RootStore.overview.canSend
|
!RootStore.overview.isWatchOnlyAccount && RootStore.overview.canSend
|
||||||
communitySendEnabled: RootStore.tokensStore.showCommunityAssetsInSend
|
communitySendEnabled: RootStore.tokensStore.showCommunityAssetsInSend
|
||||||
swapEnabled: !RootStore.overview.isWatchOnlyAccount
|
swapEnabled: !RootStore.overview.isWatchOnlyAccount
|
||||||
swapVisible: Global.featureFlags.swapEnabled
|
swapVisible: root.swapEnabled
|
||||||
|
|
||||||
onSendRequested: {
|
onSendRequested: {
|
||||||
const modal = root.sendModal
|
const modal = root.sendModal
|
||||||
|
7
ui/app/AppLayouts/stores/FeatureFlagsStore.qml
Normal file
7
ui/app/AppLayouts/stores/FeatureFlagsStore.qml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import QtQml 2.15
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
property bool connectorEnabled
|
||||||
|
property bool dappsEnabled
|
||||||
|
property bool swapEnabled
|
||||||
|
}
|
@ -1 +1,2 @@
|
|||||||
RootStore 1.0 RootStore.qml
|
RootStore 1.0 RootStore.qml
|
||||||
|
FeatureFlagsStore 1.0 FeatureFlagsStore.qml
|
||||||
|
@ -79,6 +79,14 @@ Item {
|
|||||||
tokensStore: appMain.tokensStore
|
tokensStore: appMain.tokensStore
|
||||||
currencyStore: appMain.currencyStore
|
currencyStore: appMain.currencyStore
|
||||||
}
|
}
|
||||||
|
readonly property FeatureFlagsStore featureFlagsStore: FeatureFlagsStore {
|
||||||
|
readonly property var featureFlags: typeof featureFlagsRootContextProperty !== undefined ? featureFlagsRootContextProperty : null
|
||||||
|
|
||||||
|
connectorEnabled: featureFlags ? featureFlags.connectorEnabled : false
|
||||||
|
dappsEnabled: featureFlags ? featureFlags.dappsEnabled : false
|
||||||
|
swapEnabled: featureFlags ? featureFlags.swapEnabled : false
|
||||||
|
}
|
||||||
|
|
||||||
required property bool isCentralizedMetricsEnabled
|
required property bool isCentralizedMetricsEnabled
|
||||||
|
|
||||||
// set from main.qml
|
// set from main.qml
|
||||||
@ -1379,6 +1387,8 @@ Item {
|
|||||||
sendModalPopup: sendModal
|
sendModalPopup: sendModal
|
||||||
networkConnectionStore: appMain.networkConnectionStore
|
networkConnectionStore: appMain.networkConnectionStore
|
||||||
appMainVisible: appMain.visible
|
appMainVisible: appMain.visible
|
||||||
|
dappsEnabled: featureFlagsStore.dappsEnabled
|
||||||
|
swapEnabled: featureFlagsStore.swapEnabled
|
||||||
}
|
}
|
||||||
onLoaded: {
|
onLoaded: {
|
||||||
item.resetView()
|
item.resetView()
|
||||||
@ -2137,7 +2147,7 @@ Item {
|
|||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: dappsConnectorSDKLoader
|
id: dappsConnectorSDKLoader
|
||||||
active: Global.featureFlags.connectorEnabled
|
active: featureFlagsStore.connectorEnabled
|
||||||
sourceComponent: dappsConnectorSDK
|
sourceComponent: dappsConnectorSDK
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2145,7 +2155,7 @@ Item {
|
|||||||
id: walletConnectServiceLoader
|
id: walletConnectServiceLoader
|
||||||
|
|
||||||
// It seems some of the functionality of the dapp connector depends on the WalletConnectService
|
// It seems some of the functionality of the dapp connector depends on the WalletConnectService
|
||||||
active: (Global.featureFlags.dappsEnabled || Global.featureFlags.connectorEnabled) && appMain.visible
|
active: (featureFlagsStore.dappsEnabled || featureFlagsStore.connectorEnabled) && appMain.visible
|
||||||
|
|
||||||
sourceComponent: WalletConnectService {
|
sourceComponent: WalletConnectService {
|
||||||
id: walletConnectService
|
id: walletConnectService
|
||||||
|
@ -17,9 +17,6 @@ QtObject {
|
|||||||
// use the generic var as type to break the cyclic dependency
|
// use the generic var as type to break the cyclic dependency
|
||||||
property var walletConnectService: null
|
property var walletConnectService: null
|
||||||
|
|
||||||
// avoid lookup of context property in QML
|
|
||||||
readonly property var featureFlags: featureFlagsRootContextProperty
|
|
||||||
|
|
||||||
signal openPinnedMessagesPopupRequested(var store, var messageStore, var pinnedMessagesModel, string messageToPin, string chatId)
|
signal openPinnedMessagesPopupRequested(var store, var messageStore, var pinnedMessagesModel, string messageToPin, string chatId)
|
||||||
signal openCommunityProfilePopupRequested(var store, var community, var chatCommunitySectionModule)
|
signal openCommunityProfilePopupRequested(var store, var community, var chatCommunitySectionModule)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user