fix: Re-enable light mode for status.prod (#11042)

This commit is contained in:
Igor Sirotin 2023-06-15 21:34:25 +03:00 committed by GitHub
parent 373608d744
commit 60d78eb0ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 53 deletions

View File

@ -9,25 +9,24 @@ import shared.panels 1.0
import StatusQ.Controls 0.1 import StatusQ.Controls 0.1
Rectangle { Rectangle {
id: root
property var buttonGroup property var buttonGroup
property string btnText: qsTr("TODO") property string btnText: qsTr("TODO")
property bool hovered: false
property bool checkedByDefault: false property bool checkedByDefault: false
signal checked() signal checked()
signal toggled(bool checked) signal toggled(bool checked)
function click(){ function toggle() {
radioBtn.toggle() radioBtn.toggle()
} }
id: root border.color: mouseArea.containsMouse || radioBtn.checked ? Style.current.primary : Style.current.border
border.color: hovered || radioBtn.checked ? Style.current.primary : Style.current.border
border.width: 1 border.width: 1
color: Style.current.transparent color: Style.current.transparent
width: 130 implicitWidth: 130
height: 120 implicitHeight: 120
clip: true
radius: Style.current.radius radius: Style.current.radius
StatusRadioButton { StatusRadioButton {
@ -53,14 +52,13 @@ Rectangle {
anchors.topMargin: 6 anchors.topMargin: 6
} }
MouseArea { MouseArea {
id: mouseArea id: mouseArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
onEntered: root.hovered = true
onExited: root.hovered = false
onClicked: { onClicked: {
if (radioBtn.checked)
return
radioBtn.toggle() radioBtn.toggle()
root.toggled(radioBtn.checked) root.toggled(radioBtn.checked)
} }

View File

@ -34,6 +34,11 @@ SettingsContentBase {
width: root.contentWidth width: root.contentWidth
height: generalColumn.height height: generalColumn.height
QtObject {
id: d
readonly property string experimentalFeatureMessage: qsTr("This feature is experimental and is meant for testing purposes by core contributors and the community. It's not meant for real use and makes no claims of security or integrity of funds or data. Use at your own risk.")
}
Column { Column {
id: generalColumn id: generalColumn
anchors.top: parent.top anchors.top: parent.top
@ -146,7 +151,7 @@ SettingsContentBase {
anchors.right: parent.right anchors.right: parent.right
anchors.leftMargin: Style.current.padding anchors.leftMargin: Style.current.padding
anchors.rightMargin: Style.current.padding anchors.rightMargin: Style.current.padding
visible: root.advancedStore.isWakuV2 && root.advancedStore.fleet != Constants.status_prod visible: root.advancedStore.isWakuV2
text: qsTr("WakuV2 options") text: qsTr("WakuV2 options")
topPadding: Style.current.bigPadding topPadding: Style.current.bigPadding
bottomPadding: Style.current.padding bottomPadding: Style.current.padding
@ -211,9 +216,9 @@ SettingsContentBase {
} }
onClosed: { onClosed: {
switch(root.advancedStore.bloomLevel){ switch(root.advancedStore.bloomLevel){
case "light": btnBloomLight.click(); break; case "light": btnBloomLight.toggle(); break;
case "normal": btnBloomNormal.click(); break; case "normal": btnBloomNormal.toggle(); break;
case "full": btnBloomFull.click(); break; case "full": btnBloomFull.toggle(); break;
} }
destroy() destroy()
} }
@ -230,11 +235,7 @@ SettingsContentBase {
checkedByDefault: root.advancedStore.bloomLevel == "light" checkedByDefault: root.advancedStore.bloomLevel == "light"
btnText: qsTr("Light Node") btnText: qsTr("Light Node")
onToggled: { onToggled: {
if (root.advancedStore.bloomLevel != "light") {
Global.openPopup(bloomConfirmationDialogComponent, {mode: "light"}) Global.openPopup(bloomConfirmationDialogComponent, {mode: "light"})
} else {
btnBloomLight.click()
}
} }
} }
@ -244,11 +245,7 @@ SettingsContentBase {
checkedByDefault: root.advancedStore.bloomLevel == "normal" checkedByDefault: root.advancedStore.bloomLevel == "normal"
btnText: qsTr("Normal") btnText: qsTr("Normal")
onToggled: { onToggled: {
if (root.advancedStore.bloomLevel != "normal") {
Global.openPopup(bloomConfirmationDialogComponent, {mode: "normal"}) Global.openPopup(bloomConfirmationDialogComponent, {mode: "normal"})
} else {
btnBloomNormal.click()
}
} }
} }
@ -258,11 +255,7 @@ SettingsContentBase {
checkedByDefault: root.advancedStore.bloomLevel == "full" checkedByDefault: root.advancedStore.bloomLevel == "full"
btnText: qsTr("Full Node") btnText: qsTr("Full Node")
onToggled: { onToggled: {
if (root.advancedStore.bloomLevel != "full") {
Global.openPopup(bloomConfirmationDialogComponent, {mode: "full"}) Global.openPopup(bloomConfirmationDialogComponent, {mode: "full"})
} else {
btnBloomFull.click()
}
} }
} }
} }
@ -273,22 +266,31 @@ SettingsContentBase {
anchors.leftMargin: Style.current.padding anchors.leftMargin: Style.current.padding
anchors.rightMargin: Style.current.padding anchors.rightMargin: Style.current.padding
spacing: 11 spacing: 11
visible: root.advancedStore.isWakuV2 && root.advancedStore.fleet != Constants.status_prod visible: root.advancedStore.isWakuV2
Component { Component {
id: wakuV2ModeConfirmationDialogComponent id: wakuV2ModeConfirmationDialogComponent
ConfirmationDialog {
property bool mode: false
ConfirmationDialog {
id: confirmDialog id: confirmDialog
confirmationText: qsTr("The account will be logged out. When you login again, the selected mode will be enabled")
property bool lightMode: false
confirmationText: (!lightMode ? "" : (d.experimentalFeatureMessage + "\n\n"))
+ qsTr("The account will be logged out. When you login again, the selected mode will be enabled")
confirmButtonLabel: lightMode ? qsTr("I understand") : qsTr("Confirm")
showCancelButton: lightMode
onConfirmButtonClicked: { onConfirmButtonClicked: {
root.advancedStore.setWakuV2LightClientEnabled(mode) root.advancedStore.setWakuV2LightClientEnabled(lightMode)
}
onCancelButtonClicked: {
close()
} }
onClosed: { onClosed: {
if(root.advancedStore.wakuV2LightClientEnabled){ if (root.advancedStore.wakuV2LightClientEnabled){
btnWakuV2Light.click() btnWakuV2Light.toggle()
} else { } else {
btnWakuV2Full.click(); btnWakuV2Full.toggle()
} }
destroy() destroy()
} }
@ -303,13 +305,9 @@ SettingsContentBase {
id: btnWakuV2Light id: btnWakuV2Light
buttonGroup: wakuV2Group buttonGroup: wakuV2Group
checkedByDefault: root.advancedStore.wakuV2LightClientEnabled checkedByDefault: root.advancedStore.wakuV2LightClientEnabled
btnText: qsTr("Light Node") btnText: qsTr("Light mode")
onToggled: { onToggled: {
if (!root.advancedStore.wakuV2LightClientEnabled) { Global.openPopup(wakuV2ModeConfirmationDialogComponent, { lightMode: true })
Global.openPopup(wakuV2ModeConfirmationDialogComponent, {mode: true})
} else {
btnWakuV2Light.click()
}
} }
} }
@ -317,13 +315,9 @@ SettingsContentBase {
id: btnWakuV2Full id: btnWakuV2Full
buttonGroup: wakuV2Group buttonGroup: wakuV2Group
checkedByDefault: !root.advancedStore.wakuV2LightClientEnabled checkedByDefault: !root.advancedStore.wakuV2LightClientEnabled
btnText: qsTr("Full Node") btnText: qsTr("Relay mode")
onToggled: { onToggled: {
if (root.advancedStore.wakuV2LightClientEnabled) { Global.openPopup(wakuV2ModeConfirmationDialogComponent, { lightMode: false })
Global.openPopup(wakuV2ModeConfirmationDialogComponent, {mode: false})
} else {
btnWakuV2Full.click()
}
} }
} }
} }
@ -451,7 +445,7 @@ SettingsContentBase {
id: confirmDialog id: confirmDialog
showCancelButton: true showCancelButton: true
confirmationText: qsTr("Are you sure you want to enable all the develoer 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: {
localAccountSensitiveSettings.downloadChannelMessagesEnabled = true localAccountSensitiveSettings.downloadChannelMessagesEnabled = true
Qt.callLater(root.advancedStore.enableDeveloperFeatures) Qt.callLater(root.advancedStore.enableDeveloperFeatures)
@ -615,14 +609,13 @@ SettingsContentBase {
id: confirmationPopup id: confirmationPopup
property string experimentalFeature: "" property string experimentalFeature: ""
showCancelButton: true showCancelButton: true
confirmationText: qsTr("This feature is experimental and is meant for testing purposes by core contributors and the community. It's not meant for real use and makes no claims of security or integrity of funds or data. Use at your own risk.") confirmationText: d.experimentalFeatureMessage
confirmButtonLabel: qsTr("I understand") confirmButtonLabel: qsTr("I understand")
onConfirmButtonClicked: { onConfirmButtonClicked: {
root.advancedStore.toggleExperimentalFeature(experimentalFeature) root.advancedStore.toggleExperimentalFeature(experimentalFeature)
experimentalFeature = "" experimentalFeature = ""
close() close()
} }
onCancelButtonClicked: { onCancelButtonClicked: {
close() close()
} }

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit ccde92377dcc46300ec485f4ff88bfd4e753ed47 Subproject commit 4a50e17d57c827952e46c46de5468ad8460e2641