Fix auth slider resetting when wallet connect signing is finished (#20589)
* Fix auth slider resetting when wallet connect signing is finished * Lint fix * Fixes * Fixes
This commit is contained in:
parent
2e8776d0a6
commit
35a1905396
|
@ -26,7 +26,8 @@
|
||||||
(reanimated/set-shared-value x-pos clamped-x)
|
(reanimated/set-shared-value x-pos clamped-x)
|
||||||
(when (and reached-end? (not sliding-complete?))
|
(when (and reached-end? (not sliding-complete?))
|
||||||
(set-sliding-complete true)
|
(set-sliding-complete true)
|
||||||
(when on-complete (on-complete reset-fn))))))
|
(when on-complete
|
||||||
|
(on-complete reset-fn))))))
|
||||||
(gesture/on-end (fn [event]
|
(gesture/on-end (fn [event]
|
||||||
(let [x-translation (oops/oget event "translationX")
|
(let [x-translation (oops/oget event "translationX")
|
||||||
reached-end? (>= x-translation track-width)]
|
reached-end? (>= x-translation track-width)]
|
||||||
|
@ -54,9 +55,10 @@
|
||||||
on-track-layout (rn/use-callback
|
on-track-layout (rn/use-callback
|
||||||
#(set-track-width (oops/oget % "nativeEvent.layout.width")))
|
#(set-track-width (oops/oget % "nativeEvent.layout.width")))
|
||||||
reset-fn (rn/use-callback
|
reset-fn (rn/use-callback
|
||||||
(fn []
|
(fn [keep-at-end-after-slide?]
|
||||||
(set-sliding-complete false)
|
(set-sliding-complete false)
|
||||||
(animations/reset-track-position x-pos)))
|
(when-not keep-at-end-after-slide?
|
||||||
|
(animations/reset-track-position x-pos))))
|
||||||
dimensions (rn/use-callback
|
dimensions (rn/use-callback
|
||||||
(partial utils/get-dimensions
|
(partial utils/get-dimensions
|
||||||
(or track-width constants/default-width)
|
(or track-width constants/default-width)
|
||||||
|
|
|
@ -32,9 +32,8 @@
|
||||||
:on-cancel #(rf/dispatch [:standard-auth/authorize-with-password
|
:on-cancel #(rf/dispatch [:standard-auth/authorize-with-password
|
||||||
args-with-biometric-btn])
|
args-with-biometric-btn])
|
||||||
:on-success (fn []
|
:on-success (fn []
|
||||||
(when (fn? on-close)
|
(rf/dispatch [:standard-auth/on-biometric-success on-auth-success])
|
||||||
(on-close))
|
(rf/dispatch [:standard-auth/close on-close]))
|
||||||
(rf/dispatch [:standard-auth/on-biometric-success on-auth-success]))
|
|
||||||
:on-fail (fn [err]
|
:on-fail (fn [err]
|
||||||
(rf/dispatch [:standard-auth/authorize-with-password
|
(rf/dispatch [:standard-auth/authorize-with-password
|
||||||
args-with-biometric-btn])
|
args-with-biometric-btn])
|
||||||
|
@ -48,6 +47,7 @@
|
||||||
[{:keys [db]} [on-auth-success]]
|
[{:keys [db]} [on-auth-success]]
|
||||||
(let [key-uid (get-in db [:profile/profile :key-uid])]
|
(let [key-uid (get-in db [:profile/profile :key-uid])]
|
||||||
{:fx [[:keychain/get-user-password [key-uid on-auth-success]]
|
{:fx [[:keychain/get-user-password [key-uid on-auth-success]]
|
||||||
|
[:dispatch [:standard-auth/set-success true]]
|
||||||
[:dispatch [:standard-auth/reset-login-password]]]}))
|
[:dispatch [:standard-auth/reset-login-password]]]}))
|
||||||
|
|
||||||
(schema/=> on-biometric-success events-schema/?on-biometric-success)
|
(schema/=> on-biometric-success events-schema/?on-biometric-success)
|
||||||
|
@ -74,6 +74,7 @@
|
||||||
(fn [password]
|
(fn [password]
|
||||||
(let [sha3-pwd (security/hash-masked-password password)
|
(let [sha3-pwd (security/hash-masked-password password)
|
||||||
on-auth-success-callback #(on-auth-success sha3-pwd)]
|
on-auth-success-callback #(on-auth-success sha3-pwd)]
|
||||||
|
(rf/dispatch [:standard-auth/set-success true])
|
||||||
(rf/dispatch [:standard-auth/reset-login-password])
|
(rf/dispatch [:standard-auth/reset-login-password])
|
||||||
(if has-partially-operable-accounts?
|
(if has-partially-operable-accounts?
|
||||||
(rf/dispatch [:wallet/make-partially-operable-accounts-fully-operable
|
(rf/dispatch [:wallet/make-partially-operable-accounts-fully-operable
|
||||||
|
@ -92,10 +93,7 @@
|
||||||
{:fx [[:dispatch [:standard-auth/reset-login-password]]
|
{:fx [[:dispatch [:standard-auth/reset-login-password]]
|
||||||
[:dispatch
|
[:dispatch
|
||||||
[:show-bottom-sheet
|
[:show-bottom-sheet
|
||||||
{:on-close (fn []
|
{:on-close #(rf/dispatch [:standard-auth/close on-close])
|
||||||
(rf/dispatch [:standard-auth/reset-login-password])
|
|
||||||
(when on-close
|
|
||||||
(on-close)))
|
|
||||||
:theme theme
|
:theme theme
|
||||||
:shell? blur?
|
:shell? blur?
|
||||||
:content #(bottom-sheet-password-view args)}]]]})
|
:content #(bottom-sheet-password-view args)}]]]})
|
||||||
|
@ -107,3 +105,23 @@
|
||||||
:standard-auth/reset-login-password
|
:standard-auth/reset-login-password
|
||||||
(fn [{:keys [db]}]
|
(fn [{:keys [db]}]
|
||||||
{:db (update db :profile/login dissoc :password :error)}))
|
{:db (update db :profile/login dissoc :password :error)}))
|
||||||
|
|
||||||
|
(rf/reg-fx
|
||||||
|
:standard-auth/on-close
|
||||||
|
(fn [{:keys [on-close success?]}]
|
||||||
|
(when on-close
|
||||||
|
(on-close success?))))
|
||||||
|
|
||||||
|
(rf/reg-event-fx
|
||||||
|
:standard-auth/close
|
||||||
|
(fn [{:keys [db]} [on-close]]
|
||||||
|
{:db (assoc-in db [:profile/login :success?] false)
|
||||||
|
:fx [[:dispatch [:standard-auth/reset-login-password]]
|
||||||
|
[:standard-auth/on-close
|
||||||
|
{:on-close on-close
|
||||||
|
:success? (get-in db [:profile/login :success?])}]]}))
|
||||||
|
|
||||||
|
(rf/reg-event-fx
|
||||||
|
:standard-auth/set-success
|
||||||
|
(fn [{:keys [db]} [success?]]
|
||||||
|
{:db (assoc-in db [:profile/login :success?] success?)}))
|
||||||
|
|
|
@ -16,7 +16,8 @@
|
||||||
on-complete (rn/use-callback
|
on-complete (rn/use-callback
|
||||||
(fn [reset]
|
(fn [reset]
|
||||||
(rf/dispatch [:standard-auth/authorize
|
(rf/dispatch [:standard-auth/authorize
|
||||||
{:on-close #(js/setTimeout reset 200)
|
{:on-close (fn [success?]
|
||||||
|
(js/setTimeout #(reset success?) 200))
|
||||||
:auth-button-icon-left auth-button-icon-left
|
:auth-button-icon-left auth-button-icon-left
|
||||||
:theme theme
|
:theme theme
|
||||||
:blur? blur?
|
:blur? blur?
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
(ns status-im.contexts.preview.quo.buttons.slide-button
|
(ns status-im.contexts.preview.quo.buttons.slide-button
|
||||||
(:require
|
(:require
|
||||||
[quo.core :as quo]
|
[quo.core :as quo]
|
||||||
[react-native.core :as rn]
|
|
||||||
[reagent.core :as reagent]
|
[reagent.core :as reagent]
|
||||||
[status-im.contexts.preview.quo.preview :as preview]))
|
[status-im.contexts.preview.quo.preview :as preview]))
|
||||||
|
|
||||||
|
@ -18,41 +17,36 @@
|
||||||
:type :boolean}
|
:type :boolean}
|
||||||
{:key :blur?
|
{:key :blur?
|
||||||
:type :boolean}
|
:type :boolean}
|
||||||
|
{:key :keep-at-end-after-slide?
|
||||||
|
:type :boolean}
|
||||||
(preview/customization-color-option {:key :color})])
|
(preview/customization-color-option {:key :color})])
|
||||||
|
|
||||||
(defn f-view
|
(defn f-view
|
||||||
[]
|
[]
|
||||||
(let [state (reagent/atom {:disabled? false
|
(let [state (reagent/atom {:disabled? false
|
||||||
:color :blue
|
:color :blue
|
||||||
:size :size-48})
|
:size :size-48
|
||||||
color (reagent/cursor state [:color])
|
:keep-at-end-after-slide? false})
|
||||||
blur? (reagent/cursor state [:blur?])
|
color (reagent/cursor state [:color])
|
||||||
complete? (reagent/atom false)]
|
blur? (reagent/cursor state [:blur?])
|
||||||
|
keep-at-end-after-slide? (reagent/cursor state [:keep-at-end-after-slide?])]
|
||||||
(fn []
|
(fn []
|
||||||
(rn/use-effect (fn []
|
|
||||||
(reset! complete? true)
|
|
||||||
(js/setTimeout #(reset! complete? false) 50))
|
|
||||||
[(:size @state)])
|
|
||||||
[preview/preview-container
|
[preview/preview-container
|
||||||
{:state state
|
{:state state
|
||||||
:descriptor descriptor
|
:descriptor descriptor
|
||||||
:component-container-style (when-not @blur? (:align-items :center))
|
:component-container-style (when-not @blur? (:align-items :center))
|
||||||
:blur? @blur?
|
:blur? @blur?
|
||||||
:show-blur-background? true}
|
:show-blur-background? true}
|
||||||
(if (not @complete?)
|
[quo/slide-button
|
||||||
[quo/slide-button
|
{:track-text "We gotta slide"
|
||||||
{:track-text "We gotta slide"
|
:track-icon :face-id
|
||||||
:track-icon :face-id
|
:customization-color @color
|
||||||
:customization-color @color
|
:size (:size @state)
|
||||||
:size (:size @state)
|
:disabled? (:disabled? @state)
|
||||||
:disabled? (:disabled? @state)
|
:blur? @blur?
|
||||||
:blur? @blur?
|
:type (:type @state)
|
||||||
:type (:type @state)
|
:on-complete (fn [reset-fn]
|
||||||
:on-complete (fn [_]
|
(js/alert "Slide complete")
|
||||||
(js/setTimeout (fn [] (reset! complete? true))
|
(reset-fn @keep-at-end-after-slide?))}]])))
|
||||||
1000)
|
|
||||||
(js/alert "I don't wanna slide anymore"))}]
|
|
||||||
[quo/button {:on-press (fn [] (reset! complete? false))}
|
|
||||||
"Try again"])])))
|
|
||||||
|
|
||||||
(defn view [] [:f> f-view])
|
(defn view [] [:f> f-view])
|
||||||
|
|
Loading…
Reference in New Issue