diff --git a/src/app/modules/main/profile_section/controller.nim b/src/app/modules/main/profile_section/controller.nim index 53aaf79746..a9500583da 100644 --- a/src/app/modules/main/profile_section/controller.nim +++ b/src/app/modules/main/profile_section/controller.nim @@ -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() diff --git a/src/app/modules/main/profile_section/controller_interface.nim b/src/app/modules/main/profile_section/controller_interface.nim index 8bfd5cf60b..38bf0b2832 100644 --- a/src/app/modules/main/profile_section/controller_interface.nim +++ b/src/app/modules/main/profile_section/controller_interface.nim @@ -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") diff --git a/src/app/modules/main/profile_section/io_interface.nim b/src/app/modules/main/profile_section/io_interface.nim index 54d9e2587a..33e71fb399 100644 --- a/src/app/modules/main/profile_section/io_interface.nim +++ b/src/app/modules/main/profile_section/io_interface.nim @@ -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") diff --git a/src/app/modules/main/profile_section/module.nim b/src/app/modules/main/profile_section/module.nim index a0307e4d20..12fd28cad8 100644 --- a/src/app/modules/main/profile_section/module.nim +++ b/src/app/modules/main/profile_section/module.nim @@ -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() diff --git a/src/app/modules/main/profile_section/view.nim b/src/app/modules/main/profile_section/view.nim index 74d2ea56d8..c2c4cb1886 100644 --- a/src/app/modules/main/profile_section/view.nim +++ b/src/app/modules/main/profile_section/view.nim @@ -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) \ No newline at end of file diff --git a/src/app_service/service/settings/service.nim b/src/app_service/service/settings/service.nim index 422758349c..2813a074ca 100644 --- a/src/app_service/service/settings/service.nim +++ b/src/app_service/service/settings/service.nim @@ -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: diff --git a/src/app_service/service/settings/service_interface.nim b/src/app_service/service/settings/service_interface.nim index b6d536c337..abf86b551b 100644 --- a/src/app_service/service/settings/service_interface.nim +++ b/src/app_service/service/settings/service_interface.nim @@ -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") diff --git a/ui/app/AppLayouts/Profile/views/AdvancedView.qml b/ui/app/AppLayouts/Profile/views/AdvancedView.qml index 21c6aa15a0..ad0901114c 100644 --- a/ui/app/AppLayouts/Profile/views/AdvancedView.qml +++ b/ui/app/AppLayouts/Profile/views/AdvancedView.qml @@ -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 { diff --git a/vendor/status-lib b/vendor/status-lib index c7a7bdc0df..cd5412823a 160000 --- a/vendor/status-lib +++ b/vendor/status-lib @@ -1 +1 @@ -Subproject commit c7a7bdc0df39ee25e2fe77cb7a0a362b74247aa2 +Subproject commit cd5412823a8727e2decc3be430818309c57b3a92