From a3211a921618d3808ea59f2886fb706862470934 Mon Sep 17 00:00:00 2001 From: Dmitry Novotochinov Date: Thu, 26 Sep 2019 16:35:09 +0300 Subject: [PATCH] [#9025] fix keycard pairings persistence --- src/status_im/hardwallet/core.cljs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/status_im/hardwallet/core.cljs b/src/status_im/hardwallet/core.cljs index 143fa9a6424c..c12400101c7b 100644 --- a/src/status_im/hardwallet/core.cljs +++ b/src/status_im/hardwallet/core.cljs @@ -389,7 +389,7 @@ [{:keys [db] :as cofx} flow instance-uid] (if (= flow :import) (navigation/navigate-to-cofx cofx :keycard-recovery-no-key nil) - (let [pairing-data (get-in db [:hardwallet :pairings (keyword instance-uid)])] + (let [pairing-data (get-in db [:hardwallet :pairings instance-uid])] (if pairing-data (fx/merge cofx {:db (update-in db [:hardwallet :secrets] merge pairing-data)} @@ -1505,15 +1505,16 @@ instance-uid (get-in db [:hardwallet :application-info :instance-uid]) multiaccount (find-multiaccount-by-keycard-instance-uid db instance-uid) paired-on (utils.datetime/timestamp) - pairings (get-in db [:hardwallet :pairings]) + pairings (assoc (get-in db [:hardwallet :pairings]) instance-uid {:pairing pairing + :paired-on paired-on}) instance-uid (get-in db [:hardwallet :application-info :instance-uid]) next-step (if (= setup-step :pair) :begin :card-ready)] (fx/merge cofx - {:hardwallet/persist-pairings (assoc pairings instance-uid {:pairing pairing - :paired-on paired-on}) + {:hardwallet/persist-pairings pairings :db (-> db + (assoc-in [:hardwallet :pairings] pairings) (assoc-in [:hardwallet :application-info :paired?] true) (assoc-in [:hardwallet :on-card-connected] nil) (assoc-in [:hardwallet :setup-step] next-step)