[#12260] Keycard UI issues after RNN

Signed-off-by: andrey <motor4ik@gmail.com>
This commit is contained in:
andrey 2021-07-05 14:14:48 +02:00
parent 927d67f3ca
commit 723d99cb40
No known key found for this signature in database
GPG Key ID: 89B67245FD2F0272
10 changed files with 108 additions and 121 deletions

View File

@ -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]}

View File

@ -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]}

View File

@ -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]}

View File

@ -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

View File

@ -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]
(when (not= go-to-view-id (:view-id db))
{:db {:db
(-> (assoc db :view-id go-to-view-id) (-> (assoc db :view-id go-to-view-id)
(all-screens-params go-to-view-id screen-params)) (all-screens-params go-to-view-id screen-params))
:navigate-to-fx go-to-view-id :navigate-to-fx go-to-view-id
;; simulate a navigate-to event so it can be captured be anon-metrics ;; 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]}}}) ::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]}

View File

@ -146,11 +146,12 @@
(defonce screen-disappear-reg (defonce screen-disappear-reg
(.registerComponentDidDisappearListener (.registerComponentDidDisappearListener
(.events Navigation) (.events Navigation)
(fn [_] (fn [^js evn]
(when-not (#{"popover" "bottom-sheet" "signing-sheet"} (.-componentName evn))
(doseq [[_ {:keys [ref value]}] @quo.text-input/text-input-refs] (doseq [[_ {:keys [ref value]}] @quo.text-input/text-input-refs]
(.setNativeProps ^js ref (clj->js {:text value}))) (.setNativeProps ^js ref (clj->js {:text value})))
(doseq [[^js text-input default-value] @react/text-input-refs] (doseq [[^js text-input default-value] @react/text-input-refs]
(.setNativeProps text-input (clj->js {:text default-value})))))) (.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

View File

@ -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,12 +27,7 @@
(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
:navigation
{:icon :main-icons/back
:accessibility-label :back-button
:on-press #(re-frame/dispatch [:navigate-to :keycard-settings])}}]
[rn/view {:style {:flex 1 [rn/view {:style {:flex 1
:justify-content :space-between :justify-content :space-between
:padding-vertical 16 :padding-vertical 16
@ -84,7 +78,7 @@
[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

View File

@ -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,9 +241,6 @@
;; 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
:background-color colors/white}
[topbar/topbar {}]
(if (zero? pin-retry-counter) (if (zero? pin-retry-counter)
[pin-view {:pin pin [pin-view {:pin pin
:retry-counter (when (< puk-retry-counter puk-retries) puk-retry-counter) :retry-counter (when (< puk-retry-counter puk-retries) puk-retry-counter)
@ -274,4 +270,4 @@
:t/new-pin-description) :t/new-pin-description)
:step step :step step
:status status :status status
:error-label error-label}])]))) :error-label error-label}]))))

View File

@ -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}])

View File

@ -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