From 244be2511f92f3de93ea8fb0b9df70a53f48169c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net> Date: Thu, 20 Feb 2025 17:23:47 +0100 Subject: [PATCH] device: Generalize verify-too-fast error It's not just related to swipe devices, so let's make it more generic --- pam/fingerprint-strings.h | 9 +++++++-- src/device.c | 2 +- src/net.reactivated.Fprint.Device.xml | 4 ++-- tests/dbusmock/fprintd.py | 2 +- tests/fprintd.py | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/pam/fingerprint-strings.h b/pam/fingerprint-strings.h index 911b061a..5a6e50b4 100644 --- a/pam/fingerprint-strings.h +++ b/pam/fingerprint-strings.h @@ -178,8 +178,13 @@ verify_result_str_to_msg (const char *result, bool is_swipe) return TR (N_("Your finger was not centered, try swiping your finger again")); if (strcmp (result, "verify-remove-and-retry") == 0) return TR (N_("Remove your finger, and try swiping your finger again")); - if (strcmp (result, "verify-swipe-too-fast") == 0) - return TR (N_("Swipe was too fast, try again")); + if (strcmp (result, "verify-too-fast") == 0) + { + if (is_swipe) + return TR (N_("Swipe was too fast, try again")); + else + return TR (N_("Finger scan was too fast, try again")); + } return NULL; } diff --git a/src/device.c b/src/device.c index b1e9dbf4..692b11bd 100644 --- a/src/device.c +++ b/src/device.c @@ -603,7 +603,7 @@ verify_result_to_name (gboolean match, GError *error) return "verify-remove-and-retry"; case FP_DEVICE_RETRY_TOO_FAST: - return "verify-swipe-too-fast"; + return "verify-too-fast"; default: return "verify-retry-scan"; diff --git a/src/net.reactivated.Fprint.Device.xml b/src/net.reactivated.Fprint.Device.xml index 1e3daf73..3b32186f 100644 --- a/src/net.reactivated.Fprint.Device.xml +++ b/src/net.reactivated.Fprint.Device.xml @@ -182,9 +182,9 @@ </doc:definition> </doc:item> <doc:item> - <doc:term>verify-swipe-too-fast</doc:term> + <doc:term>verify-too-fast</doc:term> <doc:definition> - The user's swipe was too fast. The user should retry scanning their finger, the verification is still ongoing. + The user's swipe or touch was too fast. The user should retry scanning their finger, the verification is still ongoing. </doc:definition> </doc:item> <doc:item> diff --git a/tests/dbusmock/fprintd.py b/tests/dbusmock/fprintd.py index 22d70bcd..90ccc68e 100644 --- a/tests/dbusmock/fprintd.py +++ b/tests/dbusmock/fprintd.py @@ -53,10 +53,10 @@ VALID_VERIFY_STATUS = [ 'verify-no-match', 'verify-match', 'verify-retry-scan', + 'verify-too-fast', 'verify-swipe-too-short', 'verify-finger-not-centered', 'verify-remove-and-retry', - 'verify-swipe-too-fast', 'verify-disconnected', 'verify-unknown-error' ] diff --git a/tests/fprintd.py b/tests/fprintd.py index c44a1f59..3eb96e12 100644 --- a/tests/fprintd.py +++ b/tests/fprintd.py @@ -2741,7 +2741,7 @@ class FPrintdVirtualDeviceVerificationTests(FPrintdVirtualDeviceBaseTest): self.assertVerifyRetry(FPrint.DeviceRetry.CENTER_FINGER, 'verify-finger-not-centered') def test_verify_retry_too_fast(self): - self.assertVerifyRetry(FPrint.DeviceRetry.TOO_FAST, 'verify-swipe-too-fast') + self.assertVerifyRetry(FPrint.DeviceRetry.TOO_FAST, 'verify-too-fast') def test_verify_error_general(self): self.assertVerifyError(FPrint.DeviceError.GENERAL, 'verify-unknown-error') -- GitLab