From 2cc689a896379f3e1c2f168a0cf7c06f97c8df7b Mon Sep 17 00:00:00 2001 From: Mohsen Date: Fri, 5 Jul 2024 14:33:38 +0330 Subject: [PATCH] [#20638] fix: Scan missing keypair keep scanning after success attempt (#20640) --- src/status_im/common/scan_qr_code/view.cljs | 6 ++---- src/status_im/contexts/settings/wallet/events.cljs | 8 +++----- .../missing_keypairs/scan_qr/view.cljs | 4 +--- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/status_im/common/scan_qr_code/view.cljs b/src/status_im/common/scan_qr_code/view.cljs index 8b2eb7e7b4..8993454abf 100644 --- a/src/status_im/common/scan_qr_code/view.cljs +++ b/src/status_im/common/scan_qr_code/view.cljs @@ -195,7 +195,7 @@ true) (defn view - [{:keys [title subtitle validate-fn on-success-scan error-message share-button? import-keypair?]}] + [{:keys [title subtitle validate-fn on-success-scan error-message share-button?]}] (let [insets (safe-area/get-insets) qr-code-succeed? (reagent/atom false) qr-view-finder (reagent/atom {}) @@ -233,9 +233,7 @@ :set-qr-code-succeeded (fn [value] (when on-success-scan (on-success-scan value)) - (if import-keypair? - (set-rescan-timeout) - (rf/dispatch [:navigate-back]))) + (rf/dispatch [:navigate-back])) :set-rescan-timeout set-rescan-timeout}]) [rn/view {:style (style/root-container (:top insets))} [header diff --git a/src/status_im/contexts/settings/wallet/events.cljs b/src/status_im/contexts/settings/wallet/events.cljs index 2485fd4a08..4bd0908b2b 100644 --- a/src/status_im/contexts/settings/wallet/events.cljs +++ b/src/status_im/contexts/settings/wallet/events.cljs @@ -92,7 +92,7 @@ (rf/reg-event-fx :wallet/make-keypairs-accounts-fully-operable make-keypairs-accounts-fully-operable) (defn connection-string-for-import-keypair - [{:keys [db]} [{:keys [sha3-pwd keypairs-key-uids connection-string on-success]}]] + [{:keys [db]} [{:keys [sha3-pwd keypairs-key-uids connection-string]}]] (let [key-uid (get-in db [:profile/profile :key-uid])] {:fx [[:effects.syncing/import-keypairs-keystores {:key-uid key-uid @@ -100,7 +100,6 @@ :keypairs-key-uids keypairs-key-uids :connection-string connection-string :on-success (fn [key-uids] - (rf/call-continuation on-success) (rf/dispatch [:wallet/make-keypairs-accounts-fully-operable key-uids])) :on-fail (fn [error] (log/error "failed to import missing key pairs with connection string" @@ -113,7 +112,7 @@ (rf/reg-event-fx :wallet/connection-string-for-import-keypair connection-string-for-import-keypair) (defn success-keypair-qr-scan - [_ [connection-string keypairs-key-uids on-import-success]] + [_ [connection-string keypairs-key-uids]] {:fx [[:dispatch [:standard-auth/authorize-with-password {:blur? true @@ -125,8 +124,7 @@ [:wallet/connection-string-for-import-keypair {:connection-string connection-string :keypairs-key-uids keypairs-key-uids - :sha3-pwd password - :on-success on-import-success}]))}]]]}) + :sha3-pwd password}]))}]]]}) (rf/reg-event-fx :wallet/success-keypair-qr-scan success-keypair-qr-scan) diff --git a/src/status_im/contexts/settings/wallet/keypairs_and_accounts/missing_keypairs/scan_qr/view.cljs b/src/status_im/contexts/settings/wallet/keypairs_and_accounts/missing_keypairs/scan_qr/view.cljs index df20708f05..1567d83de3 100644 --- a/src/status_im/contexts/settings/wallet/keypairs_and_accounts/missing_keypairs/scan_qr/view.cljs +++ b/src/status_im/contexts/settings/wallet/keypairs_and_accounts/missing_keypairs/scan_qr/view.cljs @@ -13,14 +13,12 @@ on-success-scan (rn/use-callback (fn [scanned-text] (rf/dispatch [:wallet/success-keypair-qr-scan scanned-text - keypairs-key-uids - [:navigate-back]]) + keypairs-key-uids]) [keypairs-key-uids]))] [scan-qr-code/view {:title (i18n/label :t/scan-key-pairs-qr-code) :subtitle (i18n/label :t/find-it-in-setting) :share-button? false - :import-keypair? true :validate-fn sync-utils/valid-connection-string? :error-message (i18n/label :t/invalid-key-pair-qr) :on-success-scan on-success-scan}]))