feat: add a setting to enable creation of sharded communities
Needed for https://github.com/status-im/status-desktop/issues/12197
This commit is contained in:
parent
d19e95cb5b
commit
892c4eaa2f
|
@ -18,6 +18,8 @@ const DEFAULT_CUSTOM_MOUSE_SCROLLING_ENABLED = false
|
||||||
const DEFAULT_VISIBILITY = 2 #windowed visibility, from qml
|
const DEFAULT_VISIBILITY = 2 #windowed visibility, from qml
|
||||||
const LAS_KEY_FAKE_LOADING_SCREEN_ENABLED = "global/fake_loading_screen"
|
const LAS_KEY_FAKE_LOADING_SCREEN_ENABLED = "global/fake_loading_screen"
|
||||||
const DEFAULT_FAKE_LOADING_SCREEN_ENABLED = defined(production) and (not existsEnv(TEST_ENVIRONMENT_VAR)) #enabled in production, disabled in development and e2e tests
|
const DEFAULT_FAKE_LOADING_SCREEN_ENABLED = defined(production) and (not existsEnv(TEST_ENVIRONMENT_VAR)) #enabled in production, disabled in development and e2e tests
|
||||||
|
const LAS_KEY_SHARDED_COMMUNITIES_ENABLED = "global/sharded_communities"
|
||||||
|
const DEFAULT_LAS_KEY_SHARDED_COMMUNITIES_ENABLED = false
|
||||||
|
|
||||||
QtObject:
|
QtObject:
|
||||||
type LocalAppSettings* = ref object of QObject
|
type LocalAppSettings* = ref object of QObject
|
||||||
|
@ -160,3 +162,16 @@ QtObject:
|
||||||
read = getFakeLoadingScreenEnabled
|
read = getFakeLoadingScreenEnabled
|
||||||
write = setFakeLoadingScreenEnabled
|
write = setFakeLoadingScreenEnabled
|
||||||
notify = fakeLoadingScreenEnabledChanged
|
notify = fakeLoadingScreenEnabledChanged
|
||||||
|
|
||||||
|
proc wakuV2ShardedCommunitiesEnabledChanged*(self: LocalAppSettings) {.signal.}
|
||||||
|
proc getWakuV2ShardedCommunitiesEnabled*(self: LocalAppSettings): bool {.slot.} =
|
||||||
|
self.settings.value(LAS_KEY_SHARDED_COMMUNITIES_ENABLED, newQVariant(DEFAULT_LAS_KEY_SHARDED_COMMUNITIES_ENABLED)).boolVal
|
||||||
|
|
||||||
|
proc setWakuV2ShardedCommunitiesEnabled*(self: LocalAppSettings, enabled: bool) {.slot.} =
|
||||||
|
self.settings.setValue(LAS_KEY_SHARDED_COMMUNITIES_ENABLED, newQVariant(enabled))
|
||||||
|
self.wakuV2ShardedCommunitiesEnabledChanged()
|
||||||
|
|
||||||
|
QtProperty[bool] wakuV2ShardedCommunitiesEnabled:
|
||||||
|
read = getWakuV2ShardedCommunitiesEnabled
|
||||||
|
write = setWakuV2ShardedCommunitiesEnabled
|
||||||
|
notify = wakuV2ShardedCommunitiesEnabledChanged
|
||||||
|
|
|
@ -14,6 +14,7 @@ QtObject {
|
||||||
property bool isAutoMessageEnabled: advancedModule? advancedModule.isAutoMessageEnabled : false
|
property bool isAutoMessageEnabled: advancedModule? advancedModule.isAutoMessageEnabled : false
|
||||||
property bool isDebugEnabled: advancedModule? advancedModule.isDebugEnabled : false
|
property bool isDebugEnabled: advancedModule? advancedModule.isDebugEnabled : false
|
||||||
property bool isWakuV2StoreEnabled: advancedModule ? advancedModule.isWakuV2StoreEnabled : false
|
property bool isWakuV2StoreEnabled: advancedModule ? advancedModule.isWakuV2StoreEnabled : false
|
||||||
|
readonly property bool isWakuV2ShardedCommunitiesEnabled: localAppSettings.wakuV2ShardedCommunitiesEnabled ?? false
|
||||||
property int logMaxBackups: advancedModule ? advancedModule.logMaxBackups : 1
|
property int logMaxBackups: advancedModule ? advancedModule.logMaxBackups : 1
|
||||||
|
|
||||||
property var customNetworksModel: advancedModule? advancedModule.customNetworksModel : []
|
property var customNetworksModel: advancedModule? advancedModule.customNetworksModel : []
|
||||||
|
@ -150,6 +151,13 @@ QtObject {
|
||||||
localAppSettings.fakeLoadingScreenEnabled = !localAppSettings.fakeLoadingScreenEnabled
|
localAppSettings.fakeLoadingScreenEnabled = !localAppSettings.fakeLoadingScreenEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleWakuV2ShardedCommunities() {
|
||||||
|
if(!localAppSettings)
|
||||||
|
return
|
||||||
|
|
||||||
|
localAppSettings.wakuV2ShardedCommunitiesEnabled = !localAppSettings.wakuV2ShardedCommunitiesEnabled
|
||||||
|
}
|
||||||
|
|
||||||
function setCustomScrollingEnabled(value) {
|
function setCustomScrollingEnabled(value) {
|
||||||
if(!localAppSettings)
|
if(!localAppSettings)
|
||||||
return
|
return
|
||||||
|
|
|
@ -82,7 +82,6 @@ SettingsContentBase {
|
||||||
anchors.leftMargin: Style.current.padding
|
anchors.leftMargin: Style.current.padding
|
||||||
anchors.rightMargin: Style.current.padding
|
anchors.rightMargin: Style.current.padding
|
||||||
text: qsTr("Application Logs")
|
text: qsTr("Application Logs")
|
||||||
font.pixelSize: 15
|
|
||||||
font.underline: mouseArea.containsMouse
|
font.underline: mouseArea.containsMouse
|
||||||
color: Style.current.blue
|
color: Style.current.blue
|
||||||
topPadding: 23
|
topPadding: 23
|
||||||
|
@ -167,6 +166,17 @@ SettingsContentBase {
|
||||||
bottomPadding: Style.current.padding
|
bottomPadding: Style.current.padding
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: replace with StatusQ component
|
||||||
|
StatusSettingsLineButton {
|
||||||
|
anchors.leftMargin: 0
|
||||||
|
anchors.rightMargin: 0
|
||||||
|
text: qsTr("Enable creation of sharded communities")
|
||||||
|
isSwitch: true
|
||||||
|
visible: root.advancedStore.isWakuV2
|
||||||
|
switchChecked: root.advancedStore.isWakuV2ShardedCommunitiesEnabled
|
||||||
|
onClicked: root.advancedStore.toggleWakuV2ShardedCommunities()
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: replace with StatusQ component
|
// TODO: replace with StatusQ component
|
||||||
StatusSettingsLineButton {
|
StatusSettingsLineButton {
|
||||||
anchors.leftMargin: 0
|
anchors.leftMargin: 0
|
||||||
|
@ -454,6 +464,7 @@ SettingsContentBase {
|
||||||
property bool mode: false
|
property bool mode: false
|
||||||
|
|
||||||
id: confirmDialog
|
id: confirmDialog
|
||||||
|
destroyOnClose: true
|
||||||
showCancelButton: true
|
showCancelButton: true
|
||||||
confirmationText: qsTr("Are you sure you want to enable all the developer features? The app will be restarted.")
|
confirmationText: qsTr("Are you sure you want to enable all the developer features? The app will be restarted.")
|
||||||
onConfirmButtonClicked: {
|
onConfirmButtonClicked: {
|
||||||
|
@ -473,6 +484,7 @@ SettingsContentBase {
|
||||||
property bool mode: false
|
property bool mode: false
|
||||||
|
|
||||||
id: confirmDialog
|
id: confirmDialog
|
||||||
|
destroyOnClose: true
|
||||||
showCancelButton: true
|
showCancelButton: true
|
||||||
confirmationText: qsTr("Are you sure you want to enable telemetry? This will reduce your privacy level while using Status. You need to restart the app for this change to take effect.")
|
confirmationText: qsTr("Are you sure you want to enable telemetry? This will reduce your privacy level while using Status. You need to restart the app for this change to take effect.")
|
||||||
onConfirmButtonClicked: {
|
onConfirmButtonClicked: {
|
||||||
|
@ -491,6 +503,7 @@ SettingsContentBase {
|
||||||
property bool mode: false
|
property bool mode: false
|
||||||
|
|
||||||
id: confirmDialog
|
id: confirmDialog
|
||||||
|
destroyOnClose: true
|
||||||
showCancelButton: true
|
showCancelButton: true
|
||||||
confirmationText: qsTr("Are you sure you want to enable auto message? You need to restart the app for this change to take effect.")
|
confirmationText: qsTr("Are you sure you want to enable auto message? You need to restart the app for this change to take effect.")
|
||||||
onConfirmButtonClicked: {
|
onConfirmButtonClicked: {
|
||||||
|
@ -509,6 +522,7 @@ SettingsContentBase {
|
||||||
property bool mode: false
|
property bool mode: false
|
||||||
|
|
||||||
id: confirmDialog
|
id: confirmDialog
|
||||||
|
destroyOnClose: true
|
||||||
showCancelButton: true
|
showCancelButton: true
|
||||||
confirmationText: qsTr("Are you sure you want to %1 WakuV2 Store? You need to restart the app for this change to take effect.")
|
confirmationText: qsTr("Are you sure you want to %1 WakuV2 Store? You need to restart the app for this change to take effect.")
|
||||||
.arg(root.advancedStore.isWakuV2StoreEnabled ?
|
.arg(root.advancedStore.isWakuV2StoreEnabled ?
|
||||||
|
@ -530,6 +544,7 @@ SettingsContentBase {
|
||||||
property bool mode: false
|
property bool mode: false
|
||||||
|
|
||||||
id: confirmDialog
|
id: confirmDialog
|
||||||
|
destroyOnClose: true
|
||||||
showCancelButton: true
|
showCancelButton: true
|
||||||
confirmationText: qsTr("Are you sure you want to %1 debug mode? You need to restart the app for this change to take effect.").arg(root.advancedStore.isDebugEnabled ?
|
confirmationText: qsTr("Are you sure you want to %1 debug mode? You need to restart the app for this change to take effect.").arg(root.advancedStore.isDebugEnabled ?
|
||||||
qsTr("disable") :
|
qsTr("disable") :
|
||||||
|
@ -559,8 +574,6 @@ SettingsContentBase {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
font.pixelSize: 15
|
|
||||||
color: Theme.palette.directColor1
|
|
||||||
padding: 15
|
padding: 15
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
text: qsTr("Choose a number between 1 and 100")
|
text: qsTr("Choose a number between 1 and 100")
|
||||||
|
@ -587,8 +600,6 @@ SettingsContentBase {
|
||||||
|
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
font.pixelSize: 15
|
|
||||||
color: Theme.palette.directColor1
|
|
||||||
padding: 15
|
padding: 15
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
text: qsTr("This change will only come into action after a restart")
|
text: qsTr("This change will only come into action after a restart")
|
||||||
|
|
Loading…
Reference in New Issue