-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Onboarding): implement the KeycardFactoryReset flow
- integrate it into the UI and StoryBook - a new keycardState is introduced: `FactoryResetting` (matching the backend) - a new store method introduced: `startKeycardFactoryReset()` Fixes: #17094
- Loading branch information
Showing
11 changed files
with
177 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 108 additions & 0 deletions
108
ui/app/AppLayouts/Onboarding2/KeycardFactoryResetFlow.qml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import QtQuick 2.15 | ||
import QtQuick.Controls 2.15 | ||
|
||
import StatusQ.Core 0.1 | ||
import StatusQ.Controls 0.1 | ||
import StatusQ.Components 0.1 | ||
import StatusQ.Core.Theme 0.1 | ||
import StatusQ.Core.Utils 0.1 as SQUtils | ||
|
||
import AppLayouts.Onboarding2.pages 1.0 | ||
import AppLayouts.Onboarding.enums 1.0 | ||
|
||
SQUtils.QObject { | ||
id: root | ||
|
||
required property StackView stackView | ||
required property int keycardState | ||
|
||
signal performKeycardFactoryResetRequested | ||
|
||
signal finished | ||
|
||
function init(fromLoginScreen = false) { | ||
d.fromLoginScreen = fromLoginScreen | ||
root.stackView.push(d.initialComponent()) | ||
} | ||
|
||
QtObject { | ||
id: d | ||
|
||
property bool fromLoginScreen | ||
|
||
function initialComponent() { | ||
if (root.keycardState === Onboarding.KeycardState.FactoryResetting) | ||
return keycardResetPageComponent | ||
return keycardResetAcks | ||
} | ||
} | ||
|
||
Component { | ||
id: keycardResetAcks | ||
|
||
KeycardBasePage { | ||
image.source: Theme.png("onboarding/keycard/reading") | ||
title: qsTr("Factory reset Keycard") | ||
subtitle: "<font color='%1'>".arg(Theme.palette.dangerColor1) + | ||
qsTr("All data including the stored key pair and derived accounts will be removed from the Keycard") + | ||
"</font>" | ||
buttons: [ | ||
StatusCheckBox { | ||
id: ack | ||
width: Math.min(implicitWidth, parent.width) | ||
anchors.horizontalCenter: parent.horizontalCenter | ||
text: qsTr("I understand the key pair will be deleted") | ||
}, | ||
Item { | ||
width: parent.width | ||
height: parent.spacing | ||
}, | ||
StatusButton { | ||
anchors.horizontalCenter: parent.horizontalCenter | ||
type: StatusBaseButton.Type.Danger | ||
text: qsTr("Factory reset this Keycard") | ||
enabled: ack.checked | ||
onClicked: { | ||
root.performKeycardFactoryResetRequested() | ||
root.stackView.replace(null, keycardResetPageComponent) | ||
} | ||
} | ||
] | ||
} | ||
} | ||
|
||
Component { | ||
id: keycardResetPageComponent | ||
|
||
KeycardBasePage { | ||
id: keycardResetPage | ||
readonly property bool resetting: root.keycardState === Onboarding.KeycardState.FactoryResetting | ||
|
||
image.source: resetting ? Theme.png("onboarding/keycard/empty") // FIXME correct image | ||
: Theme.png("onboarding/keycard/success") | ||
title: resetting ? qsTr("Reseting Keycard") : qsTr("Keycard successfully factory reset") | ||
subtitle: resetting ? "" : qsTr("You can now use this Keycard like it's a brand-new, empty Keycard") | ||
infoText.text: resetting ? qsTr("Do not remove your Keycard or reader") : "" | ||
buttons: [ | ||
Row { | ||
spacing: 4 | ||
visible: keycardResetPage.resetting | ||
anchors.horizontalCenter: parent.horizontalCenter | ||
StatusLoadingIndicator { | ||
color: Theme.palette.directColor1 | ||
} | ||
StatusBaseText { | ||
text: qsTr("Please wait while the Keycard is being reset") | ||
} | ||
}, | ||
StatusButton { | ||
visible: !keycardResetPage.resetting | ||
anchors.horizontalCenter: parent.horizontalCenter | ||
width: 320 | ||
text: d.fromLoginScreen ? qsTr("Back to Login screen") : qsTr("Log in or Create profile") | ||
onClicked: root.finished() | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.