Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: status-im/status-desktop
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 91f13bb87d96bd7458a88b5a05602aad67d11825
Choose a base ref
..
head repository: status-im/status-desktop
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e9744f794df225517bba546d60ec6ae4e4e3f6aa
Choose a head ref
Showing with 839 additions and 135 deletions.
  1. +16 −3 storybook/pages/KeycardEnterPinPagePage.qml
  2. +43 −0 storybook/pages/KeycardEnterPukPagePage.qml
  3. +25 −0 storybook/pages/KeycardIntroPagePage.qml
  4. +30 −11 storybook/pages/LoginScreenPage.qml
  5. +39 −12 storybook/pages/OnboardingLayoutPage.qml
  6. +210 −0 storybook/pages/UnblockWithPukFlowPage.qml
  7. +2 −2 storybook/qmlTests/tests/tst_OnboardingLayout.qml
  8. +2 −1 storybook/src/Storybook/BiometricsPopup.qml
  9. +5 −0 ui/StatusQ/src/StatusQ/Popups/StatusSimpleTextPopup.qml
  10. +2 −1 ui/StatusQ/src/onboarding/enums.h
  11. +1 −0 ui/app/AppLayouts/Onboarding2/KeycardCreateProfileFlow.qml
  12. +12 −8 ui/app/AppLayouts/Onboarding2/LoginWithKeycardFlow.qml
  13. +35 −7 ui/app/AppLayouts/Onboarding2/OnboardingFlow.qml
  14. +41 −10 ui/app/AppLayouts/Onboarding2/OnboardingLayout.qml
  15. +3 −0 ui/app/AppLayouts/Onboarding2/OnboardingStackView.qml
  16. +109 −0 ui/app/AppLayouts/Onboarding2/UnblockWithPukFlow.qml
  17. +4 −2 ui/app/AppLayouts/Onboarding2/UseRecoveryPhraseFlow.qml
  18. +21 −12 ui/app/AppLayouts/Onboarding2/components/LoginKeycardBox.qml
  19. +1 −19 ui/app/AppLayouts/Onboarding2/controls/MaybeOutlineButton.qml
  20. +25 −24 ui/app/AppLayouts/Onboarding2/pages/KeycardEnterPinPage.qml
  21. +142 −0 ui/app/AppLayouts/Onboarding2/pages/KeycardEnterPukPage.qml
  22. +52 −16 ui/app/AppLayouts/Onboarding2/pages/KeycardIntroPage.qml
  23. +9 −5 ui/app/AppLayouts/Onboarding2/pages/LoginScreen.qml
  24. +2 −0 ui/app/AppLayouts/Onboarding2/pages/qmldir
  25. +1 −0 ui/app/AppLayouts/Onboarding2/qmldir
  26. +5 −0 ui/app/AppLayouts/Onboarding2/stores/OnboardingStore.qml
  27. +2 −2 ui/app/mainui/Popups.qml
19 changes: 16 additions & 3 deletions storybook/pages/KeycardEnterPinPagePage.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15

import AppLayouts.Onboarding2.pages 1.0

@@ -18,6 +19,7 @@ Item {
return valid
}
remainingAttempts: 3
unblockWithPukAvailable: ctrlUnblockWithPUK.checked
onKeycardPinEntered: (pin) => {
console.warn("!!! PIN:", pin)
console.warn("!!! RESETTING FLOW")
@@ -35,10 +37,21 @@ Item {
}
}

Label {
anchors.bottom: parent.bottom
RowLayout {
anchors.right: parent.right
text: "Hint: %1".arg(root.existingPin)
anchors.bottom: parent.bottom

CheckBox {
id: ctrlUnblockWithPUK
text: "Unblock with PUK available"
checked: true
}

Item { Layout.fillWidth: true }

Label {
text: "Hint: %1".arg(root.existingPin)
}
}
}

43 changes: 43 additions & 0 deletions storybook/pages/KeycardEnterPukPagePage.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import QtQuick 2.15
import QtQuick.Controls 2.15

import AppLayouts.Onboarding2.pages 1.0

Item {
id: root

readonly property string existingPuk: "111111111111"

KeycardEnterPukPage {
id: page
anchors.fill: parent
remainingAttempts: 3
tryToSetPukFunction: (puk) => {
console.warn("!!! ATTEMPTED PUK:", puk)
const valid = puk === root.existingPuk
if (!valid)
remainingAttempts--
return valid
}
onKeycardPukEntered: (puk) => {
console.warn("!!! CORRECT PUK:", puk)
console.warn("!!! RESETTING FLOW")
state = "entering"
}
onKeycardFactoryResetRequested: {
console.warn("onKeycardFactoryResetRequested")
console.warn("!!! RESETTING FLOW")
state = "entering"
remainingAttempts = 3
}
}

Label {
anchors.bottom: parent.bottom
anchors.right: parent.right
text: "Hint: %1".arg(root.existingPuk)
}
}

