feat(@desktop/settings): [re-add] Add developer mode toggle
Fixes #4700
This commit is contained in:
parent
aeed9303cd
commit
967fff839b
|
@ -100,6 +100,13 @@ method setWakuV2LightClientEnabled*(self: Controller, enabled: bool) =
|
|||
|
||||
self.delegate.onWakuV2LightClientSet()
|
||||
|
||||
method enableDeveloperFeatures*(self: Controller) =
|
||||
discard self.settingsService.saveTelemetryServerUrl(DEFAULT_TELEMETRY_SERVER_URL)
|
||||
discard self.settingsService.saveAutoMessageEnabled(true)
|
||||
discard self.nodeConfigurationService.setDebugLevel(LogLevel.DEBUG)
|
||||
|
||||
quit(QuitSuccess) # quits the app TODO: change this to logout instead when supported
|
||||
|
||||
method toggleTelemetry*(self: Controller) =
|
||||
var value = ""
|
||||
if(not self.isTelemetryEnabled()):
|
||||
|
|
|
@ -34,6 +34,9 @@ method getWakuV2LightClientEnabled*(self: AccessInterface): bool {.base.} =
|
|||
method setWakuV2LightClientEnabled*(self: AccessInterface, enabled: bool) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method enableDeveloperFeatures*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method toggleTelemetry*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
|
|
|
@ -104,6 +104,9 @@ method onWakuV2LightClientSet*(self: Module) =
|
|||
method isTelemetryEnabled*(self: Module): bool =
|
||||
self.controller.isTelemetryEnabled()
|
||||
|
||||
method enableDeveloperFeatures*(self: Module) =
|
||||
self.controller.enableDeveloperFeatures()
|
||||
|
||||
method toggleTelemetry*(self: Module) =
|
||||
self.controller.toggleTelemetry()
|
||||
|
||||
|
@ -126,8 +129,7 @@ method toggleDebug*(self: Module) =
|
|||
self.controller.toggleDebug()
|
||||
|
||||
method onDebugToggled*(self: Module) =
|
||||
info "quit the app because of successful debug level changed"
|
||||
quit(QuitSuccess) # quits the app TODO: change this to logout instead when supported
|
||||
self.view.isDebugEnabledChanged()
|
||||
|
||||
method addCustomNetwork*(self: Module, name: string, endpoint: string, networkId: int, networkType: string) =
|
||||
var network: settings_service.Network
|
||||
|
|
|
@ -64,3 +64,6 @@ method toggleCommunitySection*(self: AccessInterface) {.base.} =
|
|||
|
||||
method toggleNodeManagementSection*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method enableDeveloperFeatures*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
|
@ -153,3 +153,6 @@ QtObject:
|
|||
|
||||
proc toggleNodeManagementSection*(self: View) {.slot.} =
|
||||
self.delegate.toggleNodeManagementSection()
|
||||
|
||||
proc enableDeveloperFeatures*(self: View) {.slot.} =
|
||||
self.delegate.enableDeveloperFeatures()
|
|
@ -98,6 +98,13 @@ QtObject {
|
|||
root.advancedModule.toggleDebug()
|
||||
}
|
||||
|
||||
function enableDeveloperFeatures() {
|
||||
if(!root.advancedModule)
|
||||
return
|
||||
|
||||
root.advancedModule.enableDeveloperFeatures()
|
||||
}
|
||||
|
||||
function addCustomNetwork(name, endpoint, networkId, networkType) {
|
||||
if(!root.advancedModule)
|
||||
return
|
||||
|
|
|
@ -374,6 +374,41 @@ ScrollView {
|
|||
}
|
||||
}
|
||||
|
||||
StatusSectionHeadline {
|
||||
text: qsTr("Developer features")
|
||||
topPadding: Style.current.bigPadding
|
||||
bottomPadding: Style.current.padding
|
||||
}
|
||||
|
||||
Separator {
|
||||
anchors.topMargin: Style.current.bigPadding
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: -Style.current.padding
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: -Style.current.padding
|
||||
}
|
||||
|
||||
StatusSettingsLineButton {
|
||||
text: qsTr("Full developer mode")
|
||||
isEnabled: {
|
||||
return !localAccountSensitiveSettings.downloadChannelMessagesEnabled ||
|
||||
!root.advancedStore.isTelemetryEnabled ||
|
||||
!root.advancedStore.isDebugEnabled ||
|
||||
!root.advancedStore.isAutoMessageEnabled
|
||||
}
|
||||
onClicked: {
|
||||
Global.openPopup(enableDeveloperFeaturesConfirmationDialogComponent)
|
||||
}
|
||||
}
|
||||
|
||||
Separator {
|
||||
anchors.topMargin: Style.current.bigPadding
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: -Style.current.padding
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: -Style.current.padding
|
||||
}
|
||||
|
||||
// TODO: replace with StatusQ component
|
||||
StatusSettingsLineButton {
|
||||
text: qsTr("Download messages")
|
||||
|
@ -386,22 +421,11 @@ ScrollView {
|
|||
|
||||
// TODO: replace with StatusQ component
|
||||
StatusSettingsLineButton {
|
||||
text: qsTr("Stickers/ENS on ropsten")
|
||||
visible: root.advancedStore.currentNetworkId === Constants.networkRopsten
|
||||
isSwitch: true
|
||||
switchChecked: localAccountSensitiveSettings.stickersEnsRopsten
|
||||
onClicked: {
|
||||
localAccountSensitiveSettings.stickersEnsRopsten = !localAccountSensitiveSettings.stickersEnsRopsten
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: replace with StatusQ component
|
||||
StatusSettingsLineButton {
|
||||
text: qsTr("Enable Telemetry")
|
||||
text: qsTr("Telemetry")
|
||||
isSwitch: true
|
||||
switchChecked: root.advancedStore.isTelemetryEnabled
|
||||
onClicked: {
|
||||
Global.openPopup(enableTelemetryConfirmationDialogComponent, {light: false})
|
||||
Global.openPopup(enableTelemetryConfirmationDialogComponent)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -417,11 +441,22 @@ ScrollView {
|
|||
|
||||
// TODO: replace with StatusQ component
|
||||
StatusSettingsLineButton {
|
||||
text: qsTr("Enable Auto message")
|
||||
text: qsTr("Auto message")
|
||||
isSwitch: true
|
||||
switchChecked: root.advancedStore.isAutoMessageEnabled
|
||||
onClicked: {
|
||||
Global.openPopup(enableAutoMessageConfirmationDialogComponent, {light: false})
|
||||
Global.openPopup(enableAutoMessageConfirmationDialogComponent)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: replace with StatusQ component
|
||||
StatusSettingsLineButton {
|
||||
text: qsTr("Stickers/ENS on ropsten")
|
||||
visible: root.advancedStore.currentNetworkId === Constants.networkRopsten
|
||||
isSwitch: true
|
||||
switchChecked: localAccountSensitiveSettings.stickersEnsRopsten
|
||||
onClicked: {
|
||||
localAccountSensitiveSettings.stickersEnsRopsten = !localAccountSensitiveSettings.stickersEnsRopsten
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -436,6 +471,25 @@ ScrollView {
|
|||
advancedStore: root.advancedStore
|
||||
}
|
||||
|
||||
Component {
|
||||
id: enableDeveloperFeaturesConfirmationDialogComponent
|
||||
ConfirmationDialog {
|
||||
property bool mode: false
|
||||
|
||||
id: confirmDialog
|
||||
showCancelButton: true
|
||||
confirmationText: qsTr("Are you sure you want to enable all the develoer features? The app will be restarted.")
|
||||
onConfirmButtonClicked: {
|
||||
localAccountSensitiveSettings.downloadChannelMessagesEnabled = true
|
||||
Qt.callLater(root.advancedStore.enableDeveloperFeatures)
|
||||
close()
|
||||
}
|
||||
onCancelButtonClicked: {
|
||||
close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: enableTelemetryConfirmationDialogComponent
|
||||
ConfirmationDialog {
|
||||
|
@ -479,7 +533,7 @@ ScrollView {
|
|||
|
||||
id: confirmDialog
|
||||
showCancelButton: true
|
||||
confirmationText: qsTr("Are you sure you want to %1 debug mode? The app will be restarted 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("enable"))
|
||||
onConfirmButtonClicked: {
|
||||
|
|
Loading…
Reference in New Issue