This commit is contained in:
parent
b4866ff728
commit
2cc689a896
|
@ -195,7 +195,7 @@
|
||||||
true)
|
true)
|
||||||
|
|
||||||
(defn view
|
(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)
|
(let [insets (safe-area/get-insets)
|
||||||
qr-code-succeed? (reagent/atom false)
|
qr-code-succeed? (reagent/atom false)
|
||||||
qr-view-finder (reagent/atom {})
|
qr-view-finder (reagent/atom {})
|
||||||
|
@ -233,9 +233,7 @@
|
||||||
:set-qr-code-succeeded (fn [value]
|
:set-qr-code-succeeded (fn [value]
|
||||||
(when on-success-scan
|
(when on-success-scan
|
||||||
(on-success-scan value))
|
(on-success-scan value))
|
||||||
(if import-keypair?
|
(rf/dispatch [:navigate-back]))
|
||||||
(set-rescan-timeout)
|
|
||||||
(rf/dispatch [:navigate-back])))
|
|
||||||
:set-rescan-timeout set-rescan-timeout}])
|
:set-rescan-timeout set-rescan-timeout}])
|
||||||
[rn/view {:style (style/root-container (:top insets))}
|
[rn/view {:style (style/root-container (:top insets))}
|
||||||
[header
|
[header
|
||||||
|
|
|
@ -92,7 +92,7 @@
|
||||||
(rf/reg-event-fx :wallet/make-keypairs-accounts-fully-operable make-keypairs-accounts-fully-operable)
|
(rf/reg-event-fx :wallet/make-keypairs-accounts-fully-operable make-keypairs-accounts-fully-operable)
|
||||||
|
|
||||||
(defn connection-string-for-import-keypair
|
(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])]
|
(let [key-uid (get-in db [:profile/profile :key-uid])]
|
||||||
{:fx [[:effects.syncing/import-keypairs-keystores
|
{:fx [[:effects.syncing/import-keypairs-keystores
|
||||||
{:key-uid key-uid
|
{:key-uid key-uid
|
||||||
|
@ -100,7 +100,6 @@
|
||||||
:keypairs-key-uids keypairs-key-uids
|
:keypairs-key-uids keypairs-key-uids
|
||||||
:connection-string connection-string
|
:connection-string connection-string
|
||||||
:on-success (fn [key-uids]
|
:on-success (fn [key-uids]
|
||||||
(rf/call-continuation on-success)
|
|
||||||
(rf/dispatch [:wallet/make-keypairs-accounts-fully-operable key-uids]))
|
(rf/dispatch [:wallet/make-keypairs-accounts-fully-operable key-uids]))
|
||||||
:on-fail (fn [error]
|
:on-fail (fn [error]
|
||||||
(log/error "failed to import missing key pairs with connection string"
|
(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)
|
(rf/reg-event-fx :wallet/connection-string-for-import-keypair connection-string-for-import-keypair)
|
||||||
|
|
||||||
(defn success-keypair-qr-scan
|
(defn success-keypair-qr-scan
|
||||||
[_ [connection-string keypairs-key-uids on-import-success]]
|
[_ [connection-string keypairs-key-uids]]
|
||||||
{:fx [[:dispatch
|
{:fx [[:dispatch
|
||||||
[:standard-auth/authorize-with-password
|
[:standard-auth/authorize-with-password
|
||||||
{:blur? true
|
{:blur? true
|
||||||
|
@ -125,8 +124,7 @@
|
||||||
[:wallet/connection-string-for-import-keypair
|
[:wallet/connection-string-for-import-keypair
|
||||||
{:connection-string connection-string
|
{:connection-string connection-string
|
||||||
:keypairs-key-uids keypairs-key-uids
|
:keypairs-key-uids keypairs-key-uids
|
||||||
:sha3-pwd password
|
:sha3-pwd password}]))}]]]})
|
||||||
:on-success on-import-success}]))}]]]})
|
|
||||||
|
|
||||||
(rf/reg-event-fx :wallet/success-keypair-qr-scan success-keypair-qr-scan)
|
(rf/reg-event-fx :wallet/success-keypair-qr-scan success-keypair-qr-scan)
|
||||||
|
|
||||||
|
|
|
@ -13,14 +13,12 @@
|
||||||
on-success-scan (rn/use-callback (fn [scanned-text]
|
on-success-scan (rn/use-callback (fn [scanned-text]
|
||||||
(rf/dispatch [:wallet/success-keypair-qr-scan
|
(rf/dispatch [:wallet/success-keypair-qr-scan
|
||||||
scanned-text
|
scanned-text
|
||||||
keypairs-key-uids
|
keypairs-key-uids])
|
||||||
[:navigate-back]])
|
|
||||||
[keypairs-key-uids]))]
|
[keypairs-key-uids]))]
|
||||||
[scan-qr-code/view
|
[scan-qr-code/view
|
||||||
{:title (i18n/label :t/scan-key-pairs-qr-code)
|
{:title (i18n/label :t/scan-key-pairs-qr-code)
|
||||||
:subtitle (i18n/label :t/find-it-in-setting)
|
:subtitle (i18n/label :t/find-it-in-setting)
|
||||||
:share-button? false
|
:share-button? false
|
||||||
:import-keypair? true
|
|
||||||
:validate-fn sync-utils/valid-connection-string?
|
:validate-fn sync-utils/valid-connection-string?
|
||||||
:error-message (i18n/label :t/invalid-key-pair-qr)
|
:error-message (i18n/label :t/invalid-key-pair-qr)
|
||||||
:on-success-scan on-success-scan}]))
|
:on-success-scan on-success-scan}]))
|
||||||
|
|
Loading…
Reference in New Issue