[#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]}
[{:keys [db] :as 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}
(bottom-sheet/hide-bottom-sheet)
(navigation/navigate-to-cofx :keycard-recovery-intro nil)))
@ -272,7 +275,7 @@
{:db (update-in db [:keycard :multiaccount]
(fn [multiacc]
(assoc multiacc
:recovered true
:recovered (get db :recovered-account?)
:name whisper-name
:identicon identicon)))}
(create-keycard-multiaccount)))

View File

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

View File

@ -31,8 +31,11 @@
(fx/defn enter-seed-pressed
"User is logged out and probably wants to move multiaccount to Keycard. Navigate to enter seed phrase screen"
{:events [::enter-seed-pressed]}
[cofx]
(navigation/navigate-to-cofx cofx :key-storage-stack {:screen :seed-phrase}))
[{:keys [db] :as cofx}]
(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
{:events [::seed-phrase-input-changed]}

View File

@ -149,7 +149,8 @@
:weak-password? true
:encrypt-with-password? true
: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))}
(bottom-sheet/hide-bottom-sheet)
(navigation/navigate-to-cofx :recover-multiaccount-enter-phrase nil)))