fix(@desktop/sync): settings/display_name sync&backup handling
Part of #10389 issue.
This commit is contained in:
parent
1e406269df
commit
5bfd4546c2
|
@ -27,7 +27,9 @@ proc newService*(events: EventEmitter, settingsService: settings_service.Service
|
||||||
result.settingsService = settingsService
|
result.settingsService = settingsService
|
||||||
|
|
||||||
proc init*(self: Service) =
|
proc init*(self: Service) =
|
||||||
discard
|
self.events.on(SIGNAL_DISPLAY_NAME_UPDATED) do(e:Args):
|
||||||
|
let args = SettingsTextValueArgs(e)
|
||||||
|
singletonInstance.userProfile.setDisplayName(args.value)
|
||||||
|
|
||||||
proc storeIdentityImage*(self: Service, address: string, image: string, aX: int, aY: int, bX: int, bY: int): seq[Image] =
|
proc storeIdentityImage*(self: Service, address: string, image: string, aX: int, aY: int, bX: int, bY: int): seq[Image] =
|
||||||
try:
|
try:
|
||||||
|
@ -74,8 +76,5 @@ proc setDisplayName*(self: Service, displayName: string) =
|
||||||
if(not self.settingsService.saveDisplayName(displayName)):
|
if(not self.settingsService.saveDisplayName(displayName)):
|
||||||
error "could save display name to the settings"
|
error "could save display name to the settings"
|
||||||
return
|
return
|
||||||
|
|
||||||
singletonInstance.userProfile.setDisplayName(displayName)
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error "error: ", procName="setDisplayName", errName = e.name, errDesription = e.msg
|
error "error: ", procName="setDisplayName", errName = e.name, errDesription = e.msg
|
|
@ -22,6 +22,7 @@ const DEFAULT_FLEET* = $Fleet.StatusProd
|
||||||
|
|
||||||
# Signals:
|
# Signals:
|
||||||
const SIGNAL_CURRENCY_UPDATED* = "currencyUpdated"
|
const SIGNAL_CURRENCY_UPDATED* = "currencyUpdated"
|
||||||
|
const SIGNAL_DISPLAY_NAME_UPDATED* = "displayNameUpdated"
|
||||||
const SIGNAL_CURRENT_USER_STATUS_UPDATED* = "currentUserStatusUpdated"
|
const SIGNAL_CURRENT_USER_STATUS_UPDATED* = "currentUserStatusUpdated"
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
|
@ -90,6 +91,9 @@ QtObject:
|
||||||
if settingsField.name == KEY_CURRENCY:
|
if settingsField.name == KEY_CURRENCY:
|
||||||
self.settings.currency = settingsField.value
|
self.settings.currency = settingsField.value
|
||||||
self.events.emit(SIGNAL_CURRENCY_UPDATED, SettingsTextValueArgs(value: settingsField.value))
|
self.events.emit(SIGNAL_CURRENCY_UPDATED, SettingsTextValueArgs(value: settingsField.value))
|
||||||
|
if settingsField.name == KEY_DISPLAY_NAME:
|
||||||
|
self.settings.displayName = settingsField.value
|
||||||
|
self.events.emit(SIGNAL_DISPLAY_NAME_UPDATED, SettingsTextValueArgs(value: settingsField.value))
|
||||||
|
|
||||||
self.initialized = true
|
self.initialized = true
|
||||||
|
|
||||||
|
@ -185,6 +189,7 @@ QtObject:
|
||||||
proc saveDisplayName*(self: Service, value: string): bool =
|
proc saveDisplayName*(self: Service, value: string): bool =
|
||||||
if(self.saveSetting(KEY_DISPLAY_NAME, value)):
|
if(self.saveSetting(KEY_DISPLAY_NAME, value)):
|
||||||
self.settings.displayName = value
|
self.settings.displayName = value
|
||||||
|
self.events.emit(SIGNAL_DISPLAY_NAME_UPDATED, SettingsTextValueArgs(value: self.settings.displayName))
|
||||||
return true
|
return true
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue