fix: Save settings before logging in (#15506)

This commit is contained in:
Cuteivist 2024-07-15 15:09:44 +02:00 committed by GitHub
parent 7e69a2e465
commit 2cad2a0885
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 5 deletions

View File

@ -389,10 +389,11 @@ proc setupKeychain(self: Controller, store: bool) =
else:
singletonInstance.localAccountSettings.setStoreToKeychainValue(LS_VALUE_NEVER)
proc processCreateAccountResult*(self: Controller, error: string, storeToKeychain: bool) =
proc processCreateAccountResult*(self: Controller, error: string, displayName: string, storeToKeychain: bool) =
if error != "":
self.delegate.emitStartupError(error, StartupErrorType.SetupAccError)
else:
singletonInstance.localAccountSettings.setFileName(displayName)
self.setupKeychain(storeToKeychain)
proc createAccountAndLogin*(self: Controller, storeToKeychain: bool) =
@ -403,7 +404,7 @@ proc createAccountAndLogin*(self: Controller, storeToKeychain: bool) =
self.tmpProfileImageDetails.url,
self.tmpProfileImageDetails.cropRectangle
)
self.processCreateAccountResult(error, storeToKeychain)
self.processCreateAccountResult(error, self.tmpDisplayName, storeToKeychain)
proc importAccountAndLogin*(self: Controller, storeToKeychain: bool, recoverAccount: bool = false) =
if recoverAccount:
@ -421,7 +422,7 @@ proc importAccountAndLogin*(self: Controller, storeToKeychain: bool, recoverAcco
self.tmpProfileImageDetails.cropRectangle,
)
self.processCreateAccountResult(error, storeToKeychain)
self.processCreateAccountResult(error, self.tmpDisplayName, storeToKeychain)
# NOTE: Called during FirstRunNewUserNewKeycardKeys and FirstRunNewUserImportSeedPhraseIntoKeycard
# WARNING: Reuse `importAccountAndLogin` with custom parameters
@ -438,7 +439,7 @@ proc storeKeycardAccountAndLogin*(self: Controller, storeToKeychain: bool, newKe
self.tmpProfileImageDetails.cropRectangle,
keycardInstanceUID = flowEvent.instanceUID,
)
self.processCreateAccountResult(error, storeToKeychain)
self.processCreateAccountResult(error, self.tmpDisplayName, storeToKeychain)
# NOTE: Called during FirstRunOldUserKeycardImport
proc setupKeycardAccount*(self: Controller, storeToKeychain: bool, recoverAccount: bool = false) =
@ -461,7 +462,7 @@ proc setupKeycardAccount*(self: Controller, storeToKeychain: bool, recoverAccoun
self.tmpProfileImageDetails.cropRectangle,
)
self.processCreateAccountResult(error, storeToKeychain)
self.processCreateAccountResult(error, self.tmpDisplayName, storeToKeychain)
proc getOpenedAccounts*(self: Controller): seq[AccountDto] =
return self.accountsService.openedAccounts()