parent
5907c60d5c
commit
6af3a67e9b
|
@ -5,7 +5,6 @@
|
||||||
[status-im.components.react :refer [view]]
|
[status-im.components.react :refer [view]]
|
||||||
[status-im.chat.views.message-input :refer [plain-message-input-view]]
|
[status-im.chat.views.message-input :refer [plain-message-input-view]]
|
||||||
[status-im.chat.views.staged-command :refer [simple-command-staged-view]]
|
[status-im.chat.views.staged-command :refer [simple-command-staged-view]]
|
||||||
[status-im.utils.phone-number :refer [valid-mobile-number?]]
|
|
||||||
[status-im.utils.platform :refer [platform-specific]]
|
[status-im.utils.platform :refer [platform-specific]]
|
||||||
[status-im.chat.styles.message :as st]))
|
[status-im.chat.styles.message :as st]))
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
(ns status-im.profile.validations
|
(ns status-im.profile.validations
|
||||||
(:require [cljs.spec :as s]
|
(:require [cljs.spec :as s]
|
||||||
[status-im.utils.phone-number :refer [valid-mobile-number?]]
|
|
||||||
[status-im.constants :refer [console-chat-id wallet-chat-id]]
|
[status-im.constants :refer [console-chat-id wallet-chat-id]]
|
||||||
[clojure.string :as str]))
|
[clojure.string :as str]))
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
(defn valid-mobile-number? [number]
|
(defn valid-mobile-number? [number]
|
||||||
(when (string? number)
|
(when (string? number)
|
||||||
(let [number-obj (awesome-phonenumber. number country-code "international")]
|
(let [pattern #"^\s*(?:\+?(\d{1,3}))?[-. (]*(\d{3})[-. )]*(\d{3})[-. ]*(\d{2})[-. ]*(\d{2})\s*$"
|
||||||
(and (.isValid number-obj)
|
number-obj (awesome-phonenumber. number country-code "international")]
|
||||||
|
(and (re-matches pattern number)
|
||||||
|
(.isValid number-obj)
|
||||||
(.isMobile number-obj)))))
|
(.isMobile number-obj)))))
|
||||||
|
|
Loading…
Reference in New Issue