// category: Onboarding
// status: good
25 changes: 25 additions & 0 deletions storybook/pages/KeycardIntroPagePage.qml
Original file line number Diff line number Diff line change
@@ -24,13 +24,18 @@ Item {
id: introPage
KeycardIntroPage {
keycardState: ctrlKeycardState.currentValue
unblockWithPukAvailable: ctrlUnblockWithPUK.checked
unblockUsingSeedphraseAvailable: ctrlUnblockWithSeedphrase.checked
factoryResetAvailable: ctrlFactoryReset.checked
displayPromoBanner: ctrlDisplayPromo.checked
onEmptyKeycardDetected: console.warn("!!! EMPTY DETECTED")
onNotEmptyKeycardDetected: console.warn("!!! NOT EMPTY DETECTED")
onReloadKeycardRequested: console.warn("!!! RELOAD REQUESTED")
onOpenLink: Qt.openUrlExternally(link)
onOpenLinkWithConfirmation: Qt.openUrlExternally(link)
onKeycardFactoryResetRequested: console.warn("!!! FACTORY RESET")
onUnblockWithSeedphraseRequested: console.warn("!!! UNBLOCK WITH SEEDPHRASE")
onUnblockWithPukRequested: console.warn("!!! UNBLOCK WITH PUK")
}
}

