-
Notifications
You must be signed in to change notification settings - Fork 985
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
Biometrics button on login screen #18106
Changes from 3 commits
5a74b91
ed5b192
5f1a7e5
14754f3
9331a74
e294870
5a13b7c
50dcd11
e7ecf7d
ee8e738
782c233
a95b478
8b80d27
7fa247b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,13 @@ | |
{:db (assoc db :profile/profiles-overview profiles)} | ||
(profile-selected key-uid))) | ||
|
||
(rf/reg-event-fx | ||
:profile/switch-profile | ||
(fn [{:keys [db]} [key-uid]] | ||
{:db db | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :db db is redundant |
||
:fx [[:dispatch [:profile/profile-selected key-uid]] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here, its better just dispatch in the view no need in the |
||
[:dispatch [:profile.login/login-with-biometric-if-available key-uid]]]})) | ||
|
||
(defn reduce-profiles | ||
[profiles] | ||
(reduce | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -180,18 +180,22 @@ | |
{:keychain/get-auth-method [key-uid | ||
#(rf/dispatch [:profile.login/get-auth-method-success % key-uid])]}) | ||
|
||
(rf/reg-event-fx | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you elaborate? this looks strange There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When logging in, we need |
||
:profile.login/biometric-auth | ||
(fn [] | ||
{:dispatch [:biometric/authenticate | ||
{:on-success #(rf/dispatch [:profile.login/biometric-success]) | ||
:on-fail #(rf/dispatch | ||
[:profile.login/biometric-auth-fail %])}]})) | ||
|
||
(rf/defn get-auth-method-success | ||
{:events [:profile.login/get-auth-method-success]} | ||
[{:keys [db]} auth-method key-uid] | ||
(merge {:db (assoc db :auth-method auth-method)} | ||
(when (= auth-method keychain/auth-method-biometric) | ||
{:keychain/password-hash-migration | ||
{:key-uid key-uid | ||
:callback (fn [] | ||
(rf/dispatch [:biometric/authenticate | ||
{:on-success #(rf/dispatch [:profile.login/biometric-success]) | ||
:on-fail #(rf/dispatch | ||
[:profile.login/biometric-auth-fail %])}]))}}))) | ||
:callback #(rf/dispatch [:profile.login/biometric-auth])}}))) | ||
|
||
;; result of :keychain/get-auth-method above | ||
(rf/defn get-user-password-success | ||
|
@@ -218,8 +222,7 @@ | |
(fn [{:keys [db]} [code]] | ||
(let [key-uid (get-in db [:profile/login :key-uid])] | ||
{:db db | ||
:fx [[:dispatch [:init-root :profiles]] | ||
(if (= code "NOT_ENROLLED") | ||
:fx [(if (= code "NOT_ENROLLED") | ||
clauxx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
[:biometric/supress-not-enrolled-error | ||
[key-uid | ||
[:biometric/show-message code]]] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my pr I was passing this in as a prop 🤔 No strong preferences, we could keep this input purer however and pass everything in as a prop 🤔 https://github.com/status-im/status-mobile/pull/17992/files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say unless it's used higher in the tree, mught be better to use the sub directly where it's used. I see very often 'subscription' maps passed as props all over the place, even when a sub is needed in one single child somewhere down the tree. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me it's fine either way 👍