2021-09-24 12:03:57 +00:00
|
|
|
import QtQuick 2.13
|
2021-10-12 18:26:02 +00:00
|
|
|
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared.keycard 1.0
|
2021-10-12 18:26:02 +00:00
|
|
|
import "../popups"
|
|
|
|
import "../stores"
|
2021-09-24 12:03:57 +00:00
|
|
|
|
|
|
|
Item {
|
2021-10-01 10:22:51 +00:00
|
|
|
enum OnboardingFlow {
|
|
|
|
Recover,
|
|
|
|
Generate,
|
|
|
|
ImportMnemonic
|
|
|
|
}
|
|
|
|
|
2021-09-24 12:03:57 +00:00
|
|
|
property var onClosed: function () {}
|
2021-09-27 13:55:39 +00:00
|
|
|
property bool connected: false
|
2022-03-04 23:31:31 +00:00
|
|
|
property int flow: KeycardFlowSelectionView.OnboardingFlow.Recover
|
2021-09-27 13:55:39 +00:00
|
|
|
|
2021-09-24 12:03:57 +00:00
|
|
|
id: keycardView
|
|
|
|
Component.onCompleted: {
|
2021-09-29 13:23:28 +00:00
|
|
|
insertCard.open()
|
2021-10-12 18:26:02 +00:00
|
|
|
KeycardStore.startConnection()
|
2021-09-27 13:55:39 +00:00
|
|
|
}
|
|
|
|
|
2021-10-12 18:26:02 +00:00
|
|
|
KeycardCreatePINModal {
|
2021-09-24 12:03:57 +00:00
|
|
|
id: createPinModal
|
2021-10-12 18:26:02 +00:00
|
|
|
onSubmitBtnClicked: KeycardStore.init(pin)
|
2021-09-24 12:03:57 +00:00
|
|
|
onClosed: function () {
|
2021-10-01 10:22:51 +00:00
|
|
|
if (!createPinModal.submitted) {
|
|
|
|
keycardView.onClosed()
|
|
|
|
}
|
2021-09-24 12:03:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PairingModal {
|
|
|
|
id: pairingModal
|
|
|
|
onClosed: function () {
|
2021-09-30 11:52:46 +00:00
|
|
|
if (!pairingModal.submitted) {
|
|
|
|
keycardView.onClosed()
|
|
|
|
}
|
2021-09-24 12:03:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PINModal {
|
|
|
|
id: pinModal
|
|
|
|
onClosed: function () {
|
2021-10-01 10:22:51 +00:00
|
|
|
if (!pinModal.submitted) {
|
|
|
|
keycardView.onClosed()
|
|
|
|
}
|
2021-09-27 07:36:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
InsertCard {
|
|
|
|
id: insertCard
|
2021-09-27 13:55:39 +00:00
|
|
|
onCancel: function() {
|
2021-09-24 12:03:57 +00:00
|
|
|
keycardView.onClosed()
|
|
|
|
}
|
|
|
|
}
|
2021-09-30 11:52:46 +00:00
|
|
|
|
2021-12-13 14:24:21 +00:00
|
|
|
// Not Refactored Yet
|
|
|
|
// Connections {
|
|
|
|
// id: connection
|
|
|
|
// target: OnboardingStore.keycardModelInst
|
|
|
|
// ignoreUnknownSignals: true
|
|
|
|
|
|
|
|
// onCardUnpaired: {
|
|
|
|
// pairingModal.open()
|
|
|
|
// }
|
|
|
|
|
|
|
|
// onCardPaired: {
|
|
|
|
// pinModal.open()
|
|
|
|
// }
|
|
|
|
|
|
|
|
// onCardAuthenticated: {
|
|
|
|
// switch (flow) {
|
|
|
|
// case OnboardingFlow.Recover: {
|
|
|
|
// KeycardStore.recoverAccount();
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// case OnboardingFlow.Generate: {
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// case OnboardingFlow.ImportMnemonic: {
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// //TODO: support the states below
|
|
|
|
|
|
|
|
// onCardPreInit: {
|
|
|
|
// createPinModal.open()
|
|
|
|
// }
|
|
|
|
|
|
|
|
// onCardFrozen: {
|
|
|
|
// keycardView.onClosed()
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// onCardBlocked: {
|
|
|
|
// keycardView.onClosed()
|
|
|
|
// }
|
|
|
|
|
|
|
|
// // TODO: handle these by showing an error an prompting for another card
|
|
|
|
// // later add factory reset option for the NoFreeSlots case
|
|
|
|
|
|
|
|
// onCardNoFreeSlots: {
|
|
|
|
// keycardView.onClosed()
|
|
|
|
// }
|
|
|
|
|
|
|
|
// onCardNotKeycard: {
|
|
|
|
// keycardView.onClosed()
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
2021-10-12 18:26:02 +00:00
|
|
|
}
|