2020-06-22 11:43:34 +00:00
|
|
|
import QtQuick 2.12
|
2022-05-26 13:40:41 +00:00
|
|
|
import QtQuick.Controls 2.12
|
|
|
|
import QtQuick.Layouts 1.14
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.popups 1.0
|
|
|
|
import shared.controls 1.0
|
2021-10-20 10:03:09 +00:00
|
|
|
|
2022-05-26 13:40:41 +00:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
2021-10-20 10:03:09 +00:00
|
|
|
import StatusQ.Controls 0.1
|
2022-05-26 13:40:41 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2021-10-20 10:03:09 +00:00
|
|
|
|
2024-05-22 08:13:39 +00:00
|
|
|
import AppLayouts.Profile.stores 1.0 as ProfileStores
|
|
|
|
|
2022-05-26 13:40:41 +00:00
|
|
|
import "backupseed"
|
|
|
|
|
2022-06-28 10:55:33 +00:00
|
|
|
StatusStackModal {
|
|
|
|
id: root
|
2021-12-30 12:39:47 +00:00
|
|
|
|
2024-05-22 08:13:39 +00:00
|
|
|
property ProfileStores.PrivacyStore privacyStore
|
2022-02-09 09:43:23 +00:00
|
|
|
|
2022-10-19 12:18:33 +00:00
|
|
|
onCurrentIndexChanged: {
|
|
|
|
//StatusAnimatedStack doesn't handle well items' visibility,
|
|
|
|
//keeping this solution for now until #8024 is fixed
|
|
|
|
if (currentIndex === 2) {
|
|
|
|
confirmFirstWord.forceInputFocus();
|
|
|
|
} else if (currentIndex === 3) {
|
|
|
|
confirmSecondWord.forceInputFocus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-28 10:55:33 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
|
|
|
|
readonly property int firstRandomNo: getRandomWordNumber()
|
|
|
|
readonly property int secondRandomNo: {
|
|
|
|
var num = firstRandomNo;
|
|
|
|
while (num === firstRandomNo) {
|
|
|
|
num = getRandomWordNumber();
|
2020-06-22 11:43:34 +00:00
|
|
|
}
|
2022-06-28 10:55:33 +00:00
|
|
|
return num;
|
|
|
|
}
|
|
|
|
|
2022-07-07 11:08:19 +00:00
|
|
|
readonly property alias seedHidden: confirmSeedPhrase.hideSeed
|
|
|
|
readonly property alias seedStored: confirmStoringSeedPhrase.seedStored
|
2022-06-28 10:55:33 +00:00
|
|
|
|
2022-07-07 11:08:19 +00:00
|
|
|
readonly property alias validFirstSeedWord: confirmFirstWord.inputValid
|
|
|
|
readonly property alias validSecondSeedWord: confirmSecondWord.inputValid
|
2022-06-28 10:55:33 +00:00
|
|
|
|
2022-07-07 11:08:19 +00:00
|
|
|
readonly property Item skipButton: StatusButton {
|
2022-06-28 10:55:33 +00:00
|
|
|
visible: currentIndex === 0
|
2022-07-15 10:57:23 +00:00
|
|
|
normalColor: "transparent"
|
2022-09-13 07:37:09 +00:00
|
|
|
borderColor: Theme.palette.baseColor2
|
2022-06-28 10:55:33 +00:00
|
|
|
text: qsTr("Not Now")
|
|
|
|
onClicked: root.close()
|
|
|
|
}
|
|
|
|
|
|
|
|
function getRandomWordNumber() {
|
|
|
|
return Math.floor(Math.random() * 12);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-15 10:57:23 +00:00
|
|
|
implicitHeight: 748
|
2022-06-28 10:55:33 +00:00
|
|
|
width: 480
|
2023-05-23 12:46:16 +00:00
|
|
|
headerSettings.title: qsTr("Back up your seed phrase")
|
2022-07-15 10:57:23 +00:00
|
|
|
rightButtons: [ d.skipButton, nextButton, finishButton ]
|
2022-06-28 10:55:33 +00:00
|
|
|
|
|
|
|
nextButton: StatusButton {
|
2023-08-11 10:17:28 +00:00
|
|
|
id: nextButton
|
2022-08-16 16:35:10 +00:00
|
|
|
objectName: "BackupSeedModal_nextButton"
|
2022-06-28 10:55:33 +00:00
|
|
|
enabled: {
|
|
|
|
switch (root.currentIndex) {
|
|
|
|
case 0:
|
|
|
|
return acknowledgment.allAccepted;
|
|
|
|
case 1:
|
|
|
|
return !d.seedHidden;
|
|
|
|
case 2:
|
|
|
|
return d.validFirstSeedWord;
|
|
|
|
case 3:
|
|
|
|
return d.validSecondSeedWord;
|
|
|
|
default:
|
|
|
|
return true;
|
2022-05-26 13:40:41 +00:00
|
|
|
}
|
2022-06-28 10:55:33 +00:00
|
|
|
}
|
|
|
|
text: {
|
|
|
|
switch (root.currentIndex) {
|
|
|
|
case 0:
|
|
|
|
case 1:
|
2022-07-11 15:20:35 +00:00
|
|
|
return qsTr("Confirm Seed Phrase");
|
2022-06-28 10:55:33 +00:00
|
|
|
case 2:
|
|
|
|
case 3:
|
2022-07-11 15:20:35 +00:00
|
|
|
return qsTr("Continue");
|
2022-06-28 10:55:33 +00:00
|
|
|
default:
|
|
|
|
return "";
|
2020-10-26 20:20:31 +00:00
|
|
|
}
|
|
|
|
}
|
2022-06-28 10:55:33 +00:00
|
|
|
onClicked: root.currentIndex++
|
|
|
|
}
|
2022-05-26 13:40:41 +00:00
|
|
|
|
2022-06-28 10:55:33 +00:00
|
|
|
finishButton: StatusButton {
|
|
|
|
text: qsTr("Complete & Delete My Seed Phrase")
|
2022-08-16 16:35:10 +00:00
|
|
|
objectName: "BackupSeedModal_completeAndDeleteSeedPhraseButton"
|
2022-06-28 10:55:33 +00:00
|
|
|
enabled: d.seedStored
|
|
|
|
onClicked: {
|
|
|
|
root.privacyStore.removeMnemonic();
|
|
|
|
root.close();
|
2020-08-25 20:19:46 +00:00
|
|
|
}
|
2022-06-28 10:55:33 +00:00
|
|
|
}
|
2022-05-26 13:40:41 +00:00
|
|
|
|
2022-09-27 08:51:53 +00:00
|
|
|
// split subHeaderPadding into clip and non-clip parts
|
|
|
|
subHeaderPadding: 8
|
|
|
|
readonly property int nonClipSubHeaderPadding: 8
|
|
|
|
|
2022-06-28 10:55:33 +00:00
|
|
|
subHeaderItem: SubheaderTabBar {
|
|
|
|
// Count without Acknowledgements
|
|
|
|
steps: root.itemsCount - 1
|
|
|
|
currentIndex: root.currentIndex - 1
|
|
|
|
visible: root.currentIndex > 0
|
2022-09-27 08:51:53 +00:00
|
|
|
height: visible ? implicitHeight + nonClipSubHeaderPadding - spacing : 0
|
|
|
|
|
|
|
|
Item {
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
2020-06-22 11:43:34 +00:00
|
|
|
}
|
2022-06-28 10:55:33 +00:00
|
|
|
|
|
|
|
stackItems: [
|
|
|
|
Acknowledgements {
|
|
|
|
id: acknowledgment
|
|
|
|
},
|
|
|
|
ConfirmSeedPhrasePanel {
|
|
|
|
id: confirmSeedPhrase
|
|
|
|
seedPhrase: root.privacyStore.getMnemonic().split(" ")
|
2023-12-06 15:24:10 +00:00
|
|
|
privacyStore: root.privacyStore
|
2022-06-28 10:55:33 +00:00
|
|
|
},
|
|
|
|
BackupSeedStepBase {
|
|
|
|
id: confirmFirstWord
|
2022-08-16 16:35:10 +00:00
|
|
|
objectName: "BackupSeedModal_BackupSeedStepBase_confirmFirstWord"
|
2022-06-28 10:55:33 +00:00
|
|
|
titleText: qsTr("Confirm word #%1 of your seed phrase").arg(d.firstRandomNo + 1)
|
|
|
|
wordRandomNumber: d.firstRandomNo
|
|
|
|
wordAtRandomNumber: root.privacyStore.getMnemonicWordAtIndex(d.firstRandomNo)
|
2023-08-11 10:17:28 +00:00
|
|
|
onEnterPressed: {
|
|
|
|
nextButton.clicked();
|
|
|
|
}
|
2022-06-28 10:55:33 +00:00
|
|
|
},
|
|
|
|
BackupSeedStepBase {
|
|
|
|
id: confirmSecondWord
|
2022-08-16 16:35:10 +00:00
|
|
|
objectName: "BackupSeedModal_BackupSeedStepBase_confirmSecondWord"
|
2022-06-28 10:55:33 +00:00
|
|
|
titleText: qsTr("Confirm word #%1 of your seed phrase").arg(d.secondRandomNo + 1)
|
|
|
|
wordRandomNumber: d.secondRandomNo
|
|
|
|
wordAtRandomNumber: root.privacyStore.getMnemonicWordAtIndex(d.secondRandomNo)
|
|
|
|
},
|
|
|
|
ConfirmStoringSeedPhrasePanel {
|
|
|
|
id: confirmStoringSeedPhrase
|
|
|
|
}
|
|
|
|
]
|
2020-06-22 11:43:34 +00:00
|
|
|
}
|