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

View File

@ -34,6 +34,11 @@ SettingsContentBase {
width: root.contentWidth
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 {
id: generalColumn
anchors.top: parent.top
@ -146,7 +151,7 @@ SettingsContentBase {
anchors.right: parent.right
anchors.leftMargin: 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")
topPadding: Style.current.bigPadding
bottomPadding: Style.current.padding
@ -211,9 +216,9 @@ SettingsContentBase {
}
onClosed: {
switch(root.advancedStore.bloomLevel){
case "light": btnBloomLight.click(); break;
case "normal": btnBloomNormal.click(); break;
case "full": btnBloomFull.click(); break;
case "light": btnBloomLight.toggle(); break;
case "normal": btnBloomNormal.toggle(); break;
case "full": btnBloomFull.toggle(); break;
}
destroy()
}
@ -230,11 +235,7 @@ SettingsContentBase {
checkedByDefault: root.advancedStore.bloomLevel == "light"
btnText: qsTr("Light Node")
onToggled: {
if (root.advancedStore.bloomLevel != "light") {
Global.openPopup(bloomConfirmationDialogComponent, {mode: "light"})
} else {
btnBloomLight.click()
}
Global.openPopup(bloomConfirmationDialogComponent, {mode: "light"})
}
}
@ -244,11 +245,7 @@ SettingsContentBase {
checkedByDefault: root.advancedStore.bloomLevel == "normal"
btnText: qsTr("Normal")
onToggled: {
if (root.advancedStore.bloomLevel != "normal") {
Global.openPopup(bloomConfirmationDialogComponent, {mode: "normal"})
} else {
btnBloomNormal.click()
}
Global.openPopup(bloomConfirmationDialogComponent, {mode: "normal"})
}
}
@ -258,11 +255,7 @@ SettingsContentBase {
checkedByDefault: root.advancedStore.bloomLevel == "full"
btnText: qsTr("Full Node")
onToggled: {
if (root.advancedStore.bloomLevel != "full") {
Global.openPopup(bloomConfirmationDialogComponent, {mode: "full"})
} else {
btnBloomFull.click()
}
Global.openPopup(bloomConfirmationDialogComponent, {mode: "full"})
}
}
}
@ -273,22 +266,31 @@ SettingsContentBase {
anchors.leftMargin: Style.current.padding
anchors.rightMargin: Style.current.padding
spacing: 11
visible: root.advancedStore.isWakuV2 && root.advancedStore.fleet != Constants.status_prod
visible: root.advancedStore.isWakuV2
Component {
id: wakuV2ModeConfirmationDialogComponent
ConfirmationDialog {
property bool mode: false
ConfirmationDialog {
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: {
root.advancedStore.setWakuV2LightClientEnabled(mode)
root.advancedStore.setWakuV2LightClientEnabled(lightMode)
}
onCancelButtonClicked: {
close()
}
onClosed: {
if(root.advancedStore.wakuV2LightClientEnabled){
btnWakuV2Light.click()
if (root.advancedStore.wakuV2LightClientEnabled){
btnWakuV2Light.toggle()
} else {
btnWakuV2Full.click();
btnWakuV2Full.toggle()
}
destroy()
}
@ -303,13 +305,9 @@ SettingsContentBase {
id: btnWakuV2Light
buttonGroup: wakuV2Group
checkedByDefault: root.advancedStore.wakuV2LightClientEnabled
btnText: qsTr("Light Node")
btnText: qsTr("Light mode")
onToggled: {
if (!root.advancedStore.wakuV2LightClientEnabled) {
Global.openPopup(wakuV2ModeConfirmationDialogComponent, {mode: true})
} else {
btnWakuV2Light.click()
}
Global.openPopup(wakuV2ModeConfirmationDialogComponent, { lightMode: true })
}
}
@ -317,13 +315,9 @@ SettingsContentBase {
id: btnWakuV2Full
buttonGroup: wakuV2Group
checkedByDefault: !root.advancedStore.wakuV2LightClientEnabled
btnText: qsTr("Full Node")
btnText: qsTr("Relay mode")
onToggled: {
if (root.advancedStore.wakuV2LightClientEnabled) {
Global.openPopup(wakuV2ModeConfirmationDialogComponent, {mode: false})
} else {
btnWakuV2Full.click()
}
Global.openPopup(wakuV2ModeConfirmationDialogComponent, { lightMode: false })
}
}
}
@ -451,7 +445,7 @@ SettingsContentBase {
id: confirmDialog
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: {
localAccountSensitiveSettings.downloadChannelMessagesEnabled = true
Qt.callLater(root.advancedStore.enableDeveloperFeatures)
@ -615,14 +609,13 @@ SettingsContentBase {
id: confirmationPopup
property string experimentalFeature: ""
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")
onConfirmButtonClicked: {
root.advancedStore.toggleExperimentalFeature(experimentalFeature)
experimentalFeature = ""
close()
}
onCancelButtonClicked: {
close()
}

2
vendor/status-go vendored

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