diff --git a/shell/contents/lockscreen/FlickContainer.qml b/shell/contents/lockscreen/FlickContainer.qml index 3cbf24a4..f5c0c1e3 100644 --- a/shell/contents/lockscreen/FlickContainer.qml +++ b/shell/contents/lockscreen/FlickContainer.qml @@ -11,6 +11,8 @@ MobileShell.SwipeArea { id: root required property real keypadHeight + property real animationDuration + readonly property real openFactor: position / keypadHeight property real position: 0 property bool movingUp: false @@ -47,7 +49,7 @@ MobileShell.SwipeArea { NumberAnimation on position { id: positionAnim - duration: 800 + duration: root.animationDuration easing.type: Easing.OutExpo onFinished: { diff --git a/shell/contents/lockscreen/LockScreen.qml b/shell/contents/lockscreen/LockScreen.qml index 908f4611..8e3a988b 100644 --- a/shell/contents/lockscreen/LockScreen.qml +++ b/shell/contents/lockscreen/LockScreen.qml @@ -83,9 +83,19 @@ Item { id: flickable anchors.fill: parent + // Speed up animation when passwordless + animationDuration: root.lockScreenState.canBeUnlocked ? 400 : 800 + // Distance to swipe to fully open keypad keypadHeight: Kirigami.Units.gridUnit * 20 + // Unlock lockscreen if it's already unlocked + onOpened: { + if (root.lockScreenState.canBeUnlocked) { + Qt.quit(); + } + } + // Clear entered password after closing keypad onOpenFactorChanged: { if (flickable.openFactor < 0.1) { @@ -142,6 +152,7 @@ Item { Keypad { id: keypad + visible: !root.lockScreenState.canBeUnlocked // don't show for passwordless login anchors.fill: parent openProgress: flickable.openFactor lockScreenState: root.lockScreenState diff --git a/shell/contents/lockscreen/LockScreenState.qml b/shell/contents/lockscreen/LockScreenState.qml index 5ac7de7b..d3d443c2 100644 --- a/shell/contents/lockscreen/LockScreenState.qml +++ b/shell/contents/lockscreen/LockScreenState.qml @@ -18,8 +18,8 @@ QtObject { // the info message given property string info: "" - // whether the lockscreen was passwordless - property bool passwordless: false // TODO true + // whether the lockscreen can be unlocked (no password needed, passwordless login) + readonly property bool canBeUnlocked: authenticator.unlocked // whether the device can log in with fingerprint readonly property bool isFingerprintSupported: authenticator.authenticatorTypes & ScreenLocker.Authenticator.Fingerprint @@ -38,9 +38,14 @@ QtObject { Component.onCompleted: authenticator.startAuthenticating(); function tryPassword() { - if (root.password !== '') { // prevent typing lock when password is empty + // ensure it's in authenticating state (it might get unset after suspend) + authenticator.startAuthenticating(); + + // prevent typing lock when password is empty + if (root.password !== '') { root.waitingForAuth = true; } + console.log('attempt password'); authenticator.respond(root.password); } @@ -66,10 +71,12 @@ QtObject { target: authenticator function onSucceeded() { - console.log('login succeeded'); - root.waitingForAuth = false; - root.unlockSucceeded(); - Qt.quit(); + if (authenticator.hadPrompt) { + console.log('login succeeded'); + root.waitingForAuth = false; + root.unlockSucceeded(); + Qt.quit(); + } } function onFailed(kind: int): void {