@@ -55,6 +60,26 @@ Item {
anchors.right: parent.right
anchors.bottom: parent.bottom

CheckBox {
id: ctrlUnblockWithPUK
text: "Unblock with PUK available"
checked: true
}

CheckBox {
id: ctrlUnblockWithSeedphrase
text: "Unblock with seedphrase available"
checked: true
}

CheckBox {
id: ctrlFactoryReset
text: "Factory reset available"
checked: true
}

Item { Layout.fillWidth: true }

CheckBox {
id: ctrlDisplayPromo
text: "Promo banner"
41 changes: 30 additions & 11 deletions storybook/pages/LoginScreenPage.qml
Original file line number Diff line number Diff line change
@@ -30,16 +30,29 @@ SplitView {

// keycard
property int keycardState: Onboarding.KeycardState.NoPCSCService
property int keycardRemainingPinAttempts: ctrlUnlockWithPuk.checked ? 1 : 5
property int keycardRemainingPinAttempts: 3
property int keycardRemainingPukAttempts: 3

function setPin(pin: string) { // -> bool
logs.logEvent("OnboardingStore.setPin", ["pin"], arguments)
const valid = pin === ctrlPin.text
if (!valid)
keycardRemainingPinAttempts-- // SIMULATION: decrease the remaining PIN attempts
if (keycardRemainingPinAttempts <= 0) { // SIMULATION: "lock" the keycard
keycardState = Onboarding.KeycardState.Locked
keycardRemainingPinAttempts = ctrlUnlockWithPuk.checked ? 1 : 5
if (keycardRemainingPinAttempts <= 0) { // SIMULATION: "block" the keycard
keycardState = Onboarding.KeycardState.BlockedPIN
keycardRemainingPinAttempts = 0
}
return valid
}

function setPuk(puk) { // -> bool
logs.logEvent("OnboardingStore.setPuk", ["puk"], arguments)
const valid = puk === ctrlPuk.text
if (!valid)
keycardRemainingPukAttempts--
if (keycardRemainingPukAttempts <= 0) { // SIMULATION: "block" the keycard
keycardState = Onboarding.KeycardState.BlockedPUK
keycardRemainingPukAttempts = 0
}
return valid
}
@@ -72,9 +85,10 @@ SplitView {
}
onOnboardingCreateProfileFlowRequested: logs.logEvent("onOnboardingCreateProfileFlowRequested")
onOnboardingLoginFlowRequested: logs.logEvent("onOnboardingLoginFlowRequested")
onUnlockWithSeedphraseRequested: logs.logEvent("onUnlockWithSeedphraseRequested")
onUnlockWithPukRequested: logs.logEvent("onUnlockWithPukRequested")
onUnblockWithSeedphraseRequested: logs.logEvent("onUnblockWithSeedphraseRequested")
onUnblockWithPukRequested: logs.logEvent("onUnblockWithPukRequested")
onLostKeycard: logs.logEvent("onLostKeycard")
onKeycardFactoryResetRequested: logs.logEvent("onKeycardFactoryResetRequested")

// mocks
QtObject {
@@ -90,6 +104,7 @@ SplitView {
x: root.Window.width - width
password: ctrlPassword.text
pin: ctrlPin.text
selectedProfileIsKeycard: loginScreen.selectedProfileIsKeycard
onAccountLoginError: (error, wrongPassword) => store.accountLoginError(error, wrongPassword)
onObtainingPasswordSuccess: (password) => store.obtainingPasswordSuccess(password)
onObtainingPasswordError: (errorDescription, errorType, wrongFingerprint) => store.obtainingPasswordError(errorDescription, errorType, wrongFingerprint)
@@ -132,11 +147,6 @@ SplitView {
enabled: ctrlBiometrics.checked
checked: ctrlBiometrics.checked
}
Switch {
id: ctrlUnlockWithPuk
text: "Unlock with PUK available"
checked: true
}
}

RowLayout {
@@ -150,6 +160,15 @@ SplitView {
inputMask: "999999"
selectByMouse: true
}
Label {
text: "PUK:"
}
TextField {
id: ctrlPuk
text: "111111111111"
inputMask: "999999999999"
selectByMouse: true
}
Label {
text: "State:"
}
51 changes: 39 additions & 12 deletions storybook/pages/OnboardingLayoutPage.qml
Original file line number Diff line number Diff line change
@@ -32,6 +32,7 @@ SplitView {
readonly property string mnemonic: "dog dog dog dog dog dog dog dog dog dog dog dog"
readonly property var seedWords: ["apple", "banana", "cat", "cow", "catalog", "catch", "category", "cattle", "dog", "elephant", "fish", "grape"]
readonly property string pin: "111111"
readonly property string puk: "111111111111"
readonly property string password: "somepassword"

// TODO simulation
@@ -62,17 +63,30 @@ SplitView {
property int addKeyPairState: Onboarding.AddKeyPairState.InProgress
property int syncState: Onboarding.SyncState.InProgress

property int keycardRemainingPinAttempts: ctrlUnlockWithPuk.checked ? 1 : 5
property int keycardRemainingPinAttempts: 2
property int keycardRemainingPukAttempts: 3

function setPin(pin: string) { // -> bool
logs.logEvent("OnboardingStore.setPin", ["pin"], arguments)
ctrlLoginResult.result = "🯄"
const valid = pin === mockDriver.pin
if (!valid)
keycardRemainingPinAttempts--
if (keycardRemainingPinAttempts <= 0) { // SIMULATION: "lock" the keycard
keycardState = Onboarding.KeycardState.Locked
keycardRemainingPinAttempts = ctrlUnlockWithPuk.checked ? 1 : 5
if (keycardRemainingPinAttempts <= 0) { // SIMULATION: "block" the keycard
keycardState = Onboarding.KeycardState.BlockedPIN
keycardRemainingPinAttempts = 0
}
return valid
}

function setPuk(puk) { // -> bool
logs.logEvent("OnboardingStore.setPuk", ["puk"], arguments)
const valid = puk === mockDriver.puk
if (!valid)
keycardRemainingPukAttempts--
if (keycardRemainingPukAttempts <= 0) { // SIMULATION: "block" the keycard
keycardState = Onboarding.KeycardState.BlockedPUK
keycardRemainingPukAttempts = 0
}
return valid
}
@@ -153,7 +167,11 @@ SplitView {
}
}

onReloadKeycardRequested: store.keycardState = Onboarding.KeycardState.NoPCSCService
onReloadKeycardRequested: {
store.keycardState = Onboarding.KeycardState.NoPCSCService
store.keycardRemainingPinAttempts = 2
store.keycardRemainingPukAttempts = 3
}

// mocks
QtObject {
@@ -229,13 +247,25 @@ SplitView {

visible: onboarding.stack.currentItem instanceof KeycardEnterPinPage ||
onboarding.stack.currentItem instanceof KeycardCreatePinPage ||
(onboarding.stack.currentItem instanceof LoginScreen && onboarding.stack.currentItem.selectedProfileIsKeycard)
(onboarding.stack.currentItem instanceof LoginScreen && onboarding.stack.currentItem.selectedProfileIsKeycard && store.keycardState === Onboarding.KeycardState.NotEmpty)

text: "Copy valid PIN (\"%1\")".arg(mockDriver.pin)
focusPolicy: Qt.NoFocus
onClicked: ClipboardUtils.setText(mockDriver.pin)
}

Button {
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.margins: 10

visible: onboarding.stack.currentItem instanceof KeycardEnterPukPage

text: "Copy valid PUK (\"%1\")".arg(mockDriver.puk)
focusPolicy: Qt.NoFocus
onClicked: ClipboardUtils.setText(mockDriver.puk)
}

Button {
anchors.bottom: parent.bottom
anchors.right: parent.right
@@ -290,6 +320,7 @@ SplitView {
x: root.Window.width - width
password: mockDriver.password
pin: mockDriver.pin
selectedProfileIsKeycard: onboarding.stack.currentItem instanceof LoginScreen && onboarding.stack.currentItem.selectedProfileIsKeycard
onAccountLoginError: (error, wrongPassword) => store.accountLoginError(error, wrongPassword)
onObtainingPasswordSuccess: (password) => store.obtainingPasswordSuccess(password)
onObtainingPasswordError: (errorDescription, errorType, wrongFingerprint) => store.obtainingPasswordError(errorDescription, errorType, wrongFingerprint)
@@ -388,19 +419,15 @@ SplitView {
Switch {
id: ctrlTouchIdUser
text: "Touch ID login"
visible: ctrlLoginScreen.checked
enabled: ctrlBiometrics.checked
checked: ctrlBiometrics.checked
}

Switch {
id: ctrlUnlockWithPuk
text: "Unlock with PUK available"
checked: true
}

Text {
id: ctrlLoginResult
property string result: "🯄"
visible: ctrlLoginScreen.checked
text: "Login result: %1".arg(result)
}
}
Loading