disable biometric auth when device can't save password (rooted)

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
yenda 2020-02-04 11:52:46 +01:00 committed by Andrey Shovkoplyas
parent fc1bc48fdc
commit 49fd306f25
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
2 changed files with 19 additions and 13 deletions

View File

@ -101,7 +101,13 @@
(re-frame/reg-fx
:get-supported-biometric-auth
(fn []
(get-supported #(re-frame/dispatch [:init.callback/get-supported-biometric-auth-success %]))))
(let [callback #(re-frame/dispatch [:init.callback/get-supported-biometric-auth-success %])]
;;NOTE: if we can't save user password, we can't support biometrics
(keychain/can-save-user-password?
(fn [can-save?]
(if can-save?
(get-supported callback)
(callback nil)))))))
(fx/defn set-supported-biometric-auth
{:events [:init.callback/get-supported-biometric-auth-success]}

View File

@ -29,18 +29,18 @@
(when mnemonic
[[components.common/counter {:size 22} 1]
:chevron])}
{:type :small
:title (str (i18n/label :t/lock-app-with) " " (biometric/get-label supported-biometric-auth))
:container-margin-bottom 8
:accessibility-label :biometric-auth-settings-switch
:disabled? (not (some? supported-biometric-auth))
:accessories [[react/switch
{:track-color #js {:true colors/blue :false nil}
:value (boolean biometric-auth?)
:on-value-change #(re-frame/dispatch [:multiaccounts.ui/biometric-auth-switched %])
:disabled (not supported-biometric-auth)}]]
:on-press #(re-frame/dispatch [:multiaccounts.ui/biometric-auth-switched
((complement boolean) biometric-auth?)])}
(when supported-biometric-auth
{:type :small
:title (str (i18n/label :t/lock-app-with) " " (biometric/get-label supported-biometric-auth))
:container-margin-bottom 8
:accessibility-label :biometric-auth-settings-switch
:accessories [[react/switch
{:track-color #js {:true colors/blue :false nil}
:value (boolean biometric-auth?)
:on-value-change #(re-frame/dispatch [:multiaccounts.ui/biometric-auth-switched %])
:disabled (not supported-biometric-auth)}]]
:on-press #(re-frame/dispatch [:multiaccounts.ui/biometric-auth-switched
((complement boolean) biometric-auth?)])})
;; TODO - uncomment when implemented
;; {:type :small
;; :title :t/change-password