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] [message]
(let [cause (if platform/android? (let [cause (if platform/android?
(condp = message (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-not-available-error-message :biometrics/not-available-error
android-too-many-attempts-error-message :biometric/too-many-attempts android-too-many-attempts-error-message :biometric/too-many-attempts
:biometrics/unknown-error) :biometrics/unknown-error)
(condp #(string/includes? %2 %1) message (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))] :biometrics/unknown-error))]
(ex-info "Failed to authenticate with biometrics" (ex-info "Failed to authenticate with biometrics"
{:orig-error-message message} {:orig-error-message message}

View File

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

View File

@ -18,7 +18,7 @@
(let [cofx {:db {}} (let [cofx {:db {}}
expected {:fx [[:effects.utils/show-popup expected {:fx [[:effects.utils/show-popup
{:title (i18n/label :t/biometric-auth-login-error-title) {: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 (is (match? expected
(sut/show-message cofx (sut/show-message cofx
[:biometrics/not-available-error]))))) [:biometrics/not-available-error])))))

View File

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

View File

@ -1629,6 +1629,7 @@
"ok-save-pass": "OK, save password", "ok-save-pass": "OK, save password",
"lock-app-with": "Lock app with", "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-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", "request-feature": "Request a feature",
"select-account-dapp": "Select the account you wish to use with Dapps", "select-account-dapp": "Select the account you wish to use with Dapps",
"apply": "Apply", "apply": "Apply",