Lint namespace aliases (#14526)
This commit is contained in:
parent
c7a371c104
commit
5693df5a74
|
@ -9,7 +9,10 @@
|
||||||
status-im.utils.styles/defn clojure.core/defn
|
status-im.utils.styles/defn clojure.core/defn
|
||||||
status-im.test-helpers/deftest-sub clojure.core/defn
|
status-im.test-helpers/deftest-sub clojure.core/defn
|
||||||
taoensso.tufte/defnp clojure.core/defn}
|
taoensso.tufte/defnp clojure.core/defn}
|
||||||
:linters {:invalid-arity {:skip-args [status-im.utils.fx/defn utils.re-frame/defn]}
|
:linters {:consistent-alias {:level :error
|
||||||
|
:aliases {clojure.string string
|
||||||
|
taoensso.timbre log}}
|
||||||
|
:invalid-arity {:skip-args [status-im.utils.fx/defn utils.re-frame/defn]}
|
||||||
;; TODO remove number when this is fixed
|
;; TODO remove number when this is fixed
|
||||||
;; https://github.com/borkdude/clj-kondo/issues/867
|
;; https://github.com/borkdude/clj-kondo/issues/867
|
||||||
:unresolved-symbol {:exclude [PersistentPriorityMap.EMPTY
|
:unresolved-symbol {:exclude [PersistentPriorityMap.EMPTY
|
||||||
|
|
|
@ -274,15 +274,6 @@ test macros `deftest` and `is`, which are ubiquitous in the Clojure community.
|
||||||
(:require [cljs-time.coerce :as time.coerce]))
|
(:require [cljs-time.coerce :as time.coerce]))
|
||||||
```
|
```
|
||||||
|
|
||||||
### Namespace aliases
|
|
||||||
|
|
||||||
Prefer the following namespace aliases:
|
|
||||||
|
|
||||||
```clojure
|
|
||||||
[clojure.string :as string]
|
|
||||||
[taoensso.timbre :as log]
|
|
||||||
```
|
|
||||||
|
|
||||||
### Javascript interop
|
### Javascript interop
|
||||||
|
|
||||||
Use [binaryage/oops](https://github.com/binaryage/cljs-oops) macros instead of
|
Use [binaryage/oops](https://github.com/binaryage/cljs-oops) macros instead of
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
(:require [react-native.core :as rn]
|
(:require [react-native.core :as rn]
|
||||||
[quo2.foundations.colors :as colors]
|
[quo2.foundations.colors :as colors]
|
||||||
[quo2.components.markdown.text :as text]
|
[quo2.components.markdown.text :as text]
|
||||||
[clojure.string :as clojure-string]))
|
[clojure.string :as string]))
|
||||||
|
|
||||||
(def circle-sizes {:small 20
|
(def circle-sizes {:small 20
|
||||||
:medium 32
|
:medium 32
|
||||||
|
@ -29,10 +29,10 @@
|
||||||
(let [circle-size (size circle-sizes)
|
(let [circle-size (size circle-sizes)
|
||||||
small? (= size :small)
|
small? (= size :small)
|
||||||
f-name-initial (-> f-name
|
f-name-initial (-> f-name
|
||||||
clojure-string/upper-case
|
string/upper-case
|
||||||
(subs 0 1))
|
(subs 0 1))
|
||||||
l-name-initial (-> l-name
|
l-name-initial (-> l-name
|
||||||
clojure-string/upper-case
|
string/upper-case
|
||||||
(subs 0 1))
|
(subs 0 1))
|
||||||
circle-color (colors/custom-color color 50 20)
|
circle-color (colors/custom-color color 50 20)
|
||||||
text-color (colors/custom-color-by-theme color 50 60)]
|
text-color (colors/custom-color-by-theme color 50 60)]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
(ns quo2.components.code.snippet
|
(ns quo2.components.code.snippet
|
||||||
(:require ["react-native" :as react-native]
|
(:require ["react-native" :as react-native]
|
||||||
[cljs-bean.core :as bean]
|
[cljs-bean.core :as bean]
|
||||||
[clojure.string :as str]
|
[clojure.string :as string]
|
||||||
[oops.core :as oops]
|
[oops.core :as oops]
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
[quo2.theme :as theme]
|
[quo2.theme :as theme]
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
:style (text-style (get-in node [:properties :className]))}]
|
:style (text-style (get-in node [:properties :className]))}]
|
||||||
(render-nodes children))
|
(render-nodes children))
|
||||||
;; Remove newlines as we already render each line separately.
|
;; Remove newlines as we already render each line separately.
|
||||||
(-> value str/trim-newline)))
|
(-> value string/trim-newline)))
|
||||||
nodes))
|
nodes))
|
||||||
|
|
||||||
(defn- code-block [{:keys [rows line-number-width]}]
|
(defn- code-block [{:keys [rows line-number-width]}]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(ns quo2.components.icons.icons
|
(ns quo2.components.icons.icons
|
||||||
(:require [clojure.java.io :as io]
|
(:require [clojure.java.io :as io]
|
||||||
[clojure.string :as cstr]))
|
[clojure.string :as string]))
|
||||||
|
|
||||||
(def icon-path "./resources/images/icons2/")
|
(def icon-path "./resources/images/icons2/")
|
||||||
|
|
||||||
|
@ -13,17 +13,17 @@
|
||||||
(fn [el]
|
(fn [el]
|
||||||
(let [s (combine-path path el)
|
(let [s (combine-path path el)
|
||||||
k (-> el
|
k (-> el
|
||||||
(cstr/replace "_" "-")
|
(string/replace "_" "-")
|
||||||
(cstr/replace " " "-")
|
(string/replace " " "-")
|
||||||
(cstr/lower-case)
|
(string/lower-case)
|
||||||
(str size))]
|
(str size))]
|
||||||
[k `(js/require ~s)])))
|
[k `(js/require ~s)])))
|
||||||
|
|
||||||
(defn get-files [path]
|
(defn get-files [path]
|
||||||
(->> (io/file path)
|
(->> (io/file path)
|
||||||
file-seq
|
file-seq
|
||||||
(filter #(cstr/ends-with? % "png"))
|
(filter #(string/ends-with? % "png"))
|
||||||
(map #(first (cstr/split (.getName %) #"@")))
|
(map #(first (string/split (.getName %) #"@")))
|
||||||
distinct))
|
distinct))
|
||||||
|
|
||||||
(defn get-icons [size]
|
(defn get-icons [size]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(ns status-im.async-storage.transit
|
(ns status-im.async-storage.transit
|
||||||
(:require [cognitect.transit :as transit]
|
(:require [cognitect.transit :as transit]
|
||||||
[taoensso.timbre :as timbre]))
|
[taoensso.timbre :as log]))
|
||||||
|
|
||||||
(def reader (transit/reader :json))
|
(def reader (transit/reader :json))
|
||||||
(def writer (transit/writer :json))
|
(def writer (transit/writer :json))
|
||||||
|
@ -8,4 +8,4 @@
|
||||||
(defn clj->transit [o] (transit/write writer o))
|
(defn clj->transit [o] (transit/write writer o))
|
||||||
(defn transit->clj [o] (try (transit/read reader o)
|
(defn transit->clj [o] (try (transit/read reader o)
|
||||||
(catch :default e
|
(catch :default e
|
||||||
(timbre/error e))))
|
(log/error e))))
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(ns status-im.contact.db
|
(ns status-im.contact.db
|
||||||
(:require [clojure.set :as clojure.set]
|
(:require [clojure.set :as clojure.set]
|
||||||
[clojure.string :as clojure.string]
|
[clojure.string :as string]
|
||||||
[status-im.ethereum.core :as ethereum]
|
[status-im.ethereum.core :as ethereum]
|
||||||
[status-im.utils.gfycat.core :as gfycat]
|
[status-im.utils.gfycat.core :as gfycat]
|
||||||
[status-im.utils.identicon :as identicon]
|
[status-im.utils.identicon :as identicon]
|
||||||
|
@ -40,8 +40,8 @@
|
||||||
(sort (fn [c1 c2]
|
(sort (fn [c1 c2]
|
||||||
(let [name1 (or (:name c1) (:address c1) (:public-key c1))
|
(let [name1 (or (:name c1) (:address c1) (:public-key c1))
|
||||||
name2 (or (:name c2) (:address c2) (:public-key c2))]
|
name2 (or (:name c2) (:address c2) (:public-key c2))]
|
||||||
(compare (clojure.string/lower-case name1)
|
(compare (string/lower-case name1)
|
||||||
(clojure.string/lower-case name2))))
|
(string/lower-case name2))))
|
||||||
(vals contacts)))
|
(vals contacts)))
|
||||||
|
|
||||||
(defn filter-dapps
|
(defn filter-dapps
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
(->> members
|
(->> members
|
||||||
(map #(or (get all-contacts %)
|
(map #(or (get all-contacts %)
|
||||||
(public-key->new-contact %)))
|
(public-key->new-contact %)))
|
||||||
(sort-by (comp clojure.string/lower-case #(or (:name %) (:alias %))))
|
(sort-by (comp string/lower-case #(or (:name %) (:alias %))))
|
||||||
(map #(if (get admins (:public-key %))
|
(map #(if (get admins (:public-key %))
|
||||||
(assoc % :admin? true)
|
(assoc % :admin? true)
|
||||||
%)))))
|
%)))))
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
(ns status-im.ethereum.macros
|
(ns status-im.ethereum.macros
|
||||||
(:require [clojure.java.io :as io]
|
(:require [clojure.java.io :as io]
|
||||||
[clojure.string :as cstr]))
|
[clojure.string :as string]))
|
||||||
|
|
||||||
(defn token-icon-path [path]
|
(defn token-icon-path [path]
|
||||||
(fn [el]
|
(fn [el]
|
||||||
(let [el (cstr/replace el ".png" "")
|
(let [el (string/replace el ".png" "")
|
||||||
s (str path el ".png")
|
s (str path el ".png")
|
||||||
s-js (str "." s)]
|
s-js (str "." s)]
|
||||||
(when (.exists (io/file s))
|
(when (.exists (io/file s))
|
||||||
|
@ -17,8 +17,8 @@
|
||||||
(let [path (str "./resources/images/tokens/" (name network) "/")
|
(let [path (str "./resources/images/tokens/" (name network) "/")
|
||||||
files (->> (io/file path)
|
files (->> (io/file path)
|
||||||
file-seq
|
file-seq
|
||||||
(filter #(cstr/ends-with? % "png"))
|
(filter #(string/ends-with? % "png"))
|
||||||
(map #(first (cstr/split (.getName %) #"@")))
|
(map #(first (string/split (.getName %) #"@")))
|
||||||
distinct)]
|
distinct)]
|
||||||
(into {} (map (token-icon-path path) files))))
|
(into {} (map (token-icon-path path) files))))
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
[status-im.utils.types :as types]
|
[status-im.utils.types :as types]
|
||||||
[taoensso.timbre :as log]
|
[taoensso.timbre :as log]
|
||||||
[status-im.keycard.common :as common]
|
[status-im.keycard.common :as common]
|
||||||
[clojure.string :as clojure.string]))
|
[clojure.string :as string]))
|
||||||
|
|
||||||
(fx/defn sign
|
(fx/defn sign
|
||||||
{:events [:keycard/sign]}
|
{:events [:keycard/sign]}
|
||||||
|
@ -50,8 +50,8 @@
|
||||||
|
|
||||||
(defn normalize-signature [signature]
|
(defn normalize-signature [signature]
|
||||||
(-> signature
|
(-> signature
|
||||||
(clojure.string/replace-first #"00$", "1b")
|
(string/replace-first #"00$", "1b")
|
||||||
(clojure.string/replace-first #"01$", "1c")
|
(string/replace-first #"01$", "1c")
|
||||||
ethereum/normalized-hex))
|
ethereum/normalized-hex))
|
||||||
|
|
||||||
(fx/defn sign-message
|
(fx/defn sign-message
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
[quo.platform :as platform]
|
[quo.platform :as platform]
|
||||||
[re-frame.core :as re-frame]
|
[re-frame.core :as re-frame]
|
||||||
[cljs-bean.core :as bean]
|
[cljs-bean.core :as bean]
|
||||||
[clojure.string :as clojure.string]
|
[clojure.string :as string]
|
||||||
[status-im.chat.models :as chat.models]
|
[status-im.chat.models :as chat.models]
|
||||||
[status-im.utils.react-native :as react-native-utils]))
|
[status-im.utils.react-native :as react-native-utils]))
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
:as notification}]
|
:as notification}]
|
||||||
(let [token (if erc20
|
(let [token (if erc20
|
||||||
(get-in db
|
(get-in db
|
||||||
[:wallet/all-tokens (clojure.string/lower-case contract)]
|
[:wallet/all-tokens (string/lower-case contract)]
|
||||||
default-erc20-token)
|
default-erc20-token)
|
||||||
(tokens/native-currency network))
|
(tokens/native-currency network))
|
||||||
amount (money/wei->ether (decode/uint value))
|
amount (money/wei->ether (decode/uint value))
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{:dev/always true}
|
{:dev/always true}
|
||||||
(:require
|
(:require
|
||||||
[cljs.test :as ct]
|
[cljs.test :as ct]
|
||||||
[clojure.string :as str]
|
[clojure.string :as string]
|
||||||
[shadow.test :as st]
|
[shadow.test :as st]
|
||||||
[shadow.test.env :as env]))
|
[shadow.test.env :as env]))
|
||||||
|
|
||||||
|
@ -32,10 +32,10 @@
|
||||||
(= "--repl" arg)
|
(= "--repl" arg)
|
||||||
(assoc opts :repl true)
|
(assoc opts :repl true)
|
||||||
|
|
||||||
(str/starts-with? arg "--test=")
|
(string/starts-with? arg "--test=")
|
||||||
(let [test-arg (subs arg 7)
|
(let [test-arg (subs arg 7)
|
||||||
test-syms
|
test-syms
|
||||||
(->> (str/split test-arg ",")
|
(->> (string/split test-arg ",")
|
||||||
(map symbol))]
|
(map symbol))]
|
||||||
(update opts :test-syms into test-syms))
|
(update opts :test-syms into test-syms))
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
(ns status-im.ui.components.icons.icons
|
(ns status-im.ui.components.icons.icons
|
||||||
(:require [clojure.java.io :as io]
|
(:require [clojure.java.io :as io]
|
||||||
[clojure.string :as cstr]))
|
[clojure.string :as string]))
|
||||||
|
|
||||||
(def icon-path "./resources/images/icons/")
|
(def icon-path "./resources/images/icons/")
|
||||||
|
|
||||||
(defn require-icon [el]
|
(defn require-icon [el]
|
||||||
(let [s (str "../resources/images/icons/" el ".png")
|
(let [s (str "../resources/images/icons/" el ".png")
|
||||||
k (cstr/replace el "_" "-")]
|
k (string/replace el "_" "-")]
|
||||||
[k `(js/require ~s)]))
|
[k `(js/require ~s)]))
|
||||||
|
|
||||||
(defmacro resolve-icons []
|
(defmacro resolve-icons []
|
||||||
(let [files (->> (io/file icon-path)
|
(let [files (->> (io/file icon-path)
|
||||||
file-seq
|
file-seq
|
||||||
(filter #(cstr/ends-with? % "png"))
|
(filter #(string/ends-with? % "png"))
|
||||||
(map #(first (cstr/split (.getName %) #"@")))
|
(map #(first (string/split (.getName %) #"@")))
|
||||||
distinct)]
|
distinct)]
|
||||||
(into {} (map require-icon files))))
|
(into {} (map require-icon files))))
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
(ns status-im.ui.screens.activity-center.notification.contact-verification.view
|
(ns status-im.ui.screens.activity-center.notification.contact-verification.view
|
||||||
(:require [clojure.string :as str]
|
(:require [clojure.string :as string]
|
||||||
[quo2.core :as quo2]
|
[quo2.core :as quo2]
|
||||||
[status-im.constants :as constants]
|
[status-im.constants :as constants]
|
||||||
[status-im.i18n.i18n :as i18n]
|
[status-im.i18n.i18n :as i18n]
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
(when (or (= contact-verification-status constants/contact-verification-status-accepted)
|
(when (or (= contact-verification-status constants/contact-verification-status-accepted)
|
||||||
(= contact-verification-status constants/contact-verification-status-trusted)
|
(= contact-verification-status constants/contact-verification-status-trusted)
|
||||||
(= contact-verification-status constants/contact-verification-status-untrustworthy))
|
(= contact-verification-status constants/contact-verification-status-untrustworthy))
|
||||||
(str (str/lower-case (i18n/label :t/replied)) ":"))
|
(str (string/lower-case (i18n/label :t/replied)) ":"))
|
||||||
(when (or (= contact-verification-status constants/contact-verification-status-accepted)
|
(when (or (= contact-verification-status constants/contact-verification-status-accepted)
|
||||||
(= contact-verification-status constants/contact-verification-status-pending)
|
(= contact-verification-status constants/contact-verification-status-pending)
|
||||||
(= contact-verification-status constants/contact-verification-status-declined))
|
(= contact-verification-status constants/contact-verification-status-declined))
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
[status-im.ui.screens.activity-center.notification.mentions.style :as style]
|
[status-im.ui.screens.activity-center.notification.mentions.style :as style]
|
||||||
[status-im.utils.datetime :as datetime]
|
[status-im.utils.datetime :as datetime]
|
||||||
[utils.re-frame :as rf]
|
[utils.re-frame :as rf]
|
||||||
[clojure.string :as str]))
|
[clojure.string :as string]))
|
||||||
|
|
||||||
(defn message-body [message]
|
(defn message-body [message]
|
||||||
(let [parsed-text (get-in message [:content :parsed-text])
|
(let [parsed-text (get-in message [:content :parsed-text])
|
||||||
|
@ -36,13 +36,13 @@
|
||||||
:timestamp (datetime/timestamp->relative (:timestamp notification))
|
:timestamp (datetime/timestamp->relative (:timestamp notification))
|
||||||
:unread? (not (:read notification))
|
:unread? (not (:read notification))
|
||||||
:context [[common/user-avatar-tag author]
|
:context [[common/user-avatar-tag author]
|
||||||
[quo2/text {:style style/tag-text} (str/lower-case (i18n/label :t/on))]
|
[quo2/text {:style style/tag-text} (string/lower-case (i18n/label :t/on))]
|
||||||
;; TODO (@smohamedjavid): The `group-avatar-tag` component
|
;; TODO (@smohamedjavid): The `group-avatar-tag` component
|
||||||
;; does NOT support displaying channel name along with community/chat name.
|
;; does NOT support displaying channel name along with community/chat name.
|
||||||
;; Need to update the component to support it.
|
;; Need to update the component to support it.
|
||||||
[quo2/group-avatar-tag chat-name {:size :small
|
[quo2/group-avatar-tag chat-name {:size :small
|
||||||
:override-theme :dark
|
:override-theme :dark
|
||||||
:color colors/primary-50
|
:color colors/primary-50
|
||||||
:style style/tag
|
:style style/tag
|
||||||
:text-style style/tag-text}]]
|
:text-style style/tag-text}]]
|
||||||
:message {:body (message-body message)}}]])
|
:message {:body (message-body message)}}]])
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
(ns status-im.ui.screens.communities.community-emoji-thumbnail-picker
|
(ns status-im.ui.screens.communities.community-emoji-thumbnail-picker
|
||||||
(:require [quo.react-native :as rn]
|
(:require [quo.react-native :as rn]
|
||||||
[quo.core :as quo]
|
[quo.core :as quo]
|
||||||
[clojure.string :as str]
|
[clojure.string :as string]
|
||||||
[status-im.ui.components.react :as react]
|
[status-im.ui.components.react :as react]
|
||||||
[status-im.utils.handlers :refer [>evt <sub]]
|
[status-im.utils.handlers :refer [>evt <sub]]
|
||||||
[status-im.communities.core :as communities]
|
[status-im.communities.core :as communities]
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
(let [{:keys [color]} (<sub [:communities/create-channel])
|
(let [{:keys [color]} (<sub [:communities/create-channel])
|
||||||
item-color (:color item)
|
item-color (:color item)
|
||||||
key (:key key)
|
key (:key key)
|
||||||
color-selected? (= (str/lower-case item-color) (str/lower-case color))]
|
color-selected? (= (string/lower-case item-color) (string/lower-case color))]
|
||||||
[react/touchable-opacity {:key key
|
[react/touchable-opacity {:key key
|
||||||
:accessibility-label :color-circle
|
:accessibility-label :color-circle
|
||||||
:on-press #(>evt [::communities/create-channel-field :color item-color])}
|
:on-press #(>evt [::communities/create-channel-field :color item-color])}
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
[rn/view {:style (styles/emoji-picker-color item-color)}]]]))
|
[rn/view {:style (styles/emoji-picker-color item-color)}]]]))
|
||||||
|
|
||||||
(defn update-emoji [emoji]
|
(defn update-emoji [emoji]
|
||||||
(when-not (str/blank? emoji)
|
(when-not (string/blank? emoji)
|
||||||
(>evt [::communities/create-channel-field :emoji emoji])))
|
(>evt [::communities/create-channel-field :emoji emoji])))
|
||||||
|
|
||||||
(defn emoji-keyboard-section []
|
(defn emoji-keyboard-section []
|
||||||
|
@ -45,4 +45,3 @@
|
||||||
[thumbnail-preview-section]
|
[thumbnail-preview-section]
|
||||||
[color-picker/color-picker-section color-circle]
|
[color-picker/color-picker-section color-circle]
|
||||||
[emoji-keyboard-section]]])
|
[emoji-keyboard-section]]])
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
(:require [quo.react-native :as rn]
|
(:require [quo.react-native :as rn]
|
||||||
[status-im.i18n.i18n :as i18n]
|
[status-im.i18n.i18n :as i18n]
|
||||||
[quo.core :as quo]
|
[quo.core :as quo]
|
||||||
[clojure.string :as str]
|
[clojure.string :as string]
|
||||||
[status-im.utils.handlers :refer [>evt <sub]]
|
[status-im.utils.handlers :refer [>evt <sub]]
|
||||||
[status-im.communities.core :as communities]
|
[status-im.communities.core :as communities]
|
||||||
[status-im.ui.components.toolbar :as toolbar]
|
[status-im.ui.components.toolbar :as toolbar]
|
||||||
|
@ -17,8 +17,8 @@
|
||||||
(def max-description-length 140)
|
(def max-description-length 140)
|
||||||
|
|
||||||
(defn valid? [community-name community-description]
|
(defn valid? [community-name community-description]
|
||||||
(and (not (str/blank? community-name))
|
(and (not (string/blank? community-name))
|
||||||
(not (str/blank? community-description))
|
(not (string/blank? community-description))
|
||||||
(<= (count community-name) max-name-length)
|
(<= (count community-name) max-name-length)
|
||||||
(<= (count community-description) max-description-length)))
|
(<= (count community-description) max-description-length)))
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,14 @@
|
||||||
[quo.core :as quo]
|
[quo.core :as quo]
|
||||||
[utils.debounce :as debounce]
|
[utils.debounce :as debounce]
|
||||||
[status-im.i18n.i18n :as i18n]
|
[status-im.i18n.i18n :as i18n]
|
||||||
[clojure.string :as str]
|
[clojure.string :as string]
|
||||||
[status-im.ui.components.list.views :as list]
|
[status-im.ui.components.list.views :as list]
|
||||||
[status-im.ui.screens.home.views.inner-item :as inner-item]
|
[status-im.ui.screens.home.views.inner-item :as inner-item]
|
||||||
[status-im.communities.core :as communities]
|
[status-im.communities.core :as communities]
|
||||||
[reagent.core :as reagent]))
|
[reagent.core :as reagent]))
|
||||||
|
|
||||||
(defn valid? [category-name]
|
(defn valid? [category-name]
|
||||||
(and (not (str/blank? category-name))
|
(and (not (string/blank? category-name))
|
||||||
(<= (count category-name) 30)))
|
(<= (count category-name) 30)))
|
||||||
|
|
||||||
(def selected-items (reagent/atom #{}))
|
(def selected-items (reagent/atom #{}))
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
(ns status-im.ui.screens.communities.create-channel
|
(ns status-im.ui.screens.communities.create-channel
|
||||||
(:require [clojure.string :as str]
|
(:require [clojure.string :as string]
|
||||||
[quo.react-native :as rn]
|
[quo.react-native :as rn]
|
||||||
[quo.core :as quo]
|
[quo.core :as quo]
|
||||||
[status-im.i18n.i18n :as i18n]
|
[status-im.i18n.i18n :as i18n]
|
||||||
|
@ -13,8 +13,8 @@
|
||||||
[status-im.ui.components.emoji-thumbnail.preview :as emoji-thumbnail-preview]))
|
[status-im.ui.components.emoji-thumbnail.preview :as emoji-thumbnail-preview]))
|
||||||
|
|
||||||
(defn valid? [channel-name channel-description]
|
(defn valid? [channel-name channel-description]
|
||||||
(and (not (str/blank? channel-name))
|
(and (not (string/blank? channel-name))
|
||||||
(not (str/blank? channel-description))
|
(not (string/blank? channel-description))
|
||||||
(<= (count channel-name) create/max-name-length)
|
(<= (count channel-name) create/max-name-length)
|
||||||
(<= (count channel-description) create/max-description-length)))
|
(<= (count channel-description) create/max-description-length)))
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
(ns status-im.ui.screens.communities.edit-channel
|
(ns status-im.ui.screens.communities.edit-channel
|
||||||
(:require [clojure.string :as str]
|
(:require [clojure.string :as string]
|
||||||
[quo.core :as quo]
|
[quo.core :as quo]
|
||||||
[status-im.i18n.i18n :as i18n]
|
[status-im.i18n.i18n :as i18n]
|
||||||
[status-im.ui.components.toolbar :as toolbar]
|
[status-im.ui.components.toolbar :as toolbar]
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
[status-im.ui.screens.communities.create-channel :as create-channel]))
|
[status-im.ui.screens.communities.create-channel :as create-channel]))
|
||||||
|
|
||||||
(defn valid? [community-name]
|
(defn valid? [community-name]
|
||||||
(not (str/blank? community-name)))
|
(not (string/blank? community-name)))
|
||||||
|
|
||||||
(defn view []
|
(defn view []
|
||||||
(let [{:keys [name]} (<sub [:communities/create-channel])]
|
(let [{:keys [name]} (<sub [:communities/create-channel])]
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
[status-im.ui.components.topbar :as topbar]
|
[status-im.ui.components.topbar :as topbar]
|
||||||
[status-im.ui.components.chat-icon.screen :as chat-icon.screen]
|
[status-im.ui.components.chat-icon.screen :as chat-icon.screen]
|
||||||
[status-im.multiaccounts.core :as multiaccounts]
|
[status-im.multiaccounts.core :as multiaccounts]
|
||||||
[clojure.string :as str]))
|
[clojure.string :as string]))
|
||||||
|
|
||||||
(defn header [user-pk]
|
(defn header [user-pk]
|
||||||
[:<>
|
[:<>
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
[toolbar/toolbar
|
[toolbar/toolbar
|
||||||
{:show-border? true
|
{:show-border? true
|
||||||
:center
|
:center
|
||||||
[quo/button {:disabled (and (str/blank? @user-pk)
|
[quo/button {:disabled (and (string/blank? @user-pk)
|
||||||
(zero? (count selected)))
|
(zero? (count selected)))
|
||||||
:accessibility-label :share-community-link
|
:accessibility-label :share-community-link
|
||||||
:type :secondary
|
:type :secondary
|
||||||
|
|
|
@ -6,12 +6,12 @@
|
||||||
[status-im.ethereum.core :as ethereum]
|
[status-im.ethereum.core :as ethereum]
|
||||||
[status-im.utils.types :as types]
|
[status-im.utils.types :as types]
|
||||||
[taoensso.timbre :as log]
|
[taoensso.timbre :as log]
|
||||||
[clojure.string :as clojure.string]
|
[clojure.string :as string]
|
||||||
[status-im.i18n.i18n :as i18n]))
|
[status-im.i18n.i18n :as i18n]))
|
||||||
|
|
||||||
(defn safe-blank? [s]
|
(defn safe-blank? [s]
|
||||||
(or (not s)
|
(or (not s)
|
||||||
(clojure.string/blank? s)))
|
(string/blank? s)))
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
::delete-profile
|
::delete-profile
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
[quo.design-system.colors :as colors]
|
[quo.design-system.colors :as colors]
|
||||||
[status-im.utils.money :as money]
|
[status-im.utils.money :as money]
|
||||||
[status-im.ui.components.icons.icons :as icons]
|
[status-im.ui.components.icons.icons :as icons]
|
||||||
[clojure.string :as clojure.string]
|
[clojure.string :as string]
|
||||||
[status-im.signing.gas :as gas]
|
[status-im.signing.gas :as gas]
|
||||||
[reagent.core :as reagent]))
|
[reagent.core :as reagent]))
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@
|
||||||
[react/text {:style {:margin-top 12}
|
[react/text {:style {:margin-top 12}
|
||||||
:accessibility-label :slow-fee
|
:accessibility-label :slow-fee
|
||||||
:on-press #(re-frame/dispatch [:signing.edit-fee.ui/set-option :slow])}
|
:on-press #(re-frame/dispatch [:signing.edit-fee.ui/set-option :slow])}
|
||||||
(clojure.string/join
|
(string/join
|
||||||
" "
|
" "
|
||||||
[(str (i18n/label :t/slow) ":")
|
[(str (i18n/label :t/slow) ":")
|
||||||
(str (:base-fee slow) " gwei")
|
(str (:base-fee slow) " gwei")
|
||||||
|
@ -221,7 +221,7 @@
|
||||||
[react/text {:style {:margin-top 12}
|
[react/text {:style {:margin-top 12}
|
||||||
:accessibility-label :normal-fee
|
:accessibility-label :normal-fee
|
||||||
:on-press #(re-frame/dispatch [:signing.edit-fee.ui/set-option :normal])}
|
:on-press #(re-frame/dispatch [:signing.edit-fee.ui/set-option :normal])}
|
||||||
(clojure.string/join
|
(string/join
|
||||||
" "
|
" "
|
||||||
[(str (i18n/label :t/normal) ":")
|
[(str (i18n/label :t/normal) ":")
|
||||||
(str (:base-fee normal) " gwei")
|
(str (:base-fee normal) " gwei")
|
||||||
|
@ -232,7 +232,7 @@
|
||||||
[react/text {:style {:margin-top 12}
|
[react/text {:style {:margin-top 12}
|
||||||
:accessibility-label :fast-fee
|
:accessibility-label :fast-fee
|
||||||
:on-press #(re-frame/dispatch [:signing.edit-fee.ui/set-option :fast])}
|
:on-press #(re-frame/dispatch [:signing.edit-fee.ui/set-option :fast])}
|
||||||
(clojure.string/join
|
(string/join
|
||||||
" "
|
" "
|
||||||
[(str (i18n/label :t/fast) ":")
|
[(str (i18n/label :t/fast) ":")
|
||||||
(str (:base-fee fast) " gwei")
|
(str (:base-fee fast) " gwei")
|
||||||
|
@ -241,7 +241,7 @@
|
||||||
"<- selected")])]
|
"<- selected")])]
|
||||||
(when (= :custom option)
|
(when (= :custom option)
|
||||||
[react/text {:style {:margin-top 12}}
|
[react/text {:style {:margin-top 12}}
|
||||||
(clojure.string/join
|
(string/join
|
||||||
" "
|
" "
|
||||||
[(str (i18n/label :t/custom) ":")
|
[(str (i18n/label :t/custom) ":")
|
||||||
(str (-> fee-edit
|
(str (-> fee-edit
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(ns status-im.ui.screens.wallet.collectibles.views
|
(ns status-im.ui.screens.wallet.collectibles.views
|
||||||
(:require [re-frame.core :as re-frame]
|
(:require [re-frame.core :as re-frame]
|
||||||
[clojure.string :as str]
|
[clojure.string :as string]
|
||||||
[status-im.ui.components.react :as react]
|
[status-im.ui.components.react :as react]
|
||||||
[quo.core :as quo]
|
[quo.core :as quo]
|
||||||
[status-im.utils.handlers :refer [<sub]]
|
[status-im.utils.handlers :refer [<sub]]
|
||||||
|
@ -22,12 +22,12 @@
|
||||||
|
|
||||||
(defn is-image? [nft]
|
(defn is-image? [nft]
|
||||||
(and (seq (:image_url nft))
|
(and (seq (:image_url nft))
|
||||||
(not (str/ends-with? (:image_url nft) ".svg"))
|
(not (string/ends-with? (:image_url nft) ".svg"))
|
||||||
(not (str/ends-with? (:image_url nft) ".mp4"))))
|
(not (string/ends-with? (:image_url nft) ".mp4"))))
|
||||||
|
|
||||||
(defn is-vector? [nft]
|
(defn is-vector? [nft]
|
||||||
(and (seq (:image_url nft))
|
(and (seq (:image_url nft))
|
||||||
(str/ends-with? (:image_url nft) ".svg")))
|
(string/ends-with? (:image_url nft) ".svg")))
|
||||||
|
|
||||||
(defn missing-image-placeholder []
|
(defn missing-image-placeholder []
|
||||||
[react/view {:style {:width "100%"
|
[react/view {:style {:width "100%"
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
[status-im.ui.screens.wallet.components.views :as wallet.components]
|
[status-im.ui.screens.wallet.components.views :as wallet.components]
|
||||||
[status-im.utils.handlers :refer [<sub]]
|
[status-im.utils.handlers :refer [<sub]]
|
||||||
[status-im.wallet.utils :as wallet.utils]
|
[status-im.wallet.utils :as wallet.utils]
|
||||||
[clojure.string :as str]))
|
[clojure.string :as string]))
|
||||||
|
|
||||||
(defn render-asset [{{:keys
|
(defn render-asset [{{:keys
|
||||||
[icon decimals amount color value]
|
[icon decimals amount color value]
|
||||||
|
@ -378,7 +378,7 @@
|
||||||
:ignore-offset true}
|
:ignore-offset true}
|
||||||
[topbar/topbar
|
[topbar/topbar
|
||||||
{:title name
|
{:title name
|
||||||
:subtitle (str/upper-case (i18n/label :t/powered-by-paraswap))
|
:subtitle (string/upper-case (i18n/label :t/powered-by-paraswap))
|
||||||
:modal? true}]
|
:modal? true}]
|
||||||
|
|
||||||
[react/view (merge {:padding-horizontal 16
|
[react/view (merge {:padding-horizontal 16
|
||||||
|
@ -430,4 +430,3 @@
|
||||||
{:show-border? true
|
{:show-border? true
|
||||||
:right [quo/button {:theme :accent}
|
:right [quo/button {:theme :accent}
|
||||||
(i18n/label :t/swap)]}]]))
|
(i18n/label :t/swap)]}]]))
|
||||||
|
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
[status-im.utils.handlers :refer [<sub >evt]]
|
[status-im.utils.handlers :refer [<sub >evt]]
|
||||||
[quo2.components.avatars.user-avatar :as user-avatar]
|
[quo2.components.avatars.user-avatar :as user-avatar]
|
||||||
[quo2.foundations.typography :as typography]
|
[quo2.foundations.typography :as typography]
|
||||||
[clojure.string :as str]
|
[clojure.string :as string]
|
||||||
[status-im.utils.utils :as utils.utils]
|
[status-im.utils.utils :as utils.utils]
|
||||||
[status-im.utils.datetime :as time]
|
[status-im.utils.datetime :as time]
|
||||||
[status-im.i18n.i18n :as i18n]
|
[status-im.i18n.i18n :as i18n]
|
||||||
[quo2.components.notifications.notification-dot :refer [notification-dot]]))
|
[quo2.components.notifications.notification-dot :refer [notification-dot]]))
|
||||||
|
|
||||||
(defn received-cr-item [{:keys [chat-id message timestamp read]}]
|
(defn received-cr-item [{:keys [chat-id message timestamp read]}]
|
||||||
(let [no-ens-name (str/blank? (get-in message [:content :ens-name]))
|
(let [no-ens-name (string/blank? (get-in message [:content :ens-name]))
|
||||||
display-name (first (<sub [:contacts/contact-two-names-by-identity chat-id]))]
|
display-name (first (<sub [:contacts/contact-two-names-by-identity chat-id]))]
|
||||||
[rn/view {:style {:flex-direction :row
|
[rn/view {:style {:flex-direction :row
|
||||||
:padding-top 8
|
:padding-top 8
|
||||||
|
@ -73,5 +73,3 @@
|
||||||
:padding-horizontal 8
|
:padding-horizontal 8
|
||||||
:margin-left 8}}
|
:margin-left 8}}
|
||||||
[rn/text {:style (merge typography/font-medium typography/paragraph-2 {:color colors/white})} (i18n/label :t/accept)]]]]]))
|
[rn/text {:style (merge typography/font-medium typography/paragraph-2 {:color colors/white})} (i18n/label :t/accept)]]]]]))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
unparse]]
|
unparse]]
|
||||||
[status-im.i18n.i18n :refer [label label-pluralize]]
|
[status-im.i18n.i18n :refer [label label-pluralize]]
|
||||||
[status-im.native-module.core :as status]
|
[status-im.native-module.core :as status]
|
||||||
[clojure.string :as s]
|
[clojure.string :as string]
|
||||||
[status-im.goog.i18n :as goog.18n]))
|
[status-im.goog.i18n :as goog.18n]))
|
||||||
|
|
||||||
;;;; Datetime constants
|
;;;; Datetime constants
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
(defn- is24Hour-locsym
|
(defn- is24Hour-locsym
|
||||||
"Detects if given locale symbols timeformat generates AM/PM ('a')."
|
"Detects if given locale symbols timeformat generates AM/PM ('a')."
|
||||||
[^js locsym]
|
[^js locsym]
|
||||||
(not (s/includes?
|
(not (string/includes?
|
||||||
(nth (.-TIMEFORMATS locsym) 2)
|
(nth (.-TIMEFORMATS locsym) 2)
|
||||||
"a")))
|
"a")))
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@
|
||||||
(.format ^js (time-fmt) datetime)
|
(.format ^js (time-fmt) datetime)
|
||||||
|
|
||||||
(within-last-n-days? datetime 1)
|
(within-last-n-days? datetime 1)
|
||||||
(str (s/capitalize (label :t/datetime-yesterday))
|
(str (string/capitalize (label :t/datetime-yesterday))
|
||||||
" "
|
" "
|
||||||
(.format ^js (time-fmt) datetime))
|
(.format ^js (time-fmt) datetime))
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
(ns status-im.utils.name
|
(ns status-im.utils.name
|
||||||
(:require [clojure.string :as str]))
|
(:require [clojure.string :as string]))
|
||||||
|
|
||||||
(defn too-long? [name max-len]
|
(defn too-long? [name max-len]
|
||||||
(> (count name) max-len))
|
(> (count name) max-len))
|
||||||
|
|
||||||
(defn max-name
|
(defn max-name
|
||||||
[name max-len]
|
[name max-len]
|
||||||
(let [names (str/split name " ")]
|
(let [names (string/split name " ")]
|
||||||
(first
|
(first
|
||||||
(reduce (fn [[name done] next-name]
|
(reduce (fn [[name done] next-name]
|
||||||
(if done
|
(if done
|
||||||
name
|
name
|
||||||
(let [new-name (str/join " " [name next-name])]
|
(let [new-name (string/join " " [name next-name])]
|
||||||
(if (too-long? new-name max-len)
|
(if (too-long? new-name max-len)
|
||||||
(let [new-name' (str name " " (first next-name) ".")]
|
(let [new-name' (str name " " (first next-name) ".")]
|
||||||
(if (too-long? new-name' max-len)
|
(if (too-long? new-name' max-len)
|
||||||
|
@ -25,6 +25,6 @@
|
||||||
(if (> (count name) max-len)
|
(if (> (count name) max-len)
|
||||||
(let [name' (max-name name max-len)]
|
(let [name' (max-name name max-len)]
|
||||||
(if (too-long? name' max-len)
|
(if (too-long? name' max-len)
|
||||||
(str (str/trim (subs name 0 max-len)) "...")
|
(str (string/trim (subs name 0 max-len)) "...")
|
||||||
name'))
|
name'))
|
||||||
name))
|
name))
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
(ns status-im.utils.snoopy
|
(ns status-im.utils.snoopy
|
||||||
(:require [clojure.string :as clojure.string]
|
(:require [clojure.string :as string]
|
||||||
[status-im.utils.config :as config]
|
[status-im.utils.config :as config]
|
||||||
["react-native/Libraries/vendor/emitter/EventEmitter" :refer [EventEmitter]]
|
["react-native/Libraries/vendor/emitter/EventEmitter" :refer [EventEmitter]]
|
||||||
["rn-snoopy" :default snoopy]
|
["rn-snoopy" :default snoopy]
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
(= first-arg "gethEvent"))
|
(= first-arg "gethEvent"))
|
||||||
(and
|
(and
|
||||||
(string? method)
|
(string? method)
|
||||||
(clojure.string/starts-with? method "<callback for Status."))))
|
(string/starts-with? method "<callback for Status."))))
|
||||||
|
|
||||||
(defn timer-filter [{:keys [method]}]
|
(defn timer-filter [{:keys [method]}]
|
||||||
(contains? #{"callTimers" "createTimer"} method))
|
(contains? #{"callTimers" "createTimer"} method))
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
(or (= module "NativeAnimatedModule")
|
(or (= module "NativeAnimatedModule")
|
||||||
(and
|
(and
|
||||||
(string? method)
|
(string? method)
|
||||||
(clojure.string/starts-with? method "<callback for NativeAnimatedModule."))))
|
(string/starts-with? method "<callback for NativeAnimatedModule."))))
|
||||||
|
|
||||||
(defn keyboard-observer-filter [{:keys [module]}]
|
(defn keyboard-observer-filter [{:keys [module]}]
|
||||||
;; mostly all calls to KeyboardObserver are done by FlatList
|
;; mostly all calls to KeyboardObserver are done by FlatList
|
||||||
|
|
Loading…
Reference in New Issue