fix(@desktop): crash when transitioning from login|onboarding to the app state
This commit is contained in:
parent
b80ac8070f
commit
5a7aac0baf
|
@ -23,6 +23,9 @@ proc delete*(self: LoginController) =
|
|||
proc reset*(self: LoginController) =
|
||||
self.view.removeAccounts()
|
||||
|
||||
proc moveToAppState*(self: LoginController) =
|
||||
self.view.moveToAppState()
|
||||
|
||||
proc handleNodeLogin(self: LoginController, response: NodeSignal) =
|
||||
if not self.view.isCurrentFlow: return
|
||||
if self.view.currentAccount.account != nil:
|
||||
|
|
|
@ -115,6 +115,8 @@ QtObject:
|
|||
msg = getCurrentExceptionMsg()
|
||||
result = StatusGoError(error: msg).toJson
|
||||
|
||||
proc moveToAppState*(self: LoginView) {.signal.}
|
||||
|
||||
proc loginResponseChanged*(self: LoginView, error: string) {.signal.}
|
||||
|
||||
proc setLastLoginResponse*(self: LoginView, loginResponse: StatusGoError) =
|
||||
|
|
|
@ -24,6 +24,9 @@ proc delete*(self: OnboardingController) =
|
|||
proc reset*(self: OnboardingController) =
|
||||
self.view.removeAccounts()
|
||||
|
||||
proc moveToAppState*(self: OnboardingController) =
|
||||
self.view.moveToAppState()
|
||||
|
||||
proc handleNodeLogin(self: OnboardingController, response: NodeSignal) =
|
||||
if not self.view.isCurrentFlow: return
|
||||
if self.view.currentAccount.account != nil:
|
||||
|
|
|
@ -108,6 +108,8 @@ QtObject:
|
|||
msg = "Account already exists. Please try importing another account."
|
||||
result = StatusGoError(error: msg).toJson
|
||||
|
||||
proc moveToAppState*(self: OnboardingView) {.signal.}
|
||||
|
||||
proc loginResponseChanged*(self: OnboardingView, error: string) {.signal.}
|
||||
|
||||
proc setLastLoginResponse*(self: OnboardingView, loginResponse: StatusGoError) =
|
||||
|
|
|
@ -168,6 +168,13 @@ proc mainProc() =
|
|||
login.reset()
|
||||
onboarding.reset()
|
||||
|
||||
status.events.emit("loginCompleted", args)
|
||||
login.moveToAppState()
|
||||
onboarding.moveToAppState()
|
||||
|
||||
status.events.once("loginCompleted") do(a: Args):
|
||||
var args = AccountArgs(a)
|
||||
|
||||
status.startMessenger()
|
||||
profile.init(args.account)
|
||||
wallet.init()
|
||||
|
@ -176,7 +183,6 @@ proc mainProc() =
|
|||
utilsController.init()
|
||||
browserController.init()
|
||||
node.init()
|
||||
|
||||
wallet.checkPendingTransactions()
|
||||
|
||||
engine.setRootContextProperty("loginModel", login.variant)
|
||||
|
|
|
@ -207,8 +207,7 @@ StatusWindow {
|
|||
|
||||
DSM.SignalTransition {
|
||||
targetState: appState
|
||||
signal: onboardingModel.loginResponseChanged
|
||||
guard: !error
|
||||
signal: onboardingModel.moveToAppState
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,8 +217,7 @@ StatusWindow {
|
|||
|
||||
DSM.SignalTransition {
|
||||
targetState: appState
|
||||
signal: onboardingModel.loginResponseChanged
|
||||
guard: !error
|
||||
signal: onboardingModel.moveToAppState
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -229,8 +227,7 @@ StatusWindow {
|
|||
|
||||
DSM.SignalTransition {
|
||||
targetState: appState
|
||||
signal: loginModel.loginResponseChanged
|
||||
guard: !error
|
||||
signal: loginModel.moveToAppState
|
||||
}
|
||||
|
||||
DSM.SignalTransition {
|
||||
|
|
Loading…
Reference in New Issue