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
This commit is contained in:
Lukáš Tinkl 2025-01-28 17:20:20 +01:00 committed by Lukáš Tinkl
parent f64019fb09
commit e2f9dab33b
4 changed files with 24 additions and 18 deletions

View File

@ -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}
]
}
}

View File

@ -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}
]
}
}

View File

@ -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()
}

View File

@ -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...")