fix Lost the syncing state in fallback recovery, when first enter the seed phrase for the wrong account (#21298)
This commit is contained in:
parent
27d1a5f3f4
commit
59c2b79df2
|
@ -23,6 +23,7 @@
|
|||
|
||||
(defn- navigate-to-sign-in-by-syncing
|
||||
[]
|
||||
(rf/dispatch [:syncing/clear-syncing-fallback-flow])
|
||||
(debounce/throttle-and-dispatch
|
||||
[:onboarding/navigate-to-sign-in-by-syncing]
|
||||
1000))
|
||||
|
@ -37,6 +38,7 @@
|
|||
|
||||
(defn- navigate-to-sign-in-by-seed-phrase
|
||||
[create-profile?]
|
||||
(rf/dispatch [:syncing/clear-syncing-fallback-flow])
|
||||
(rf/dispatch [:onboarding/navigate-to-sign-in-by-seed-phrase
|
||||
(if create-profile?
|
||||
:screen/onboarding.new-to-status
|
||||
|
|
|
@ -72,15 +72,21 @@
|
|||
[{:keys [db] :as cofx}]
|
||||
(let [{:keys [display-name seed-phrase password image-path color] :as profile}
|
||||
(:onboarding/profile db)
|
||||
loading-screen (if (seq (:syncing/key-uid db))
|
||||
syncing-account-recovered? (and (seq (:syncing/key-uid db))
|
||||
(= (:syncing/key-uid db)
|
||||
(get-in db [:onboarding/profile :key-uid])))
|
||||
loading-screen (if syncing-account-recovered?
|
||||
:screen/onboarding.preparing-status
|
||||
:screen/onboarding.generating-keys)]
|
||||
(rf/merge cofx
|
||||
{:dispatch [:navigate-to-within-stack
|
||||
[loading-screen
|
||||
(get db
|
||||
:onboarding/navigated-to-enter-seed-phrase-from-screen
|
||||
:screen/onboarding.new-to-status)]]
|
||||
{:fx [[:dispatch
|
||||
[:navigate-to-within-stack
|
||||
[loading-screen
|
||||
(get db
|
||||
:onboarding/navigated-to-enter-seed-phrase-from-screen
|
||||
:screen/onboarding.new-to-status)]]]
|
||||
(when-not syncing-account-recovered?
|
||||
[:dispatch [:syncing/clear-syncing-installation-id]])]
|
||||
:dispatch-later [{:ms constants/onboarding-generating-keys-animation-duration-ms
|
||||
:dispatch [:navigate-to-within-stack
|
||||
[:screen/onboarding.enable-notifications
|
||||
|
@ -154,15 +160,14 @@
|
|||
:on-cancel #(re-frame/dispatch [:pop-to-root :multiaccounts])}}
|
||||
{:db (-> db
|
||||
(assoc-in [:onboarding/profile :seed-phrase] seed-phrase)
|
||||
(assoc-in [:onboarding/profile :key-uid] key-uid)
|
||||
(assoc-in [:onboarding/profile :color] constants/profile-default-color))
|
||||
:fx [[:dispatch
|
||||
[:navigate-to-within-stack
|
||||
[next-screen
|
||||
(get db
|
||||
:onboarding/navigated-to-enter-seed-phrase-from-screen
|
||||
:screen/onboarding.new-to-status)]]]
|
||||
(when-not syncing-account-recovered?
|
||||
[:dispatch [:syncing/clear-syncing-data]])]})))
|
||||
:screen/onboarding.new-to-status)]]]]})))
|
||||
|
||||
(rf/defn navigate-to-create-profile
|
||||
{:events [:onboarding/navigate-to-create-profile]}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
(defn- navigate-to-enter-seed-phrase
|
||||
[]
|
||||
(rf/dispatch [:syncing/set-syncing-fallback-flow])
|
||||
(debounce/debounce-and-dispatch
|
||||
[:onboarding/navigate-to-sign-in-by-seed-phrase :screen/onboarding.sync-or-recover-profile]
|
||||
500))
|
||||
|
|
|
@ -142,7 +142,7 @@
|
|||
(rf/dispatch [:chats-list/load-success result])
|
||||
(rf/dispatch [:communities/get-user-requests-to-join])
|
||||
(rf/dispatch [:profile.login/get-chats-callback]))}]
|
||||
(when (:syncing/installation-id db)
|
||||
(when (and (:syncing/fallback-flow? db) (:syncing/installation-id db))
|
||||
[:dispatch [:pairing/finish-seed-phrase-fallback-syncing]])
|
||||
(when-not new-account?
|
||||
[:dispatch [:universal-links/process-stored-event]])]})))
|
||||
|
|
|
@ -39,11 +39,6 @@
|
|||
{:type :negative
|
||||
:text error}]))))
|
||||
|
||||
(rf/defn initiate-pairing-process
|
||||
{:events [:syncing/initiate-pairing-process]}
|
||||
[{:keys [db]}]
|
||||
{:db (assoc db :syncing/pairing-process-initiated? true)})
|
||||
|
||||
(rf/defn set-syncing-installation-id
|
||||
{:events [:syncing/set-syncing-installation-id]}
|
||||
[{:keys [db]} installation-id key-uid]
|
||||
|
@ -51,15 +46,26 @@
|
|||
:syncing/key-uid key-uid
|
||||
:syncing/installation-id installation-id)})
|
||||
|
||||
(defn clear-syncing-data
|
||||
(defn clear-syncing-installation-id
|
||||
[{:keys [db]}]
|
||||
{:db (dissoc
|
||||
db
|
||||
:syncing/key-uid
|
||||
:syncing/installation-id
|
||||
:syncing/pairing-process-initiated?)})
|
||||
:syncing/installation-id)})
|
||||
|
||||
(re-frame/reg-event-fx :syncing/clear-syncing-data clear-syncing-data)
|
||||
(re-frame/reg-event-fx :syncing/clear-syncing-installation-id clear-syncing-installation-id)
|
||||
|
||||
(defn set-syncing-fallback-flow
|
||||
[{:keys [db]}]
|
||||
{:db (assoc db :syncing/fallback-flow? true)})
|
||||
|
||||
(re-frame/reg-event-fx :syncing/set-syncing-fallback-flow set-syncing-fallback-flow)
|
||||
|
||||
(defn clear-syncing-fallback-flow
|
||||
[{:keys [db]}]
|
||||
{:db (dissoc db :syncing/fallback-flow?)})
|
||||
|
||||
(re-frame/reg-event-fx :syncing/clear-syncing-fallback-flow clear-syncing-fallback-flow)
|
||||
|
||||
(rf/defn preflight-outbound-check-for-local-pairing
|
||||
{:events [:syncing/preflight-outbound-check]}
|
||||
|
@ -95,7 +101,6 @@
|
|||
(when (sync-utils/valid-connection-string? response)
|
||||
(on-valid-connection-string response)
|
||||
(rf/dispatch [:syncing/update-role constants/local-pairing-role-sender])
|
||||
(rf/dispatch [:syncing/initiate-pairing-process])
|
||||
(rf/dispatch [:hide-bottom-sheet])))]
|
||||
(when-not (and error (string/blank? error))
|
||||
(let [key-uid (get-in db [:profile/profile :key-uid])
|
||||
|
|
Loading…
Reference in New Issue