fix(@desktop/onboarding): the app crashes when converting a keycard to a regular account, or just being in loading state forever

Fixes: #11507
This commit is contained in:
Sale Djenic 2023-07-12 14:30:52 +02:00 committed by saledjenic
parent 51edc1b256
commit 7849d03707
2 changed files with 12 additions and 10 deletions

View File

@ -163,6 +163,9 @@ method moveToAppState*[T](self: Module[T]) =
method moveToStartupState*[T](self: Module[T]) =
self.view.setAppState(AppState.StartupState)
proc moveToAppEncryptionProcessState[T](self: Module[T]) =
self.view.setAppState(AppState.AppEncryptionProcessState)
method startUpUIRaised*[T](self: Module[T]) =
self.view.startUpUIRaised()
@ -412,7 +415,6 @@ method onNodeLogin*[T](self: Module[T], error: string) =
return
self.delegate.logout()
self.view.setCurrentStartupState(newLoginKeycardConvertedToRegularAccountState(currStateObj.flowType(), nil))
self.moveToStartupState()
else:
let err = self.delegate.userLoggedIn(recoverAccount = false)
if err.len > 0:
@ -533,7 +535,13 @@ method onLocalPairingStatusUpdate*[T](self: Module[T], status: LocalPairingStatu
self.view.onLocalPairingStatusUpdate(status)
method onReencryptionProcessStarted*[T](self: Module[T]) =
self.view.onReencryptionProcessStarted()
self.moveToAppEncryptionProcessState()
method onReencryptionProcessFinished*[T](self: Module[T]) =
self.view.onReencryptionProcessFinished()
let currStateObj = self.view.currentStartupStateObj()
if not currStateObj.isNil and
currStateObj.flowType() == FlowType.LostKeycardConvertToRegularAccount and
currStateObj.stateType() == StateType.LoginKeycardConvertedToRegularAccount:
self.moveToStartupState()
return
self.moveToLoadingAppState()

View File

@ -104,7 +104,7 @@ QtObject:
proc onSecondaryActionClicked*(self: View) {.slot.} =
self.delegate.onSecondaryActionClicked()
proc onTertiaryActionClicked*(self: View) {.slot.} =
self.delegate.onTertiaryActionClicked()
@ -373,9 +373,3 @@ QtObject:
proc validateLocalPairingConnectionString*(self: View, connectionString: string): string {.slot.} =
return self.delegate.validateLocalPairingConnectionString(connectionString)
proc onReencryptionProcessStarted*(self: View) =
self.setAppState(AppState.AppEncryptionProcessState)
proc onReencryptionProcessFinished*(self: View) =
self.setAppState(AppState.AppLoadingState)