fix(@desktop): crash when transitioning from login|onboarding to the app state

This commit is contained in:
Andrei Smirnov 2021-08-11 15:56:37 +03:00 committed by Andrei Smirnov
parent b80ac8070f
commit 5a7aac0baf
6 changed files with 20 additions and 7 deletions

View File

@ -23,6 +23,9 @@ proc delete*(self: LoginController) =
proc reset*(self: LoginController) = proc reset*(self: LoginController) =
self.view.removeAccounts() self.view.removeAccounts()
proc moveToAppState*(self: LoginController) =
self.view.moveToAppState()
proc handleNodeLogin(self: LoginController, response: NodeSignal) = proc handleNodeLogin(self: LoginController, response: NodeSignal) =
if not self.view.isCurrentFlow: return if not self.view.isCurrentFlow: return
if self.view.currentAccount.account != nil: if self.view.currentAccount.account != nil:

View File

@ -115,6 +115,8 @@ QtObject:
msg = getCurrentExceptionMsg() msg = getCurrentExceptionMsg()
result = StatusGoError(error: msg).toJson result = StatusGoError(error: msg).toJson
proc moveToAppState*(self: LoginView) {.signal.}
proc loginResponseChanged*(self: LoginView, error: string) {.signal.} proc loginResponseChanged*(self: LoginView, error: string) {.signal.}
proc setLastLoginResponse*(self: LoginView, loginResponse: StatusGoError) = proc setLastLoginResponse*(self: LoginView, loginResponse: StatusGoError) =

View File

@ -24,6 +24,9 @@ proc delete*(self: OnboardingController) =
proc reset*(self: OnboardingController) = proc reset*(self: OnboardingController) =
self.view.removeAccounts() self.view.removeAccounts()
proc moveToAppState*(self: OnboardingController) =
self.view.moveToAppState()
proc handleNodeLogin(self: OnboardingController, response: NodeSignal) = proc handleNodeLogin(self: OnboardingController, response: NodeSignal) =
if not self.view.isCurrentFlow: return if not self.view.isCurrentFlow: return
if self.view.currentAccount.account != nil: if self.view.currentAccount.account != nil:

View File

@ -108,6 +108,8 @@ QtObject:
msg = "Account already exists. Please try importing another account." msg = "Account already exists. Please try importing another account."
result = StatusGoError(error: msg).toJson result = StatusGoError(error: msg).toJson
proc moveToAppState*(self: OnboardingView) {.signal.}
proc loginResponseChanged*(self: OnboardingView, error: string) {.signal.} proc loginResponseChanged*(self: OnboardingView, error: string) {.signal.}
proc setLastLoginResponse*(self: OnboardingView, loginResponse: StatusGoError) = proc setLastLoginResponse*(self: OnboardingView, loginResponse: StatusGoError) =

View File

@ -168,6 +168,13 @@ proc mainProc() =
login.reset() login.reset()
onboarding.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() status.startMessenger()
profile.init(args.account) profile.init(args.account)
wallet.init() wallet.init()
@ -176,7 +183,6 @@ proc mainProc() =
utilsController.init() utilsController.init()
browserController.init() browserController.init()
node.init() node.init()
wallet.checkPendingTransactions() wallet.checkPendingTransactions()
engine.setRootContextProperty("loginModel", login.variant) engine.setRootContextProperty("loginModel", login.variant)

View File

@ -207,8 +207,7 @@ StatusWindow {
DSM.SignalTransition { DSM.SignalTransition {
targetState: appState targetState: appState
signal: onboardingModel.loginResponseChanged signal: onboardingModel.moveToAppState
guard: !error
} }
} }
@ -218,8 +217,7 @@ StatusWindow {
DSM.SignalTransition { DSM.SignalTransition {
targetState: appState targetState: appState
signal: onboardingModel.loginResponseChanged signal: onboardingModel.moveToAppState
guard: !error
} }
} }
@ -229,8 +227,7 @@ StatusWindow {
DSM.SignalTransition { DSM.SignalTransition {
targetState: appState targetState: appState
signal: loginModel.loginResponseChanged signal: loginModel.moveToAppState
guard: !error
} }
DSM.SignalTransition { DSM.SignalTransition {