Fix empty contact code string errors
Signed-off-by: Vitaliy Vlasov <siphiuel@gmail.com>
This commit is contained in:
parent
081b90ff4e
commit
dfeec0f39f
|
@ -127,6 +127,13 @@
|
||||||
[x y]
|
[x y]
|
||||||
(str "0x04" x y))
|
(str "0x04" x y))
|
||||||
|
|
||||||
|
(defn valid-eth-name-prefix?
|
||||||
|
[prefix]
|
||||||
|
(not
|
||||||
|
(or (string/blank? prefix)
|
||||||
|
(string/ends-with? prefix ".")
|
||||||
|
(string/includes? prefix ".."))))
|
||||||
|
|
||||||
(defn is-valid-eth-name?
|
(defn is-valid-eth-name?
|
||||||
[ens-name]
|
[ens-name]
|
||||||
(and ens-name
|
(and ens-name
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
(merge {:db (assoc db
|
(merge {:db (assoc db
|
||||||
:contacts/new-identity new-identity
|
:contacts/new-identity new-identity
|
||||||
:contacts/new-identity-error (db/validate-pub-key db new-identity))}
|
:contacts/new-identity-error (db/validate-pub-key db new-identity))}
|
||||||
(when-not is-public-key?
|
(when (and (not is-public-key?)
|
||||||
|
(ens/valid-eth-name-prefix? new-identity))
|
||||||
(let [chain (ethereum/chain-keyword db)]
|
(let [chain (ethereum/chain-keyword db)]
|
||||||
{:resolve-public-key {:registry (get ens/ens-registries chain)
|
{:resolve-public-key {:registry (get ens/ens-registries chain)
|
||||||
:ens-name (if (ens/is-valid-eth-name? new-identity)
|
:ens-name (if (ens/is-valid-eth-name? new-identity)
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
(views/defview new-chat []
|
(views/defview new-chat []
|
||||||
(views/letsubs [contacts [:contacts/active]
|
(views/letsubs [contacts [:contacts/active]
|
||||||
|
new-identity [:contacts/new-identity]
|
||||||
error-message [:new-identity-error]]
|
error-message [:new-identity-error]]
|
||||||
[react/keyboard-avoiding-view {:style {:flex 1}}
|
[react/keyboard-avoiding-view {:style {:flex 1}}
|
||||||
[status-bar/status-bar]
|
[status-bar/status-bar]
|
||||||
|
@ -32,7 +33,7 @@
|
||||||
[react/view add-new.styles/new-chat-input-container
|
[react/view add-new.styles/new-chat-input-container
|
||||||
[react/text-input {:ref (fn [v] (js/setTimeout #(reset! tw (if v "100%" "95%")) 100))
|
[react/text-input {:ref (fn [v] (js/setTimeout #(reset! tw (if v "100%" "95%")) 100))
|
||||||
:on-change-text #(re-frame/dispatch [:new-chat/set-new-identity %])
|
:on-change-text #(re-frame/dispatch [:new-chat/set-new-identity %])
|
||||||
:on-submit-editing #(when-not error-message
|
:on-submit-editing #(when (and new-identity (not error-message))
|
||||||
(re-frame/dispatch [:contact.ui/contact-code-submitted]))
|
(re-frame/dispatch [:contact.ui/contact-code-submitted]))
|
||||||
:placeholder (i18n/label :t/enter-contact-code)
|
:placeholder (i18n/label :t/enter-contact-code)
|
||||||
:style (add-new.styles/input @tw)
|
:style (add-new.styles/input @tw)
|
||||||
|
|
Loading…
Reference in New Issue