ShellUserVerifier: Add method to check if the service name is fingerprint

We have multiple places where we check if we're handling a fingerprint
event, so let's add a common public function so that it can be used also
by the authPrompt.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1652>
This commit is contained in:
Marco Trevisan (Treviño) 2021-02-08 17:07:45 +01:00 committed by Ray Strode
parent 09602ae2ae
commit f7685dc224

View File

@ -474,6 +474,11 @@ var ShellUserVerifier = class {
return serviceName == this._defaultService; return serviceName == this._defaultService;
} }
serviceIsFingerprint(serviceName) {
return this._fingerprintReaderType !== FingerprintReaderType.NONE &&
serviceName === FINGERPRINT_SERVICE_NAME;
}
_updateDefaultService() { _updateDefaultService() {
if (this._settings.get_boolean(PASSWORD_AUTHENTICATION_KEY)) if (this._settings.get_boolean(PASSWORD_AUTHENTICATION_KEY))
this._defaultService = PASSWORD_SERVICE_NAME; this._defaultService = PASSWORD_SERVICE_NAME;
@ -527,8 +532,7 @@ var ShellUserVerifier = class {
_onInfo(client, serviceName, info) { _onInfo(client, serviceName, info) {
if (this.serviceIsForeground(serviceName)) { if (this.serviceIsForeground(serviceName)) {
this._queueMessage(info, MessageType.INFO); this._queueMessage(info, MessageType.INFO);
} else if (serviceName == FINGERPRINT_SERVICE_NAME && } else if (this.serviceIsFingerprint(serviceName)) {
this._fingerprintReaderType !== FingerprintReaderType.NONE) {
// We don't show fingerprint messages directly since it's // We don't show fingerprint messages directly since it's
// not the main auth service. Instead we use the messages // not the main auth service. Instead we use the messages
// as a cue to display our own message. // as a cue to display our own message.