parent
3794742c8f
commit
cdb39452d7
|
@ -9,6 +9,10 @@
|
||||||
;; https://github.com/status-im/status-desktop/blob/2ba96803168461088346bf5030df750cb226df4c/ui/imports/utils/Constants.qml#L468
|
;; https://github.com/status-im/status-desktop/blob/2ba96803168461088346bf5030df750cb226df4c/ui/imports/utils/Constants.qml#L468
|
||||||
(def min-length 5)
|
(def min-length 5)
|
||||||
|
|
||||||
|
;; Combine ASCII and Emoji into one regex
|
||||||
|
(def bio-chars-regex
|
||||||
|
#"^[\u00a9\u00ae\u2000-\u3300\ud83c\ud000-\udfff\ud83d\ud000-\udfff\ud83e\ud000-\udfff\u0000-\u007F]+$")
|
||||||
|
|
||||||
(def common-names ["Ethereum" "Bitcoin"])
|
(def common-names ["Ethereum" "Bitcoin"])
|
||||||
|
|
||||||
(defn has-common-names? [s] (pos? (count (filter #(string/includes? s %) common-names))))
|
(defn has-common-names? [s] (pos? (count (filter #(string/includes? s %) common-names))))
|
||||||
|
@ -19,6 +23,10 @@
|
||||||
|
|
||||||
(defn bio-too-long? [s] (> (count (string/trim (str s))) constants/profile-bio-max-length))
|
(defn bio-too-long? [s] (> (count (string/trim (str s))) constants/profile-bio-max-length))
|
||||||
|
|
||||||
|
(defn bio-invalid-characters?
|
||||||
|
[s]
|
||||||
|
(not (re-find bio-chars-regex s)))
|
||||||
|
|
||||||
(defn validation-name
|
(defn validation-name
|
||||||
[s]
|
[s]
|
||||||
(cond
|
(cond
|
||||||
|
@ -40,12 +48,9 @@
|
||||||
(defn validation-bio
|
(defn validation-bio
|
||||||
[s]
|
[s]
|
||||||
(cond
|
(cond
|
||||||
(string/blank? s) nil
|
(string/blank? s) nil
|
||||||
(validators/has-emojis? s) (i18n/label :t/are-not-allowed
|
(bio-invalid-characters? s) (i18n/label :t/invalid-characters-bio)
|
||||||
{:check (i18n/label :t/emojis)})
|
(bio-too-long? s) (i18n/label :t/bio-is-too-long)))
|
||||||
(validators/has-special-characters? s) (i18n/label :t/are-not-allowed
|
|
||||||
{:check (i18n/label :t/special-characters)})
|
|
||||||
(bio-too-long? s) (i18n/label :t/bio-is-too-long)))
|
|
||||||
|
|
||||||
(defn validation-nickname
|
(defn validation-nickname
|
||||||
[s]
|
[s]
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
(ns status-im.contexts.profile.edit.bio.events
|
(ns status-im.contexts.profile.edit.bio.events
|
||||||
(:require [clojure.string :as string]
|
(:require [clojure.string :as string]
|
||||||
|
[taoensso.timbre :as log]
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
|
@ -27,6 +28,7 @@
|
||||||
:params [new-bio]
|
:params [new-bio]
|
||||||
:on-success [:profile/edit-profile-bio-success
|
:on-success [:profile/edit-profile-bio-success
|
||||||
{:bio new-bio
|
{:bio new-bio
|
||||||
:added? (string/blank? bio)}]}]]]}))
|
:added? (string/blank? bio)}]
|
||||||
|
:on-error #(log/error "failed to set bio " %)}]]]}))
|
||||||
|
|
||||||
(rf/reg-event-fx :profile/edit-bio edit-profile-bio)
|
(rf/reg-event-fx :profile/edit-bio edit-profile-bio)
|
||||||
|
|
|
@ -12,12 +12,15 @@
|
||||||
|
|
||||||
(rf/reg-event-fx :profile/edit-profile-picture-success
|
(rf/reg-event-fx :profile/edit-profile-picture-success
|
||||||
(fn [_ [images]]
|
(fn [_ [images]]
|
||||||
{:fx [[:dispatch [:profile/update-local-picture (reverse images)]]
|
(let [has-picture? (rf/sub [:profile/has-picture])]
|
||||||
[:dispatch
|
{:fx [[:dispatch [:profile/update-local-picture (reverse images)]]
|
||||||
[:toasts/upsert
|
[:dispatch
|
||||||
{:type :positive
|
[:toasts/upsert
|
||||||
:theme :dark
|
{:type :positive
|
||||||
:text (i18n/label :t/profile-picture-added)}]]]}))
|
:theme :dark
|
||||||
|
:text (i18n/label (if has-picture?
|
||||||
|
:t/profile-picture-updated
|
||||||
|
:t/profile-picture-added))}]]]})))
|
||||||
|
|
||||||
(defn edit-profile-picture
|
(defn edit-profile-picture
|
||||||
[{:keys [db]} [picture crop-width crop-height]]
|
[{:keys [db]} [picture crop-width crop-height]]
|
||||||
|
|
|
@ -15,11 +15,10 @@
|
||||||
:margin-bottom 12})
|
:margin-bottom 12})
|
||||||
|
|
||||||
(def camera-button
|
(def camera-button
|
||||||
{:position :absolute
|
{:position :absolute
|
||||||
:border-radius 16
|
:overflow :hidden
|
||||||
:overflow :hidden
|
:right 0
|
||||||
:right 0
|
:bottom 0})
|
||||||
:bottom 0})
|
|
||||||
|
|
||||||
(def item-container
|
(def item-container
|
||||||
{:padding-top 14})
|
{:padding-top 14})
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
|
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
|
||||||
"owner": "status-im",
|
"owner": "status-im",
|
||||||
"repo": "status-go",
|
"repo": "status-go",
|
||||||
"version": "v0.179.7",
|
"version": "v0.179.8",
|
||||||
"commit-sha1": "cdac86f73ac3bf7f4f4cf09b5bc27fb1602c1820",
|
"commit-sha1": "70a9996d824e1b5b12560e5b3504c340e416f4dc",
|
||||||
"src-sha256": "0svj36zq1v7p1d6dwa29s8m82gfy4ffdcajqcn2wyxxr7i1nwnwa"
|
"src-sha256": "1gzzgc5frp5hf7sbzxsakgl648c4h5jn61g0c17fgca46vdk3l9c"
|
||||||
}
|
}
|
||||||
|
|
|
@ -754,6 +754,7 @@
|
||||||
"invalid-range": "Invalid format, must be between {{min}} and {{max}}",
|
"invalid-range": "Invalid format, must be between {{min}} and {{max}}",
|
||||||
"invalid-username-or-key": "Invalid username or chat key",
|
"invalid-username-or-key": "Invalid username or chat key",
|
||||||
"invalid-ens-or-key": "Invalid ENS or Chat key",
|
"invalid-ens-or-key": "Invalid ENS or Chat key",
|
||||||
|
"invalid-characters-bio": "Invalid characters. Standard keyboard characters and emojis only.",
|
||||||
"join-me": "Hey join me on Status: {{url}}",
|
"join-me": "Hey join me on Status: {{url}}",
|
||||||
"join-a-community": "or join a community",
|
"join-a-community": "or join a community",
|
||||||
"join-open-community": "Join Community",
|
"join-open-community": "Join Community",
|
||||||
|
|
Loading…
Reference in New Issue