fix(onboarding): fix importing seed phrase importing different accounts

Fixes #5253
This commit is contained in:
Jonathan Rainville 2022-03-29 15:15:42 -04:00
parent 08131e1d2d
commit e344e00f8b
7 changed files with 39 additions and 13 deletions

View File

@ -203,15 +203,18 @@ QtObject {
id: keysMain
KeysMainView {
onButtonClicked: {
OnboardingStore.accountImported = false
Global.applicationWindow.navigateTo("GenKey");
}
onKeycardLinkClicked: {
OnboardingStore.accountImported = false
Global.applicationWindow.navigateTo("KeycardFlowSelection");
}
onSeedLinkClicked: {
Global.applicationWindow.navigateTo("ExistingKey");
}
onBackClicked: {
OnboardingStore.accountImported = false
Global.applicationWindow.navigateTo("Welcome");
}
}

View File

@ -79,6 +79,7 @@ ModalPopup {
text: qsTrId("re-encrypt-key")
onClicked: {
OnboardingStore.accountImported = true
popup.buttonClicked()
}
}

View File

@ -19,6 +19,7 @@ QtObject {
property real profImgBX: 0.0
property real profImgBY: 0.0
property bool accountCreated: false
property bool accountImported: false
property bool showBeforeGetStartedPopup: true
@ -31,6 +32,10 @@ QtObject {
onboardingModuleInst.setSelectedAccountByIndex(selectedAccountIdx)
}
function importAccountAndDisplayName(displayName) {
onboardingModuleInst.setDisplayName(displayName)
}
function updatedDisplayName(displayName) {
if (displayName !== root.displayName) {
print(displayName, root.displayName)

View File

@ -115,7 +115,6 @@ OnboardingBasePage {
}
onClicked: {
//confPswInput.text = ""
if (OnboardingStore.accountCreated) {
if (root.password !== root.tmpPass) {
OnboardingStore.changePassword(root.tmpPass, root.password);
@ -127,7 +126,12 @@ OnboardingBasePage {
} else {
root.tmpPass = root.password;
submitBtn.loading = true
OnboardingStore.setCurrentAccountAndDisplayName(0, root.displayName);
if (OnboardingStore.accountImported) {
OnboardingStore.importAccountAndDisplayName(root.displayName);
} else {
OnboardingStore.setCurrentAccountAndDisplayName(0, root.displayName);
}
pause.start();
}
}

View File

@ -22,13 +22,25 @@ Item {
state: "username"
ListView {
id: accountsList
model: OnboardingStore.onboardingModuleInst.accountsModel
delegate: Item {
Component.onCompleted: {
root.pubKey = model.pubKey;
root.address = model.address;
Component.onCompleted: {
if (OnboardingStore.accountImported) {
root.pubKey = OnboardingStore.onboardingModuleInst.importedAccountPubKey;
root.address = OnboardingStore.onboardingModuleInst.importedAccountAddress;
}
}
Loader {
active: !OnboardingStore.accountImported
sourceComponent: ListView {
id: accountsList
model: OnboardingStore.onboardingModuleInst.accountsModel
delegate: Item {
Component.onCompleted: {
if (index === 0) {
root.pubKey = model.pubKey;
root.address = model.address;
}
}
}
}
}

View File

@ -180,7 +180,7 @@ OnboardingBasePage {
}
PropertyChanges {
target: seedLink
text: qsTr("lmport a seed phrase")
text: qsTr("Import a seed phrase")
}
},
@ -188,7 +188,7 @@ OnboardingBasePage {
name: "importseed"
PropertyChanges {
target: txtTitle
text: qsTr("lmport a seed phrase")
text: qsTr("Import a seed phrase")
}
PropertyChanges {
@ -199,12 +199,12 @@ Only use this option if you already have a seed phrase.")
}
PropertyChanges {
target: button
text: qsTr("lmport a seed phrase")
text: qsTr("Import a seed phrase")
}
PropertyChanges {
target: keycardLink
text: qsTr("lmport a seed phrase into a new Keycard")
text: qsTr("Import a seed phrase into a new Keycard")
}
PropertyChanges {

View File

@ -248,6 +248,7 @@ Item {
anchors.topMargin: 16
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
OnboardingStore.accountImported = false
onGenKeyClicked()
}
}