Update navigation for QR scan
Factor copy/paste to use choose-recipient Change assoc to an update Set name to nil
This commit is contained in:
parent
db7614f8f7
commit
3578eed912
|
@ -45,7 +45,7 @@
|
||||||
[react/touchable-highlight {:style (styles/recipient-touchable true)
|
[react/touchable-highlight {:style (styles/recipient-touchable true)
|
||||||
:on-press #(react/get-from-clipboard
|
:on-press #(react/get-from-clipboard
|
||||||
(fn [clipboard]
|
(fn [clipboard]
|
||||||
(re-frame/dispatch [:choose-recipient clipboard])))}
|
(re-frame/dispatch [:choose-recipient clipboard nil])))}
|
||||||
[react/view {:style styles/recipient-button}
|
[react/view {:style styles/recipient-button}
|
||||||
[react/text {:style styles/recipient-button-text}
|
[react/text {:style styles/recipient-button-text}
|
||||||
(i18n/label :t/wallet-address-from-clipboard)]
|
(i18n/label :t/wallet-address-from-clipboard)]
|
||||||
|
@ -93,6 +93,6 @@
|
||||||
(let [data (-> code
|
(let [data (-> code
|
||||||
.-data
|
.-data
|
||||||
(string/replace #"ethereum:" ""))]
|
(string/replace #"ethereum:" ""))]
|
||||||
(re-frame/dispatch [:choose-recipient data])))}]
|
(re-frame/dispatch [:choose-recipient data nil])))}]
|
||||||
[viewfinder camera-dimensions]]
|
[viewfinder camera-dimensions]]
|
||||||
[recipient-buttons]]))
|
[recipient-buttons]]))
|
||||||
|
|
|
@ -37,17 +37,20 @@
|
||||||
|
|
||||||
;;;; Handlers
|
;;;; Handlers
|
||||||
|
|
||||||
(handlers/register-handler-db
|
(defn choose-address-and-name [db address name]
|
||||||
|
(update db :wallet/send-transaction assoc :to-address address :to-name name))
|
||||||
|
|
||||||
|
(handlers/register-handler-fx
|
||||||
:choose-recipient
|
:choose-recipient
|
||||||
(fn [db [_ recipient]]
|
(fn [{:keys [db]} [_ address name]]
|
||||||
(assoc-in db [:wallet :send :recipient] recipient)))
|
(let [{:keys [view-id]} db]
|
||||||
|
(cond-> {:db (choose-address-and-name db address name)}
|
||||||
|
(= :choose-recipient view-id) (assoc :dispatch [:navigate-back])))))
|
||||||
|
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
:wallet-open-send-transaction
|
:wallet-open-send-transaction
|
||||||
(fn [{db :db} [_ address name]]
|
(fn [{db :db} [_ address name]]
|
||||||
{:db (update db :wallet/send-transaction
|
{:db (choose-address-and-name db address name)
|
||||||
#(assoc % :to-address address
|
|
||||||
:to-name name))
|
|
||||||
:dispatch-n [[:navigate-back]
|
:dispatch-n [[:navigate-back]
|
||||||
[:navigate-back]]}))
|
[:navigate-back]]}))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue