mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-23 12:08:53 +00:00
fix(Onboarding): Back button appears on loading screen
- don't clear the stack, we might need it to show errors during login (while displaying splash screen) - use the `backAvailableHint` instead on the splash screen itself to hide the back button - when a login error happens, unwind (or recreate) the stack to show the LoginScreen page again, together with the error message - add a simulation of these 2 scenarios to StoryBook, together with showing the splash screen after a login Fixes #17352
This commit is contained in:
parent
c5085b3097
commit
f9bda5ced4
@ -166,6 +166,12 @@ SplitView {
|
|||||||
|
|
||||||
// password signals
|
// password signals
|
||||||
signal accountLoginError(string error, bool wrongPassword)
|
signal accountLoginError(string error, bool wrongPassword)
|
||||||
|
|
||||||
|
// (test) error handler
|
||||||
|
onAccountLoginError: function (error, wrongPassword) {
|
||||||
|
ctrlLoginResult.result = "<font color='red'>⛔</font>"
|
||||||
|
onboarding.unwindToLoginScreen()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
biometricsAvailable: ctrlBiometrics.checked
|
biometricsAvailable: ctrlBiometrics.checked
|
||||||
@ -179,7 +185,6 @@ SplitView {
|
|||||||
logs.logEvent("onFinished", ["flow", "data"], arguments)
|
logs.logEvent("onFinished", ["flow", "data"], arguments)
|
||||||
|
|
||||||
console.warn("!!! SIMULATION: SHOWING SPLASH")
|
console.warn("!!! SIMULATION: SHOWING SPLASH")
|
||||||
stack.clear()
|
|
||||||
stack.push(splashScreen, { runningProgressAnimation: true })
|
stack.push(splashScreen, { runningProgressAnimation: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +193,7 @@ SplitView {
|
|||||||
|
|
||||||
// SIMULATION: emit an error in case of wrong password or PIN
|
// SIMULATION: emit an error in case of wrong password or PIN
|
||||||
if (method === Onboarding.LoginMethod.Password && data.password !== mockDriver.password) {
|
if (method === Onboarding.LoginMethod.Password && data.password !== mockDriver.password) {
|
||||||
onboardingStore.accountLoginError("The impossible has happened", Math.random() < 0.5) // randomly fail between a wrong pass and some other error
|
onboardingStore.accountLoginError("", true)
|
||||||
ctrlLoginResult.result = "<font color='red'>⛔</font>"
|
ctrlLoginResult.result = "<font color='red'>⛔</font>"
|
||||||
} else if (method === Onboarding.LoginMethod.Keycard && data.pin !== mockDriver.pin) {
|
} else if (method === Onboarding.LoginMethod.Keycard && data.pin !== mockDriver.pin) {
|
||||||
onboardingStore.keycardRemainingPinAttempts-- // SIMULATION: decrease the remaining PIN attempts
|
onboardingStore.keycardRemainingPinAttempts-- // SIMULATION: decrease the remaining PIN attempts
|
||||||
@ -200,6 +205,7 @@ SplitView {
|
|||||||
ctrlLoginResult.result = "<font color='red'>⛔</font>"
|
ctrlLoginResult.result = "<font color='red'>⛔</font>"
|
||||||
} else {
|
} else {
|
||||||
ctrlLoginResult.result = "<font color='green'>✔</font>"
|
ctrlLoginResult.result = "<font color='green'>✔</font>"
|
||||||
|
stack.push(splashScreen, { runningProgressAnimation: true })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,6 +365,7 @@ SplitView {
|
|||||||
id: splashScreen
|
id: splashScreen
|
||||||
|
|
||||||
DidYouKnowSplashScreen {
|
DidYouKnowSplashScreen {
|
||||||
|
readonly property bool backAvailableHint: false
|
||||||
property bool runningProgressAnimation
|
property bool runningProgressAnimation
|
||||||
|
|
||||||
NumberAnimation on progress {
|
NumberAnimation on progress {
|
||||||
@ -460,6 +467,18 @@ SplitView {
|
|||||||
visible: ctrlLoginScreen.checked
|
visible: ctrlLoginScreen.checked
|
||||||
text: "Login result: %1".arg(result)
|
text: "Login result: %1".arg(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
text: "Unwind"
|
||||||
|
visible: ctrlLoginScreen.checked && onboarding.stack.depth > 1 && !(onboarding.currentPage instanceof DidYouKnowSplashScreen)
|
||||||
|
onClicked: onboarding.unwindToLoginScreen()
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
text: "Simulate login error"
|
||||||
|
visible: ctrlLoginScreen.checked && onboarding.currentPage instanceof DidYouKnowSplashScreen
|
||||||
|
onClicked: onboarding.onboardingStore.accountLoginError("SIMULATION: Something bad happened", false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
@ -24,7 +24,7 @@ Page {
|
|||||||
property bool networkChecksEnabled: true
|
property bool networkChecksEnabled: true
|
||||||
property alias keycardPinInfoPageDelay: onboardingFlow.keycardPinInfoPageDelay
|
property alias keycardPinInfoPageDelay: onboardingFlow.keycardPinInfoPageDelay
|
||||||
|
|
||||||
readonly property alias stack: onboardingFlow
|
readonly property alias stack: onboardingFlow // TODO remove external stack access
|
||||||
readonly property string currentPageName: stack.topLevelItem ? Utils.objectTypeName(stack.topLevelItem) : ""
|
readonly property string currentPageName: stack.topLevelItem ? Utils.objectTypeName(stack.topLevelItem) : ""
|
||||||
|
|
||||||
signal shareUsageDataRequested(bool enabled)
|
signal shareUsageDataRequested(bool enabled)
|
||||||
@ -49,6 +49,16 @@ Page {
|
|||||||
d.resetState()
|
d.resetState()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clear the stack down to the LoginScreen, or recreate it
|
||||||
|
// the purpose is to return from main/splash screen in case of a late stage error
|
||||||
|
// and use the below error handler (onAccountLoginError)
|
||||||
|
function unwindToLoginScreen() {
|
||||||
|
onboardingFlow.pop(null, StackView.PopTransition)
|
||||||
|
if (!onboardingFlow.loginScreen) {
|
||||||
|
restartFlow()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function setBiometricResponse(secret: string, error = "",
|
function setBiometricResponse(secret: string, error = "",
|
||||||
detailedError = "",
|
detailedError = "",
|
||||||
wrongFingerprint = false) {
|
wrongFingerprint = false) {
|
||||||
@ -216,10 +226,10 @@ Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// error handler for the LoginScreen
|
||||||
Connections {
|
Connections {
|
||||||
target: root.onboardingStore
|
target: root.onboardingStore
|
||||||
|
|
||||||
// (password) login
|
|
||||||
function onAccountLoginError(error: string, wrongPassword: bool) {
|
function onAccountLoginError(error: string, wrongPassword: bool) {
|
||||||
const loginScreen = onboardingFlow.loginScreen
|
const loginScreen = onboardingFlow.loginScreen
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ StatusWindow {
|
|||||||
Theme.changeTheme(localAppSettings.theme, systemPalette.isCurrentSystemThemeDark())
|
Theme.changeTheme(localAppSettings.theme, systemPalette.isCurrentSystemThemeDark())
|
||||||
Theme.changeFontSize(localAccountSensitiveSettings.fontSize)
|
Theme.changeFontSize(localAccountSensitiveSettings.fontSize)
|
||||||
|
|
||||||
d.runMockedKeycardControllerWindow() // FIXME this is run twice with onboardingV1
|
d.runMockedKeycardControllerWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO remove direct backend access
|
//TODO remove direct backend access
|
||||||
@ -395,6 +395,7 @@ StatusWindow {
|
|||||||
Component {
|
Component {
|
||||||
id: splashScreenV2
|
id: splashScreenV2
|
||||||
DidYouKnowSplashScreen {
|
DidYouKnowSplashScreen {
|
||||||
|
readonly property bool backAvailableHint: false
|
||||||
readonly property string pageClassName: "Splash"
|
readonly property string pageClassName: "Splash"
|
||||||
property bool runningProgressAnimation
|
property bool runningProgressAnimation
|
||||||
messagesEnabled: true
|
messagesEnabled: true
|
||||||
@ -475,7 +476,6 @@ StatusWindow {
|
|||||||
console.error("!!! ONBOARDING FINISHED WITH ERROR:", error)
|
console.error("!!! ONBOARDING FINISHED WITH ERROR:", error)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
stack.clear()
|
|
||||||
stack.push(splashScreenV2, { runningProgressAnimation: true })
|
stack.push(splashScreenV2, { runningProgressAnimation: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,7 +500,7 @@ StatusWindow {
|
|||||||
moveToAppMain()
|
moveToAppMain()
|
||||||
}
|
}
|
||||||
onAccountLoginError: function (error, wrongPassword) {
|
onAccountLoginError: function (error, wrongPassword) {
|
||||||
onboardingLayout.stack.pop()
|
onboardingLayout.unwindToLoginScreen() // error handled internally
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user