[#12260] Keycard UI issues after RNN
Signed-off-by: andrey <motor4ik@gmail.com>
This commit is contained in:
parent
927d67f3ca
commit
723d99cb40
|
@ -39,7 +39,7 @@
|
|||
{:db (-> db
|
||||
(assoc-in [:keycard :pin :enter-step] :original)
|
||||
(assoc-in [:keycard :pin :status] nil))}
|
||||
(navigation/navigate-to-cofx :enter-pin-settings nil)))
|
||||
(navigation/navigate-replace :enter-pin-settings nil)))
|
||||
|
||||
(fx/defn proceed-to-change-puk
|
||||
{:events [:keycard/proceed-to-change-puk]}
|
||||
|
@ -48,12 +48,12 @@
|
|||
{:db (-> db
|
||||
(assoc-in [:keycard :pin :enter-step] :puk-original)
|
||||
(assoc-in [:keycard :pin :status] nil))}
|
||||
(navigation/navigate-to-cofx :enter-pin-settings nil)))
|
||||
(navigation/navigate-replace :enter-pin-settings nil)))
|
||||
|
||||
(fx/defn proceed-to-change-pairing
|
||||
{:events [:keycard/proceed-to-change-pairing]}
|
||||
[{:keys [db] :as cofx}]
|
||||
(navigation/navigate-to-cofx cofx :change-pairing-code nil))
|
||||
(navigation/navigate-replace cofx :change-pairing-code nil))
|
||||
|
||||
(fx/defn discard-pin-change
|
||||
{:events [::on-cancel]}
|
||||
|
@ -63,7 +63,7 @@
|
|||
(common/hide-connection-sheet)
|
||||
(if (get-in db [:keycard :pin :puk-restore?])
|
||||
(navigation/navigate-to-cofx :multiaccounts nil)
|
||||
(navigation/navigate-to-cofx :keycard-settings nil))))
|
||||
(navigation/set-stack-root :profile-stack [:my-profile :keycard-settings]))))
|
||||
|
||||
(fx/defn change-pin
|
||||
{:events [:keycard/change-pin]}
|
||||
|
@ -151,7 +151,7 @@
|
|||
(common/hide-connection-sheet)
|
||||
(if puk-restore?
|
||||
(navigation/navigate-to-cofx :multiaccounts nil)
|
||||
(navigation/navigate-to-cofx :keycard-settings nil))
|
||||
(navigation/set-stack-root :profile-stack [:my-profile :keycard-settings]))
|
||||
(when (:multiaccounts/login db)
|
||||
(common/get-keys-from-keycard)))))
|
||||
|
||||
|
@ -166,7 +166,7 @@
|
|||
:utils/show-popup {:title ""
|
||||
:content (i18n/label :t/puk-changed)}}
|
||||
(common/hide-connection-sheet)
|
||||
(navigation/navigate-to-cofx :keycard-settings nil)))
|
||||
(navigation/set-stack-root :profile-stack [:my-profile :keycard-settings])))
|
||||
|
||||
(fx/defn on-change-pairing-success
|
||||
{:events [:keycard.callback/on-change-pairing-success]}
|
||||
|
@ -178,7 +178,7 @@
|
|||
:utils/show-popup {:title ""
|
||||
:content (i18n/label :t/pairing-changed)}}
|
||||
(common/hide-connection-sheet)
|
||||
(navigation/navigate-to-cofx :keycard-settings nil)))
|
||||
(navigation/set-stack-root :profile-stack [:my-profile :keycard-settings])))
|
||||
|
||||
(fx/defn on-change-pin-error
|
||||
{:events [:keycard.callback/on-change-pin-error]}
|
||||
|
|
|
@ -295,7 +295,7 @@
|
|||
{:utils/show-popup {:title ""
|
||||
:content (i18n/label :t/keycard-unauthorized-operation)}}
|
||||
(clear-on-card-connected)
|
||||
(navigation/navigate-to-cofx :keycard-settings nil)))
|
||||
(navigation/set-stack-root :profile-stack [:my-profile :keycard-settings])))
|
||||
|
||||
(fx/defn navigate-to-enter-pin-screen
|
||||
{:events [:keycard/navigate-to-enter-pin-screen]}
|
||||
|
|
|
@ -67,7 +67,9 @@
|
|||
:status nil))
|
||||
:hide-popover nil})
|
||||
(when-not (:multiaccounts/login db)
|
||||
(navigation/navigate-to-cofx :keycard-pin nil))))
|
||||
(if (:popover/popover db)
|
||||
(navigation/navigate-replace :keycard-pin nil)
|
||||
(navigation/navigate-to-cofx :keycard-pin nil)))))
|
||||
|
||||
(fx/defn dismiss-frozen-keycard-popover
|
||||
{:events [::frozen-keycard-popover-dismissed]}
|
||||
|
|
|
@ -214,7 +214,7 @@
|
|||
:content (i18n/label (if (= backup-type :recovery-card)
|
||||
:t/keycard-can-use-with-new-passcode :t/keycard-backup-success-body))}}
|
||||
(if (multiaccounts.model/logged-in? cofx)
|
||||
(navigation/navigate-to-cofx :keycard-settings nil)
|
||||
(navigation/set-stack-root :profile-stack [:my-profile :keycard-settings])
|
||||
(return-to-keycard-login))))
|
||||
|
||||
(fx/defn on-generate-and-load-key-success
|
||||
|
|
|
@ -12,12 +12,13 @@
|
|||
|
||||
(fx/defn navigate-to-cofx
|
||||
[{:keys [db]} go-to-view-id screen-params]
|
||||
{:db
|
||||
(-> (assoc db :view-id go-to-view-id)
|
||||
(all-screens-params go-to-view-id screen-params))
|
||||
:navigate-to-fx go-to-view-id
|
||||
;; simulate a navigate-to event so it can be captured be anon-metrics
|
||||
::anon-metrics/transform-and-log {:coeffects {:event [:navigate-to go-to-view-id screen-params]}}})
|
||||
(when (not= go-to-view-id (:view-id db))
|
||||
{:db
|
||||
(-> (assoc db :view-id go-to-view-id)
|
||||
(all-screens-params go-to-view-id screen-params))
|
||||
:navigate-to-fx go-to-view-id
|
||||
;; simulate a navigate-to event so it can be captured be anon-metrics
|
||||
::anon-metrics/transform-and-log {:coeffects {:event [:navigate-to go-to-view-id screen-params]}}}))
|
||||
|
||||
(fx/defn navigate-to
|
||||
{:events [:navigate-to]}
|
||||
|
|
|
@ -146,11 +146,12 @@
|
|||
(defonce screen-disappear-reg
|
||||
(.registerComponentDidDisappearListener
|
||||
(.events Navigation)
|
||||
(fn [_]
|
||||
(doseq [[_ {:keys [ref value]}] @quo.text-input/text-input-refs]
|
||||
(.setNativeProps ^js ref (clj->js {:text value})))
|
||||
(doseq [[^js text-input default-value] @react/text-input-refs]
|
||||
(.setNativeProps text-input (clj->js {:text default-value}))))))
|
||||
(fn [^js evn]
|
||||
(when-not (#{"popover" "bottom-sheet" "signing-sheet"} (.-componentName evn))
|
||||
(doseq [[_ {:keys [ref value]}] @quo.text-input/text-input-refs]
|
||||
(.setNativeProps ^js ref (clj->js {:text value})))
|
||||
(doseq [[^js text-input default-value] @react/text-input-refs]
|
||||
(.setNativeProps text-input (clj->js {:text default-value})))))))
|
||||
|
||||
;; SET ROOT
|
||||
(re-frame/reg-fx
|
||||
|
@ -326,9 +327,7 @@
|
|||
(re-frame/reg-fx
|
||||
:navigate-to-fx
|
||||
(fn [key]
|
||||
;;TODO WHY #{:home} ? we need to review all navigations to root screens home, wallet profile etc
|
||||
(when-not (#{:home} key)
|
||||
(navigate key))))
|
||||
(navigate key)))
|
||||
|
||||
(re-frame/reg-fx
|
||||
:navigate-back-fx
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
(ns status-im.ui.screens.keycard.pairing.views
|
||||
(:require [re-frame.core :as re-frame]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.ui.components.topbar :as topbar]
|
||||
[status-im.ui.components.toolbar :as toolbar]
|
||||
[status-im.i18n.i18n :as i18n]
|
||||
[status-im.utils.security :as security]
|
||||
|
@ -28,63 +27,58 @@
|
|||
(re-frame/dispatch [:keycard/change-pairing-code @pairing-code]))
|
||||
(reset! show-error true)))]
|
||||
[rn/keyboard-avoiding-view {:flex 1}
|
||||
[topbar/topbar
|
||||
{:border-bottom false
|
||||
:navigation
|
||||
{:icon :main-icons/back
|
||||
:accessibility-label :back-button
|
||||
:on-press #(re-frame/dispatch [:navigate-to :keycard-settings])}}]
|
||||
[rn/view {:style {:flex 1
|
||||
:justify-content :space-between
|
||||
:padding-vertical 16
|
||||
:padding-horizontal 16}}
|
||||
[rn/scroll-view {:style {:flex 1}}
|
||||
[rn/view {:style {:flex 1
|
||||
:justify-content :space-between
|
||||
:padding-vertical 16
|
||||
:padding-horizontal 16}}
|
||||
|
||||
[rn/view
|
||||
[quo/text {:weight :bold
|
||||
:align :center
|
||||
:size :x-large}
|
||||
(i18n/label :t/change-pairing-title)]]
|
||||
[rn/view
|
||||
[rn/view {:style {:padding 16}}
|
||||
[quo/text-input {:secure-text-entry true
|
||||
:auto-capitalize :none
|
||||
:auto-focus true
|
||||
:show-cancel false
|
||||
:accessibility-label :password-input
|
||||
:placeholder (i18n/label :t/pairing-code-placeholder)
|
||||
:on-change-text #(reset! pairing-code (security/mask-data %))
|
||||
:return-key-type :next
|
||||
:on-submit-editing #(when valid-pairing-code
|
||||
(some-> ^js @confirm-ref .focus))}]]
|
||||
[rn/view {:style {:padding 16
|
||||
:opacity (if-not valid-pairing-code 0.33 1)}}
|
||||
[quo/text-input {:secure-text-entry true
|
||||
:get-ref #(reset! confirm-ref %)
|
||||
:auto-capitalize :none
|
||||
:show-cancel false
|
||||
:accessibility-label :password-input
|
||||
:editable valid-pairing-code
|
||||
:placeholder (i18n/label :t/confirm-pairing-code-placeholder)
|
||||
:return-key-type :go
|
||||
:error (when @show-error (i18n/label :t/pairing-code_error1))
|
||||
:blur-on-submit true
|
||||
:on-focus #(reset! show-error false)
|
||||
:on-submit-editing on-submit
|
||||
:on-change-text #(do
|
||||
(reset! confirm (security/mask-data %))
|
||||
(cond
|
||||
(> (count @pairing-code) (count @confirm))
|
||||
(reset! show-error false)
|
||||
[rn/view
|
||||
[quo/text {:weight :bold
|
||||
:align :center
|
||||
:size :x-large}
|
||||
(i18n/label :t/change-pairing-title)]]
|
||||
[rn/view
|
||||
[rn/view {:style {:padding 16}}
|
||||
[quo/text-input {:secure-text-entry true
|
||||
:auto-capitalize :none
|
||||
:auto-focus true
|
||||
:show-cancel false
|
||||
:accessibility-label :password-input
|
||||
:placeholder (i18n/label :t/pairing-code-placeholder)
|
||||
:on-change-text #(reset! pairing-code (security/mask-data %))
|
||||
:return-key-type :next
|
||||
:on-submit-editing #(when valid-pairing-code
|
||||
(some-> ^js @confirm-ref .focus))}]]
|
||||
[rn/view {:style {:padding 16
|
||||
:opacity (if-not valid-pairing-code 0.33 1)}}
|
||||
[quo/text-input {:secure-text-entry true
|
||||
:get-ref #(reset! confirm-ref %)
|
||||
:auto-capitalize :none
|
||||
:show-cancel false
|
||||
:accessibility-label :password-input
|
||||
:editable valid-pairing-code
|
||||
:placeholder (i18n/label :t/confirm-pairing-code-placeholder)
|
||||
:return-key-type :go
|
||||
:error (when @show-error (i18n/label :t/pairing-code_error1))
|
||||
:blur-on-submit true
|
||||
:on-focus #(reset! show-error false)
|
||||
:on-submit-editing on-submit
|
||||
:on-change-text #(do
|
||||
(reset! confirm (security/mask-data %))
|
||||
(cond
|
||||
(> (count @pairing-code) (count @confirm))
|
||||
(reset! show-error false)
|
||||
|
||||
(not (confirm-pairing-code @pairing-code @confirm))
|
||||
(reset! show-error true)
|
||||
(not (confirm-pairing-code @pairing-code @confirm))
|
||||
(reset! show-error true)
|
||||
|
||||
:else (reset! show-error false)))}]]]
|
||||
[rn/view
|
||||
[quo/text {:color :secondary
|
||||
:align :center
|
||||
:size :small}
|
||||
(i18n/label :t/change-pairing-description)]]]
|
||||
:else (reset! show-error false)))}]]]
|
||||
[rn/view
|
||||
[quo/text {:color :secondary
|
||||
:align :center
|
||||
:size :small}
|
||||
(i18n/label :t/change-pairing-description)]]]]
|
||||
[toolbar/toolbar
|
||||
{:show-border? true
|
||||
:right [quo/button
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
[status-im.ui.screens.keycard.pin.styles :as styles]
|
||||
[status-im.ui.components.checkbox.view :as checkbox]
|
||||
[status-im.utils.platform :as platform]
|
||||
[status-im.utils.utils :as utils]
|
||||
[status-im.ui.components.topbar :as topbar]))
|
||||
[status-im.utils.utils :as utils]))
|
||||
|
||||
(def default-pin-retries-number 3)
|
||||
(def default-puk-retries-number 5)
|
||||
|
@ -242,36 +241,33 @@
|
|||
;; properly rewritten so that different instances of pin-view do not
|
||||
;; mess with state unrelated to them.
|
||||
step (or step :current)]
|
||||
[react/view {:flex 1
|
||||
:background-color colors/white}
|
||||
[topbar/topbar {}]
|
||||
(if (zero? pin-retry-counter)
|
||||
[pin-view {:pin pin
|
||||
:retry-counter (when (< puk-retry-counter puk-retries) puk-retry-counter)
|
||||
:title-label :t/enter-puk-code
|
||||
:description-label :t/enter-puk-code-description
|
||||
:step step
|
||||
:status status
|
||||
:error-label error-label}]
|
||||
[pin-view {:pin pin
|
||||
:retry-counter (when (< pin-retry-counter pin-retries) pin-retry-counter)
|
||||
:title-label (case step
|
||||
:current :t/current-pin
|
||||
:login :t/current-pin
|
||||
:import-multiaccount :t/current-pin
|
||||
:original :t/create-a-pin
|
||||
:confirmation :t/repeat-pin
|
||||
:puk-original :t/create-a-puk
|
||||
:puk-confirmation :t/repeat-puk
|
||||
:t/current-pin)
|
||||
:description-label (case step
|
||||
:current :t/current-pin-description
|
||||
:sign :t/current-pin-description
|
||||
:import-multiaccount :t/current-pin-description
|
||||
:login :t/login-pin-description
|
||||
:puk-original :t/new-puk-description
|
||||
:puk-confirmation :t/new-puk-description
|
||||
:t/new-pin-description)
|
||||
:step step
|
||||
:status status
|
||||
:error-label error-label}])])))
|
||||
(if (zero? pin-retry-counter)
|
||||
[pin-view {:pin pin
|
||||
:retry-counter (when (< puk-retry-counter puk-retries) puk-retry-counter)
|
||||
:title-label :t/enter-puk-code
|
||||
:description-label :t/enter-puk-code-description
|
||||
:step step
|
||||
:status status
|
||||
:error-label error-label}]
|
||||
[pin-view {:pin pin
|
||||
:retry-counter (when (< pin-retry-counter pin-retries) pin-retry-counter)
|
||||
:title-label (case step
|
||||
:current :t/current-pin
|
||||
:login :t/current-pin
|
||||
:import-multiaccount :t/current-pin
|
||||
:original :t/create-a-pin
|
||||
:confirmation :t/repeat-pin
|
||||
:puk-original :t/create-a-puk
|
||||
:puk-confirmation :t/repeat-puk
|
||||
:t/current-pin)
|
||||
:description-label (case step
|
||||
:current :t/current-pin-description
|
||||
:sign :t/current-pin-description
|
||||
:import-multiaccount :t/current-pin-description
|
||||
:login :t/login-pin-description
|
||||
:puk-original :t/new-puk-description
|
||||
:puk-confirmation :t/new-puk-description
|
||||
:t/new-pin-description)
|
||||
:step step
|
||||
:status status
|
||||
:error-label error-label}]))))
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
[status-im.ui.components.colors :as colors]
|
||||
[quo.core :as quo]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.ui.screens.keycard.views :as keycard.views]
|
||||
[status-im.keycard.common :as keycard.common]))
|
||||
[status-im.ui.screens.keycard.views :as keycard.views]))
|
||||
|
||||
(defn- activity-indicator [loading?]
|
||||
(when loading?
|
||||
|
@ -112,6 +111,6 @@
|
|||
(defn reset-pin []
|
||||
[keycard.views/login-pin
|
||||
{:back-button-handler
|
||||
::keycard.common/navigate-to-keycard-settings
|
||||
:navigate-back
|
||||
:hide-login-actions? true
|
||||
:default-enter-step :reset}])
|
||||
|
|
|
@ -786,13 +786,9 @@
|
|||
:component keycard.settings/reset-pin}
|
||||
{:name :enter-pin-settings
|
||||
:insets {:bottom true}
|
||||
;;TODO dynamic title
|
||||
:options {:topBar {:visible false}}
|
||||
:component keycard.pin/enter-pin}
|
||||
{:name :change-pairing-code
|
||||
:insets {:bottom true}
|
||||
;;TODO dynamic title
|
||||
:options {:topBar {:visible false}}
|
||||
:component keycard.pairing/change-pairing-code}
|
||||
|
||||
;;KEYSTORAGE
|
||||
|
|
Loading…
Reference in New Issue