From e2f9dab33b9ff240ef927fd3ece4ef6474bd23c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Tinkl?= Date: Tue, 28 Jan 2025 17:20:20 +0100 Subject: [PATCH] fix(Onboarding/SyncProgressPagePage): fixup back buttons - SyncProgressPagePage: enable the back button only in the failed state - SyncProgressPagePage: fix the "Try again" and "Back" button to go to the Scan QR step; the connection code is disposable and can't be used again anyway - adjust the respective SB pages to reflect the correct enum values --- storybook/pages/KeycardAddKeyPairPagePage.qml | 15 ++++++++++----- storybook/pages/SyncProgressPagePage.qml | 15 ++++++++++----- .../AppLayouts/Onboarding2/LoginBySyncingFlow.qml | 10 +++------- .../Onboarding2/pages/SyncProgressPage.qml | 2 +- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/storybook/pages/KeycardAddKeyPairPagePage.qml b/storybook/pages/KeycardAddKeyPairPagePage.qml index 8ce57c3a6b..43a50a6d3b 100644 --- a/storybook/pages/KeycardAddKeyPairPagePage.qml +++ b/storybook/pages/KeycardAddKeyPairPagePage.qml @@ -13,14 +13,14 @@ Item { id: progressPage anchors.fill: parent - addKeyPairState: Onboarding.AddKeyPairState.InProgress + addKeyPairState: ctrlState.currentValue onKeypairAddTryAgainRequested: { console.warn("!!! onKeypairAddTryAgainRequested") - addKeyPairState = Onboarding.AddKeyPairState.InProgress + ctrlState.currentIndex = ctrlState.indexOfValue(Onboarding.AddKeyPairState.InProgress) Backpressure.debounce(root, 2000, function() { console.warn("!!! SIMULATION: SUCCESS") - addKeyPairState = Onboarding.AddKeyPairState.Success + ctrlState.currentIndex = ctrlState.indexOfValue(Onboarding.AddKeyPairState.Success) })() } onKeypairAddContinueRequested: console.warn("!!! onKeypairAddContinueRequested") @@ -33,8 +33,13 @@ Item { anchors.right: parent.right anchors.bottom: parent.bottom width: 350 - model: ["Onboarding.AddKeyPairState.InProgress", "Onboarding.AddKeyPairState.Success", "Onboarding.AddKeyPairState.Failed"] - onCurrentIndexChanged: progressPage.addKeyPairState = currentIndex + textRole: "name" + valueRole: "value" + model: [ + {name: "InProgress", value: Onboarding.AddKeyPairState.InProgress}, + {name: "Success", value: Onboarding.AddKeyPairState.Success}, + {name: "Failed", value: Onboarding.AddKeyPairState.Failed} + ] } } diff --git a/storybook/pages/SyncProgressPagePage.qml b/storybook/pages/SyncProgressPagePage.qml index db63967cfe..789ea2330e 100644 --- a/storybook/pages/SyncProgressPagePage.qml +++ b/storybook/pages/SyncProgressPagePage.qml @@ -12,13 +12,13 @@ Item { SyncProgressPage { id: progressPage anchors.fill: parent - syncState: Onboarding.SyncState.InProgress + syncState: ctrlState.currentValue onRestartSyncRequested: { console.warn("!!! RESTART SYNC REQUESTED") - syncState = Onboarding.SyncState.InProgress + ctrlState.currentIndex = ctrlState.indexOfValue(Onboarding.SyncState.InProgress) Backpressure.debounce(root, 2000, function() { console.warn("!!! SIMULATION: SUCCESS") - syncState = Onboarding.SyncState.Success + ctrlState.currentIndex = ctrlState.indexOfValue(Onboarding.SyncState.Success) })() } onLoginToAppRequested: console.warn("!!! LOGIN TO APP REQUESTED") @@ -30,8 +30,13 @@ Item { anchors.right: parent.right anchors.bottom: parent.bottom width: 300 - model: ["Onboarding.SyncState.InProgress", "Onboarding.SyncState.Success", "Onboarding.SyncState.Failed"] - onCurrentIndexChanged: progressPage.syncState = currentIndex + textRole: "name" + valueRole: "value" + model: [ + {name: "InProgress", value: Onboarding.SyncState.InProgress}, + {name: "Success", value: Onboarding.SyncState.Success}, + {name: "Failed", value: Onboarding.SyncState.Failed} + ] } } diff --git a/ui/app/AppLayouts/Onboarding2/LoginBySyncingFlow.qml b/ui/app/AppLayouts/Onboarding2/LoginBySyncingFlow.qml index c4cf2b4de0..c8067c1b18 100644 --- a/ui/app/AppLayouts/Onboarding2/LoginBySyncingFlow.qml +++ b/ui/app/AppLayouts/Onboarding2/LoginBySyncingFlow.qml @@ -29,7 +29,7 @@ SQUtils.QObject { onSyncProceedWithConnectionString: { root.syncProceedWithConnectionString(connectionString) - root.stackView.push(syncProgressPage, { connectionString }) + root.stackView.push(syncProgressPage) } } } @@ -38,17 +38,13 @@ SQUtils.QObject { id: syncProgressPage SyncProgressPage { - property string connectionString readonly property bool backAvailableHint: - root.syncState !== Onboarding.SyncState.InProgress + root.syncState === Onboarding.SyncState.Failed syncState: root.syncState onLoginToAppRequested: root.finished() - onRestartSyncRequested: { - root.syncProceedWithConnectionString(connectionString) - root.stackView.replace(syncProgressPage) - } + onRestartSyncRequested: root.stackView.pop() onLoginWithSeedphraseRequested: root.loginWithSeedphraseRequested() } diff --git a/ui/app/AppLayouts/Onboarding2/pages/SyncProgressPage.qml b/ui/app/AppLayouts/Onboarding2/pages/SyncProgressPage.qml index 62a4991695..529742b98b 100644 --- a/ui/app/AppLayouts/Onboarding2/pages/SyncProgressPage.qml +++ b/ui/app/AppLayouts/Onboarding2/pages/SyncProgressPage.qml @@ -21,7 +21,7 @@ OnboardingPage { states: [ State { name: "inprogress" - when: root.syncState === Onboarding.SyncState.InProgress + when: root.syncState === Onboarding.SyncState.InProgress || root.syncState === Onboarding.SyncState.Idle PropertyChanges { target: root title: qsTr("Profile sync in progress...")