From 55cb3c37575a450689b881742fee102c4d81dea1 Mon Sep 17 00:00:00 2001 From: Sale Djenic Date: Fri, 5 Aug 2022 10:52:29 +0200 Subject: [PATCH] fix(@desktop/onboarding): startup stuck when entering wrong password Fixes: #6812 --- src/app/modules/startup/controller.nim | 5 ++--- src/app/modules/startup/module.nim | 2 ++ ui/main.qml | 13 +++++++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/app/modules/startup/controller.nim b/src/app/modules/startup/controller.nim index 2f66f851c6..0891069d86 100644 --- a/src/app/modules/startup/controller.nim +++ b/src/app/modules/startup/controller.nim @@ -68,7 +68,7 @@ proc newController*(delegate: io_interface.AccessInterface, result.tmpRecoverUsingSeedPhraseWhileLogin = false # Forward declaration -proc cleanTmpData(self: Controller) +proc cleanTmpData*(self: Controller) proc delete*(self: Controller) = discard @@ -77,7 +77,6 @@ proc init*(self: Controller) = self.events.on(SignalType.NodeLogin.event) do(e:Args): let signal = NodeSignal(e) self.delegate.onNodeLogin(signal.event.error) - self.cleanTmpData() self.events.on(SignalType.NodeStopped.event) do(e:Args): self.events.emit("nodeStopped", Args()) @@ -191,7 +190,7 @@ proc setRecoverUsingSeedPhraseWhileLogin*(self: Controller, value: bool) = proc getRecoverUsingSeedPhraseWhileLogin*(self: Controller): bool = return self.tmpRecoverUsingSeedPhraseWhileLogin -proc cleanTmpData(self: Controller) = +proc cleanTmpData*(self: Controller) = self.tmpSelectedLoginAccountKeyUid = "" self.tmpProfileImageDetails = ProfileImageDetails() self.tmpKeychainErrorOccurred = true diff --git a/src/app/modules/startup/module.nim b/src/app/modules/startup/module.nim index c8f2e79432..2b21668ffc 100644 --- a/src/app/modules/startup/module.nim +++ b/src/app/modules/startup/module.nim @@ -222,10 +222,12 @@ method onNodeLogin*[T](self: Module[T], error: string) = quit() # quit the app if error.len == 0: + self.controller.cleanTmpData() self.delegate.userLoggedIn() if currStateObj.flowType() != FlowType.AppLogin: self.controller.storeIdentityImage() else: + self.view.setAppState(AppState.StartupState) if currStateObj.flowType() == FlowType.AppLogin: self.emitAccountLoginError(error) else: diff --git a/ui/main.qml b/ui/main.qml index 50f2d5eb1b..6a87b86ae3 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -130,8 +130,14 @@ StatusWindow { } function onAppStateChanged(state) { - if(state === Constants.appState.appLoading) { + if(state === Constants.appState.startup) { + // we're here only in case of error when we're returning from the app loading state + loader.sourceComponent = undefined + startupOnboarding.visible = true + } + else if(state === Constants.appState.appLoading) { loader.sourceComponent = appLoadingAnimation + startupOnboarding.visible = false } else if(state === Constants.appState.main) { // We set main module to the Global singleton once user is logged in and we move to the main app. @@ -150,10 +156,9 @@ StatusWindow { if (localAccountSensitiveSettings.hiddenCommunityBackUpBanners === "") { localAccountSensitiveSettings.hiddenCommunityBackUpBanners = []; } + startupOnboarding.unload() + startupOnboarding.visible = false } - - startupOnboarding.unload() - startupOnboarding.visible = false } }