diff --git a/src/status_im/keycard/recovery.cljs b/src/status_im/keycard/recovery.cljs index cc54101b25..3195f5bf5e 100644 --- a/src/status_im/keycard/recovery.cljs +++ b/src/status_im/keycard/recovery.cljs @@ -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))) diff --git a/src/status_im/multiaccounts/create/core.cljs b/src/status_im/multiaccounts/create/core.cljs index f23cf18d03..d1de8a2481 100644 --- a/src/status_im/multiaccounts/create/core.cljs +++ b/src/status_im/multiaccounts/create/core.cljs @@ -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)))) + (fx/merge + cofx + {:db (dissoc db :intro-wizard)} + (navigation/navigate-to-cofx :notifications-onboarding nil))) (fx/defn init-key-generation [{:keys [db] :as cofx}] diff --git a/src/status_im/multiaccounts/key_storage/core.cljs b/src/status_im/multiaccounts/key_storage/core.cljs index b0e0cc2703..a48ce36234 100644 --- a/src/status_im/multiaccounts/key_storage/core.cljs +++ b/src/status_im/multiaccounts/key_storage/core.cljs @@ -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]} diff --git a/src/status_im/multiaccounts/recover/core.cljs b/src/status_im/multiaccounts/recover/core.cljs index 1071bd4ed5..ddefcf391f 100644 --- a/src/status_im/multiaccounts/recover/core.cljs +++ b/src/status_im/multiaccounts/recover/core.cljs @@ -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)))