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