-
Notifications
You must be signed in to change notification settings - Fork 990
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
Wallet: Password field contains saved data once user put it before while transaction confirmation #18447 #18899
Changes from all commits
5f32df6
1129f31
6e00cda
6e1087b
f9342df
07e0064
f8c2f65
a243732
e2b919d
cf12db0
3bec9d5
6a88729
466ed2d
82826fa
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 | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -16,6 +16,7 @@ | |||||||
[utils.debounce :as debounce] | ||||||||
[utils.i18n :as i18n] | ||||||||
[utils.re-frame :as rf] | ||||||||
[utils.security.core :as security] | ||||||||
[utils.transforms :as transforms])) | ||||||||
|
||||||||
(defonce push-animation-fn-atom (atom nil)) | ||||||||
|
@@ -190,56 +191,81 @@ | |||||||
:default-password password}])) | ||||||||
|
||||||||
(defn login-section | ||||||||
[{:keys [set-show-profiles]}] | ||||||||
(let [processing (rf/sub [:profile/login-processing]) | ||||||||
{:keys [key-uid name customization-color]} (rf/sub [:profile/login-profile]) | ||||||||
sign-in-enabled? (rf/sub [:sign-in-enabled?]) | ||||||||
profile-picture (rf/sub [:profile/login-profiles-picture key-uid]) | ||||||||
login-multiaccount #(rf/dispatch [:profile.login/login])] | ||||||||
[rn/keyboard-avoiding-view | ||||||||
{:style style/login-container | ||||||||
:keyboardVerticalOffset (- (safe-area/get-bottom))} | ||||||||
[rn/view | ||||||||
{:style style/multi-profile-button-container} | ||||||||
(when config/quo-preview-enabled? | ||||||||
[quo/button | ||||||||
{:size 32 | ||||||||
:type :grey | ||||||||
:background :blur | ||||||||
:icon-only? true | ||||||||
:on-press #(rf/dispatch [:navigate-to :quo-preview]) | ||||||||
:disabled? processing | ||||||||
:accessibility-label :quo-preview | ||||||||
:container-style {:margin-right 12}} | ||||||||
:i/reveal-whitelist]) | ||||||||
[quo/button | ||||||||
{:size 32 | ||||||||
:type :grey | ||||||||
:background :blur | ||||||||
:icon-only? true | ||||||||
:on-press set-show-profiles | ||||||||
:disabled? processing | ||||||||
:accessibility-label :show-profiles} | ||||||||
:i/multi-profile]] | ||||||||
[rn/scroll-view | ||||||||
{:keyboard-should-persist-taps :always | ||||||||
:style {:flex 1}} | ||||||||
[quo/profile-card | ||||||||
{:name name | ||||||||
:customization-color (or customization-color :primary) | ||||||||
:profile-picture profile-picture | ||||||||
:card-style style/login-profile-card}] | ||||||||
[password-input]] | ||||||||
[quo/button | ||||||||
{:size 40 | ||||||||
:type :primary | ||||||||
:customization-color (or customization-color :primary) | ||||||||
:accessibility-label :login-button | ||||||||
:icon-left :i/unlocked | ||||||||
:disabled? (or (not sign-in-enabled?) processing) | ||||||||
:on-press login-multiaccount | ||||||||
:container-style {:margin-bottom (+ (safe-area/get-bottom) 12)}} | ||||||||
(i18n/label :t/log-in)]])) | ||||||||
[] | ||||||||
(let [password-value (reagent/atom nil)] | ||||||||
(fn [{:keys [set-show-profiles]}] | ||||||||
(let [{:keys [processing password]} (rf/sub [:profile/login]) | ||||||||
{:keys [key-uid name customization-color]} (rf/sub [:profile/login-profile]) | ||||||||
sign-in-enabled? (rf/sub [:sign-in-enabled?]) | ||||||||
profile-picture (rf/sub [:profile/login-profiles-picture key-uid]) | ||||||||
auth-method (rf/sub [:auth-method]) | ||||||||
login-multiaccount #(rf/dispatch [:profile.login/login]) | ||||||||
on-change-password (fn [value] | ||||||||
(reset! password-value value) | ||||||||
(when (not= value | ||||||||
(security/safe-unmask-data | ||||||||
password)) | ||||||||
(rf/dispatch [:set-in | ||||||||
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. These type of events status-mobile/src/legacy/status_im/events.cljs Lines 220 to 222 in bfed36d
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. Done 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. They are still being used here @mmilad75. Maybe you forgot to push? |
||||||||
[:profile/login :password] | ||||||||
(security/mask-data value)]) | ||||||||
(rf/dispatch [:set-in [:profile/login :error] | ||||||||
""])))] | ||||||||
[rn/keyboard-avoiding-view | ||||||||
{:style style/login-container | ||||||||
:keyboardVerticalOffset (- (safe-area/get-bottom))} | ||||||||
[rn/view | ||||||||
{:style style/multi-profile-button-container} | ||||||||
(when config/quo-preview-enabled? | ||||||||
[quo/button | ||||||||
{:size 32 | ||||||||
:type :grey | ||||||||
:background :blur | ||||||||
:icon-only? true | ||||||||
:on-press #(rf/dispatch [:navigate-to :quo-preview]) | ||||||||
:disabled? processing | ||||||||
:accessibility-label :quo-preview | ||||||||
:container-style {:margin-right 12}} | ||||||||
:i/reveal-whitelist]) | ||||||||
[quo/button | ||||||||
{:size 32 | ||||||||
:type :grey | ||||||||
:background :blur | ||||||||
:icon-only? true | ||||||||
:on-press set-show-profiles | ||||||||
:disabled? processing | ||||||||
:accessibility-label :show-profiles} | ||||||||
:i/multi-profile]] | ||||||||
[rn/scroll-view | ||||||||
{:keyboard-should-persist-taps :always | ||||||||
:style {:flex 1}} | ||||||||
[quo/profile-card | ||||||||
{:name name | ||||||||
:customization-color (or customization-color :primary) | ||||||||
:profile-picture profile-picture | ||||||||
:card-style style/login-profile-card}] | ||||||||
[standard-authentication/password-input | ||||||||
{:shell? true | ||||||||
:blur? true | ||||||||
:on-press-biometrics (when (= auth-method constants/auth-method-biometric) | ||||||||
(fn [] | ||||||||
(rf/dispatch [:biometric/authenticate | ||||||||
{:on-success #(rf/dispatch | ||||||||
[:profile.login/biometric-success]) | ||||||||
:on-fail #(rf/dispatch | ||||||||
[:profile.login/biometric-auth-fail | ||||||||
%])}]))) | ||||||||
:password @password-value | ||||||||
:on-change-password on-change-password}]] | ||||||||
[quo/button | ||||||||
{:size 40 | ||||||||
:type :primary | ||||||||
:customization-color (or customization-color :primary) | ||||||||
:accessibility-label :login-button | ||||||||
:icon-left :i/unlocked | ||||||||
:disabled? (or (not sign-in-enabled?) processing) | ||||||||
:on-press login-multiaccount | ||||||||
:container-style {:margin-bottom (+ (safe-area/get-bottom) 12)}} | ||||||||
(i18n/label :t/log-in)]])))) | ||||||||
|
||||||||
;; we had to register it here, because of hotreload, overwise on hotreload it will be reseted | ||||||||
(defonce show-profiles? (reagent/atom false)) | ||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,8 +32,7 @@ | |
(rf/reg-event-fx :wallet/navigate-to-new-account | ||
(fn [{:keys [db]} [address]] | ||
{:db (assoc-in db [:wallet :current-viewing-account-address] address) | ||
:fx [[:dispatch [:hide-bottom-sheet]] | ||
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. do we definitely need to move this to the other event? 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. Yes, we agreed to close the bottom sheet before the navigation happens 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. Right, but the original order did that no? |
||
[:dispatch [:navigate-to :wallet-accounts address]] | ||
:fx [[:dispatch [:navigate-to :wallet-accounts address]] | ||
[:dispatch [:wallet/show-account-created-toast address]]]})) | ||
|
||
(rf/reg-event-fx :wallet/switch-current-viewing-account | ||
|
@@ -199,7 +198,8 @@ | |
(fn [_ [account-details]] | ||
(let [on-success (fn [derived-address-details] | ||
(rf/dispatch [:wallet/add-account account-details | ||
(first derived-address-details)]))] | ||
(first derived-address-details)]) | ||
(rf/dispatch [:hide-bottom-sheet]))] | ||
{:fx [[:dispatch [:wallet/create-derived-addresses account-details on-success]]]}))) | ||
|
||
(rf/reg-event-fx :wallet/bridge-select-token | ||
|
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.
Since we are talking more about performance these days, I'd like to mention a few things for this
enter-password
component I deem significant and that appear in many of our PRs. In no order of importance::standard-auth/update-password
on every key press, this forces the parentview
component to be rendered twice, for every key press. This problem cascades to its childrenpassword-input/view
andquo/button
.input/view
itself is quite heavy. We can save a bunch of CPU cycles if we process the parentview
component and its children only once on every key press.button
component are different on every Reagent pass because theon-press
function is recreated over and over. This forces the button component to be re-processed by Reagent on every pass of the parent component.Things that would allow us to render all components in
enter-password
once on every key press:[:profile/login :password]
and[:profile/login :error]
on every key press. Use local state and then the wholeenter-password
component and its children would render once. The global state should be left for things that change less often.key-uid
doesn't change when the user is typing, so it can be moved outside the renderer, and then we can make theon-press
of the button be created only once. This would allow Reagent to skip processing the button component entirely on every key press. The button component is not the cheapest too if we look at its implementation.cc @flexsurfer A slightly different example than what we were discussing today in the perf channel. Still, a good example where multiple Reagent passes cascade down the component tree (and I haven't checked the other subcomponents, but on the surface they also have low-hanging fruits to optimize).