diff --git a/storybook/qmlTests/tests/tst_OnboardingLayout.qml b/storybook/qmlTests/tests/tst_OnboardingLayout.qml index 0fb48a6870e..23dceb55d5d 100644 --- a/storybook/qmlTests/tests/tst_OnboardingLayout.qml +++ b/storybook/qmlTests/tests/tst_OnboardingLayout.qml @@ -34,7 +34,11 @@ Item { OnboardingLayout { anchors.fill: parent + networkChecksEnabled: false + biometricsAvailable: mockDriver.biometricsAvailable + keycardPinInfoPageDelay: 0 + onboardingStore: OnboardingStore { readonly property int keycardState: mockDriver.keycardState // enum Onboarding.KeycardState property int keycardRemainingPinAttempts: 5 @@ -70,6 +74,7 @@ Item { } function inputConnectionStringForBootstrapping(connectionString: string) {} } + metricsStore: SharedStores.MetricsStore { readonly property var d: QtObject { id: d @@ -85,8 +90,6 @@ Item { readonly property bool isCentralizedMetricsEnabled : d.isCentralizedMetricsEnabled } - biometricsAvailable: mockDriver.biometricsAvailable - QtObject { id: localAppSettings property bool metricsPopupSeen diff --git a/ui/app/AppLayouts/Onboarding2/KeycardCreateProfileFlow.qml b/ui/app/AppLayouts/Onboarding2/KeycardCreateProfileFlow.qml index 60db29aa7fc..8a383b790bb 100644 --- a/ui/app/AppLayouts/Onboarding2/KeycardCreateProfileFlow.qml +++ b/ui/app/AppLayouts/Onboarding2/KeycardCreateProfileFlow.qml @@ -2,11 +2,13 @@ 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 @@ -14,6 +16,7 @@ SQUtils.QObject { required property int keycardState required property int addKeyPairState + required property int keycardPinInfoPageDelay required property var seedWords required property var isSeedPhraseValid @@ -166,10 +169,12 @@ SQUtils.QObject { id: keycardCreatePinPage KeycardCreatePinPage { - onKeycardPinCreated: { - root.keycardPinCreated(pin) - root.keyPairTransferRequested() - root.stackView.push(addKeypairPage) + onKeycardPinCreated: (pin) => { + Backpressure.debounce(root, root.keycardPinInfoPageDelay, () => { + root.keycardPinCreated(pin) + root.keyPairTransferRequested() + root.stackView.push(addKeypairPage) + })() } } } diff --git a/ui/app/AppLayouts/Onboarding2/LoginWithKeycardFlow.qml b/ui/app/AppLayouts/Onboarding2/LoginWithKeycardFlow.qml index 94c71c3ea97..c296a5e785b 100644 --- a/ui/app/AppLayouts/Onboarding2/LoginWithKeycardFlow.qml +++ b/ui/app/AppLayouts/Onboarding2/LoginWithKeycardFlow.qml @@ -2,6 +2,7 @@ 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 @@ -16,6 +17,8 @@ SQUtils.QObject { required property int remainingAttempts required property var isSeedPhraseValid + required property int keycardPinInfoPageDelay + property bool displayKeycardPromoBanner signal keycardPinEntered(string pin) @@ -85,9 +88,11 @@ SQUtils.QObject { remainingAttempts: root.remainingAttempts unlockUsingSeedphrase: true - onKeycardPinEntered: { - root.keycardPinEntered(pin) - root.finished() + onKeycardPinEntered: (pin) => { + Backpressure.debounce(root, root.keycardPinInfoPageDelay, () => { + root.keycardPinEntered(pin) + root.finished() + })() } onReloadKeycardRequested: d.reload() @@ -114,9 +119,11 @@ SQUtils.QObject { id: keycardCreatePinPage KeycardCreatePinPage { - onKeycardPinCreated: { - root.keycardPinCreated(pin) - root.finished() + onKeycardPinCreated: (pin) => { + Backpressure.debounce(root, root.keycardPinInfoPageDelay, () => { + root.keycardPinCreated(pin) + root.finished() + })() } } } diff --git a/ui/app/AppLayouts/Onboarding2/OnboardingFlow.qml b/ui/app/AppLayouts/Onboarding2/OnboardingFlow.qml index 593f95ceeff..6c168bfd903 100644 --- a/ui/app/AppLayouts/Onboarding2/OnboardingFlow.qml +++ b/ui/app/AppLayouts/Onboarding2/OnboardingFlow.qml @@ -22,6 +22,8 @@ SQUtils.QObject { required property bool displayKeycardPromoBanner required property bool networkChecksEnabled + property int keycardPinInfoPageDelay: 2000 + // functions required property var passwordStrengthScoreFunction required property var isSeedPhraseValid @@ -161,6 +163,8 @@ SQUtils.QObject { displayKeycardPromoBanner: root.displayKeycardPromoBanner isSeedPhraseValid: root.isSeedPhraseValid + keycardPinInfoPageDelay: root.keycardPinInfoPageDelay + onReloadKeycardRequested: root.reloadKeycardRequested() onKeycardFactoryResetRequested: root.keycardFactoryResetRequested() onKeyPairTransferRequested: root.keyPairTransferRequested() @@ -216,6 +220,8 @@ SQUtils.QObject { tryToSetPinFunction: root.tryToSetPinFunction isSeedPhraseValid: root.isSeedPhraseValid + keycardPinInfoPageDelay: root.keycardPinInfoPageDelay + onKeycardPinEntered: (pin) => root.keycardPinEntered(pin) onKeycardPinCreated: (pin) => root.keycardPinCreated(pin) onSeedphraseSubmitted: (seedphrase) => root.seedphraseSubmitted(seedphrase) diff --git a/ui/app/AppLayouts/Onboarding2/OnboardingLayout.qml b/ui/app/AppLayouts/Onboarding2/OnboardingLayout.qml index b2205ccfe3d..bf583cfc629 100644 --- a/ui/app/AppLayouts/Onboarding2/OnboardingLayout.qml +++ b/ui/app/AppLayouts/Onboarding2/OnboardingLayout.qml @@ -23,6 +23,7 @@ Page { property bool biometricsAvailable: Qt.platform.os === Constants.mac property bool networkChecksEnabled: true + property alias keycardPinInfoPageDelay: onboardingFlow.keycardPinInfoPageDelay readonly property alias stack: stack diff --git a/ui/app/AppLayouts/Onboarding2/pages/KeycardCreatePinPage.qml b/ui/app/AppLayouts/Onboarding2/pages/KeycardCreatePinPage.qml index 7bc2b26d022..028f518e73a 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/KeycardCreatePinPage.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/KeycardCreatePinPage.qml @@ -7,7 +7,6 @@ import StatusQ.Components 0.1 import StatusQ.Controls 0.1 import StatusQ.Controls.Validators 0.1 import StatusQ.Core.Theme 0.1 -import StatusQ.Core.Backpressure 0.1 import AppLayouts.Onboarding2.controls 1.0 @@ -103,7 +102,7 @@ KeycardBasePage { StateChangeScript { script: { pinInput.setPin(d.pin) - Backpressure.debounce(root, 2000, () => root.keycardPinCreated(d.pin))() + root.keycardPinCreated(d.pin) } } }, diff --git a/ui/app/AppLayouts/Onboarding2/pages/KeycardEnterPinPage.qml b/ui/app/AppLayouts/Onboarding2/pages/KeycardEnterPinPage.qml index 3d66c3cb38d..601661068f5 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/KeycardEnterPinPage.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/KeycardEnterPinPage.qml @@ -146,9 +146,7 @@ KeycardBasePage { enabled: false } StateChangeScript { - script: { - Backpressure.debounce(root, 2000, () => root.keycardPinEntered(pinInput.pinInput))() - } + script: root.keycardPinEntered(pinInput.pinInput) } }, State {