[#11263] Entering "0x" in the Recipient throws an error
[#11262] Wallet "Done" and "Add to favorites" only appears when the input box is focused Signed-off-by: andrey <motor4ik@gmail.com>
This commit is contained in:
parent
2e7c377343
commit
b198084b78
|
@ -89,7 +89,6 @@
|
||||||
:subtitle second-name
|
:subtitle second-name
|
||||||
:on-press #(do
|
:on-press #(do
|
||||||
(some-> ^js @scroll-view-ref (.scrollTo #js {:x 0 :animated true}))
|
(some-> ^js @scroll-view-ref (.scrollTo #js {:x 0 :animated true}))
|
||||||
(re-frame/dispatch [:wallet.recipient/focus-input])
|
|
||||||
(re-frame/dispatch [:wallet.recipient/address-changed name]))
|
(re-frame/dispatch [:wallet.recipient/address-changed name]))
|
||||||
:icon [chat-icon/contact-icon-contacts-tab
|
:icon [chat-icon/contact-icon-contacts-tab
|
||||||
(multiaccounts/displayed-photo contact)]}]))
|
(multiaccounts/displayed-photo contact)]}]))
|
||||||
|
@ -119,9 +118,7 @@
|
||||||
[quo/list-item
|
[quo/list-item
|
||||||
{:title [quo/text {:monospace true}
|
{:title [quo/text {:monospace true}
|
||||||
(utils/get-shortened-checksum-address address)]
|
(utils/get-shortened-checksum-address address)]
|
||||||
:on-press #(do
|
:on-press #(re-frame/dispatch [:wallet.recipient/address-changed address])
|
||||||
(re-frame/dispatch [:wallet.recipient/focus-input])
|
|
||||||
(re-frame/dispatch [:wallet.recipient/address-changed address]))
|
|
||||||
:size :small
|
:size :small
|
||||||
:accessory [react/text {:style {:flex-shrink 1
|
:accessory [react/text {:style {:flex-shrink 1
|
||||||
:color colors/gray}}
|
:color colors/gray}}
|
||||||
|
@ -248,9 +245,8 @@
|
||||||
(i18n/label :t/add)]}]]]))
|
(i18n/label :t/add)]}]]]))
|
||||||
|
|
||||||
(views/defview recipient []
|
(views/defview recipient []
|
||||||
(views/letsubs [{:keys [address resolved-address searching] :as recip} [:wallet/recipient]
|
(views/letsubs [{:keys [address resolved-address searching]} [:wallet/recipient]
|
||||||
search-filter [:search/recipient-filter]
|
search-filter [:search/recipient-filter]]
|
||||||
input-focused? (reagent/atom false)]
|
|
||||||
(let [disabled? (or searching (not resolved-address))]
|
(let [disabled? (or searching (not resolved-address))]
|
||||||
[kb-presentation/keyboard-avoiding-view {:style {:flex 1}}
|
[kb-presentation/keyboard-avoiding-view {:style {:flex 1}}
|
||||||
[react/view {:flex 1}
|
[react/view {:flex 1}
|
||||||
|
@ -270,10 +266,6 @@
|
||||||
(i18n/label :t/paste)]]
|
(i18n/label :t/paste)]]
|
||||||
[quo/text-input
|
[quo/text-input
|
||||||
{:multiline true
|
{:multiline true
|
||||||
:get-ref #(when (and recip %)
|
|
||||||
(re-frame/dispatch [:set-in [:wallet/recipient :inp-ref] %]))
|
|
||||||
:on-focus #(reset! input-focused? true)
|
|
||||||
:on-blur #(reset! input-focused? false)
|
|
||||||
:default-value address
|
:default-value address
|
||||||
:height 70
|
:height 70
|
||||||
:placeholder (i18n/label :t/recipient-code-placeholder)
|
:placeholder (i18n/label :t/recipient-code-placeholder)
|
||||||
|
@ -297,7 +289,6 @@
|
||||||
:color :inherit}
|
:color :inherit}
|
||||||
(utils/get-shortened-address resolved-address)]]))]
|
(utils/get-shortened-address resolved-address)]]))]
|
||||||
[accordion search-filter]]]
|
[accordion search-filter]]]
|
||||||
(when @input-focused?
|
|
||||||
[toolbar/toolbar
|
[toolbar/toolbar
|
||||||
{:show-border? true
|
{:show-border? true
|
||||||
:left
|
:left
|
||||||
|
@ -314,4 +305,4 @@
|
||||||
:after :main-icons/next
|
:after :main-icons/next
|
||||||
:disabled disabled?
|
:disabled disabled?
|
||||||
:on-press #(re-frame/dispatch [:wallet.send/set-recipient resolved-address])}
|
:on-press #(re-frame/dispatch [:wallet.send/set-recipient resolved-address])}
|
||||||
(i18n/label :t/done)]}])]])))
|
(i18n/label :t/done)]}]]])))
|
|
@ -81,9 +81,7 @@
|
||||||
(if address
|
(if address
|
||||||
(if (:wallet/recipient db)
|
(if (:wallet/recipient db)
|
||||||
{:db (update db :wallet/recipient assoc :resolved-address address
|
{:db (update db :wallet/recipient assoc :resolved-address address
|
||||||
:address address)
|
:address address)}
|
||||||
;;android
|
|
||||||
:dispatch-later [{:ms 1000 :dispatch [:wallet.recipient/focus-input]}]}
|
|
||||||
(if (:wallet/prepare-transaction db)
|
(if (:wallet/prepare-transaction db)
|
||||||
{:db (update db :wallet/prepare-transaction assoc
|
{:db (update db :wallet/prepare-transaction assoc
|
||||||
:to address :to-name (find-address-name db address))}
|
:to address :to-name (find-address-name db address))}
|
||||||
|
|
|
@ -23,35 +23,14 @@
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
:wallet.recipient/address-paste
|
:wallet.recipient/address-paste
|
||||||
(fn [inp-ref]
|
(fn []
|
||||||
(react/get-from-clipboard
|
(react/get-from-clipboard
|
||||||
#(do
|
#(re-frame/dispatch [:wallet.recipient/address-changed (string/trim %)]))))
|
||||||
(when inp-ref (.focus inp-ref))
|
|
||||||
(re-frame/dispatch [:wallet.recipient/address-changed (string/trim %)])))))
|
|
||||||
|
|
||||||
(re-frame/reg-fx
|
|
||||||
:wallet.recipient/address-paste
|
|
||||||
(fn [inp-ref]
|
|
||||||
(react/get-from-clipboard
|
|
||||||
#(do
|
|
||||||
(when inp-ref (.focus inp-ref))
|
|
||||||
(re-frame/dispatch [:wallet.recipient/address-changed (string/trim %)])))))
|
|
||||||
|
|
||||||
(re-frame/reg-fx
|
|
||||||
::focus-input
|
|
||||||
(fn [inp-ref]
|
|
||||||
(when inp-ref
|
|
||||||
(.focus inp-ref))))
|
|
||||||
|
|
||||||
(fx/defn focus-input
|
|
||||||
{:events [:wallet.recipient/focus-input]}
|
|
||||||
[{:keys [db]}]
|
|
||||||
{::focus-input (get-in db [:wallet/recipient :inp-ref])})
|
|
||||||
|
|
||||||
(fx/defn address-paste-pressed
|
(fx/defn address-paste-pressed
|
||||||
{:events [:wallet.recipient/address-paste-pressed]}
|
{:events [:wallet.recipient/address-paste-pressed]}
|
||||||
[{:keys [db]}]
|
[_]
|
||||||
{:wallet.recipient/address-paste (get-in db [:wallet/recipient :inp-ref])})
|
{:wallet.recipient/address-paste nil})
|
||||||
|
|
||||||
(fx/defn set-recipient
|
(fx/defn set-recipient
|
||||||
{:events [::recipient-address-resolved]}
|
{:events [::recipient-address-resolved]}
|
||||||
|
@ -77,7 +56,8 @@
|
||||||
:number-of-retries 3}))
|
:number-of-retries 3}))
|
||||||
{:ui/show-error (i18n/label :t/wallet-invalid-address-checksum {:data recipient})
|
{:ui/show-error (i18n/label :t/wallet-invalid-address-checksum {:data recipient})
|
||||||
:db (assoc-in db [:wallet/recipient :searching] false)}))
|
:db (assoc-in db [:wallet/recipient :searching] false)}))
|
||||||
(and (not (string/blank? recipient)) (ens/valid-eth-name-prefix? recipient))
|
(and (not (string/blank? recipient)) (not (string/starts-with? recipient "0x"))
|
||||||
|
(ens/valid-eth-name-prefix? recipient))
|
||||||
(let [ens-name (if (= (.indexOf ^js recipient ".") -1)
|
(let [ens-name (if (= (.indexOf ^js recipient ".") -1)
|
||||||
(stateofus/subdomain recipient)
|
(stateofus/subdomain recipient)
|
||||||
recipient)]
|
recipient)]
|
||||||
|
@ -112,8 +92,6 @@
|
||||||
:name (or name "")}]
|
:name (or name "")}]
|
||||||
(fx/merge cofx
|
(fx/merge cofx
|
||||||
{:db (assoc-in db [:wallet/favourites address] new-favourite)
|
{:db (assoc-in db [:wallet/favourites address] new-favourite)
|
||||||
;;android
|
|
||||||
:dispatch-later [{:ms 1000 :dispatch [:wallet.recipient/focus-input]}]
|
|
||||||
::json-rpc/call [{:method "wallet_addFavourite"
|
::json-rpc/call [{:method "wallet_addFavourite"
|
||||||
:params [new-favourite]
|
:params [new-favourite]
|
||||||
:on-success #()}]}
|
:on-success #()}]}
|
||||||
|
|
Loading…
Reference in New Issue