feat: Allow to enable auto message
This commit is contained in:
parent
30d1866ee6
commit
2d49da7331
|
@ -44,6 +44,12 @@ method toggleTelemetry*[T](self: Controller[T]) =
|
|||
method isTelemetryEnabled*[T](self: Controller[T]): bool =
|
||||
return self.settingsService.isTelemetryEnabled()
|
||||
|
||||
method toggleAutoMessage*[T](self: Controller[T]) =
|
||||
self.settingsService.toggleAutoMessage()
|
||||
|
||||
method isAutoMessageEnabled*[T](self: Controller[T]): bool =
|
||||
return self.settingsService.isAutoMessageEnabled()
|
||||
|
||||
method toggleDebug*[T](self: Controller[T]) =
|
||||
self.settingsService.toggleDebug()
|
||||
|
||||
|
|
|
@ -15,6 +15,12 @@ method toggleTelemetry*(self: AccessInterface) {.base.} =
|
|||
method isTelemetryEnabled*(self: AccessInterface): bool {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method toggleAutoMessage*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method isAutoMessageEnabled*(self: AccessInterface): bool {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method toggleDebug*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
|
|
|
@ -14,6 +14,9 @@ method isLoaded*(self: AccessInterface): bool {.base.} =
|
|||
method toggleTelemetry*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method toggleAutoMessage*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method toggleDebug*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ method load*[T](self: Module[T]) =
|
|||
|
||||
self.view.setIsTelemetryEnabled(self.controller.isTelemetryEnabled())
|
||||
self.view.setIsDebugEnabled(self.controller.isDebugEnabled())
|
||||
self.view.setIsAutoMessageEnabled(self.controller.isAutoMessageEnabled())
|
||||
|
||||
self.moduleLoaded = true
|
||||
self.delegate.profileSectionDidLoad()
|
||||
|
@ -100,5 +101,8 @@ method viewDidLoad*(self: Module) =
|
|||
method toggleTelemetry*[T](self: Module[T]) =
|
||||
self.controller.toggleTelemetry()
|
||||
|
||||
method toggleAutoMessage*[T](self: Module[T]) =
|
||||
self.controller.toggleAutoMessage()
|
||||
|
||||
method toggleDebug*[T](self: Module[T]) =
|
||||
self.controller.toggleDebug()
|
||||
|
|
|
@ -9,6 +9,7 @@ QtObject:
|
|||
# TODO: move to the correct module once all have been merged
|
||||
isTelemetryEnabled: bool
|
||||
isDebugEnabled: bool
|
||||
isAutoMessageEnabled: bool
|
||||
|
||||
proc setup(self: View) =
|
||||
self.QObject.setup
|
||||
|
@ -54,3 +55,20 @@ QtObject:
|
|||
proc toggleDebug*(self: View) {.slot.} =
|
||||
self.delegate.toggleDebug()
|
||||
self.setIsDebugEnabled(not self.isDebugEnabled)
|
||||
|
||||
proc isAutoMessageEnabledChanged*(self: View) {.signal.}
|
||||
|
||||
proc setIsAutoMessageEnabled*(self: View, isAutoMessageEnabled: bool) =
|
||||
self.isAutoMessageEnabled = isAutoMessageEnabled
|
||||
self.isAutoMessageEnabledChanged()
|
||||
|
||||
proc getIsAutoMessageEnabled*(self: View): QVariant {.slot.} =
|
||||
return newQVariant(self.isAutoMessageEnabled)
|
||||
|
||||
QtProperty[QVariant] isAutoMessageEnabled:
|
||||
read = getIsAutoMessageEnabled
|
||||
notify = isAutoMessageEnabledChanged
|
||||
|
||||
proc toggleAutoMessage*(self: View) {.slot.} =
|
||||
self.delegate.toggleAutoMessage()
|
||||
self.setIsAutoMessageEnabled(not self.isAutoMessageEnabled)
|
|
@ -93,6 +93,13 @@ method isTelemetryEnabled*(self: Service): bool =
|
|||
let telemetryServerUrl = status_go_settings.getSetting[string](Setting.TelemetryServerUrl)
|
||||
return telemetryServerUrl != ""
|
||||
|
||||
method toggleAutoMessage*(self: Service) =
|
||||
let enabled = status_go_settings.getSetting[bool](Setting.AutoMessageEnabled)
|
||||
discard status_go_settings.saveSetting(Setting.AutoMessageEnabled, not enabled)
|
||||
|
||||
method isAutoMessageEnabled*(self: Service): bool =
|
||||
return status_go_settings.getSetting[bool](Setting.AutoMessageEnabled)
|
||||
|
||||
method toggleDebug*(self: Service) =
|
||||
var nodeConfig = status_go_settings.getNodeConfig()
|
||||
if nodeConfig["LogLevel"].getStr() == $LogLevel.INFO:
|
||||
|
|
|
@ -57,6 +57,12 @@ method toggleTelemetry*(self: ServiceInterface) {.base.} =
|
|||
method isTelemetryEnabled*(self: ServiceInterface): bool {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method toggleAutoMessage*(self: ServiceInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method isAutoMessageEnabled*(self: ServiceInterface): bool {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method toggleDebug*(self: ServiceInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
|
|
|
@ -417,6 +417,7 @@ ScrollView {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: replace with StatusQ component
|
||||
StatusSettingsLineButton {
|
||||
text: qsTr("Debug")
|
||||
isSwitch: true
|
||||
|
@ -425,6 +426,16 @@ ScrollView {
|
|||
openPopup(enableDebugComponent)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: replace with StatusQ component
|
||||
StatusSettingsLineButton {
|
||||
text: qsTr("Enable Auto message")
|
||||
isSwitch: true
|
||||
switchChecked: root.store.profileModuleInst.isAutoMessageEnabled
|
||||
onClicked: {
|
||||
openPopup(enableAutoMessageConfirmationDialogComponent, {light: false})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NetworksModal {
|
||||
|
@ -453,6 +464,24 @@ ScrollView {
|
|||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: enableAutoMessageConfirmationDialogComponent
|
||||
ConfirmationDialog {
|
||||
property bool mode: false
|
||||
|
||||
id: confirmDialog
|
||||
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.")
|
||||
onConfirmButtonClicked: {
|
||||
root.store.profileModuleInst.toggleAutoMessage()
|
||||
close()
|
||||
}
|
||||
onCancelButtonClicked: {
|
||||
close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: enableDebugComponent
|
||||
ConfirmationDialog {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit c7a7bdc0df39ee25e2fe77cb7a0a362b74247aa2
|
||||
Subproject commit cd5412823a8727e2decc3be430818309c57b3a92
|
Loading…
Reference in New Issue