Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrkhalil committed Apr 1, 2024
1 parent 0d3e10e commit f542259
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
9 changes: 5 additions & 4 deletions src/status_im/common/biometric/effects.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
:effects.biometric/authenticate
(fn [{:keys [prompt-message on-success on-fail on-cancel on-done on-max-attempts-reached
ignore-too-many-attempts?]
:or {on-done identity
on-success identity
on-cancel identity
on-fail identity}}]
:or {on-done identity
on-success identity
on-cancel identity
on-fail identity
on-max-attempts-reached on-cancel}}]
(-> (biometrics/authenticate
{:prompt-message (or prompt-message (i18n/label :t/biometric-auth-reason-login))
:fallback-prompt-message (i18n/label
Expand Down
18 changes: 8 additions & 10 deletions src/status_im/common/standard_authentication/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,14 @@
{:fx [[:dispatch [:dismiss-keyboard]]
[:dispatch
[:biometric/authenticate
{:prompt-message (i18n/label :t/biometric-auth-confirm-message)
:on-cancel #(rf/dispatch [:standard-auth/authorize-with-password
args-with-biometric-btn])
:on-success #(rf/dispatch [:standard-auth/on-biometric-success
on-auth-success])
:on-max-attempts-reached #(rf/dispatch [:standard-auth/authorize-with-password
args-with-biometric-btn])
:on-fail (fn [err]
(when on-auth-fail (on-auth-fail err))
(rf/dispatch [:standard-auth/on-biometric-fail err]))}]]]}))
{:prompt-message (i18n/label :t/biometric-auth-confirm-message)
:on-cancel #(rf/dispatch [:standard-auth/authorize-with-password
args-with-biometric-btn])
:on-success #(rf/dispatch [:standard-auth/on-biometric-success
on-auth-success])
:on-fail (fn [err]
(when on-auth-fail (on-auth-fail err))
(rf/dispatch [:standard-auth/on-biometric-fail err]))}]]]}))

(schema/=> authorize-with-biometric events-schema/?authorize-with-biometric)
(rf/reg-event-fx :standard-auth/authorize-with-biometric authorize-with-biometric)
Expand Down

0 comments on commit f542259

Please sign in to comment.