-
Notifications
You must be signed in to change notification settings - Fork 985
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: added biometrics setting to new-settings * fix: fix renaming issues from status-im2 * ref: addressed @cammellos' review comments * fix: open password settings in a modal * ref: addressed review comments * fix: disabling biometric clears auth-method from keychain * chore: quo/overlay seqs the childrend so need to add keys * fix: don't pass the password unmasked between events to avoid leaks
- Loading branch information
Showing
14 changed files
with
168 additions
and
21 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/status_im/contexts/profile/settings/screens/password/style.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
(ns status-im.contexts.profile.settings.screens.password.style) | ||
|
||
(defn navigation | ||
[top-inset] | ||
{:padding-top top-inset}) | ||
|
||
(def header | ||
{:padding-horizontal 20 | ||
:padding-bottom 8 | ||
:padding-top 12}) |
86 changes: 86 additions & 0 deletions
86
src/status_im/contexts/profile/settings/screens/password/view.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
(ns status-im.contexts.profile.settings.screens.password.view | ||
(:require [quo.core :as quo] | ||
[quo.theme :as quo.theme] | ||
[react-native.core :as rn] | ||
[react-native.safe-area :as safe-area] | ||
[status-im.common.biometric.events :as biometric] | ||
[status-im.common.not-implemented :as not-implemented] | ||
[status-im.common.standard-authentication.standard-auth.authorize :as authorize] | ||
[status-im.constants :as constants] | ||
[status-im.contexts.profile.settings.screens.password.style :as style] | ||
[utils.i18n :as i18n] | ||
[utils.re-frame :as rf])) | ||
|
||
(defn- on-press-biometric-enable | ||
[button-label theme] | ||
(fn [] | ||
(authorize/authorize | ||
{:biometric-auth? false | ||
:blur? true | ||
:theme theme | ||
:auth-button-label (i18n/label :t/biometric-enable-button {:bio-type-label button-label}) | ||
:on-close (fn [] (rf/dispatch [:standard-auth/reset-login-password])) | ||
:on-auth-success (fn [password] | ||
(rf/dispatch [:hide-bottom-sheet]) | ||
(rf/dispatch [:standard-auth/reset-login-password]) | ||
(rf/dispatch [:biometric/enable password]))}))) | ||
|
||
(defn- get-biometric-item | ||
[theme] | ||
(let [auth-method (rf/sub [:auth-method]) | ||
biometric-type (rf/sub [:biometric/supported-type]) | ||
label (biometric/get-label-by-type biometric-type) | ||
icon (biometric/get-icon-by-type biometric-type) | ||
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))] | ||
{:title label | ||
:image-props icon | ||
:image :icon | ||
:blur? true | ||
:action :selector | ||
:action-props {:disabled? (not supported?) | ||
:on-change press-handler | ||
:checked? biometric-on?} | ||
:on-press press-handler})) | ||
|
||
(defn- get-change-password-item | ||
[] | ||
{:title (i18n/label :t/change-password) | ||
:on-press not-implemented/alert | ||
:blur? true | ||
:image :icon | ||
:image-props :i/password | ||
:action :arrow}) | ||
|
||
(defn- view-internal | ||
[{:keys [theme]}] | ||
(let [insets (safe-area/get-insets)] | ||
[quo/overlay {:type :shell} | ||
[rn/view | ||
{:key :navigation | ||
:style (style/navigation (:top insets))} | ||
[quo/page-nav | ||
{:background :blur | ||
:icon-name :i/arrow-left | ||
:on-press #(rf/dispatch [:navigate-back])}]] | ||
[rn/view | ||
{:key :header | ||
:style style/header} | ||
[quo/text | ||
{:accessibility-label :password-settings-label | ||
:weight :semi-bold | ||
:number-of-lines 1 | ||
:size :heading-1} | ||
(i18n/label :t/password)]] | ||
[quo/category | ||
{:key :category | ||
:data [(get-biometric-item theme) | ||
(get-change-password-item)] | ||
:blur? true | ||
:list-type :settings}]])) | ||
|
||
(def view (quo.theme/with-theme view-internal)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters