fingerprint: Show different strings depending on type
Fprintd knows if the fingerprint reader is of the swipe or press type. We now show different labels depending on that. Closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2011 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1572>
This commit is contained in:
parent
824cdc9177
commit
aa392d45c9
78
data/dbus-interfaces/net.reactivated.Fprint.Device.xml
Normal file
78
data/dbus-interfaces/net.reactivated.Fprint.Device.xml
Normal file
@ -0,0 +1,78 @@
|
||||
<!DOCTYPE node PUBLIC
|
||||
"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
|
||||
<node>
|
||||
<interface name="net.reactivated.Fprint.Device">
|
||||
<method name="ListEnrolledFingers">
|
||||
<arg type="s" name="username" direction="in">
|
||||
</arg>
|
||||
<arg type="as" name="enrolled_fingers" direction="out">
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="DeleteEnrolledFingers">
|
||||
<arg type="s" name="username" direction="in">
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="DeleteEnrolledFingers2">
|
||||
</method>
|
||||
|
||||
<method name="Claim">
|
||||
<arg type="s" name="username" direction="in">
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="Release">
|
||||
</method>
|
||||
|
||||
<method name="VerifyStart">
|
||||
<arg type="s" name="finger_name" direction="in">
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="VerifyStop">
|
||||
</method>
|
||||
|
||||
<signal name="VerifyFingerSelected">
|
||||
<arg type="s" name="finger_name">
|
||||
</arg>
|
||||
</signal>
|
||||
|
||||
<signal name="VerifyStatus">
|
||||
<arg type="s" name="result">
|
||||
</arg>
|
||||
|
||||
<arg type="b" name="done">
|
||||
</arg>
|
||||
|
||||
</signal>
|
||||
|
||||
<method name="EnrollStart">
|
||||
<arg type="s" name="finger_name" direction="in">
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="EnrollStop">
|
||||
</method>
|
||||
|
||||
<signal name="EnrollStatus">
|
||||
<arg type="s" name="result">
|
||||
</arg>
|
||||
|
||||
<arg type="b" name="done">
|
||||
</arg>
|
||||
</signal>
|
||||
|
||||
<property name="name" type="s" access="read">
|
||||
</property>
|
||||
|
||||
<property name="num-enroll-stages" type="i" access="read">
|
||||
</property>
|
||||
|
||||
<property name="scan-type" type="s" access="read">
|
||||
</property>
|
||||
|
||||
</interface>
|
||||
</node>
|
@ -2,6 +2,7 @@
|
||||
<gresources>
|
||||
<gresource prefix="/org/gnome/shell/dbus-interfaces">
|
||||
<file preprocess="xml-stripblanks">net.hadess.SensorProxy.xml</file>
|
||||
<file preprocess="xml-stripblanks">net.reactivated.Fprint.Device.xml</file>
|
||||
<file preprocess="xml-stripblanks">net.reactivated.Fprint.Manager.xml</file>
|
||||
<file preprocess="xml-stripblanks">org.freedesktop.Application.xml</file>
|
||||
<file preprocess="xml-stripblanks">org.freedesktop.bolt1.Device.xml</file>
|
||||
|
@ -15,6 +15,8 @@ const SmartcardManager = imports.misc.smartcardManager;
|
||||
|
||||
const FprintManagerIface = loadInterfaceXML('net.reactivated.Fprint.Manager');
|
||||
const FprintManagerProxy = Gio.DBusProxy.makeProxyWrapper(FprintManagerIface);
|
||||
const FprintDeviceIface = loadInterfaceXML('net.reactivated.Fprint.Device');
|
||||
const FprintDeviceProxy = Gio.DBusProxy.makeProxyWrapper(FprintDeviceIface);
|
||||
|
||||
Gio._promisify(Gdm.Client.prototype,
|
||||
'open_reauthentication_channel', 'open_reauthentication_channel_finish');
|
||||
@ -52,6 +54,12 @@ var MessageType = {
|
||||
HINT: 3,
|
||||
};
|
||||
|
||||
const FingerprintReaderType = {
|
||||
NONE: 0,
|
||||
PRESS: 1,
|
||||
SWIPE: 2,
|
||||
};
|
||||
|
||||
function fadeInActor(actor) {
|
||||
if (actor.opacity == 255 && actor.visible)
|
||||
return null;
|
||||
@ -312,7 +320,7 @@ var ShellUserVerifier = class {
|
||||
}
|
||||
|
||||
_checkForFingerprintReader() {
|
||||
this._haveFingerprintReader = false;
|
||||
this._fingerprintReaderType = FingerprintReaderType.NONE;
|
||||
|
||||
if (!this._settings.get_boolean(FINGERPRINT_AUTHENTICATION_KEY) ||
|
||||
this._fprintManager == null) {
|
||||
@ -321,9 +329,17 @@ var ShellUserVerifier = class {
|
||||
}
|
||||
|
||||
this._fprintManager.GetDefaultDeviceRemote(Gio.DBusCallFlags.NONE, this._cancellable,
|
||||
(device, error) => {
|
||||
if (!error && device) {
|
||||
this._haveFingerprintReader = true;
|
||||
(params, error) => {
|
||||
if (!error && params) {
|
||||
const [device] = params;
|
||||
const fprintDeviceProxy = new FprintDeviceProxy(Gio.DBus.system,
|
||||
'net.reactivated.Fprint',
|
||||
device);
|
||||
const fprintDeviceType = fprintDeviceProxy['scan-type'];
|
||||
|
||||
this._fingerprintReaderType = fprintDeviceType === 'swipe'
|
||||
? FingerprintReaderType.SWIPE
|
||||
: FingerprintReaderType.PRESS;
|
||||
this._updateDefaultService();
|
||||
}
|
||||
});
|
||||
@ -438,7 +454,7 @@ var ShellUserVerifier = class {
|
||||
this._defaultService = PASSWORD_SERVICE_NAME;
|
||||
else if (this._settings.get_boolean(SMARTCARD_AUTHENTICATION_KEY))
|
||||
this._defaultService = SMARTCARD_SERVICE_NAME;
|
||||
else if (this._haveFingerprintReader)
|
||||
else if (this._fingerprintReaderType !== FingerprintReaderType.NONE)
|
||||
this._defaultService = FINGERPRINT_SERVICE_NAME;
|
||||
|
||||
if (!this._defaultService) {
|
||||
@ -471,7 +487,9 @@ var ShellUserVerifier = class {
|
||||
_beginVerification() {
|
||||
this._startService(this._getForegroundService());
|
||||
|
||||
if (this._userName && this._haveFingerprintReader && !this.serviceIsForeground(FINGERPRINT_SERVICE_NAME))
|
||||
if (this._userName &&
|
||||
this._fingerprintReaderType !== FingerprintReaderType.NONE &&
|
||||
!this.serviceIsForeground(FINGERPRINT_SERVICE_NAME))
|
||||
this._startService(FINGERPRINT_SERVICE_NAME);
|
||||
}
|
||||
|
||||
@ -479,14 +497,19 @@ var ShellUserVerifier = class {
|
||||
if (this.serviceIsForeground(serviceName)) {
|
||||
this._queueMessage(info, MessageType.INFO);
|
||||
} else if (serviceName == FINGERPRINT_SERVICE_NAME &&
|
||||
this._haveFingerprintReader) {
|
||||
this._fingerprintReaderType !== FingerprintReaderType.NONE) {
|
||||
// We don't show fingerprint messages directly since it's
|
||||
// not the main auth service. Instead we use the messages
|
||||
// as a cue to display our own message.
|
||||
|
||||
// Translators: this message is shown below the password entry field
|
||||
// to indicate the user can swipe their finger instead
|
||||
this._queueMessage(_("(or swipe finger)"), MessageType.HINT);
|
||||
if (this._fingerprintReaderType === FingerprintReaderType.SWIPE) {
|
||||
// Translators: this message is shown below the password entry field
|
||||
// to indicate the user can swipe their finger on the fingerprint reader
|
||||
this._queueMessage(_('(or swipe finger across reader)'), MessageType.HINT);
|
||||
} else {
|
||||
// Translators: this message is shown below the password entry field
|
||||
// to indicate the user can place their finger on the fingerprint reader instead
|
||||
this._queueMessage(_('(or place finger on reader)'), MessageType.HINT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user