Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show proper error when bio metric fails #20233

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/react_native/biometrics.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

(def ^:private ^:const android-not-available-error-message "Biometric hardware unavailable")
(def ^:private ^:const android-not-enrolled-error-message "No fingerprints enrolled.")
(def ^:private ^:const android-too-many-attempts-error-message
"Too many attempts. Use screen lock instead.")
(def ^:private ^:const ios-not-enrolled-error-message "No identities are enrolled")

(defn get-supported-type
Expand Down Expand Up @@ -39,8 +41,9 @@
[message]
(let [cause (if platform/android?
(condp = message
android-not-enrolled-error-message :biometrics/not-enrolled-error
android-not-available-error-message :biometrics/not-available-error
android-not-enrolled-error-message :biometrics/not-enrolled-error
android-not-available-error-message :biometrics/not-available-error
android-too-many-attempts-error-message :biometric/too-many-attempts
:biometrics/unknown-error)

(condp #(string/includes? %2 %1) message
Expand Down
10 changes: 7 additions & 3 deletions src/status_im/common/biometric/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@

(defn show-message
[_ [code]]
(let [content (if (#{:biometrics/not-enrolled-error
:biometrics/not-available-error}
code)
(let [content (case code
(:biometrics/not-enrolled-error
:biometrics/not-available-error)
(i18n/label :t/grant-face-id-permissions)

:biometric/too-many-attempts
(i18n/label :t/biometric-too-many-attempts)

(i18n/label :t/biometric-auth-error {:code code}))]
{:fx [[:effects.utils/show-popup
{:title (i18n/label :t/biometric-auth-login-error-title)
Expand Down
1 change: 1 addition & 0 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"biometric-enable-button": "Enable {{bio-type-label}}",
"biometric-fingerprint": "Fingerprint",
"biometric-faceid": "Face ID",
"biometric-too-many-attempts": "Too many attempts. Enter the password manually or try again after some time",
"biometric-touchid": "Touch ID",
"blank-keycard-text": "You can proceed with your keycard once you've generated your keys and name",
"blank-keycard-title": "Looks like you’ve tapped \na blank keycard",
Expand Down