fix(@desktop/general): biometrics prompt is shown after restarting the app even it was not enabled
Fixes: #11261
This commit is contained in:
parent
8872877524
commit
774da7dd47
|
@ -13,6 +13,7 @@ const LS_VALUE_NEVER* = "never"
|
|||
QtObject:
|
||||
type LocalAccountSettings* = ref object of QObject
|
||||
settingsFileDir: string
|
||||
currentFileName: string
|
||||
settings: QSettings
|
||||
|
||||
proc setup(self: LocalAccountSettings) =
|
||||
|
@ -33,8 +34,16 @@ QtObject:
|
|||
proc setFileName*(self: LocalAccountSettings, fileName: string) =
|
||||
if(not self.settings.isNil):
|
||||
self.settings.delete
|
||||
let filePath = os.joinPath(self.settingsFileDir, fileName)
|
||||
self.settings = newQSettings(filePath, QSettingsFormat.IniFormat)
|
||||
let
|
||||
currentFilePath = os.joinPath(self.settingsFileDir, self.currentFileName)
|
||||
newFilePath = os.joinPath(self.settingsFileDir, fileName)
|
||||
try:
|
||||
if self.currentFileName.len > 0 and currentFilePath != newFilePath:
|
||||
moveFile(currentFilePath, newFilePath)
|
||||
except OSError:
|
||||
discard
|
||||
self.currentFileName = fileName
|
||||
self.settings = newQSettings(newFilePath, QSettingsFormat.IniFormat)
|
||||
|
||||
proc storeToKeychainValueChanged*(self: LocalAccountSettings) {.signal.}
|
||||
|
||||
|
|
|
@ -86,6 +86,7 @@ QtObject:
|
|||
proc updateLoggedInAccount*(self: Service, displayName: string, images: seq[Image]) =
|
||||
self.loggedInAccount.name = displayName
|
||||
self.loggedInAccount.images = images
|
||||
singletonInstance.localAccountSettings.setFileName(displayName)
|
||||
|
||||
proc getImportedAccount*(self: Service): GeneratedAccountDto =
|
||||
return self.importedAccount
|
||||
|
@ -103,8 +104,7 @@ QtObject:
|
|||
proc connectToFetchingFromWakuEvents*(self: Service) =
|
||||
self.events.on(SignalType.WakuBackedUpProfile.event) do(e: Args):
|
||||
var receivedData = WakuBackedUpProfileSignal(e)
|
||||
self.loggedInAccount.name = receivedData.backedUpProfile.displayName
|
||||
self.loggedInAccount.images = receivedData.backedUpProfile.images
|
||||
self.updateLoggedInAccount(receivedData.backedUpProfile.displayName, receivedData.backedUpProfile.images)
|
||||
|
||||
proc init*(self: Service) =
|
||||
try:
|
||||
|
@ -418,7 +418,7 @@ QtObject:
|
|||
result["ListenAddr"] = newJString("0.0.0.0:" & $main_constants.STATUS_PORT)
|
||||
|
||||
proc setLocalAccountSettingsFile(self: Service) =
|
||||
if(main_constants.IS_MACOS and self.getLoggedInAccount.isValid()):
|
||||
if self.getLoggedInAccount.isValid():
|
||||
singletonInstance.localAccountSettings.setFileName(self.getLoggedInAccount.name)
|
||||
|
||||
proc addKeycardDetails(self: Service, kcInstance: string, settingsJson: var JsonNode, accountData: var JsonNode) =
|
||||
|
@ -778,6 +778,7 @@ QtObject:
|
|||
debug "Account logged in succesfully"
|
||||
# this should be fetched later from waku
|
||||
self.loggedInAccount = accToBeLoggedIn
|
||||
self.setLocalAccountSettingsFile()
|
||||
return
|
||||
except Exception as e:
|
||||
error "error: ", procName="loginAccountKeycard", errName = e.name, errDesription = e.msg
|
||||
|
|
Loading…
Reference in New Issue