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)
|
||||
:on-press #(react/get-from-clipboard
|
||||
(fn [clipboard]
|
||||
(re-frame/dispatch [:choose-recipient clipboard])))}
|
||||
(re-frame/dispatch [:choose-recipient clipboard nil])))}
|
||||
[react/view {:style styles/recipient-button}
|
||||
[react/text {:style styles/recipient-button-text}
|
||||
(i18n/label :t/wallet-address-from-clipboard)]
|
||||
|
@ -93,6 +93,6 @@
|
|||
(let [data (-> code
|
||||
.-data
|
||||
(string/replace #"ethereum:" ""))]
|
||||
(re-frame/dispatch [:choose-recipient data])))}]
|
||||
(re-frame/dispatch [:choose-recipient data nil])))}]
|
||||
[viewfinder camera-dimensions]]
|
||||
[recipient-buttons]]))
|
||||
|
|
|
@ -37,17 +37,20 @@
|
|||
|
||||
;;;; 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
|
||||
(fn [db [_ recipient]]
|
||||
(assoc-in db [:wallet :send :recipient] recipient)))
|
||||
(fn [{:keys [db]} [_ address name]]
|
||||
(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
|
||||
:wallet-open-send-transaction
|
||||
(fn [{db :db} [_ address name]]
|
||||
{:db (update db :wallet/send-transaction
|
||||
#(assoc % :to-address address
|
||||
:to-name name))
|
||||
{:db (choose-address-and-name db address name)
|
||||
:dispatch-n [[:navigate-back]
|
||||
[:navigate-back]]}))
|
||||
|
||||
|
|
Loading…
Reference in New Issue