From 0472140f0223de09ca04b5fd8c87d501fccd16de Mon Sep 17 00:00:00 2001 From: frank Date: Fri, 3 Feb 2023 16:07:27 +0800 Subject: [PATCH] fix: Unable to add new contact on receiver device after local pairing until app relaunch (#14936) --- src/status_im/signals/core.cljs | 8 ++++---- src/status_im2/constants.cljs | 6 ++++++ src/status_im2/navigation/core.cljs | 17 +++++++++++++++-- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/status_im/signals/core.cljs b/src/status_im/signals/core.cljs index 477f4e4566..6620d69d11 100644 --- a/src/status_im/signals/core.cljs +++ b/src/status_im/signals/core.cljs @@ -54,9 +54,9 @@ :peers-count (count (:peers peer-stats)))})) (defn handle-local-pairing-signals - [signal-type] - (log/info "local pairing signal received" - {:signal-type signal-type})) + [event] + (log/debug "local pairing signal received" + {:event event})) (rf/defn process {:events [:signals/signal-received]} @@ -110,5 +110,5 @@ "status.updates.timedout" (visibility-status-updates/handle-visibility-status-updates cofx (js->clj event-js :keywordize-keys true)) - "localPairing" (handle-local-pairing-signals event-str) + "localPairing" (handle-local-pairing-signals (js->clj event-js :keywordize-keys true)) (log/debug "Event " type " not handled")))) diff --git a/src/status_im2/constants.cljs b/src/status_im2/constants.cljs index da8476c2d3..2e17340daf 100644 --- a/src/status_im2/constants.cljs +++ b/src/status_im2/constants.cljs @@ -273,3 +273,9 @@ (def ^:const theme-type-light 1) (def ^:const theme-type-dark 2) (def ^:const bottom-sheet-animation-delay 450) + +(def ^:const local-pair-event-process-success "process-success") +(def ^:const local-pair-event-process-error "process-error") +(def ^:const local-pair-action-connect 1) +(def ^:const local-pair-action-pairing-account 2) +(def ^:const local-pair-action-sync-device 3) diff --git a/src/status_im2/navigation/core.cljs b/src/status_im2/navigation/core.cljs index 4f4aa9a1e6..62e579324e 100644 --- a/src/status_im2/navigation/core.cljs +++ b/src/status_im2/navigation/core.cljs @@ -25,7 +25,10 @@ (defn dismiss-all-modals [] - (log/debug "dissmiss-all-modals") + (log/debug "dissmiss-all-modals" + {:curr-modal @state/curr-modal + :modals @state/modals + :dissmissing @state/dissmissing}) (when @state/curr-modal (reset! state/curr-modal false) (reset! state/dissmissing true) @@ -75,7 +78,11 @@ (defn open-modal [comp] - (log/debug "open-modal" comp) + (log/debug "open-modal" + {:comp comp + :dissmissing @state/dissmissing + :curr-modal @state/curr-modal + :modals @state/modals}) (let [{:keys [options]} (get views/screens comp)] (if @state/dissmissing (reset! state/dissmissing comp) @@ -122,6 +129,10 @@ (defn modal-dismissed-listener [] + (log/debug "modal-dismissed" + {:modals @state/modals + :curr-modal @state/curr-modal + :dissmissing @state/dissmissing}) (if (> (count @state/modals) 1) (let [new-modals (butlast @state/modals)] (reset! state/modals (vec new-modals)) @@ -180,6 +191,7 @@ :init-root-fx (fn [new-root-id] (log/debug :init-root-fx new-root-id) + (dismiss-all-modals) (reset! state/root-comp-id new-root-id) (reset! state/root-id @state/root-comp-id) (navigation/set-root (get (roots/roots) new-root-id)))) @@ -188,6 +200,7 @@ :init-root-with-component-fx (fn [[new-root-id new-root-comp-id]] (log/debug :init-root-with-component-fx new-root-id new-root-comp-id) + (dismiss-all-modals) (reset! state/root-comp-id new-root-comp-id) (reset! state/root-id @state/root-comp-id) (navigation/set-root (get (roots/roots) new-root-id))))