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

View File

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