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