on xenial help sign in
Make id work, maybe?
commitd0e5e7a0f26ba3d7d128280a2f8f7ff00c31d80d authorMichael Terry <michael.terry@canonical.com> dateTue 24 May 2016, 16:34 (10 years ago) parent812dd12
2 files changed+19−41
qml/Greeter/Greeter.qml+19−11 tests/mocks/Biometryd/Biometryd.qmltypes−30
qml/Greeter/Greeter.qml+19−11
@@ -16,7 +16,7 @@
1616
1717import QtQuick 2.4
1818import AccountsService 0.1
19−import Biometryd 0.0 as Biometryd
19+import Biometryd 0.0
2020import GSettings 1.0
2121import Ubuntu.Components 1.3
2222import Ubuntu.SystemImage 0.1
@@ -482,35 +482,43 @@ Showable {
482482 onLanguageChanged: lightDM.infographic.readyForDataChange()
483483 }
484484
485− Biometryd.Observer {
485+ Observer {
486486 id: biometryd
487487 objectName: "biometryd"
488488
489− property var operation
489+ property var operation: null
490490
491− Component.onCompleted: {
492− if (Biometryd.defaultDevice) {
491+ function cancelOperation() {
492+ if (operation) {
493+ operation.cancel();
494+ operation = null;
495+ }
496+ }
497+
498+ function restartOperation() {
499+ cancelOperation();
500+
501+ if (Biometryd.defaultDevice && true /* FIXME check AS */) {
493502 var identifier = Biometryd.defaultDevice.identifier;
494503 operation = identifier.identifyUser();
495504 operation.start(biometryd);
496505 }
497506 }
498507
499− Component.onDestruction: {
500− if (operation)
501− operation.cancel();
502− }
508+ Component.onCompleted: restartOperation()
509+ Component.onDestruction: cancelOperation()
503510
504511 onSucceeded: {
505512 // FIXME validate result.uid
506513 d.fingerprintFailureCount = 0;
507− operation.start(biometryd);
514+ restartOperation();
508515 if (root.active)
509516 root.forcedUnlock = true;
510517 }
511518 onFailed: {
519+ console.log("Failed to identify user:", reason);
512520 d.fingerprintFailureCount++;
513− operation.start(biometryd);
521+ restartOperation();
514522 if (loader.item)
515523 loader.item.showErrorMessage(i18n.tr("Try again"));
516524 }
tests/mocks/Biometryd/Biometryd.qmltypesdeleted−30
@@ -1,30 +0,0 @@
1−import QtQuick.tooling 1.2
2−
3−// This file describes the plugin-supplied types contained in the library.
4−// It is used for QML tooling purposes only.
5−//
6−// This file was auto-generated by:
7−// 'qmlplugindump -notrelocatable Biometryd 0.0 tests/mocks'
8−
9−Module {
10− dependencies: []
11− Component {
12− name: "MockObserver"
13− prototype: "QObject"
14− exports: ["Biometryd/Observer 0.0"]
15− exportMetaObjectRevisions: [0]
16− Signal {
17− name: "succeeded"
18− Parameter { name: "result"; type: "QVariant" }
19− }
20− Signal {
21− name: "failed"
22− Parameter { name: "reason"; type: "string" }
23− }
24− Method {
25− name: "mockIdentification"
26− Parameter { name: "uid"; type: "int" }
27− Parameter { name: "error"; type: "string" }
28− }
29− }
30−}