diff --git a/src/app/modules/main/profile_section/privacy/controller.nim b/src/app/modules/main/profile_section/privacy/controller.nim index 6703499af2..20da36bdd7 100644 --- a/src/app/modules/main/profile_section/privacy/controller.nim +++ b/src/app/modules/main/profile_section/privacy/controller.nim @@ -41,6 +41,10 @@ proc init*(self: Controller) = var args = SettingProfilePictureArgs(e) self.delegate.emitProfilePicturesShowToChanged(args.value) + self.events.on(SIGNAL_SETTING_PROFILE_PICTURES_VISIBILITY_CHANGED) do(e: Args): + var args = SettingProfilePictureArgs(e) + self.delegate.emitProfilePicturesVisibilityChanged(args.value) + proc isMnemonicBackedUp*(self: Controller): bool = return self.privacyService.isMnemonicBackedUp() diff --git a/src/app/modules/main/profile_section/privacy/io_interface.nim b/src/app/modules/main/profile_section/privacy/io_interface.nim index 82ac43ed33..ca39813209 100644 --- a/src/app/modules/main/profile_section/privacy/io_interface.nim +++ b/src/app/modules/main/profile_section/privacy/io_interface.nim @@ -74,3 +74,6 @@ method getPasswordStrengthScore*(self: AccessInterface, password: string): int { method emitProfilePicturesShowToChanged*(self: AccessInterface, value: int) {.base.} = raise newException(ValueError, "No implementation available") +method emitProfilePicturesVisibilityChanged*(self: AccessInterface, value: int) {.base.} = + raise newException(ValueError, "No implementation available") + diff --git a/src/app/modules/main/profile_section/privacy/module.nim b/src/app/modules/main/profile_section/privacy/module.nim index c243ae9c4e..f1ecb2453f 100644 --- a/src/app/modules/main/profile_section/privacy/module.nim +++ b/src/app/modules/main/profile_section/privacy/module.nim @@ -93,6 +93,9 @@ method setProfilePicturesShowTo*(self: Module, value: int) = method emitProfilePicturesShowToChanged*(self: Module, value: int) = self.view.profilePicturesShowToChanged() +method emitProfilePicturesVisibilityChanged*(self: Module, value: int) = + self.view.profilePicturesVisibilityChanged() + method getProfilePicturesVisibility*(self: Module): int = self.controller.getProfilePicturesVisibility() diff --git a/src/app_service/service/settings/dto/settings.nim b/src/app_service/service/settings/dto/settings.nim index 3a4fb3182c..7e2b6a5829 100644 --- a/src/app_service/service/settings/dto/settings.nim +++ b/src/app_service/service/settings/dto/settings.nim @@ -180,7 +180,7 @@ proc toSettingsFieldDto*(jsonObj: JsonNode): SettingsFieldDto = field.name = jsonObj["name"].getStr() case field.name: - of KEY_PROFILE_PICTURES_SHOW_TO: + of KEY_PROFILE_PICTURES_SHOW_TO, KEY_PROFILE_PICTURES_VISIBILITY: field.value = jsonObj["value"].getInt().intToStr else: field.value = jsonObj["value"].getStr() diff --git a/src/app_service/service/settings/service.nim b/src/app_service/service/settings/service.nim index b014ab2496..4b474f89ed 100644 --- a/src/app_service/service/settings/service.nim +++ b/src/app_service/service/settings/service.nim @@ -22,6 +22,7 @@ const DEFAULT_FLEET* = $Fleet.Prod const SIGNAL_CURRENT_USER_STATUS_UPDATED* = "currentUserStatusUpdated" const SIGNAL_SETTING_PROFILE_PICTURES_SHOW_TO_CHANGED* = "profilePicturesShowToChanged" +const SIGNAL_SETTING_PROFILE_PICTURES_VISIBILITY_CHANGED* = "profilePicturesVisibilityChanged" logScope: topics = "settings-service" @@ -35,7 +36,6 @@ type SettingProfilePictureArgs* = ref object of Args value*: int - QtObject: type Service* = ref object of QObject events: EventEmitter @@ -71,6 +71,10 @@ QtObject: self.settings.profilePicturesShowTo = settingsfield.value.parseInt self.events.emit(SIGNAL_SETTING_PROFILE_PICTURES_SHOW_TO_CHANGED, SettingProfilePictureArgs(value: self.settings.profilePicturesShowTo)) + if settingsField.name == KEY_PROFILE_PICTURES_VISIBILITY: + self.settings.profilePicturesVisibility = settingsfield.value.parseInt + self.events.emit(SIGNAL_SETTING_PROFILE_PICTURES_VISIBILITY_CHANGED, SettingProfilePictureArgs(value: self.settings.profilePicturesVisibility)) + proc saveSetting(self: Service, attribute: string, value: string | JsonNode | bool | int): bool = try: let response = status_settings.saveSettings(attribute, value)