fix(onboarding): fixed back navigation for new users

Closes #5831
This commit is contained in:
Alexandra Betouni 2022-05-24 16:50:19 +03:00 committed by Iuri Matias
parent 3af262e2d0
commit b847c75ad6
2 changed files with 18 additions and 19 deletions

View File

@ -190,9 +190,10 @@ QtObject {
KeysMainView { KeysMainView {
onButtonClicked: { onButtonClicked: {
if (state === "importseed") { if (state === "importseed") {
importSeedState.seedInputState = "newUser"; importSeedState.seedInputState = "existingUser";
Global.applicationWindow.navigateTo("ImportSeed"); Global.applicationWindow.navigateTo("ImportSeed");
} else { } else {
importSeedState.seedInputState = "newUser";
Global.applicationWindow.navigateTo("GenKey"); Global.applicationWindow.navigateTo("GenKey");
} }
} }
@ -200,11 +201,19 @@ QtObject {
Global.applicationWindow.navigateTo("KeycardFlowSelection"); Global.applicationWindow.navigateTo("KeycardFlowSelection");
} }
onSeedLinkClicked: { onSeedLinkClicked: {
importSeedState.seedInputState = "existingUser"; if (state === "getkeys") {
Global.applicationWindow.navigateTo("ImportSeed"); importSeedState.seedInputState = "newUser";
state = "importseed";
} else {
importSeedState.seedInputState = "existingUser";
Global.applicationWindow.navigateTo("ImportSeed");
}
} }
onBackClicked: { onBackClicked: {
if ((root.keysMainSetState === "connectkeys" && LoginStore.currentAccount.username !== "") || root.prevState === "LogIn") { if (state === "importseed") {
state = "getkeys";
} else if (((root.keysMainSetState === "connectkeys") && (LoginStore.currentAccount.username !== ""))
|| (root.prevState === "LogIn") || (state === "getkeys")) {
Global.applicationWindow.navigateTo("LogIn"); Global.applicationWindow.navigateTo("LogIn");
} else { } else {
Global.applicationWindow.navigateTo("Welcome"); Global.applicationWindow.navigateTo("Welcome");
@ -217,12 +226,10 @@ QtObject {
id: seedPhrase id: seedPhrase
SeedPhraseInputView { SeedPhraseInputView {
onExit: { onExit: {
if (root.keysMainSetState === "connectkeys") { if (root.keysMainSetState !== "connectkeys") {
Global.applicationWindow.navigateTo("KeyMain");
} else {
root.keysMainSetState = "importseed"; root.keysMainSetState = "importseed";
Global.applicationWindow.navigateTo("KeyMain");
} }
Global.applicationWindow.navigateTo("KeyMain");
} }
onSeedValidated: { onSeedValidated: {
root.keysMainSetState = "importseed"; root.keysMainSetState = "importseed";
@ -238,7 +245,7 @@ QtObject {
if (root.keysMainSetState === "importseed") { if (root.keysMainSetState === "importseed") {
root.keysMainSetState = "connectkeys" root.keysMainSetState = "connectkeys"
Global.applicationWindow.navigateTo("ImportSeed"); Global.applicationWindow.navigateTo("ImportSeed");
} else if (LoginStore.currentAccount.username !== "") { } else if (LoginStore.currentAccount.username !== "" && importSeedState.seedInputState === "existingUser") {
Global.applicationWindow.navigateTo("LogIn"); Global.applicationWindow.navigateTo("LogIn");
} else { } else {
Global.applicationWindow.navigateTo("KeysMain"); Global.applicationWindow.navigateTo("KeysMain");
@ -253,7 +260,7 @@ QtObject {
property var keycardFlowSelectionComponent: Component { property var keycardFlowSelectionComponent: Component {
id: keycardFlowSelection id: keycardFlowSelection
KeycardFlowSelectionView { KeycardFlowSelectionView {
onClosed: function () { onClosed: {
if (root.hasAccounts) { if (root.hasAccounts) {
Global.applicationWindow.navigateTo("InitialState") Global.applicationWindow.navigateTo("InitialState")
} else { } else {

View File

@ -120,11 +120,7 @@ OnboardingBasePage {
parent.font.underline = false parent.font.underline = false
} }
onClicked: { onClicked: {
if (root.state === "getkeys") { root.seedLinkClicked();
root.state = "importseed";
} else {
root.seedLinkClicked();
}
} }
} }
} }
@ -181,7 +177,6 @@ OnboardingBasePage {
// PropertyChanges { // PropertyChanges {
// target: keycardLink // target: keycardLink
// text: qsTr("Generate keys for a new Keycard") // text: qsTr("Generate keys for a new Keycard")
// } // }
PropertyChanges { PropertyChanges {
target: seedLink target: seedLink
@ -194,7 +189,6 @@ OnboardingBasePage {
PropertyChanges { PropertyChanges {
target: txtTitle target: txtTitle
text: qsTr("Import a seed phrase") text: qsTr("Import a seed phrase")
} }
PropertyChanges { PropertyChanges {
target: keysImg target: keysImg
@ -209,12 +203,10 @@ Only use this option if you already have a seed phrase.")
PropertyChanges { PropertyChanges {
target: button target: button
text: qsTr("Import a seed phrase") text: qsTr("Import a seed phrase")
} }
// PropertyChanges { // PropertyChanges {
// target: keycardLink // target: keycardLink
// text: qsTr("Import a seed phrase into a new Keycard") // text: qsTr("Import a seed phrase into a new Keycard")
// } // }
PropertyChanges { PropertyChanges {
target: seedLink target: seedLink