fix: face id toggle respect system face id permission (#20227)

Signed-off-by: yqrashawn <namy.19@gmail.com>
This commit is contained in:
yqrashawn 2024-06-13 09:28:07 +08:00 committed by GitHub
parent 799bd1d4dc
commit 874906b11f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 14 additions and 10 deletions

View File

@ -41,13 +41,13 @@
[message]
(let [cause (if platform/android?
(condp = message
android-not-enrolled-error-message :biometrics/not-enrolled-error
android-not-enrolled-error-message :biometrics/fingerprints-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
ios-not-enrolled-error-message :biometrics/not-enrolled-error
ios-not-enrolled-error-message :biometrics/ios-not-enrolled-error
:biometrics/unknown-error))]
(ex-info "Failed to authenticate with biometrics"
{:orig-error-message message}

View File

@ -14,8 +14,11 @@
(defn show-message
[_ [code]]
(let [content (case code
(:biometrics/not-enrolled-error
(:biometrics/fingerprints-not-enrolled-error
:biometrics/not-available-error)
(i18n/label :t/grant-fingerprints-permissions)
:biometrics/ios-not-enrolled-error
(i18n/label :t/grant-face-id-permissions)
:biometric/too-many-attempts

View File

@ -18,7 +18,7 @@
(let [cofx {:db {}}
expected {:fx [[:effects.utils/show-popup
{:title (i18n/label :t/biometric-auth-login-error-title)
:content (i18n/label :t/grant-face-id-permissions)}]]}]
:content (i18n/label :t/grant-fingerprints-permissions)}]]}]
(is (match? expected
(sut/show-message cofx
[:biometrics/not-available-error])))))

View File

@ -30,18 +30,18 @@
supported? (boolean biometric-type)
enabled? (= auth-method constants/auth-method-biometric)
biometric-on? (and supported? enabled?)
press-handler (if biometric-on?
(fn [] (rf/dispatch [:biometric/disable]))
(on-press-biometric-enable label theme))]
press-handler (when supported?
(if biometric-on?
(fn [] (rf/dispatch [:biometric/disable]))
(on-press-biometric-enable label theme)))]
{:title label
:image-props icon
:image :icon
:blur? true
:action :selector
:action-props {:disabled? (not supported?)
:on-change press-handler
:action-props {:on-change press-handler
:checked? biometric-on?}
:on-press (when supported? press-handler)}))
:on-press press-handler}))
(defn- get-change-password-item
[]

View File

@ -1629,6 +1629,7 @@
"ok-save-pass": "OK, save password",
"lock-app-with": "Lock app with",
"grant-face-id-permissions": "To grant the required Face ID permission, please go to your system settings and make sure that Status > Face ID is selected",
"grant-fingerprints-permissions": "To grant the required fingerprints permission, please go to your system settings and make sure that Status > Fingerprints is selected",
"request-feature": "Request a feature",
"select-account-dapp": "Select the account you wish to use with Dapps",
"apply": "Apply",