fix: fix onboarding to go back to the right screen on close

This commit is contained in:
Jonathan Rainville 2020-07-01 11:37:36 -04:00 committed by Iuri Matias
parent 90011710ec
commit 7eb44366da
2 changed files with 20 additions and 11 deletions

View File

@ -11,6 +11,7 @@ import "./imports"
ApplicationWindow { ApplicationWindow {
property alias appSettings: settings property alias appSettings: settings
property bool hasAccounts: !!loginModel.rowCount()
id: applicationWindow id: applicationWindow
width: 1232 width: 1232
@ -57,17 +58,11 @@ ApplicationWindow {
DSM.State { DSM.State {
id: onboardingState id: onboardingState
initialState: loginModel.rowCount() ? stateLogin : stateIntro initialState: hasAccounts ? stateLogin : stateIntro
DSM.State { DSM.State {
id: stateIntro id: stateIntro
onEntered: loader.sourceComponent = intro onEntered: loader.sourceComponent = intro
DSM.SignalTransition {
targetState: keysMainState
signal: applicationWindow.navigateTo
guard: path === "KeysMain"
}
} }
DSM.State { DSM.State {
@ -121,7 +116,7 @@ ApplicationWindow {
} }
DSM.SignalTransition { DSM.SignalTransition {
targetState: loginModel.rowCount() ? stateLogin : stateIntro targetState: hasAccounts ? stateLogin : stateIntro
signal: applicationWindow.navigateTo signal: applicationWindow.navigateTo
guard: path === "InitialState" guard: path === "InitialState"
} }
@ -132,6 +127,12 @@ ApplicationWindow {
guard: path === "ExistingKey" guard: path === "ExistingKey"
} }
DSM.SignalTransition {
targetState: keysMainState
signal: applicationWindow.navigateTo
guard: path === "KeysMain"
}
DSM.FinalState { DSM.FinalState {
id: onboardingDoneState id: onboardingDoneState
} }
@ -179,7 +180,11 @@ ApplicationWindow {
id: existingKey id: existingKey
ExistingKey { ExistingKey {
onClosed: function () { onClosed: function () {
applicationWindow.navigateTo("InitialState") if (hasAccounts) {
applicationWindow.navigateTo("InitialState")
} else {
applicationWindow.navigateTo("KeysMain")
}
} }
} }
} }
@ -188,7 +193,11 @@ ApplicationWindow {
id: genKey id: genKey
GenKey { GenKey {
onClosed: function () { onClosed: function () {
applicationWindow.navigateTo("InitialState") if (hasAccounts) {
applicationWindow.navigateTo("InitialState")
} else {
applicationWindow.navigateTo("KeysMain")
}
} }
} }
} }

View File

@ -27,7 +27,7 @@ Item {
CreatePasswordModal { CreatePasswordModal {
id: createPasswordModal id: createPasswordModal
onClosed: function () { onClosed: function () {
existingKeyView.onClosed() genKeyView.onClosed()
} }
} }
} }