2025-01-24 01:17:48 +01:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
|
|
|
|
import StatusQ.Core.Utils 0.1 as SQUtils
|
|
|
|
import StatusQ.Core.Backpressure 0.1
|
|
|
|
|
|
|
|
import AppLayouts.Onboarding2.pages 1.0
|
|
|
|
import AppLayouts.Onboarding.enums 1.0
|
|
|
|
|
|
|
|
SQUtils.QObject {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
required property StackView stackView
|
|
|
|
|
|
|
|
required property int keycardState
|
|
|
|
required property int addKeyPairState
|
2025-02-04 08:22:05 -05:00
|
|
|
required property int authorizationState
|
|
|
|
required property int pinSettingState
|
2025-01-24 01:17:48 +01:00
|
|
|
required property int keycardPinInfoPageDelay
|
|
|
|
|
|
|
|
required property var isSeedPhraseValid
|
|
|
|
|
|
|
|
property bool displayKeycardPromoBanner
|
|
|
|
|
|
|
|
signal loginWithKeycardRequested
|
|
|
|
signal keycardFactoryResetRequested
|
|
|
|
signal keycardPinCreated(string pin)
|
2025-02-04 08:22:05 -05:00
|
|
|
signal authorizationRequested
|
2025-01-24 01:17:48 +01:00
|
|
|
signal seedphraseSubmitted(string seedphrase)
|
|
|
|
|
|
|
|
signal keypairAddTryAgainRequested
|
|
|
|
signal reloadKeycardRequested
|
|
|
|
signal createProfileWithoutKeycardRequested
|
|
|
|
|
|
|
|
signal finished
|
|
|
|
|
|
|
|
function init() {
|
|
|
|
root.stackView.push(d.initialComponent())
|
|
|
|
}
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
|
|
|
|
function initialComponent() {
|
|
|
|
if (root.keycardState === Onboarding.KeycardState.Empty)
|
|
|
|
return seedphrasePage
|
|
|
|
|
|
|
|
if (root.keycardState === Onboarding.KeycardState.NotEmpty)
|
|
|
|
return keycardNotEmptyPage
|
|
|
|
|
|
|
|
return keycardIntroPage
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: keycardIntroPage
|
|
|
|
|
|
|
|
KeycardIntroPage {
|
|
|
|
keycardState: root.keycardState
|
|
|
|
displayPromoBanner: root.displayKeycardPromoBanner
|
|
|
|
|
|
|
|
onReloadKeycardRequested: {
|
|
|
|
root.reloadKeycardRequested()
|
|
|
|
root.stackView.replace(d.initialComponent(),
|
|
|
|
StackView.PopTransition)
|
|
|
|
}
|
|
|
|
|
|
|
|
onKeycardFactoryResetRequested: root.keycardFactoryResetRequested()
|
|
|
|
onEmptyKeycardDetected: root.stackView.replace(seedphrasePage)
|
|
|
|
onNotEmptyKeycardDetected: root.stackView.replace(keycardNotEmptyPage)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: keycardNotEmptyPage
|
|
|
|
|
|
|
|
KeycardNotEmptyPage {
|
|
|
|
onReloadKeycardRequested: {
|
|
|
|
root.reloadKeycardRequested()
|
|
|
|
root.stackView.replace(d.initialComponent(),
|
|
|
|
StackView.PopTransition)
|
|
|
|
}
|
|
|
|
|
|
|
|
onLoginWithThisKeycardRequested: root.loginWithKeycardRequested()
|
|
|
|
onKeycardFactoryResetRequested: root.keycardFactoryResetRequested()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: seedphrasePage
|
|
|
|
|
|
|
|
SeedphrasePage {
|
|
|
|
title: qsTr("Enter recovery phrase of lost Keycard")
|
|
|
|
|
2025-02-04 08:22:05 -05:00
|
|
|
authorizationState: root.authorizationState
|
2025-01-24 01:17:48 +01:00
|
|
|
isSeedPhraseValid: root.isSeedPhraseValid
|
|
|
|
onSeedphraseSubmitted: (seedphrase) => {
|
|
|
|
root.seedphraseSubmitted(seedphrase)
|
|
|
|
root.stackView.push(keycardCreatePinPage)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: keycardCreatePinPage
|
|
|
|
|
|
|
|
KeycardCreatePinPage {
|
2025-02-04 08:22:05 -05:00
|
|
|
pinSettingState: root.pinSettingState
|
|
|
|
authorizationState: root.authorizationState
|
2025-01-24 01:17:48 +01:00
|
|
|
onKeycardPinCreated: (pin) => {
|
|
|
|
root.keycardPinCreated(pin)
|
2025-02-04 08:22:05 -05:00
|
|
|
root.authorizationRequested()
|
|
|
|
}
|
|
|
|
onKeycardAuthorized: {
|
|
|
|
root.stackView.push(addKeypairPage)
|
2025-01-24 01:17:48 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: addKeypairPage
|
|
|
|
|
|
|
|
KeycardAddKeyPairPage {
|
|
|
|
readonly property bool backAvailableHint: false
|
|
|
|
|
|
|
|
addKeyPairState: root.addKeyPairState
|
|
|
|
|
|
|
|
onKeypairAddContinueRequested: root.finished()
|
|
|
|
|
|
|
|
onKeypairAddTryAgainRequested: {
|
|
|
|
root.stackView.replace(addKeypairPage)
|
|
|
|
root.keypairAddTryAgainRequested()
|
|
|
|
}
|
|
|
|
|
|
|
|
onReloadKeycardRequested: {
|
|
|
|
root.reloadKeycardRequested()
|
|
|
|
|
|
|
|
const page = root.stackView.find(
|
|
|
|
item => item instanceof CreateKeycardProfilePage)
|
|
|
|
|
|
|
|
root.stackView.replace(page, d.initialComponent(),
|
|
|
|
StackView.PopTransition)
|
|
|
|
}
|
|
|
|
|
|
|
|
onCreateProfilePageRequested: root.createProfileWithoutKeycardRequested()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|