[#11823] Fix balances fetching on recovering kk multiacc

This commit is contained in:
Roman Volosovskyi 2021-03-04 11:43:53 +02:00
parent 174329d098
commit 843c015d56
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
4 changed files with 29 additions and 17 deletions

View File

@ -61,7 +61,10 @@
{:events [::recover-with-keycard-pressed]} {:events [::recover-with-keycard-pressed]}
[{:keys [db] :as cofx}] [{:keys [db] :as cofx}]
(fx/merge cofx (fx/merge cofx
{:db (assoc-in db [:keycard :flow] :import) {:db
(-> db
(assoc-in [:keycard :flow] :import)
(assoc :recovered-account? true))
:keycard/check-nfc-enabled nil} :keycard/check-nfc-enabled nil}
(bottom-sheet/hide-bottom-sheet) (bottom-sheet/hide-bottom-sheet)
(navigation/navigate-to-cofx :keycard-recovery-intro nil))) (navigation/navigate-to-cofx :keycard-recovery-intro nil)))
@ -272,7 +275,7 @@
{:db (update-in db [:keycard :multiaccount] {:db (update-in db [:keycard :multiaccount]
(fn [multiacc] (fn [multiacc]
(assoc multiacc (assoc multiacc
:recovered true :recovered (get db :recovered-account?)
:name whisper-name :name whisper-name
:identicon identicon)))} :identicon identicon)))}
(create-keycard-multiaccount))) (create-keycard-multiaccount)))

View File

@ -95,7 +95,9 @@
{:events [:multiaccounts.create.ui/intro-wizard]} {:events [:multiaccounts.create.ui/intro-wizard]}
[{:keys [db] :as cofx}] [{:keys [db] :as cofx}]
(fx/merge cofx (fx/merge cofx
{:db (update db :keycard dissoc :flow)} {:db (-> db
(update :keycard dissoc :flow)
(dissoc :restored-account?))}
(prepare-intro-wizard) (prepare-intro-wizard)
(navigation/navigate-to-cofx :create-multiaccount-generate-key nil))) (navigation/navigate-to-cofx :create-multiaccount-generate-key nil)))
@ -107,14 +109,21 @@
(bottom-sheet/hide-bottom-sheet) (bottom-sheet/hide-bottom-sheet)
(navigation/navigate-to-cofx :create-multiaccount-generate-key nil))) (navigation/navigate-to-cofx :create-multiaccount-generate-key nil)))
(fx/defn remove-recovery-flag [{:keys [db]}]
{:db (dissoc db :recovered-account?)})
(fx/defn dec-step (fx/defn dec-step
{:events [:intro-wizard/dec-step]} {:events [:intro-wizard/dec-step]}
[{:keys [db] :as cofx}] [{:keys [db] :as cofx}]
(let [step (get-in db [:intro-wizard :step])] (let [step (get-in db [:intro-wizard :step])]
(fx/merge cofx (fx/merge cofx
(if (or (= step :enter-phrase) (= :generate-key step)) (when (= step :enter-phrase)
#(prepare-intro-wizard %) remove-recovery-flag)
{:db (assoc-in db [:intro-wizard :step] (decrement-step step))})))) (if (or (= step :enter-phrase)
(= :generate-key step))
prepare-intro-wizard
(fn [_]
{:db (assoc-in db [:intro-wizard :step] (decrement-step step))})))))
(fx/defn intro-step-back (fx/defn intro-step-back
{:events [:intro-wizard/navigate-back]} {:events [:intro-wizard/navigate-back]}
@ -131,14 +140,10 @@
(fx/defn exit-wizard (fx/defn exit-wizard
[{:keys [db] :as cofx}] [{:keys [db] :as cofx}]
(let [recovered-account? (get-in db [:intro-wizard :recovering?])]
(log/info "exit-wizard" "recovered-account?" recovered-account?)
(fx/merge (fx/merge
cofx cofx
{:db (-> db {:db (dissoc db :intro-wizard)}
(dissoc :intro-wizard) (navigation/navigate-to-cofx :notifications-onboarding nil)))
(assoc :recovered-account? recovered-account?))}
(navigation/navigate-to-cofx :notifications-onboarding nil))))
(fx/defn init-key-generation (fx/defn init-key-generation
[{:keys [db] :as cofx}] [{:keys [db] :as cofx}]

View File

@ -31,8 +31,11 @@
(fx/defn enter-seed-pressed (fx/defn enter-seed-pressed
"User is logged out and probably wants to move multiaccount to Keycard. Navigate to enter seed phrase screen" "User is logged out and probably wants to move multiaccount to Keycard. Navigate to enter seed phrase screen"
{:events [::enter-seed-pressed]} {:events [::enter-seed-pressed]}
[cofx] [{:keys [db] :as cofx}]
(navigation/navigate-to-cofx cofx :key-storage-stack {:screen :seed-phrase})) (fx/merge
cofx
{:db (assoc db :recovered-account? true)}
(navigation/navigate-to-cofx :key-storage-stack {:screen :seed-phrase})))
(fx/defn seed-phrase-input-changed (fx/defn seed-phrase-input-changed
{:events [::seed-phrase-input-changed]} {:events [::seed-phrase-input-changed]}

View File

@ -149,7 +149,8 @@
:weak-password? true :weak-password? true
:encrypt-with-password? true :encrypt-with-password? true
:back-action :intro-wizard/navigate-back :back-action :intro-wizard/navigate-back
:forward-action :multiaccounts.recover/enter-phrase-next-pressed}) :forward-action :multiaccounts.recover/enter-phrase-next-pressed}
:recovered-account? true)
(update :keycard dissoc :flow))} (update :keycard dissoc :flow))}
(bottom-sheet/hide-bottom-sheet) (bottom-sheet/hide-bottom-sheet)
(navigation/navigate-to-cofx :recover-multiaccount-enter-phrase nil))) (navigation/navigate-to-cofx :recover-multiaccount-enter-phrase nil)))