Compare commits

...
Author SHA1 Message Date
yqrashawn f573ca6b4e reformat 2022-12-21 21:18:38 +08:00
yqrashawn f6ed540593 mock before reformat 2022-12-21 21:11:55 +08:00
123 changed files with 1335 additions and 3341 deletions
+20 -21
View File
@@ -1,21 +1,20 @@
{:lint-as {status-im.utils.views/defview clojure.core/defn
status-im.utils.views/letsubs clojure.core/let
reagent.core/with-let clojure.core/let
status-im.utils.fx/defn clj-kondo.lint-as/def-catch-all
utils.re-frame/defn clj-kondo.lint-as/def-catch-all
quo.react/with-deps-check clojure.core/fn
quo.previews.preview/list-comp clojure.core/for
status-im.utils.styles/def clojure.core/def
status-im.utils.styles/defn clojure.core/defn
status-im.test-helpers/deftest-sub clojure.core/defn
taoensso.tufte/defnp clojure.core/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
;; https://github.com/borkdude/clj-kondo/issues/867
:unresolved-symbol {:exclude [PersistentPriorityMap.EMPTY
number
status-im.test-helpers/restore-app-db]}}
:config-in-ns {mocks.js-dependencies {:linters {:clojure-lsp/unused-public-var {:level :off}}}}}
{:lint-as {status-im.utils.views/defview clojure.core/defn
status-im.utils.views/letsubs clojure.core/let
reagent.core/with-let clojure.core/let
status-im.utils.fx/defn clj-kondo.lint-as/def-catch-all
utils.re-frame/defn clj-kondo.lint-as/def-catch-all
quo.react/with-deps-check clojure.core/fn
quo.previews.preview/list-comp clojure.core/for
status-im.utils.styles/def clojure.core/def
status-im.utils.styles/defn clojure.core/defn
status-im.test-helpers/deftest-sub clojure.core/defn
taoensso.tufte/defnp clojure.core/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
;; https://github.com/borkdude/clj-kondo/issues/867
:unresolved-symbol {:exclude [PersistentPriorityMap.EMPTY
number
status-im.test-helpers/restore-app-db]}}}
+5 -17
View File
@@ -285,20 +285,16 @@ endif
# Tests
#--------------
lint: export TARGET := default
lint: export TARGET := clojure
lint: ##@test Run code style checks
sh scripts/lint-re-frame-in-quo-components.sh && \
clj-kondo --config .clj-kondo/config.edn --cache false --lint src && \
TARGETS=$$(git diff --diff-filter=d --cached --name-only | grep -e \.clj$$ -e \.cljs$$ -e \.cljc$$ -e \.edn$$ || echo shadow-cljs.edn) && \
zprint '{:search-config? true}' -fc $$TARGETS
TARGETS=$$(git diff --diff-filter=d --cached --name-only src && echo src) && \
clojure -Scp "$$CLASS_PATH" -m cljfmt.main check --indents indentation.edn $$TARGETS
lint-fix: export TARGET := default
lint-fix: export TARGET := clojure
lint-fix: ##@test Run code style checks and fix issues
TARGETS=$$(git diff --diff-filter=d --cached --name-only | grep -e \.clj$$ -e \.cljs$$ -e \.cljc$$ -e \.edn$$ || echo shadow-cljs.edn) && \
clojure-lsp clean-ns --filenames $$(echo $$TARGETS | xargs | sed -e 's/ /,/g') && \
zprint '{:search-config? true}' -fw $$TARGETS && \
zprint '{:search-config? true}' -fw $$TARGETS
clojure -Scp "$$CLASS_PATH" -m cljfmt.main fix src --indents indentation.edn
shadow-server: export TARGET := clojure
shadow-server:##@ Start shadow-cljs in server mode for watching
@@ -309,14 +305,6 @@ test-watch: ##@ Watch tests and re-run no changes to cljs files
yarn install
nodemon --exec 'yarn shadow-cljs compile mocks && yarn shadow-cljs compile test && node --require ./test-resources/override.js target/test/test.js' -e cljs
test-watch-for-repl: export TARGET := clojure
test-watch-for-repl: ##@ Watch tests and support REPL connections
yarn install
rm -f target/test/test.js
concurrently --kill-others --prefix-colors 'auto' --names 'build,repl' \
'yarn shadow-cljs compile mocks && yarn shadow-cljs watch test --verbose' \
'until [ -f ./target/test/test.js ] ; do sleep 1 ; done ; node --require ./test-resources/override.js ./target/test/test.js --repl'
test: export TARGET := clojure
test: ##@test Run tests once in NodeJS
# Here we create the gyp bindings for nodejs
@@ -20,8 +20,6 @@ printed out by mistake in a log entry (see https://github.com/status-im/status-m
To minimize the risk of leaking passwords through logs, we should not pass
passwords as strings in our codebase. We introduced a new type `MaskedData` in
`status-im.utils.security`.
update (16-Dec-2022) `status-im.utils.security` is now moved over to `utils.security.core`
We use `(security/mask-data <data to hide>` to wrap sensitive data into this
type and then use `(security/unmask <masked-data>)` to get the plaintext back.
+1
View File
@@ -0,0 +1 @@
{letsubs [[:inner 0]]}
+181 -259
View File
@@ -51,45 +51,6 @@
}
},
{
"path": "borkdude/edamame/0.0.11-alpha.28/edamame-0.0.11-alpha.28",
"host": "https://repo.clojars.org",
"pom": {
"sha1": "488f403591739aab5a68ce6e7f82c0e855c23fd6",
"sha256": "1cw712kzza733g55s02ql35q630zd8j8nmnpivcczjkg240jans4"
},
"jar": {
"sha1": "371f3e232e7fdb04b7b2044825eb9822280e8f93",
"sha256": "1iyxq6jypjd875cgdyllknh27mx5fnkyjz80mr927d5i94r0ywj4"
}
},
{
"path": "borkdude/sci.impl.reflector/0.0.1/sci.impl.reflector-0.0.1",
"host": "https://repo.clojars.org",
"pom": {
"sha1": "eb3aff6c7db85d91f7e05b98e06d1354a4fce36c",
"sha256": "1bvr7cvpbvqi7swypzpbfrig16zipwvmg4m47y2x5chs5czwxv15"
},
"jar": {
"sha1": "33dfc86102e0ea400498cbca47572459c1c43b00",
"sha256": "0a5gxmj8kzc01y9bn7l4x7c1v5q9wcbvw5hdr525d3ylsyl6xfkw"
}
},
{
"path": "borkdude/sci/0.2.1-alpha.1/sci-0.2.1-alpha.1",
"host": "https://repo.clojars.org",
"pom": {
"sha1": "516cb8e3a8e430d59d9c3e7a51f9f859e3b249e0",
"sha256": "1nrww29m90q1avaahw7i5418c18crc3cidhbg3ml7h7vjjplsl9y"
},
"jar": {
"sha1": "96e39dcbc3fb3a41c6bf2e628303cf0f534b28a3",
"sha256": "1cjvz85ls982rmx90igv4mcfaa53fj5z29df9mf4jplyig3l9dxb"
}
},
{
"path": "cider/cider-nrepl/0.25.3/cider-nrepl-0.25.3",
"host": "https://repo.clojars.org",
@@ -117,15 +78,15 @@
},
{
"path": "clj-stacktrace/clj-stacktrace/0.2.8/clj-stacktrace-0.2.8",
"path": "cljfmt/cljfmt/0.6.7/cljfmt-0.6.7",
"host": "https://repo.clojars.org",
"pom": {
"sha1": "c5a47e6858344c9fd42eecafc7920a7a18d6126d",
"sha256": "1az0fs9k5xvzl8bz564apd77kqc83nl8sxsrvmswmbmkamvy4hd3"
"sha1": "3d7ac9112908c9c9349adc056d1d06ae2cd33c21",
"sha256": "1q46q43mykn61f032y5734j84gcjca41pwd3iik9xghnzmphy2mn"
},
"jar": {
"sha1": "b0654b98763199ee57182526465d823492d1cc3f",
"sha256": "1029wd82qyxv6ji9pd38m32nqia56h6845lqv4ym4dsz5i201g9a"
"sha1": "91e8afa2c19db72acdef7f881aad905871ba6e69",
"sha256": "0ara83gaqnafjgr2aqz5zqmywdsmhsz483xkkxpiwbn9lfqvidmh"
}
},
@@ -143,15 +104,15 @@
},
{
"path": "cljsjs/react-dom-server/17.0.1-0/react-dom-server-17.0.1-0",
"path": "cljsjs/react/17.0.1-0/react-17.0.1-0",
"host": "https://repo.clojars.org",
"pom": {
"sha1": "ff154f318e1f63061b5bd42d9a38fc8547360cb4",
"sha256": "166ynlrph7rx3nql0c85c37vcbcsnwbjamk71hw74rz451pgnncr"
"sha1": "d5d3681281585d981375fe7bb29362bfcd0d4449",
"sha256": "0rskh6mfq5h0l0wybs68w9v585a6zlnnfgrvsf5k3h51fk2p28da"
},
"jar": {
"sha1": "d5c53eca9f3884402c76268b82e3828223dcbf90",
"sha256": "1530hwqpxzxfjm6dy77whqwjzzx79jpnd9xvnkxy1lnk7l7lj494"
"sha1": "726da8a9305a865df90d81e9a8d58f87ff0ee8bd",
"sha256": "0bfmvw8gk98vdf9azll6041r1jaz1pmb0dyb35cfc8dr3mmr4ag7"
}
},
@@ -169,15 +130,15 @@
},
{
"path": "cljsjs/react/17.0.1-0/react-17.0.1-0",
"path": "cljsjs/react-dom-server/17.0.1-0/react-dom-server-17.0.1-0",
"host": "https://repo.clojars.org",
"pom": {
"sha1": "d5d3681281585d981375fe7bb29362bfcd0d4449",
"sha256": "0rskh6mfq5h0l0wybs68w9v585a6zlnnfgrvsf5k3h51fk2p28da"
"sha1": "ff154f318e1f63061b5bd42d9a38fc8547360cb4",
"sha256": "166ynlrph7rx3nql0c85c37vcbcsnwbjamk71hw74rz451pgnncr"
},
"jar": {
"sha1": "726da8a9305a865df90d81e9a8d58f87ff0ee8bd",
"sha256": "0bfmvw8gk98vdf9azll6041r1jaz1pmb0dyb35cfc8dr3mmr4ag7"
"sha1": "d5c53eca9f3884402c76268b82e3828223dcbf90",
"sha256": "1530hwqpxzxfjm6dy77whqwjzzx79jpnd9xvnkxy1lnk7l7lj494"
}
},
@@ -311,6 +272,32 @@
}
},
{
"path": "com/googlecode/java-diff-utils/diffutils/1.3.0/diffutils-1.3.0",
"host": "https://repo1.maven.org/maven2",
"pom": {
"sha1": "7d5e372ff32c90095800f96d8308c41af0285a41",
"sha256": "1dj7p0m0kwnjvy1y3kq63zb6bw0azjf79i5xbccmy3wv63b1vqrg"
},
"jar": {
"sha1": "7e060dd5b19431e6d198e91ff670644372f60fbd",
"sha256": "1hn5plp7iyl626h8mrra56sysfm2qannj1dapr1m5afwkb24vfk1"
}
},
{
"path": "com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1",
"host": "https://repo1.maven.org/maven2",
"pom": {
"sha1": "5e902aae26ac5c36f6420f689f43333129dd69e2",
"sha256": "10vzlnl8vbjv2jqf818wdb7kgy9c6qjka7fjmmi3vdpg1mcn6pv6"
},
"jar": {
"sha1": "c9ad4a0850ab676c5c64461a05ca524cdfff59f1",
"sha256": "170rflxnqnah0265ik2aylmxkshyqbf2zas9bp2l32xqj9l6jsaf"
}
},
{
"path": "com/google/elemental2/elemental2-core/1.0.0-RC1/elemental2-core-1.0.0-RC1",
"host": "https://repo1.maven.org/maven2",
@@ -441,19 +428,6 @@
}
},
{
"path": "com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1",
"host": "https://repo1.maven.org/maven2",
"pom": {
"sha1": "5e902aae26ac5c36f6420f689f43333129dd69e2",
"sha256": "10vzlnl8vbjv2jqf818wdb7kgy9c6qjka7fjmmi3vdpg1mcn6pv6"
},
"jar": {
"sha1": "c9ad4a0850ab676c5c64461a05ca524cdfff59f1",
"sha256": "170rflxnqnah0265ik2aylmxkshyqbf2zas9bp2l32xqj9l6jsaf"
}
},
{
"path": "com/ibm/icu/icu4j/66.1/icu4j-66.1",
"host": "https://repo1.maven.org/maven2",
@@ -467,6 +441,58 @@
}
},
{
"path": "commons-codec/commons-codec/1.10/commons-codec-1.10",
"host": "https://repo1.maven.org/maven2",
"pom": {
"sha1": "44b9477418d2942d45550f7e7c66c16262062d0e",
"sha256": "1yscxabk7i59vgfjg7c1y3prj39h1d8prnwgxbisc4ni29qdpf5x"
},
"jar": {
"sha1": "4b95f4897fa13f2cd904aee711aeafc0c5295cd8",
"sha256": "0scm6321zz76dc3bs8sy2qyami755lz4lq5455gl67bi9slxyha2"
}
},
{
"path": "commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4",
"host": "https://repo1.maven.org/maven2",
"pom": {
"sha1": "65112009d674333c1acfafb4e198ff250d710764",
"sha256": "007nyd66fqp3fbrmnsbfp1fpkhmr2lk33qmkp3salqld3xd7qlc8"
},
"jar": {
"sha1": "f95188e3d372e20e7328706c37ef366e5d7859b0",
"sha256": "1xyyl54sfxsdcwxdyq6b0azmr31b4dwqns850jjkw9a9dwrh5v54"
}
},
{
"path": "commons-io/commons-io/2.6/commons-io-2.6",
"host": "https://repo1.maven.org/maven2",
"pom": {
"sha1": "5060835593e5b6ed18c82fc2e782f0a3c30a00b1",
"sha256": "0q4a6fp6xkyd86ikymkyv2plhf9vj8aqvggxg9d1yad2jcw8c8qc"
},
"jar": {
"sha1": "815893df5f31da2ece4040fe0a12fd44b577afaf",
"sha256": "04v5fg53jl9gbn6pyz3l7kbpxv0xjzyasnw6yd1a3hhacq2d6xzq"
}
},
{
"path": "compojure/compojure/1.5.2/compojure-1.5.2",
"host": "https://repo.clojars.org",
"pom": {
"sha1": "9e8da477b6682094d56802cb155291a2acb829bd",
"sha256": "036z64iprypccz03iq7lqxvw99xjh4xlsfmfwbs37pmhfnfmbdnx"
},
"jar": {
"sha1": "0b5258d0616ffc5f64c2b6d95f09de56d24df439",
"sha256": "1s2k05lwnlm9a66mxnsss437i9gp70dny8y2rlfkl090s6mdqsaf"
}
},
{
"path": "com/taoensso/encore/2.105.0/encore-2.105.0",
"host": "https://repo.clojars.org",
@@ -545,58 +571,6 @@
}
},
{
"path": "commons-codec/commons-codec/1.10/commons-codec-1.10",
"host": "https://repo1.maven.org/maven2",
"pom": {
"sha1": "44b9477418d2942d45550f7e7c66c16262062d0e",
"sha256": "1yscxabk7i59vgfjg7c1y3prj39h1d8prnwgxbisc4ni29qdpf5x"
},
"jar": {
"sha1": "4b95f4897fa13f2cd904aee711aeafc0c5295cd8",
"sha256": "0scm6321zz76dc3bs8sy2qyami755lz4lq5455gl67bi9slxyha2"
}
},
{
"path": "commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4",
"host": "https://repo1.maven.org/maven2",
"pom": {
"sha1": "65112009d674333c1acfafb4e198ff250d710764",
"sha256": "007nyd66fqp3fbrmnsbfp1fpkhmr2lk33qmkp3salqld3xd7qlc8"
},
"jar": {
"sha1": "f95188e3d372e20e7328706c37ef366e5d7859b0",
"sha256": "1xyyl54sfxsdcwxdyq6b0azmr31b4dwqns850jjkw9a9dwrh5v54"
}
},
{
"path": "commons-io/commons-io/2.6/commons-io-2.6",
"host": "https://repo1.maven.org/maven2",
"pom": {
"sha1": "5060835593e5b6ed18c82fc2e782f0a3c30a00b1",
"sha256": "0q4a6fp6xkyd86ikymkyv2plhf9vj8aqvggxg9d1yad2jcw8c8qc"
},
"jar": {
"sha1": "815893df5f31da2ece4040fe0a12fd44b577afaf",
"sha256": "04v5fg53jl9gbn6pyz3l7kbpxv0xjzyasnw6yd1a3hhacq2d6xzq"
}
},
{
"path": "compojure/compojure/1.5.2/compojure-1.5.2",
"host": "https://repo.clojars.org",
"pom": {
"sha1": "9e8da477b6682094d56802cb155291a2acb829bd",
"sha256": "036z64iprypccz03iq7lqxvw99xjh4xlsfmfwbs37pmhfnfmbdnx"
},
"jar": {
"sha1": "0b5258d0616ffc5f64c2b6d95f09de56d24df439",
"sha256": "1s2k05lwnlm9a66mxnsss437i9gp70dny8y2rlfkl090s6mdqsaf"
}
},
{
"path": "crypto-equality/crypto-equality/1.0.0/crypto-equality-1.0.0",
"host": "https://repo.clojars.org",
@@ -675,19 +649,6 @@
}
},
{
"path": "hashp/hashp/0.2.1/hashp-0.2.1",
"host": "https://repo.clojars.org",
"pom": {
"sha1": "32530b9106a64fd5442d2aa27c6da4175d1f1440",
"sha256": "1z94k8c52r87rq3nhc0mqazcxff6d4phi8gy1bgndhiz4nq1mia7"
},
"jar": {
"sha1": "fb501db2eb4a028c1875382d58c17c381aec47b8",
"sha256": "1lwirzb60zvksvkb3arpwi4fk1xnp0x5ljmrca5vf7dq25lmwmsd"
}
},
{
"path": "hiccup/hiccup/1.0.5/hiccup-1.0.5",
"host": "https://repo.clojars.org",
@@ -818,32 +779,6 @@
}
},
{
"path": "mvxcvi/arrangement/1.2.0/arrangement-1.2.0",
"host": "https://repo.clojars.org",
"pom": {
"sha1": "4f19bd291595870162eadd35456a0b2e76444a64",
"sha256": "1qqnl05nwcjnzhlgplcsbckrp8pqvf8n6bf8kr8rz7lz2q4px3vb"
},
"jar": {
"sha1": "036e640bb9e14c2aa95589a45a018eb8358ce3f6",
"sha256": "1m3v1rkpdmv7aym5vq2swh0mf9mg7xppdr3vrl4g6qm3s42c24b7"
}
},
{
"path": "mvxcvi/puget/1.3.1/puget-1.3.1",
"host": "https://repo.clojars.org",
"pom": {
"sha1": "07104dc20a13c7e255fffee4f16de9a6873c187f",
"sha256": "1129rb3qksg7n85j03k6d3sr6868g724097vxids1r4wqj2phxkf"
},
"jar": {
"sha1": "a4f7dcf71ccd8d69d4ecd2b19f3d671dfc169308",
"sha256": "029znh7p8f1h91gri4jhzwqsa0rnn3i34yr3kav55npym2sw5sfp"
}
},
{
"path": "net/cgrand/macrovich/0.2.1/macrovich-0.2.1",
"host": "https://repo.clojars.org",
@@ -949,15 +884,15 @@
},
{
"path": "org/clojure/core.rrb-vector/0.1.2/core.rrb-vector-0.1.2",
"path": "org/clojure/core.rrb-vector/0.1.1/core.rrb-vector-0.1.1",
"host": "https://repo1.maven.org/maven2",
"pom": {
"sha1": "e9336ac820c5a7e07fe0aa431df981cbab6db3e3",
"sha256": "07q9qmxc7ggaxh27imgs34svn4j269rhslbnrs63ahrqzk5bmqlf"
"sha1": "3231642aa1dcf628c864a5f208cd293fbd6a385a",
"sha256": "18kk5sds5lg8r2kidhz9qpgyrvggkj8j4sgfdsmyyl93w3f16lnp"
},
"jar": {
"sha1": "0404feea925608b921b56acd11d3b187a0d33fe4",
"sha256": "13hkx1285f2imqlj6wbgyxki2yg8rmfr49iq1zijxm1cgfx8xyai"
"sha1": "aafb7677ec1e9f344fc834bbbdb91e8ba02af474",
"sha256": "0cqyy1vqrhilgwrdxsibd7360ch3hhwjnbbnzsak38v6i6mg66xl"
}
},
@@ -1000,19 +935,6 @@
}
},
{
"path": "org/clojure/google-closure-library-third-party/0.0-20191016-6ae1f72f/google-closure-library-third-party-0.0-20191016-6ae1f72f",
"host": "https://repo1.maven.org/maven2",
"pom": {
"sha1": "1aa0b32fd70e6644dcb06b88b55630d6bbb6f188",
"sha256": "1wq6gvhlvy3mdhj1cb0w62kclqd7x42dqd0275l40rlla5q5h1z1"
},
"jar": {
"sha1": "4fc15daa4fd1b150e8c6d32755796634446dd86a",
"sha256": "1ykw162gng0lcbxn2f387vv1l4d7hfwyayhxgzqqgi9jx211fzw5"
}
},
{
"path": "org/clojure/google-closure-library/0.0-20191016-6ae1f72f/google-closure-library-0.0-20191016-6ae1f72f",
"host": "https://repo1.maven.org/maven2",
@@ -1026,6 +948,19 @@
}
},
{
"path": "org/clojure/google-closure-library-third-party/0.0-20191016-6ae1f72f/google-closure-library-third-party-0.0-20191016-6ae1f72f",
"host": "https://repo1.maven.org/maven2",
"pom": {
"sha1": "1aa0b32fd70e6644dcb06b88b55630d6bbb6f188",
"sha256": "1wq6gvhlvy3mdhj1cb0w62kclqd7x42dqd0275l40rlla5q5h1z1"
},
"jar": {
"sha1": "4fc15daa4fd1b150e8c6d32755796634446dd86a",
"sha256": "1ykw162gng0lcbxn2f387vv1l4d7hfwyayhxgzqqgi9jx211fzw5"
}
},
{
"path": "org/clojure/spec.alpha/0.2.176/spec.alpha-0.2.176",
"host": "https://repo1.maven.org/maven2",
@@ -1052,19 +987,6 @@
}
},
{
"path": "org/clojure/tools.analyzer.jvm/1.1.0/tools.analyzer.jvm-1.1.0",
"host": "https://repo1.maven.org/maven2",
"pom": {
"sha1": "3f21bdbd549557232eb0bf0965b2beea34004d52",
"sha256": "0cyyhf82pn4mjw4whr4sx3cnxrgsk862dq92gn79yawxr6842i51"
},
"jar": {
"sha1": "027d2ebe594eb5f46d6bcea62593e184937b3011",
"sha256": "0kcfcn12dmyrm7sk1jkrlcb7ws8kazfqziv62mfid62xc095gayz"
}
},
{
"path": "org/clojure/tools.analyzer/1.0.0/tools.analyzer-1.0.0",
"host": "https://repo1.maven.org/maven2",
@@ -1078,6 +1000,19 @@
}
},
{
"path": "org/clojure/tools.analyzer.jvm/1.1.0/tools.analyzer.jvm-1.1.0",
"host": "https://repo1.maven.org/maven2",
"pom": {
"sha1": "3f21bdbd549557232eb0bf0965b2beea34004d52",
"sha256": "0cyyhf82pn4mjw4whr4sx3cnxrgsk862dq92gn79yawxr6842i51"
},
"jar": {
"sha1": "027d2ebe594eb5f46d6bcea62593e184937b3011",
"sha256": "0kcfcn12dmyrm7sk1jkrlcb7ws8kazfqziv62mfid62xc095gayz"
}
},
{
"path": "org/clojure/tools.cli/1.0.194/tools.cli-1.0.194",
"host": "https://repo1.maven.org/maven2",
@@ -1143,19 +1078,6 @@
}
},
{
"path": "org/graalvm/js/js-scriptengine/20.1.0/js-scriptengine-20.1.0",
"host": "https://repo1.maven.org/maven2",
"pom": {
"sha1": "020bac4e8232f0b051e3e6b8033f67653cf9c685",
"sha256": "1avd7kmwh0i6nkcirwl358a6lkpqwara0f5a7qiw1fjivc81qmzq"
},
"jar": {
"sha1": "a4accb1ced82da8d61bd2928f435de8af548dc2b",
"sha256": "03001wa3xs08lw2rz27w5s0fyspyhkiiarqsrq9yf8gfysmnik2s"
}
},
{
"path": "org/graalvm/js/js/20.1.0/js-20.1.0",
"host": "https://repo1.maven.org/maven2",
@@ -1169,6 +1091,19 @@
}
},
{
"path": "org/graalvm/js/js-scriptengine/20.1.0/js-scriptengine-20.1.0",
"host": "https://repo1.maven.org/maven2",
"pom": {
"sha1": "020bac4e8232f0b051e3e6b8033f67653cf9c685",
"sha256": "1avd7kmwh0i6nkcirwl358a6lkpqwara0f5a7qiw1fjivc81qmzq"
},
"jar": {
"sha1": "a4accb1ced82da8d61bd2928f435de8af548dc2b",
"sha256": "03001wa3xs08lw2rz27w5s0fyspyhkiiarqsrq9yf8gfysmnik2s"
}
},
{
"path": "org/graalvm/regex/regex/20.1.0/regex-20.1.0",
"host": "https://repo1.maven.org/maven2",
@@ -1299,6 +1234,19 @@
}
},
{
"path": "org/ow2/asm/asm/7.1/asm-7.1",
"host": "https://repo1.maven.org/maven2",
"pom": {
"sha1": "7e40eb6619fd20bd7d98bf775bfdd810aec87ac7",
"sha256": "101i3pyrq082kjyz413hfqwkjjsyfnk9kx3rqr38ln56mlp78a8g"
},
"jar": {
"sha1": "fa29aa438674ff19d5e1386d2c3527a0267f291e",
"sha256": "1pnlb1ick32bihpzc599xl9ppd07qhls6pm0xaqwrj9cdlmzmcja"
}
},
{
"path": "org/ow2/asm/asm-analysis/7.1/asm-analysis-7.1",
"host": "https://repo1.maven.org/maven2",
@@ -1351,19 +1299,6 @@
}
},
{
"path": "org/ow2/asm/asm/7.1/asm-7.1",
"host": "https://repo1.maven.org/maven2",
"pom": {
"sha1": "7e40eb6619fd20bd7d98bf775bfdd810aec87ac7",
"sha256": "101i3pyrq082kjyz413hfqwkjjsyfnk9kx3rqr38ln56mlp78a8g"
},
"jar": {
"sha1": "fa29aa438674ff19d5e1386d2c3527a0267f291e",
"sha256": "1pnlb1ick32bihpzc599xl9ppd07qhls6pm0xaqwrj9cdlmzmcja"
}
},
{
"path": "org/wildfly/client/wildfly-client-config/1.0.1.Final/wildfly-client-config-1.0.1.Final",
"host": "https://repo1.maven.org/maven2",
@@ -1416,6 +1351,19 @@
}
},
{
"path": "reagent/reagent/1.0.0/reagent-1.0.0",
"host": "https://repo.clojars.org",
"pom": {
"sha1": "93ad5ccb0101108fb0843a3f2c50da28f8fd8336",
"sha256": "1l4xzgc4wbd8b29mhj5j336cf8w1zccaia0w413zf3bnj6jf5m38"
},
"jar": {
"sha1": "a1dd4d40425bb2e1afad0fe72780b43ff394ccfa",
"sha256": "1g607s1ymns85923bvhwrsj0y5czyqqq1jmxx0a58fnsm1b318fa"
}
},
{
"path": "re-com/re-com/2.8.0/re-com-2.8.0",
"host": "https://repo.clojars.org",
@@ -1429,6 +1377,19 @@
}
},
{
"path": "refactor-nrepl/refactor-nrepl/2.5.0/refactor-nrepl-2.5.0",
"host": "https://repo.clojars.org",
"pom": {
"sha1": "0bce30b420249ba7e4b90cbb3e046b4bb5416389",
"sha256": "0zmg5qc8d55pry7832isiwd2q237znfjqjpxchd2hvlpalh5qnva"
},
"jar": {
"sha1": "6bc3441afc94f7ca024e41a864ca75e05df7e207",
"sha256": "0w8hax99y98l53mixxzx2ja0vcnhjv8dnsaz1zj3vqk775ns5w6i"
}
},
{
"path": "re-frame/re-frame/0.12.0/re-frame-0.12.0",
"host": "https://repo.clojars.org",
@@ -1468,32 +1429,6 @@
}
},
{
"path": "reagent/reagent/1.0.0/reagent-1.0.0",
"host": "https://repo.clojars.org",
"pom": {
"sha1": "93ad5ccb0101108fb0843a3f2c50da28f8fd8336",
"sha256": "1l4xzgc4wbd8b29mhj5j336cf8w1zccaia0w413zf3bnj6jf5m38"
},
"jar": {
"sha1": "a1dd4d40425bb2e1afad0fe72780b43ff394ccfa",
"sha256": "1g607s1ymns85923bvhwrsj0y5czyqqq1jmxx0a58fnsm1b318fa"
}
},
{
"path": "refactor-nrepl/refactor-nrepl/2.5.0/refactor-nrepl-2.5.0",
"host": "https://repo.clojars.org",
"pom": {
"sha1": "0bce30b420249ba7e4b90cbb3e046b4bb5416389",
"sha256": "0zmg5qc8d55pry7832isiwd2q237znfjqjpxchd2hvlpalh5qnva"
},
"jar": {
"sha1": "6bc3441afc94f7ca024e41a864ca75e05df7e207",
"sha256": "0w8hax99y98l53mixxzx2ja0vcnhjv8dnsaz1zj3vqk775ns5w6i"
}
},
{
"path": "rewrite-clj/rewrite-clj/0.6.1/rewrite-clj-0.6.1",
"host": "https://repo.clojars.org",
@@ -1508,15 +1443,15 @@
},
{
"path": "rewrite-cljs/rewrite-cljs/0.4.5/rewrite-cljs-0.4.5",
"path": "rewrite-cljs/rewrite-cljs/0.4.4/rewrite-cljs-0.4.4",
"host": "https://repo.clojars.org",
"pom": {
"sha1": "378cd53218027b9a93640dcf64c040665f6c9c6b",
"sha256": "1qrhrgzhqdyqizh0ngnr4zgj9xkfzq0qhsws4pxxra3qc9ikl9cq"
"sha1": "4e7a2542517a5b0231631305461603605bea1592",
"sha256": "050imgkzw5q7200klwrkd4v32xxy1f4aghs8g4ma5dbg4rl4pgcd"
},
"jar": {
"sha1": "c35be115c39dadc71a4de3f584aa8ca295e11257",
"sha256": "1dnw0jhr1hhqz80w3z5d8qdbaqdvgzg4fyhv6lffa51c9ca1dsr1"
"sha1": "dd14a371d0d09eedccb39f01e3edabefb2d1e64f",
"sha256": "0hb07wg71i2bjn8wzs8q6w1nb3jb2s36nhr9kv9mc0gyrr6im244"
}
},
@@ -1648,18 +1583,5 @@
"sha1": "09af0b348e6253dcf9fd567d0d22ffebdea46176",
"sha256": "1qg2iyblykfkzmplc2c46916b9m0h5ad6lxmvrk5qn3pdxqr8vw0"
}
},
{
"path": "zprint/zprint/1.1.1/zprint-1.1.1",
"host": "https://repo.clojars.org",
"pom": {
"sha1": "d7225bdc4978d3a8eac8613187cddd2efb9e39d2",
"sha256": "0yyy31h88zww238c2v4zi9va3pjp7ii76zjggglakd3wm1fdbnck"
},
"jar": {
"sha1": "3bd9bbedb188a66ccf72c1e22819e8e423a6757a",
"sha256": "1bvrarxw0dqvxlhj6gdwrv6mklzh4p79537g293fqlm07f2knfph"
}
}
]
+17 -23
View File
@@ -2,16 +2,13 @@ args4j/args4j/2.0.26/args4j-2.0.26.jar
bidi/bidi/2.1.6/bidi-2.1.6.jar
binaryage/env-config/0.2.2/env-config-0.2.2.jar
binaryage/oops/0.7.0/oops-0.7.0.jar
borkdude/edamame/0.0.11-alpha.28/edamame-0.0.11-alpha.28.jar
borkdude/sci.impl.reflector/0.0.1/sci.impl.reflector-0.0.1.jar
borkdude/sci/0.2.1-alpha.1/sci-0.2.1-alpha.1.jar
cider/cider-nrepl/0.25.3/cider-nrepl-0.25.3.jar
cider/piggieback/0.4.1/piggieback-0.4.1.jar
clj-stacktrace/clj-stacktrace/0.2.8/clj-stacktrace-0.2.8.jar
cljfmt/cljfmt/0.6.7/cljfmt-0.6.7.jar
cljs-bean/cljs-bean/1.3.0/cljs-bean-1.3.0.jar
cljsjs/react-dom-server/17.0.1-0/react-dom-server-17.0.1-0.jar
cljsjs/react-dom/17.0.1-0/react-dom-17.0.1-0.jar
cljsjs/react/17.0.1-0/react-17.0.1-0.jar
cljsjs/react-dom/17.0.1-0/react-dom-17.0.1-0.jar
cljsjs/react-dom-server/17.0.1-0/react-dom-server-17.0.1-0.jar
clout/clout/2.1.2/clout-2.1.2.jar
com/andrewmcveigh/cljs-time/0.5.2/cljs-time-0.5.2.jar
com/bhauman/cljs-test-display/0.1.1/cljs-test-display-0.1.1.jar
@@ -22,6 +19,8 @@ com/cognitect/transit-js/0.8.846/transit-js-0.8.846.jar
com/fasterxml/jackson/core/jackson-core/2.8.7/jackson-core-2.8.7.jar
com/google/code/findbugs/jsr305/3.0.1/jsr305-3.0.1.jar
com/google/code/gson/gson/2.7/gson-2.7.jar
com/googlecode/java-diff-utils/diffutils/1.3.0/diffutils-1.3.0.jar
com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar
com/google/elemental2/elemental2-core/1.0.0-RC1/elemental2-core-1.0.0-RC1.jar
com/google/errorprone/error_prone_annotations/2.3.1/error_prone_annotations-2.3.1.jar
com/google/guava/guava/25.1-jre/guava-25.1-jre.jar
@@ -32,25 +31,23 @@ com/google/jsinterop/base/1.0.0/base-1.0.0.jar
com/google/jsinterop/jsinterop-annotations/1.0.2/jsinterop-annotations-1.0.2.jar
com/google/protobuf/protobuf-java/3.11.1/protobuf-java-3.11.1.jar
com/google/re2j/re2j/1.3/re2j-1.3.jar
com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar
com/ibm/icu/icu4j/66.1/icu4j-66.1.jar
commons-codec/commons-codec/1.10/commons-codec-1.10.jar
commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4.jar
commons-io/commons-io/2.6/commons-io-2.6.jar
compojure/compojure/1.5.2/compojure-1.5.2.jar
com/taoensso/encore/2.105.0/encore-2.105.0.jar
com/taoensso/timbre/4.10.0/timbre-4.10.0.jar
com/taoensso/truss/1.5.0/truss-1.5.0.jar
com/taoensso/tufte/2.1.0/tufte-2.1.0.jar
com/wsscode/pathom/2.2.31/pathom-2.2.31.jar
com/wsscode/spec-inspec/1.0.0-alpha2/spec-inspec-1.0.0-alpha2.jar
commons-codec/commons-codec/1.10/commons-codec-1.10.jar
commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4.jar
commons-io/commons-io/2.6/commons-io-2.6.jar
compojure/compojure/1.5.2/compojure-1.5.2.jar
crypto-equality/crypto-equality/1.0.0/crypto-equality-1.0.0.jar
crypto-random/crypto-random/1.2.0/crypto-random-1.2.0.jar
day8/re-frame/test/0.1.5/test-0.1.5.jar
edn-query-language/eql/0.0.9/eql-0.0.9.jar
expound/expound/0.8.5/expound-0.8.5.jar
fipp/fipp/0.6.23/fipp-0.6.23.jar
hashp/hashp/0.2.1/hashp-0.2.1.jar
hiccup/hiccup/1.0.5/hiccup-1.0.5.jar
hickory/hickory/0.7.1/hickory-0.7.1.jar
http-kit/http-kit/2.2.0/http-kit-2.2.0.jar
@@ -61,8 +58,6 @@ javax/servlet/servlet-api/2.5/servlet-api-2.5.jar
javax/xml/bind/jaxb-api/2.3.0/jaxb-api-2.3.0.jar
medley/medley/0.8.2/medley-0.8.2.jar
mvxcvi/alphabase/1.0.0/alphabase-1.0.0.jar
mvxcvi/arrangement/1.2.0/arrangement-1.2.0.jar
mvxcvi/puget/1.3.1/puget-1.3.1.jar
net/cgrand/macrovich/0.2.1/macrovich-0.2.1.jar
nrepl/nrepl/0.7.0/nrepl-0.7.0.jar
org/checkerframework/checker-qual/2.0.0/checker-qual-2.0.0.jar
@@ -71,23 +66,23 @@ org/clojure/clojurescript/1.10.773/clojurescript-1.10.773.jar
org/clojure/core.async/1.3.610/core.async-1.3.610.jar
org/clojure/core.cache/1.0.207/core.cache-1.0.207.jar
org/clojure/core.memoize/1.0.236/core.memoize-1.0.236.jar
org/clojure/core.rrb-vector/0.1.2/core.rrb-vector-0.1.2.jar
org/clojure/core.rrb-vector/0.1.1/core.rrb-vector-0.1.1.jar
org/clojure/core.specs.alpha/0.2.44/core.specs.alpha-0.2.44.jar
org/clojure/data.json/1.0.0/data.json-1.0.0.jar
org/clojure/data.priority-map/1.0.0/data.priority-map-1.0.0.jar
org/clojure/google-closure-library-third-party/0.0-20191016-6ae1f72f/google-closure-library-third-party-0.0-20191016-6ae1f72f.jar
org/clojure/google-closure-library/0.0-20191016-6ae1f72f/google-closure-library-0.0-20191016-6ae1f72f.jar
org/clojure/google-closure-library-third-party/0.0-20191016-6ae1f72f/google-closure-library-third-party-0.0-20191016-6ae1f72f.jar
org/clojure/spec.alpha/0.2.176/spec.alpha-0.2.176.jar
org/clojure/test.check/1.1.0/test.check-1.1.0.jar
org/clojure/tools.analyzer.jvm/1.1.0/tools.analyzer.jvm-1.1.0.jar
org/clojure/tools.analyzer/1.0.0/tools.analyzer-1.0.0.jar
org/clojure/tools.analyzer.jvm/1.1.0/tools.analyzer.jvm-1.1.0.jar
org/clojure/tools.cli/1.0.194/tools.cli-1.0.194.jar
org/clojure/tools.logging/0.4.1/tools.logging-0.4.1.jar
org/clojure/tools.macro/0.1.5/tools.macro-0.1.5.jar
org/clojure/tools.reader/1.3.3/tools.reader-1.3.3.jar
org/codehaus/mojo/animal-sniffer-annotations/1.14/animal-sniffer-annotations-1.14.jar
org/graalvm/js/js-scriptengine/20.1.0/js-scriptengine-20.1.0.jar
org/graalvm/js/js/20.1.0/js-20.1.0.jar
org/graalvm/js/js-scriptengine/20.1.0/js-scriptengine-20.1.0.jar
org/graalvm/regex/regex/20.1.0/regex-20.1.0.jar
org/graalvm/sdk/graal-sdk/20.1.0/graal-sdk-20.1.0.jar
org/graalvm/truffle/truffle-api/20.1.0/truffle-api-20.1.0.jar
@@ -98,23 +93,23 @@ org/jboss/xnio/xnio-api/3.8.0.Final/xnio-api-3.8.0.Final.jar
org/jboss/xnio/xnio-nio/3.8.0.Final/xnio-nio-3.8.0.Final.jar
org/jsoup/jsoup/1.9.2/jsoup-1.9.2.jar
org/msgpack/msgpack/0.6.12/msgpack-0.6.12.jar
org/ow2/asm/asm/7.1/asm-7.1.jar
org/ow2/asm/asm-analysis/7.1/asm-analysis-7.1.jar
org/ow2/asm/asm-commons/7.1/asm-commons-7.1.jar
org/ow2/asm/asm-tree/7.1/asm-tree-7.1.jar
org/ow2/asm/asm-util/7.1/asm-util-7.1.jar
org/ow2/asm/asm/7.1/asm-7.1.jar
org/wildfly/client/wildfly-client-config/1.0.1.Final/wildfly-client-config-1.0.1.Final.jar
org/wildfly/common/wildfly-common/1.5.2.Final/wildfly-common-1.5.2.Final.jar
prismatic/schema/1.1.7/schema-1.1.7.jar
quoin/quoin/0.1.2/quoin-0.1.2.jar
reagent/reagent/1.0.0/reagent-1.0.0.jar
re-com/re-com/2.8.0/re-com-2.8.0.jar
refactor-nrepl/refactor-nrepl/2.5.0/refactor-nrepl-2.5.0.jar
re-frame/re-frame/0.12.0/re-frame-0.12.0.jar
re-frisk-remote/re-frisk-remote/1.6.0/re-frisk-remote-1.6.0.jar
re-frisk/sente/1.15.0/sente-1.15.0.jar
reagent/reagent/1.0.0/reagent-1.0.0.jar
refactor-nrepl/refactor-nrepl/2.5.0/refactor-nrepl-2.5.0.jar
rewrite-clj/rewrite-clj/0.6.1/rewrite-clj-0.6.1.jar
rewrite-cljs/rewrite-cljs/0.4.5/rewrite-cljs-0.4.5.jar
rewrite-cljs/rewrite-cljs/0.4.4/rewrite-cljs-0.4.4.jar
ring-cors/ring-cors/0.1.8/ring-cors-0.1.8.jar
ring/ring-codec/1.1.2/ring-codec-1.1.2.jar
ring/ring-core/1.8.1/ring-core-1.8.1.jar
@@ -125,4 +120,3 @@ thheller/shadow-cljs/2.11.16/shadow-cljs-2.11.16-aot.jar
thheller/shadow-cljsjs/0.0.21/shadow-cljsjs-0.0.21.jar
thheller/shadow-util/0.7.0/shadow-util-0.7.0.jar
viebel/codox-klipse-theme/0.0.1/codox-klipse-theme-0.0.1.jar
zprint/zprint/1.1.1/zprint-1.1.1.jar
-2
View File
@@ -17,8 +17,6 @@ in mkShell {
lsof # used in start-react-native.sh
# build specific utilities
clojure maven watchman
# lint specific utilities
clj-kondo zprint clojure-lsp
# other nice to have stuff
yarn nodejs python27
] # and some special cases
+1 -1
View File
@@ -23,7 +23,7 @@ let
# for calling clojure targets in CI or Makefile
clojure = mkShell {
buildInputs = with pkgs; [ clojure flock maven openjdk ];
buildInputs = with pkgs; [ clojure flock maven openjdk clj-kondo ];
inputsFrom = [ nodejs-sh ];
# CLASSPATH from clojure deps with 'src' appended to find local sources.
shellHook = with pkgs; ''
-1
View File
@@ -89,7 +89,6 @@
"@testing-library/jest-native": "^5.0.0",
"@testing-library/react-native": "^11.2.0",
"@types/jest": "^28.1.6",
"concurrently": "^7.6.0",
"detox": "^19.9.1",
"jest": "^25.1.0",
"jest-circus": "^26.0.0",
+16 -16
View File
@@ -20,7 +20,9 @@
[bidi "2.1.6"]
;; test dependencies
[day8.re-frame/test "0.1.5"]
[com.taoensso/tufte "2.1.0"]]
[com.taoensso/tufte "2.1.0"]
;; linting
[cljfmt/cljfmt "0.6.7"]]
;; port and middleware for repl in development
:nrepl {:port 7888
@@ -81,25 +83,23 @@
:output-dir "target/test"
:optimizations :simple
:target :node-test
;; When running tests without a REPL you can uncomment below line to `make test-watch` a specific file
;; :ns-regexp "status-im.chat.models-test$"
:main
status-im.test-runner/main
;; When running tests without a REPL you can uncomment the below line to `make test-watch` a specific
;; file
;:ns-regexp "status-im.chat.models-test$"
:main status-im.test-runner/main
;; set :ui-driven to true to let shadow-cljs inject node-repl
:ui-driven
true
:ui-driven true
:closure-defines
{status-im.utils.config/POKT_TOKEN #shadow/env "POKT_TOKEN"
status-im.utils.config/OPENSEA_API_KEY #shadow/env "OPENSEA_API_KEY"}
:compiler-options
{;; needed because we override require and it
;; messes with source-map which reports callstack
;; exceeded exceptions instead of real issues
:source-map false
;; needed because we use deref in tests
:static-fns false
:optimizations :simple
:infer-externs true}}
:compiler-options {;; needed because we override require and it
;; messes with source-map which reports callstack
;; exceeded exceptions instead of real issues
:source-map false
;; needed because we use deref in tests
:static-fns false
:optimizations :simple
:infer-externs true}}
;; mock.js-dependencies is mocking the react-native libraries
;; we build it as a node library so that it can be required by
-18
View File
@@ -1,18 +0,0 @@
import { useDerivedValue } from 'react-native-reanimated';
const MAX_SCALE = 1.8;
export function ringScale(scale, subtract) {
return useDerivedValue(
function () {
'worklet'
const value = scale.value;
const maxDelta = MAX_SCALE - 1;
const maxDeltaDiff = 1 - maxDelta;
const maxVirtualScale = MAX_SCALE + maxDelta;
const decimals = value - Math.floor(value);
const normalizedValue = value >= maxVirtualScale ? (decimals + ((parseInt(value) - 1) * maxDeltaDiff) + 1) : value;
return (((normalizedValue - subtract) > MAX_SCALE ? normalizedValue - maxDelta : normalizedValue) - subtract);
}
);
}
-11
View File
@@ -1,5 +1,3 @@
import { useDerivedValue, interpolate } from 'react-native-reanimated';
// Generic Worklets
export function applyAnimationsToStyle(animations, style) {
@@ -29,12 +27,3 @@ export function applyAnimationsToStyle(animations, style) {
return Object.assign(animatedStyle, style);
};
};
export function interpolateValue(sharedValue, inputRange, outputRange) {
return useDerivedValue(
function () {
'worklet'
return interpolate(sharedValue.value, inputRange, outputRange);
}
);
}
+3 -27
View File
@@ -4,22 +4,6 @@
(:require [status-im.utils.test :as utils.test])
(:require [status-im.chat.default-chats :refer (default-chats)]))
;; to generate a js Proxy at js/__STATUS_MOBILE_JS_IDENTITY_PROXY__ that accept any (.xxx) call and
;; return itself
;; For the convenience to mock eg.
;; (-> reanimated/slide-out-up-animation .springify (.damping 20) (.stiffness 300))
;; (-> reanimated/slide-out-up-animation (.damping 20) .springify (.stiffness 300))
(js/eval
"
var globalThis
if (typeof window === \"undefined\") {
globalThis = global
} else {
globalThis = window
}
globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return () => globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__}})
")
(def action-button #js {:default #js {:Item #js {}}})
(def config #js {:default #js {}})
(def camera #js {:RNCamera #js {:Constants #js {}}})
@@ -138,10 +122,8 @@ globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return (
(def react-native-share #js {:default {}})
(def react-native-svg
#js
{:SvgUri #js {:render identity}
:SvgXml #js {:render identity}
:default #js {:render identity}
:Path #js {:render identity}})
{:SvgUri #js {:render identity}
:SvgXml #js {:render identity}})
(def react-native-webview #js {:default {}})
(def react-native-audio-toolkit #js {:MediaStates {}})
(def net-info #js {})
@@ -254,10 +236,7 @@ globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return (
:withTiming (fn [])
:withDelay (fn [])
:Easing #js {:bezier identity}
:Keyframe (fn [])
:SlideOutUp js/__STATUS_MOBILE_JS_IDENTITY_PROXY__
:SlideInUp js/__STATUS_MOBILE_JS_IDENTITY_PROXY__
:LinearTransition js/__STATUS_MOBILE_JS_IDENTITY_PROXY__})
:Keyframe (fn [])})
(def react-native-gesture-handler
#js
{:default #js {}
@@ -342,8 +321,6 @@ globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return (
(def shell-worklets #js {})
(def record-audio-worklets #js {})
;; Update i18n_resources.cljs
(defn mock
[module]
@@ -392,7 +369,6 @@ globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return (
"react-native-svg" react-native-svg
"../src/js/worklet_factory.js" worklet-factory
"../src/js/shell_worklets.js" shell-worklets
"../src/js/record_audio_worklets.js" record-audio-worklets
"./fleets.js" default-fleets
"./chats.js" default-chats
"@walletconnect/client" wallet-connect-client
+3 -3
View File
@@ -7,9 +7,9 @@
(defn date
[value]
[rn/view
{:margin-vertical 16
:padding-right 8
:padding-left 62}
{:margin-vertical 8
:padding-right 20
:padding-left 60}
[text/text
{:weight :medium
:accessibility-label :divider-date-text
@@ -4,7 +4,6 @@
(def container
{:flex 1
:flex-wrap :wrap
:height 18
:flex-direction :row
:align-items :center})
@@ -40,4 +39,4 @@
(defn time-text
[ens?]
{:color colors/neutral-50
:margin-left (if ens? 8 4)})
:margin-left (if ens? 8 4)})
@@ -1,105 +0,0 @@
(ns quo2.components.notifications.count-down-circle
(:require [goog.string :as gstring]
[quo2.foundations.colors :as colors]
[quo2.theme :as theme]
[react-native.core :as rn]
[react-native.svg :as svg]
[reagent.core :as reagent]))
(defn- get-path-props
[size stroke-width rotation]
(let [half-size (/ size 2)
half-stroke-width (/ stroke-width 2)
arc-radius (- half-size half-stroke-width)
arc-diameter (* arc-radius 2)
rotation-indicator (if (= rotation :clockwise) "1,0" "0,1")
path-length (* js/Math.PI arc-diameter)
path (gstring/format
"m %s,%s a %s,%s 0 %s 0,%s a %s,%s 0 %s 0 ,-%s"
half-size
half-stroke-width
arc-radius
arc-radius
rotation-indicator
arc-diameter
arc-radius
arc-radius
rotation-indicator
arc-diameter)]
{:path path
:path-length path-length}))
(defn- linear-ease
[time start goal duration]
(if (zero? duration)
start
(-> time
(/ duration)
(* goal)
(+ start))))
(defn- get-start-at
[duration initial-remaining-time]
(cond (or (zero? duration) (= duration initial-remaining-time)) 0
(number? initial-remaining-time) (- duration initial-remaining-time)
:else 0))
(def ^:private themes
{:color {:light colors/neutral-80-opa-40
:dark colors/white-opa-40}})
(defn circle-timer
[{:keys [color duration size stroke-width trail-color rotation initial-remaining-time]}]
(let [rotation (or rotation :clockwise)
duration (or duration 4)
stroke-width (or stroke-width 1)
size (or size 9)
max-stroke-width (max stroke-width 0)
{:keys [path path-length]} (get-path-props size max-stroke-width rotation)
start-at (get-start-at duration initial-remaining-time)
elapsed-time (reagent/atom 0)
prev-frame-time (reagent/atom nil)
frame-request (reagent/atom nil)
display-time (reagent/atom start-at)
;; get elapsed frame time
swap-elapsed-time-each-frame (fn swap-elapsed-time-each-frame [frame-time]
(if (nil? @prev-frame-time)
(do (reset! prev-frame-time frame-time)
(reset! frame-request (js/requestAnimationFrame
swap-elapsed-time-each-frame)))
(let [delta (- (/ frame-time 1000)
(/ @prev-frame-time 1000))
current-elapsed (swap! elapsed-time + delta)
current-display-time (+ start-at current-elapsed)
completed? (>= current-display-time duration)]
(reset! display-time (if completed?
duration
current-display-time))
(when-not completed?
(reset! prev-frame-time frame-time)
(reset! frame-request (js/requestAnimationFrame
swap-elapsed-time-each-frame))))))]
(reagent/create-class
{:component-will-unmount #(js/cancelAnimationFrame @frame-request)
:reagent-render
(fn []
(reset! frame-request (js/requestAnimationFrame swap-elapsed-time-each-frame))
[rn/view
{:style {:position :relative
:width size
:height size}}
[svg/svg
{:view-box (str "0 0 " size " " size)
:width size
:height size}
[svg/path
{:d path :fill :none :stroke (or trail-color :transparent) :stroke-width stroke-width}]
(when-not (= @display-time duration)
[svg/path
{:d path
:fill :none
:stroke (or color (get-in themes [:color (theme/get-theme)]))
:stroke-linecap :square
:stroke-width stroke-width
:stroke-dasharray path-length
:stroke-dashoffset (linear-ease @display-time 0 path-length duration)}])]])})))
@@ -1,81 +0,0 @@
(ns quo2.components.notifications.toast
(:require [i18n.i18n :as i18n]
[quo2.components.icon :as icon]
[quo2.components.markdown.text :as text]
[quo2.components.notifications.count-down-circle :as count-down-circle]
[quo2.foundations.colors :as colors]
[quo2.theme :as theme]
[react-native.core :as rn]))
(def ^:private themes
{:container {:light {:background-color colors/white-opa-70}
:dark {:background-color colors/neutral-80-opa-70}}
:text {:light {:color colors/neutral-100}
:dark {:color colors/white}}
:icon {:light {:color colors/neutral-100}
:dark {:color colors/white}}
:action-container {:light {:background-color :colors/neutral-80-opa-5}
:dark {:background-color :colors/white-opa-5}}})
(defn- merge-theme-style
[component-key styles]
(merge (get-in themes [component-key (theme/get-theme)]) styles))
(defn toast-action-container
[{:keys [on-press style]} & children]
[rn/touchable-highlight {:on-press on-press}
[into
[rn/view
{:style (merge
{:flex-direction :row
:padding-vertical 3
:padding-horizontal 8
:align-items :center
:border-radius 8
:background-color (get-in themes
[:action-container (theme/get-theme)
:background-color])}
style)}]
children]])
(defn toast-undo-action
[duration on-press]
[toast-action-container {:on-press on-press}
[rn/view {:style {:margin-right 5}}
[count-down-circle/circle-timer {:duration duration}]]
[text/text
{:size :paragraph-2 :weight :medium :style (merge-theme-style :text {})}
[i18n/label :t/undo]]])
(defn- toast-container
[{:keys [left middle right]}]
[rn/view {:style {:padding-left 12 :padding-right 12}}
[rn/view
{:style (merge-theme-style :container
{:flex-direction :row
:width "100%"
:margin :auto
:justify-content :space-between
:padding-vertical 8
:padding-left 10
:padding-right 8
:border-radius 12})}
[rn/view {:style {:padding 2}} left]
[rn/view {:style {:padding 4 :flex 1}}
[text/text
{:size :paragraph-2 :weight :medium :style (merge-theme-style :text {})}
middle]]
(when right right)]])
(defn toast
[{:keys [icon icon-color text action undo-duration undo-on-press]}]
[toast-container
{:left (when icon
[icon/icon icon
{:container-style {:width 20 :height 20}
:color (or icon-color
(get-in themes [:icon (theme/get-theme) :color]))}])
:middle text
:right (if undo-duration
[toast-undo-action undo-duration undo-on-press]
action)}])
+9 -44
View File
@@ -1,31 +1,18 @@
(ns quo2.components.reactions.reaction
(:require [quo2.components.icon :as icons]
[quo2.components.markdown.text :as quo2.text]
[quo2.components.markdown.text :as text]
[quo2.components.reactions.style :as style]
[quo2.foundations.colors :as colors]
[quo2.theme :as theme]
[react-native.core :as rn]))
(def reaction-styling
{:flex-direction :row
:justify-content :center
:align-items :center
:padding-horizontal 8
:border-radius 8
:height 24})
(defn open-reactions-menu
(defn add-reaction
[{:keys [on-press]}]
(let [dark? (theme/dark?)]
[rn/touchable-opacity
{:on-press on-press
:accessibility-label :emoji-reaction-add
:style (merge reaction-styling
{:padding-horizontal 9
:border-width 1
:margin-top 5
:border-color (if dark?
colors/neutral-70
colors/neutral-30)})}
:style (style/add-reaction)}
[icons/icon :i/add
{:size 20
:color (if dark?
@@ -35,41 +22,19 @@
(defn reaction
"Add your emoji as a param here"
[{:keys [emoji clicks neutral? on-press accessibility-label]}]
(let [dark? (theme/dark?)
text-color (if dark?
colors/white
colors/neutral-100)
numeric-value (int clicks)
clicks-positive? (pos? numeric-value)]
(let [numeric-value (int clicks)]
[rn/touchable-opacity
{:on-press on-press
:accessibility-label accessibility-label
:style (merge reaction-styling
(cond->
{:background-color
(if dark?
(if neutral?
colors/neutral-70
:transparent)
(if neutral?
colors/neutral-30
:transparent))}
(and dark? (not neutral?))
(assoc :border-color colors/neutral-70
:border-width 1)
(and (not dark?) (not neutral?))
(assoc :border-color colors/neutral-30
:border-width 1)))}
:style (style/reaction neutral?)}
[icons/icon emoji
{:no-color true
:size 16}]
[quo2.text/text
[text/text
{:size :paragraph-2
:weight :semi-bold
:color text-color
:flex-direction :row
:align-items :center
:justify-content :center}
(if clicks-positive?
(str " " numeric-value)
"")]]))
(when (pos? numeric-value)
(str " " numeric-value))]]))
+34
View File
@@ -0,0 +1,34 @@
(ns quo2.components.reactions.style
(:require [quo2.foundations.colors :as colors]))
(def reaction-styling
{:flex-direction :row
:justify-content :center
:align-items :center
:padding-horizontal 8
:border-radius 8
:height 24})
(defn add-reaction
[]
(merge reaction-styling
{:padding-horizontal 9
:border-width 1
:border-color (colors/theme-colors colors/neutral-30 colors/neutral-70)}))
(defn reaction
[neutral?]
(merge reaction-styling
(cond->
{:background-color (colors/theme-colors (if neutral?
colors/neutral-30
:transparent)
(if neutral?
colors/neutral-70
:transparent))}
(and (colors/dark?) (not neutral?))
(assoc :border-color colors/neutral-70
:border-width 1)
(and (not (colors/dark?)) (not neutral?))
(assoc :border-color colors/neutral-30
:border-width 1))))
@@ -1,228 +0,0 @@
(ns quo2.components.record-audio.record-audio.style
(:require [quo2.foundations.colors :as colors]
[react-native.reanimated :as reanimated]))
(defn animated-circle
[scale opacity color]
(reanimated/apply-animations-to-style
{:transform [{:scale scale}]
:opacity opacity}
{:width 56
:height 56
:border-width 1
:border-color color
:border-radius 28
:position :absolute
:justify-content :center
:align-items :center
:z-index 0}))
(defn record-button-big-container
[translate-x translate-y opacity]
(reanimated/apply-animations-to-style
{:transform [{:translateY translate-y}
{:translateX translate-x}]
:opacity opacity}
{:position :absolute
:bottom 0
:right 0
:width 96
:height 96
:align-items :center
:justify-content :center
:z-index 0}))
(defn record-button-big-body
[button-color]
{:width 56
:height 56
:border-radius 28
:justify-content :center
:align-items :center
:background-color button-color
:overflow :hidden})
(defn record-button-big-red-overlay
[red-overlay-opacity]
(reanimated/apply-animations-to-style
{:opacity red-overlay-opacity}
{:position :absolute
:top 0
:left 0
:right 0
:bottom 0
:background-color colors/danger-50}))
(defn record-button-big-gray-overlay
[gray-overlay-opacity]
(reanimated/apply-animations-to-style
{:opacity gray-overlay-opacity}
{:position :absolute
:top 0
:left 0
:right 0
:bottom 0
:background-color (colors/theme-colors colors/neutral-80-opa-5-opaque colors/neutral-80)}))
(defn record-button-big-icon-container
[icon-opacity]
(reanimated/apply-animations-to-style
{:opacity icon-opacity}
{}))
(def stop-icon
{:width 13
:height 13
:border-radius 4
:background-color colors/white})
(defn send-button-container
[opacity]
(reanimated/apply-animations-to-style
{:opacity opacity}
{:justify-content :center
:align-items :center
:position :absolute
:width 56
:height 56
:top 0
:right 20}))
(defn send-button-connector
[opacity width height border-radius-first-half border-radius-second-half]
(reanimated/apply-animations-to-style
{:opacity opacity
:width width
:height height
:border-bottom-left-radius border-radius-second-half
:border-top-left-radius border-radius-first-half
:border-top-right-radius border-radius-first-half
:border-bottom-right-radius border-radius-second-half}
{:justify-content :center
:align-items :center
:align-self :center
:background-color colors/primary-50
:z-index 0}))
(defn send-button
[translate-y opacity]
(reanimated/apply-animations-to-style
{:transform [{:translateY translate-y}]
:opacity opacity}
{:justify-content :center
:align-items :center
:background-color colors/primary-50
:width 32
:height 32
:border-radius 16
:position :absolute
:top 0
:right 32
:z-index 10}))
(def send-icon-container
{:z-index 10})
(defn lock-button-container
[opacity]
(reanimated/apply-animations-to-style
{:opacity opacity}
{:transform [{:rotate "45deg"}]
:justify-content :center
:align-items :center
:position :absolute
:width 56
:height 56
:top 20
:left 20}))
(defn lock-button-connector
[opacity width height border-radius-first-half border-radius-second-half]
(reanimated/apply-animations-to-style
{:opacity opacity
:width width
:height height
:border-bottom-left-radius border-radius-first-half
:border-top-left-radius border-radius-first-half
:border-top-right-radius border-radius-second-half
:border-bottom-right-radius border-radius-second-half}
{:justify-content :center
:align-items :center
:align-self :center
:background-color (colors/theme-colors colors/neutral-80-opa-5-opaque colors/neutral-80)
:overflow :hidden}))
(defn lock-button
[translate-x-y opacity]
(reanimated/apply-animations-to-style
{:transform [{:translateX translate-x-y}
{:translateY translate-x-y}]
:opacity opacity}
{:width 32
:height 32
:justify-content :center
:align-items :center
:background-color (colors/theme-colors colors/neutral-80-opa-5-opaque colors/neutral-80)
:border-radius 16
:position :absolute
:top 24
:left 24
:overflow :hidden
:z-index 12}))
(defn delete-button-container
[opacity]
(reanimated/apply-animations-to-style
{:opacity opacity}
{:justify-content :center
:align-items :center
:position :absolute
:width 56
:height 56
:bottom 20
:left 0}))
(defn delete-button-connector
[opacity width height border-radius-first-half border-radius-second-half]
(reanimated/apply-animations-to-style
{:opacity opacity
:width width
:height height
:border-bottom-left-radius border-radius-first-half
:border-top-left-radius border-radius-first-half
:border-top-right-radius border-radius-second-half
:border-bottom-right-radius border-radius-second-half}
{:justify-content :center
:align-items :center
:align-self :center
:background-color colors/danger-50
:z-index 0}))
(defn delete-button
[translate-x opacity]
(reanimated/apply-animations-to-style
{:transform [{:translateX translate-x}]
:opacity opacity}
{:width 32
:height 32
:justify-content :center
:align-items :center
:background-color colors/danger-50
:border-radius 16
:position :absolute
:top 76
:left 0
:z-index 11}))
(defn record-button-container
[opacity]
(reanimated/apply-animations-to-style
{:opacity opacity}
{:margin-bottom 32
:margin-right 32}))
(def input-container
{:width 140
:height 140
:align-items :flex-end
:justify-content :flex-end})
@@ -1,767 +0,0 @@
(ns quo2.components.record-audio.record-audio.view
(:require [cljs-bean.core :as bean]
[oops.core :as oops]
[quo.react :refer [effect! memo]]
[quo2.components.buttons.button :as button]
[quo2.components.icon :as icons]
[quo2.components.record-audio.record-audio.style :as style]
[quo2.foundations.colors :as colors]
[react-native.core :as rn]
[react-native.reanimated :as reanimated]
[reagent.core :as reagent]
[status-im.utils.utils :as utils]))
(def ^:private scale-to-each 1.8)
(def ^:private scale-to-total 2.6)
(def ^:private scale-padding 0.16)
(def ^:private opacity-from-lock 1)
(def ^:private opacity-from-default 0.5)
(def ^:private signal-anim-duration 3900)
(def ^:private signal-anim-duration-2 1950)
(def ^:private animated-ring
(reagent/adapt-react-class
(memo
(fn [props]
(let [{:keys [scale opacity color]} (bean/bean props)]
(reagent/as-element
[reanimated/view {:style (style/animated-circle scale opacity color)}]))))))
(def ^:private record-button-area-big
{:width 56
:height 56
:x 64
:y 64})
(def ^:private record-button-area
{:width 48
:height 48
:x 68
:y 68})
(defn- delete-button-area
[active?]
{:width (if active? 72 82)
:height 56
:x (if active? -16 -32)
:y (if active? 64 70)})
(defn- lock-button-area
[active?]
{:width (if active? 72 100)
:height (if active? 72 102)
:x -32
:y -32})
(defn- send-button-area
[active?]
{:width 56
:height (if active? 72 92)
:x 68
:y (if active? -16 -32)})
(defn- touch-inside-area?
[{:keys [location-x location-y ignore-min-y? ignore-max-y? ignore-min-x? ignore-max-x?]}
{:keys [width height x y]}]
(let [max-x (+ x width)
max-y (+ y height)]
(and
(and
(or ignore-min-x? (>= location-x x))
(or ignore-max-x? (<= location-x max-x)))
(and
(or ignore-min-y? (>= location-y y))
(or ignore-max-y? (<= location-y max-y))))))
(def record-audio-worklets (js/require "../src/js/record_audio_worklets.js"))
(defn- ring-scale
[scale substract]
(.ringScale ^js record-audio-worklets
scale
substract))
(defn- record-button-big
[recording? ready-to-send? ready-to-lock? ready-to-delete? record-button-is-animating?
record-button-at-initial-position? locked? reviewing-audio? recording-timer recording-length-ms
clear-timeout touch-active?]
[:f>
(fn []
(let [scale (reanimated/use-shared-value 1)
opacity (reanimated/use-shared-value 0)
opacity-from (if @ready-to-lock? opacity-from-lock opacity-from-default)
animations (map
(fn [index]
(let [ring-scale (ring-scale scale (* scale-padding index))]
{:scale ring-scale
:opacity (reanimated/interpolate ring-scale
[1 scale-to-each]
[opacity-from 0])}))
(range 0 5))
rings-color (cond
@ready-to-lock? (colors/theme-colors colors/neutral-80-opa-5-opaque
colors/neutral-80)
@ready-to-delete? colors/danger-50
:else colors/primary-50)
translate-y (reanimated/use-shared-value 0)
translate-x (reanimated/use-shared-value 0)
button-color colors/primary-50
icon-color (if (and (not (colors/dark?)) @ready-to-lock?) colors/black colors/white)
icon-opacity (reanimated/use-shared-value 1)
red-overlay-opacity (reanimated/use-shared-value 0)
gray-overlay-opacity (reanimated/use-shared-value 0)
complete-animation (fn []
(cond
(and @ready-to-lock? (not @record-button-is-animating?))
(do
(reset! locked? true)
(reset! ready-to-lock? false))
(and (not @locked?) (not @reviewing-audio?))
(do
(reset! recording? false)
(reset! ready-to-send? false)
(reset! ready-to-delete? false)
(reset! ready-to-lock? false)
(utils/clear-interval @recording-timer)
(reset! recording-length-ms 0))))
start-animation (fn []
(reanimated/set-shared-value opacity 1)
(reanimated/animate-shared-value-with-timing scale
2.6
signal-anim-duration
:linear)
;; TODO: Research if we can implement this with withSequence method
;; from Reanimated 2
;; GitHub issue [#14561]:
;; https://github.com/status-im/status-mobile/issues/14561
(reset! clear-timeout
(utils/set-timeout
#(do (reanimated/set-shared-value scale scale-to-each)
(reanimated/animate-shared-value-with-delay-repeat
scale
scale-to-total
signal-anim-duration-2
:linear
0
-1))
signal-anim-duration)))
stop-animation (fn []
(reanimated/set-shared-value opacity 0)
(reanimated/cancel-animation scale)
(reanimated/set-shared-value scale 1)
(when @clear-timeout (utils/clear-timeout @clear-timeout)))
start-y-animation (fn []
(reset! record-button-at-initial-position? false)
(reset! record-button-is-animating? true)
(reanimated/animate-shared-value-with-timing translate-y
-64
250
:easing1)
(reanimated/animate-shared-value-with-delay icon-opacity
0 33.33
:linear 76.66)
(utils/set-timeout (fn []
(reset! record-button-is-animating? false)
(when-not @touch-active? (complete-animation)))
250))
reset-y-animation (fn []
(reanimated/animate-shared-value-with-timing translate-y
0
300
:easing1)
(reanimated/animate-shared-value-with-timing icon-opacity
1
500
:linear)
(utils/set-timeout (fn []
(reset! record-button-at-initial-position? true))
500))
start-x-animation (fn []
(reset! record-button-at-initial-position? false)
(reset! record-button-is-animating? true)
(reanimated/animate-shared-value-with-timing translate-x
-64
250
:easing1)
(reanimated/animate-shared-value-with-delay icon-opacity
0 33.33
:linear 76.66)
(reanimated/animate-shared-value-with-timing red-overlay-opacity
1
33.33
:linear)
(utils/set-timeout (fn []
(reset! record-button-is-animating? false)
(when-not @touch-active? (complete-animation)))
250))
reset-x-animation (fn []
(reanimated/animate-shared-value-with-timing translate-x
0
300
:easing1)
(reanimated/animate-shared-value-with-timing icon-opacity
1
500
:linear)
(reanimated/animate-shared-value-with-timing red-overlay-opacity
0
100
:linear)
(utils/set-timeout (fn []
(reset! record-button-at-initial-position? true))
500))
start-x-y-animation (fn []
(reset! record-button-at-initial-position? false)
(reset! record-button-is-animating? true)
(reanimated/animate-shared-value-with-timing translate-y
-44
200
:easing1)
(reanimated/animate-shared-value-with-timing translate-x
-44
200
:easing1)
(reanimated/animate-shared-value-with-delay icon-opacity
0 33.33
:linear 33.33)
(reanimated/animate-shared-value-with-timing gray-overlay-opacity
1
33.33
:linear)
(utils/set-timeout (fn []
(reset! record-button-is-animating? false)
(when-not @touch-active? (complete-animation)))
200))
reset-x-y-animation (fn []
(reanimated/animate-shared-value-with-timing translate-y
0
300
:easing1)
(reanimated/animate-shared-value-with-timing translate-x
0
300
:easing1)
(reanimated/animate-shared-value-with-timing icon-opacity
1
500
:linear)
(reanimated/animate-shared-value-with-timing gray-overlay-opacity
0
800
:linear)
(utils/set-timeout (fn []
(reset! record-button-at-initial-position? true))
800))]
(effect! #(cond
@recording?
(start-animation)
(not @ready-to-lock?)
(stop-animation))
[@recording?])
(effect! #(if @ready-to-lock?
(start-x-y-animation)
(reset-x-y-animation))
[@ready-to-lock?])
(effect! #(if @ready-to-send?
(start-y-animation)
(reset-y-animation))
[@ready-to-send?])
(effect! #(if @ready-to-delete?
(start-x-animation)
(reset-x-animation))
[@ready-to-delete?])
[reanimated/view
{:style (style/record-button-big-container translate-x translate-y opacity)
:pointer-events :none}
[:<>
(map-indexed
(fn [id animation]
^{:key id}
[animated-ring
{:scale (:scale animation)
:opacity (:opacity animation)
:color rings-color}])
animations)]
[rn/view {:style (style/record-button-big-body button-color)}
[reanimated/view {:style (style/record-button-big-red-overlay red-overlay-opacity)}]
[reanimated/view {:style (style/record-button-big-gray-overlay gray-overlay-opacity)}]
[reanimated/view {:style (style/record-button-big-icon-container icon-opacity)}
(if @locked?
[rn/view {:style style/stop-icon}]
[icons/icon :i/audio {:color icon-color}])]]]))])
(defn- send-button
[recording? ready-to-send? reviewing-audio?]
[:f>
(fn []
(let [opacity (reanimated/use-shared-value 0)
translate-y (reanimated/use-shared-value 20)
connector-opacity (reanimated/use-shared-value 0)
width (reanimated/use-shared-value 12)
height (reanimated/use-shared-value 24)
border-radius-first-half (reanimated/use-shared-value 16)
border-radius-second-half (reanimated/use-shared-value 8)
start-y-animation (fn []
(reanimated/animate-shared-value-with-delay translate-y
12 50
:linear 133.33)
(reanimated/animate-shared-value-with-delay connector-opacity
1 0
:easing1 93.33)
(reanimated/animate-shared-value-with-delay width
56 83.33
:easing1 80)
(reanimated/animate-shared-value-with-delay height
56 83.33
:easing1 80)
(reanimated/animate-shared-value-with-delay
border-radius-first-half
28 83.33
:easing1 80)
(reanimated/animate-shared-value-with-delay
border-radius-second-half
28 83.33
:easing1 80))
reset-y-animation (fn []
(reanimated/animate-shared-value-with-timing translate-y
0
100
:linear)
(reanimated/set-shared-value connector-opacity 0)
(reanimated/set-shared-value width 12)
(reanimated/set-shared-value height 24)
(reanimated/set-shared-value border-radius-first-half 16)
(reanimated/set-shared-value border-radius-second-half 8))
fade-in-animation (fn []
(reanimated/animate-shared-value-with-timing translate-y
0
200
:linear)
(reanimated/animate-shared-value-with-timing opacity
1
200
:linear))
fade-out-animation (fn []
(reanimated/animate-shared-value-with-timing translate-y
(if @reviewing-audio?
76
20)
200
:linear)
(when-not @reviewing-audio?
(reanimated/animate-shared-value-with-timing opacity
0
200
:linear))
(reanimated/set-shared-value connector-opacity 0)
(reanimated/set-shared-value width 24)
(reanimated/set-shared-value height 12)
(reanimated/set-shared-value border-radius-first-half 8)
(reanimated/set-shared-value border-radius-second-half 16))
fade-out-reset-animation (fn []
(reanimated/animate-shared-value-with-timing opacity
0
200
:linear)
(reanimated/animate-shared-value-with-delay translate-y
20 0
:linear 200)
(reanimated/set-shared-value connector-opacity 0)
(reanimated/set-shared-value width 24)
(reanimated/set-shared-value height 12)
(reanimated/set-shared-value border-radius-first-half 8)
(reanimated/set-shared-value border-radius-second-half 16))]
(effect! #(if @recording?
(fade-in-animation)
(fade-out-animation))
[@recording?])
(effect! #(when-not @reviewing-audio?
(fade-out-reset-animation))
[@reviewing-audio?])
(effect! #(cond
@ready-to-send?
(start-y-animation)
@recording? (reset-y-animation))
[@ready-to-send?])
[:<>
[reanimated/view {:style (style/send-button-container opacity)}
[reanimated/view
{:style (style/send-button-connector connector-opacity
width
height
border-radius-first-half
border-radius-second-half)}]]
[reanimated/view
{:style (style/send-button translate-y opacity)
:pointer-events :none}
[icons/icon :i/arrow-up
{:color colors/white
:size 20
:container-style style/send-icon-container}]]]))])
(defn- lock-button
[recording? ready-to-lock? locked?]
[:f>
(fn []
(let [translate-x-y (reanimated/use-shared-value 20)
opacity (reanimated/use-shared-value 0)
connector-opacity (reanimated/use-shared-value 0)
width (reanimated/use-shared-value 24)
height (reanimated/use-shared-value 12)
border-radius-first-half (reanimated/use-shared-value 8)
border-radius-second-half (reanimated/use-shared-value 8)
start-x-y-animation (fn []
(reanimated/animate-shared-value-with-delay translate-x-y
8 50
:linear 116.66)
(reanimated/animate-shared-value-with-delay connector-opacity
1 0
:easing1 80)
(reanimated/animate-shared-value-with-delay width
56 83.33
:easing1 63.33)
(reanimated/animate-shared-value-with-delay height
56 83.33
:easing1 63.33)
(reanimated/animate-shared-value-with-delay
border-radius-first-half
28 83.33
:easing1 63.33)
(reanimated/animate-shared-value-with-delay
border-radius-second-half
28 83.33
:easing1 63.33))
reset-x-y-animation (fn []
(reanimated/animate-shared-value-with-timing translate-x-y
0
100
:linear)
(reanimated/set-shared-value connector-opacity 0)
(reanimated/set-shared-value width 24)
(reanimated/set-shared-value height 12)
(reanimated/set-shared-value border-radius-first-half 8)
(reanimated/set-shared-value border-radius-second-half 16))
fade-in-animation (fn []
(reanimated/animate-shared-value-with-timing translate-x-y
0
220
:linear)
(reanimated/animate-shared-value-with-timing opacity
1
220
:linear))
fade-out-animation (fn []
(reanimated/animate-shared-value-with-timing translate-x-y
20
200
:linear)
(reanimated/animate-shared-value-with-timing opacity
0
200
:linear)
(reanimated/set-shared-value connector-opacity 0)
(reanimated/set-shared-value width 24)
(reanimated/set-shared-value height 12)
(reanimated/set-shared-value border-radius-first-half 8)
(reanimated/set-shared-value border-radius-second-half 16))]
(effect! #(if @recording?
(fade-in-animation)
(fade-out-animation))
[@recording?])
(effect! #(cond
@ready-to-lock?
(start-x-y-animation)
(and @recording? (not @locked?))
(reset-x-y-animation))
[@ready-to-lock?])
(effect! #(if @locked?
(fade-out-animation)
(reset-x-y-animation))
[@locked?])
[:<>
[reanimated/view {:style (style/lock-button-container opacity)}
[reanimated/view
{:style (style/lock-button-connector connector-opacity
width
height
border-radius-first-half
border-radius-second-half)}]]
[reanimated/view
{:style (style/lock-button translate-x-y opacity)
:pointer-events :none}
[icons/icon (if @ready-to-lock? :i/locked :i/unlocked)
{:color (colors/theme-colors colors/black colors/white)
:size 20}]]]))])
(defn- delete-button
[recording? ready-to-delete?]
[:f>
(fn []
(let [opacity (reanimated/use-shared-value 0)
translate-x (reanimated/use-shared-value 20)
connector-opacity (reanimated/use-shared-value 0)
width (reanimated/use-shared-value 24)
height (reanimated/use-shared-value 12)
border-radius-first-half (reanimated/use-shared-value 8)
border-radius-second-half (reanimated/use-shared-value 8)
start-x-animation (fn []
(reanimated/animate-shared-value-with-delay translate-x
12 50
:linear 133.33)
(reanimated/animate-shared-value-with-delay connector-opacity
1 0
:easing1 93.33)
(reanimated/animate-shared-value-with-delay width
56 83.33
:easing1 80)
(reanimated/animate-shared-value-with-delay height
56 83.33
:easing1 80)
(reanimated/animate-shared-value-with-delay
border-radius-first-half
28 83.33
:easing1 80)
(reanimated/animate-shared-value-with-delay
border-radius-second-half
28 83.33
:easing1 80))
reset-x-animation (fn []
(reanimated/animate-shared-value-with-timing translate-x
0
100
:linear)
(reanimated/set-shared-value connector-opacity 0)
(reanimated/set-shared-value width 24)
(reanimated/set-shared-value height 12)
(reanimated/set-shared-value border-radius-first-half 8)
(reanimated/set-shared-value border-radius-second-half 16))
fade-in-animation (fn []
(reanimated/animate-shared-value-with-timing translate-x
0
200
:linear)
(reanimated/animate-shared-value-with-timing opacity
1
200
:linear))
fade-out-animation (fn []
(reanimated/animate-shared-value-with-timing translate-x
20
200
:linear)
(reanimated/animate-shared-value-with-timing opacity
0
200
:linear)
(reanimated/set-shared-value connector-opacity 0)
(reanimated/set-shared-value width 24)
(reanimated/set-shared-value height 12)
(reanimated/set-shared-value border-radius-first-half 8)
(reanimated/set-shared-value border-radius-second-half 16))]
(effect! #(if @recording?
(fade-in-animation)
(fade-out-animation))
[@recording?])
(effect! #(cond
@ready-to-delete?
(start-x-animation)
@recording?
(reset-x-animation))
[@ready-to-delete?])
[:<>
[reanimated/view {:style (style/delete-button-container opacity)}
[reanimated/view
{:style (style/delete-button-connector connector-opacity
width
height
border-radius-first-half
border-radius-second-half)}]]
[reanimated/view
{:style (style/delete-button translate-x opacity)
:pointer-events :none}
[icons/icon :i/delete
{:color colors/white
:size 20}]]]))])
(defn- record-button
[recording? reviewing-audio?]
[:f>
(fn []
(let [opacity (reanimated/use-shared-value 1)
show-animation #(reanimated/set-shared-value opacity 1)
hide-animation #(reanimated/set-shared-value opacity 0)]
(effect! #(if (or @recording? @reviewing-audio?)
(hide-animation)
(show-animation))
[@recording? @reviewing-audio?])
[reanimated/view {:style (style/record-button-container opacity)}
[button/button
{:type :outline
:size 32
:width 32
:accessibility-label :mic-button}
[icons/icon :i/audio {:color (colors/theme-colors colors/neutral-100 colors/white)}]]]))])
(defn input-view
[]
[:f>
(fn []
(let [recording? (reagent/atom false)
locked? (reagent/atom false)
ready-to-send? (reagent/atom false)
ready-to-lock? (reagent/atom false)
ready-to-delete? (reagent/atom false)
reviewing-audio? (reagent/atom false)
clear-timeout (atom nil)
record-button-at-initial-position? (atom true)
record-button-is-animating? (atom false)
touch-active? (atom false)
recording-timer (atom nil)
recording-length-ms (atom 0)
on-start-should-set-responder
(fn [^js e]
(when-not @locked?
(let [pressed-record-button? (touch-inside-area?
{:location-x (oops/oget e "nativeEvent.locationX")
:location-y (oops/oget e "nativeEvent.locationY")
:ignore-min-y? false
:ignore-max-y? false
:ignore-min-x? false
:ignore-max-x? false}
record-button-area)]
(when-not @reviewing-audio?
(reset! recording? pressed-record-button?)
(when pressed-record-button?
;; TODO: By now we just track recording length, we need to add actual audio
;; recording logic
;; GitHub issue [#14558]: https://github.com/status-im/status-mobile/issues/14558
(reset! recording-timer (utils/set-interval #(reset! recording-length-ms
(+ @recording-length-ms 500))
500))))
(reset! touch-active? true)))
true)
on-responder-move
(fn [^js e]
(when-not @locked?
(let [location-x (oops/oget e "nativeEvent.locationX")
location-y (oops/oget e "nativeEvent.locationY")
page-x (oops/oget e "nativeEvent.pageX")
page-y (oops/oget e "nativeEvent.pageY")
moved-to-send-button? (touch-inside-area?
{:location-x location-x
:location-y location-y
:ignore-min-y? true
:ignore-max-y? false
:ignore-min-x? false
:ignore-max-x? true}
(send-button-area @ready-to-send?))
moved-to-delete-button? (touch-inside-area?
{:location-x location-x
:location-y location-y
:ignore-min-y? false
:ignore-max-y? true
:ignore-min-x? true
:ignore-max-x? false}
(delete-button-area @ready-to-delete?))
moved-to-lock-button? (touch-inside-area?
{:location-x location-x
:location-y location-y
:ignore-min-y? false
:ignore-max-y? false
:ignore-min-x? false
:ignore-max-x? false}
(lock-button-area @ready-to-lock?))
moved-to-record-button? (and
(touch-inside-area?
{:location-x location-x
:location-y location-y
:ignore-min-y? false
:ignore-max-y? false
:ignore-min-x? false
:ignore-max-x? false}
record-button-area-big)
(not= location-x page-x)
(not= location-y page-y))]
(cond
(and
(or
(and moved-to-record-button? @ready-to-lock?)
(and (not @locked?) moved-to-lock-button? @record-button-at-initial-position?))
(not @ready-to-delete?)
(not @ready-to-send?)
@recording?)
(reset! ready-to-lock? moved-to-lock-button?)
(and
(or
(and moved-to-record-button? @ready-to-delete?)
(and moved-to-delete-button? @record-button-at-initial-position?))
(not @ready-to-lock?)
(not @ready-to-send?)
@recording?)
(reset! ready-to-delete? moved-to-delete-button?)
(and
(or
(and moved-to-record-button? @ready-to-send?)
(and moved-to-send-button? @record-button-at-initial-position?))
(not @ready-to-lock?)
(not @ready-to-delete?)
@recording?)
(reset! ready-to-send? moved-to-send-button?)))))
on-responder-release
(fn [^js e]
(let [on-record-button? (touch-inside-area?
{:location-x (oops/oget e "nativeEvent.locationX")
:location-y (oops/oget e "nativeEvent.locationY")
:ignore-min-y? false
:ignore-max-y? false
:ignore-min-x? false
:ignore-max-x? false}
(if @reviewing-audio? record-button-area record-button-area-big))]
(cond
(and @reviewing-audio? on-record-button?)
(reset! reviewing-audio? false)
(and @ready-to-lock? (not @record-button-is-animating?))
(do
(reset! locked? true)
(reset! ready-to-lock? false))
(and (not @reviewing-audio?) on-record-button?)
(do
(when (>= @recording-length-ms 500) (reset! reviewing-audio? true))
(reset! locked? false)
(reset! recording? false)
(reset! ready-to-lock? false)
(utils/clear-interval @recording-timer)
(reset! recording-length-ms 0))
(and (not @locked?) (not @reviewing-audio?) (not @record-button-is-animating?))
(do
(reset! recording? false)
(reset! ready-to-send? false)
(reset! ready-to-delete? false)
(reset! ready-to-lock? false)
(utils/clear-interval @recording-timer)
(reset! recording-length-ms 0))))
(reset! touch-active? false))]
(fn []
[rn/view
{:style style/input-container
:pointer-events :box-only
:on-start-should-set-responder on-start-should-set-responder
:on-responder-move on-responder-move
:on-responder-release on-responder-release}
[delete-button recording? ready-to-delete?]
[lock-button recording? ready-to-lock? locked?]
[send-button recording? ready-to-send? reviewing-audio?]
[record-button-big
recording?
ready-to-send?
ready-to-lock?
ready-to-delete?
record-button-is-animating?
record-button-at-initial-position?
locked?
reviewing-audio?
recording-timer
recording-length-ms
clear-timeout
touch-active?]
[record-button recording? reviewing-audio?]])))])
+14 -26
View File
@@ -1,6 +1,5 @@
(ns quo2.components.tags.context-tags
(:require [quo2.components.avatars.group-avatar :as group-avatar]
[quo2.components.icon :as icons]
[quo2.components.markdown.text :as text]
[quo2.foundations.colors :as colors]
[quo2.theme :as quo2.theme]
@@ -58,31 +57,20 @@
(trim-public-key public-key)]]))
(defn context-tag
[_ _]
(fn [params photo name channel-name]
(let [text-style (:text-style params)
text-params {:weight :medium
:size :paragraph-2
:style (assoc text-style :justify-content :center)}
icon-color (colors/theme-colors colors/neutral-50 colors/neutral-40)]
[base-tag (assoc-in params [:style :padding-left] 3)
[rn/image
{:style {:width 20
:border-radius 10
:background-color :white
:height 20}
:source photo}]
[rn/view
{:style {:align-items :center
:flex-direction :row}}
[text/text text-params (str " " name)]
(when channel-name
[:<>
[icons/icon
:i/chevron-right
{:color icon-color
:size 16}]
[text/text text-params (str "# " channel-name)]])]])))
[params photo name]
(let [text-style (params :text-style)]
[base-tag (assoc-in params [:style :padding-left] 3)
[rn/image
{:style {:width 20
:border-radius 10
:background-color :white
:height 20}
:source photo}]
[text/text
(merge {:weight :medium
:size :paragraph-2}
{:style text-style})
(str " " name)]]))
(defn user-avatar-tag
[]
+48 -50
View File
@@ -1,54 +1,51 @@
(ns quo2.core
(:require
quo2.components.avatars.account-avatar
quo2.components.avatars.channel-avatar
quo2.components.avatars.group-avatar
quo2.components.avatars.icon-avatar
quo2.components.avatars.user-avatar
quo2.components.avatars.wallet-user-avatar
quo2.components.buttons.button
quo2.components.buttons.dynamic-button
quo2.components.community.community-card-view
quo2.components.community.community-list-view
quo2.components.community.community-view
quo2.components.community.discover-card
quo2.components.community.token-gating
quo2.components.counter.counter
quo2.components.dividers.date
quo2.components.dividers.divider-label
quo2.components.dividers.new-messages
quo2.components.drawers.action-drawers
quo2.components.dropdowns.dropdown
quo2.components.header
quo2.components.icon
quo2.components.info.info-message
quo2.components.info.information-box
quo2.components.list-items.channel
quo2.components.list-items.menu-item
quo2.components.list-items.preview-list
quo2.components.loaders.skeleton
quo2.components.markdown.text
quo2.components.messages.gap
quo2.components.messages.system-message
quo2.components.navigation.floating-shell-button
quo2.components.navigation.page-nav
quo2.components.notifications.activity-log.view
quo2.components.notifications.count-down-circle
quo2.components.notifications.info-count
quo2.components.notifications.notification-dot
quo2.components.notifications.toast
quo2.components.reactions.reaction
quo2.components.selectors.disclaimer
quo2.components.selectors.selectors
quo2.components.separator
quo2.components.settings.privacy-option
quo2.components.tabs.account-selector
quo2.components.tabs.tabs
quo2.components.tags.context-tags
quo2.components.tags.status-tags
quo2.components.tags.tags))
(:require quo2.components.avatars.account-avatar
quo2.components.avatars.channel-avatar
quo2.components.avatars.group-avatar
quo2.components.avatars.icon-avatar
quo2.components.avatars.user-avatar
quo2.components.avatars.wallet-user-avatar
quo2.components.buttons.button
quo2.components.buttons.dynamic-button
quo2.components.community.community-card-view
quo2.components.community.community-list-view
quo2.components.community.community-view
quo2.components.community.discover-card
quo2.components.community.token-gating
quo2.components.counter.counter
quo2.components.dividers.date
quo2.components.dividers.divider-label
quo2.components.dividers.new-messages
quo2.components.drawers.action-drawers
quo2.components.dropdowns.dropdown
quo2.components.header
quo2.components.icon
quo2.components.info.info-message
quo2.components.info.information-box
quo2.components.list-items.channel
quo2.components.list-items.menu-item
quo2.components.list-items.preview-list
quo2.components.loaders.skeleton
quo2.components.markdown.text
quo2.components.messages.author.view
quo2.components.messages.gap
quo2.components.messages.system-message
quo2.components.navigation.floating-shell-button
quo2.components.navigation.page-nav
quo2.components.notifications.activity-log.view
quo2.components.notifications.info-count
quo2.components.notifications.notification-dot
quo2.components.reactions.reaction
quo2.components.selectors.disclaimer
quo2.components.selectors.selectors
quo2.components.separator
quo2.components.settings.privacy-option
quo2.components.tabs.account-selector
quo2.components.tabs.tabs
quo2.components.tags.context-tags
quo2.components.tags.status-tags
quo2.components.tags.tags))
(def toast quo2.components.notifications.toast/toast)
(def button quo2.components.buttons.button/button)
(def dynamic-button quo2.components.buttons.dynamic-button/dynamic-button)
(def text quo2.components.markdown.text/text)
@@ -63,6 +60,7 @@
(def gap quo2.components.messages.gap/gap)
(def system-message quo2.components.messages.system-message/system-message)
(def reaction quo2.components.reactions.reaction/reaction)
(def add-reaction quo2.components.reactions.reaction/add-reaction)
(def tags quo2.components.tags.tags/tags)
(def user-avatar-tag quo2.components.tags.context-tags/user-avatar-tag)
(def context-tag quo2.components.tags.context-tags/context-tag)
@@ -76,6 +74,7 @@
(def disclaimer quo2.components.selectors.disclaimer/disclaimer)
(def checkbox quo2.components.selectors.selectors/checkbox)
(def skeleton quo2.components.loaders.skeleton/skeleton)
(def author quo2.components.messages.author.view/author)
;;;; AVATAR
(def account-avatar quo2.components.avatars.account-avatar/account-avatar)
@@ -112,7 +111,6 @@
(def activity-log quo2.components.notifications.activity-log.view/view)
(def info-count quo2.components.notifications.info-count/info-count)
(def notification-dot quo2.components.notifications.notification-dot/notification-dot)
(def count-down-circle quo2.components.notifications.count-down-circle/circle-timer)
;;;; SETTINGS
(def privacy-option quo2.components.settings.privacy-option/card)
-24
View File
@@ -14,21 +14,6 @@
(let [rgb (string/split value #",")]
(str (string/join "," (butlast rgb)) "," opacity ")")))))
(defn- alpha-opaque
[value opacity]
(when value
(if (string/starts-with? value "#")
(let [hex (string/replace value #"#" "")
r (- 255 (* opacity (- 255 (js/parseInt (subs hex 0 2) 16))))
g (- 255 (* opacity (- 255 (js/parseInt (subs hex 2 4) 16))))
b (- 255 (* opacity (- 255 (js/parseInt (subs hex 4 6) 16))))]
(str "rgb(" r "," g "," b ")"))
(let [rgb (string/split value #",")
r (- 255 (* opacity (- 255 (get rgb 0))))
g (- 255 (* opacity (- 255 (get rgb 1))))
b (- 255 (* opacity (- 255 (get rgb 2))))]
(str "rgb(" r "," g "," b ")")))))
(def theme-alpha
(memoize
(fn
@@ -65,7 +50,6 @@
;;80 with transparency
(def neutral-80-opa-5 (alpha neutral-80 0.05))
(def neutral-80-opa-10 (alpha neutral-80 0.1))
(def neutral-80-opa-15 (alpha neutral-80 0.15))
(def neutral-80-opa-20 (alpha neutral-80 0.2))
(def neutral-80-opa-30 (alpha neutral-80 0.3))
(def neutral-80-opa-40 (alpha neutral-80 0.4))
@@ -92,9 +76,6 @@
(def neutral-100-opa-95 (alpha neutral-100 0.95))
(def neutral-100-opa-100 (alpha neutral-100 1))
;;80 with transparency opaque
(def neutral-80-opa-5-opaque (alpha-opaque neutral-80 0.05))
;;;;White
;;Solid
@@ -113,11 +94,6 @@
(def white-opa-90 (alpha white 0.9))
(def white-opa-95 (alpha white 0.95))
;;;;Black
;;Solid
(def black "#000000")
;;;;Primary
;;Solid
-16
View File
@@ -1,9 +1,6 @@
(ns react-native.core
(:require ["@react-native-community/blur" :as blur]
["react" :as react]
["react-native" :as react-native]
[cljs-bean.core :as bean]
[oops.core :as oops]
[react-native.flat-list :as flat-list]
[react-native.platform :as platform]
[react-native.section-list :as section-list]
@@ -87,16 +84,3 @@
(merge (when platform/ios? {:behavior :padding})
props)]
children))
(defn use-effect
([effect] (use-effect effect []))
([effect deps]
(react/useEffect effect (bean/->js deps))))
(def use-ref react/useRef)
(defn use-effect-once [effect] (use-effect effect))
(defn use-unmount
[f]
(let [fn-ref (use-ref f)]
(oops/oset! fn-ref "current" f)
(use-effect-once (fn [] #((oops/oget fn-ref "current"))))))
+8 -52
View File
@@ -1,25 +1,11 @@
(ns react-native.reanimated
(:require ["react-native" :as rn]
["react-native-linear-gradient" :default LinearGradient]
["react-native-reanimated" :default reanimated :refer
(useSharedValue useAnimatedStyle
withTiming
withDelay
withSpring
withRepeat
Easing
Keyframe
cancelAnimation
SlideInUp
SlideOutUp
LinearTransition)]
[clojure.string :as string]
[reagent.core :as reagent]))
;; Animations
(def slide-in-up-animation SlideInUp)
(def slide-out-up-animation SlideOutUp)
(def linear-transition LinearTransition)
(:require
["react-native" :as rn]
["react-native-linear-gradient" :default LinearGradient]
["react-native-reanimated" :default reanimated :refer
(useSharedValue useAnimatedStyle withTiming withDelay withSpring withRepeat Easing Keyframe)]
[clojure.string :as string]
[reagent.core :as reagent]))
;; Animated Components
(def create-animated-component (comp reagent/adapt-react-class (.-createAnimatedComponent reanimated)))
@@ -40,7 +26,6 @@
(def with-spring withSpring)
(def key-frame Keyframe)
(def with-repeat withRepeat)
(def cancel-animation cancelAnimation)
;; Easings
(def bezier (.-bezier ^js Easing))
@@ -75,13 +60,6 @@
;; Worklets
(def worklet-factory (js/require "../src/js/worklet_factory.js"))
(defn interpolate
[shared-value input-range output-range]
(.interpolateValue ^js worklet-factory
shared-value
(clj->js input-range)
(clj->js output-range)))
;;;; Component Animations
;; kebab-case styles are not working for worklets
@@ -116,26 +94,4 @@
(js-obj "duration" duration
"easing" (get easings easing)))
number-of-repetitions
reverse?)))
(defn animate-shared-value-with-delay-repeat
([anim val duration easing delay number-of-repetitions]
(animate-shared-value-with-delay-repeat anim val duration easing delay number-of-repetitions false))
([anim val duration easing delay number-of-repetitions reverse?]
(set-shared-value anim
(with-delay delay
(with-repeat
(with-timing val
#js
{:duration duration
:easing (get easings easing)})
number-of-repetitions
reverse?)))))
(defn animate-shared-value-with-spring
[anim val {:keys [mass stiffness damping]}]
(set-shared-value anim
(with-spring val
(js-obj "mass" mass
"damping" damping
"stiffness" stiffness))))
reverse?)))
View File
-6
View File
@@ -1,6 +0,0 @@
(ns react-native.svg
(:require ["react-native-svg" :as Svg]
[reagent.core :as reagent]))
(def svg (reagent/adapt-react-class Svg/default))
(def path (reagent/adapt-react-class Svg/Path))
+5 -3
View File
@@ -20,6 +20,7 @@
[status-im.utils.http :as http]
[status-im.utils.platform :as platform]
[status-im.utils.random :as random]
[status-im.utils.security :as security]
[status-im.utils.types :as types]
[status-im.utils.universal-links.utils :as links]
[status-im2.navigation.events :as navigation]
@@ -227,9 +228,10 @@
(fx/defn handle-message-link
{:events [:browser.ui/message-link-pressed]}
[_ link]
(if (links/universal-link? link)
{:dispatch [:universal-links/handle-url link]}
{:browser/show-browser-selection link}))
(when (security/safe-link? link)
(if (links/universal-link? link)
{:dispatch [:universal-links/handle-url link]}
{:browser/show-browser-selection link})))
(fx/defn update-browser-on-nav-change
[cofx url error?]
+2 -2
View File
@@ -3,6 +3,8 @@
[quo.design-system.colors :as colors]
[re-frame.core :as re-frame]
[status-im.add-new.db :as new-public-chat.db]
[status-im.chat.models.delete-message :as delete-message]
[status-im.chat.models.delete-message-for-me :as delete-for-me]
[status-im.chat.models.loading :as loading]
[status-im.chat.models.message-list :as message-list]
[status-im.constants :as constants]
@@ -17,8 +19,6 @@
[status-im.utils.fx :as fx]
[status-im.utils.types :as types]
[status-im.utils.utils :as utils]
[status-im2.contexts.chat.messages.message.delete-message-for-me.events :as delete-for-me]
[status-im2.contexts.chat.messages.message.delete-message.events :as delete-message]
[status-im2.navigation.events :as navigation]
[taoensso.timbre :as log]))
@@ -1,9 +1,11 @@
(ns status-im2.contexts.chat.messages.message.delete-message.events
(:require [status-im.chat.models.message-list :as message-list]
(ns status-im.chat.models.delete-message
(:require [re-frame.core :as re-frame]
[status-im.chat.models.message-list :as message-list]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.utils.datetime :as datetime]
[status-im2.common.json-rpc.events :as json-rpc]
[taoensso.timbre :as log]
[utils.re-frame :as rf]))
[status-im.utils.fx :as fx]
[taoensso.encore :as enc]
[taoensso.timbre :as log]))
(defn- update-db-clear-undo-timer
[db chat-id message-id]
@@ -44,7 +46,7 @@
(when (get-in db [:messages chat-id message-id])
(update-in db [:messages chat-id message-id] assoc :deleted? true)))
(rf/defn delete
(fx/defn delete
"Delete message now locally and broadcast after undo time limit timeout"
{:events [:chat.ui/delete-message]}
[{:keys [db]} {:keys [chat-id message-id]} undo-time-limit-ms]
@@ -59,7 +61,7 @@
:message-id message-id}]
:ms undo-time-limit-ms}])))
(rf/defn undo
(fx/defn undo
{:events [:chat.ui/undo-delete-message]}
[{:keys [db]} {:keys [chat-id message-id]}]
(when (get-in db [:messages chat-id message-id])
@@ -67,22 +69,21 @@
{:db (update-db-undo-locally db chat-id message-id)}
chat-id)))
(rf/defn delete-and-send
(fx/defn delete-and-send
{:events [:chat.ui/delete-message-and-send]}
[{:keys [db]} {:keys [message-id chat-id]}]
(when-let [message (get-in db [:messages chat-id message-id])]
(cond-> {:db (update-db-clear-undo-timer db chat-id message-id)
::json-rpc/call [{:method "wakuext_deleteMessageAndSend"
:params [message-id]
:js-response true
:on-error #(log/error "failed to delete message "
{:message-id message-id :error %})
:on-success #(rf/dispatch [:sanitize-messages-and-process-response
%])}]}
(get-in db [:pin-messages chat-id message-id])
(assoc :dispatch
[:pin-message/send-pin-message
{:chat-id chat-id :message-id message-id :pinned false}]))))
(enc/assoc-when
{:db (update-db-clear-undo-timer db chat-id message-id)
::json-rpc/call [{:method "wakuext_deleteMessageAndSend"
:params [message-id]
:js-response true
:on-error #(log/error "failed to delete message "
{:message-id message-id :error %})
:on-success #(re-frame/dispatch [:sanitize-messages-and-process-response %])}]}
:dispatch
(and (get-in db [:pin-messages chat-id message-id])
[:pin-message/send-pin-message {:chat-id chat-id :message-id message-id :pinned false}]))))
(defn- filter-pending-send-messages
"traverse all messages find not yet synced deleted? messages"
@@ -92,14 +93,14 @@
(map (fn [message] {:chat-id chat-id :message-id (first message)}))
(concat acc)))
(rf/defn send-all
(fx/defn send-all
"Get all deleted messages that not yet synced with status-go and send them"
{:events [:chat.ui/send-all-deleted-messages]}
[{:keys [db] :as cofx}]
(let [pending-send-messages (reduce-kv filter-pending-send-messages [] (:messages db))]
(apply rf/merge cofx (map delete-and-send pending-send-messages))))
(apply fx/merge cofx (map delete-and-send pending-send-messages))))
(rf/defn delete-messages-localy
(fx/defn delete-messages-localy
"Mark messages :deleted? localy in client"
{:events [:chat.ui/delete-messages-localy]}
[{:keys [db]} messages chat-id]
@@ -1,9 +1,10 @@
(ns status-im2.contexts.chat.messages.message.delete-message-for-me.events
(:require [status-im.chat.models.message-list :as message-list]
(ns status-im.chat.models.delete-message-for-me
(:require [re-frame.core :as re-frame]
[status-im.chat.models.message-list :as message-list]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.utils.datetime :as datetime]
[status-im2.common.json-rpc.events :as json-rpc]
[taoensso.timbre :as log]
[utils.re-frame :as rf]))
[status-im.utils.fx :as fx]
[taoensso.timbre :as log]))
(defn- update-db-clear-undo-timer
[db chat-id message-id]
@@ -38,7 +39,7 @@
:deleted-for-me-undoable-till)
(update-db-clear-undo-timer db chat-id message-id))))
(rf/defn delete
(fx/defn delete
"Delete message for me now locally and broadcast after undo time limit timeout"
{:events [:chat.ui/delete-message-for-me]}
[{:keys [db]} {:keys [chat-id message-id]} undo-time-limit-ms]
@@ -53,7 +54,7 @@
:message-id message-id}]
:ms undo-time-limit-ms}])))
(rf/defn undo
(fx/defn undo
{:events [:chat.ui/undo-delete-message-for-me]}
[{:keys [db]} {:keys [chat-id message-id]}]
(when (get-in db [:messages chat-id message-id])
@@ -61,7 +62,7 @@
{:db (update-db-undo-locally db chat-id message-id)}
chat-id)))
(rf/defn delete-and-sync
(fx/defn delete-and-sync
{:events [:chat.ui/delete-message-for-me-and-sync]}
[{:keys [db]} {:keys [message-id chat-id]}]
(when (get-in db [:messages chat-id message-id])
@@ -71,7 +72,7 @@
:js-response true
:on-error #(log/error "failed to delete message for me, message id: "
{:message-id message-id :error %})
:on-success #(rf/dispatch [:sanitize-messages-and-process-response %])}]}))
:on-success #(re-frame/dispatch [:sanitize-messages-and-process-response %])}]}))
(defn- filter-pending-sync-messages
"traverse all messages find not yet synced deleted-for-me? messages"
@@ -82,9 +83,9 @@
(map (fn [message] {:chat-id chat-id :message-id (first message)}))
(concat acc)))
(rf/defn sync-all
(fx/defn sync-all
"Get all deleted-for-me messages that not yet synced with status-go and sync them"
{:events [:chat.ui/sync-all-deleted-for-me-messages]}
[{:keys [db] :as cofx}]
(let [pending-sync-messages (reduce-kv filter-pending-sync-messages [] (:messages db))]
(apply rf/merge cofx (map delete-and-sync pending-sync-messages))))
(apply fx/merge cofx (map delete-and-sync pending-sync-messages))))
@@ -1,9 +1,7 @@
(ns status-im2.contexts.chat.messages.message.delete-message-for-me.events-test
(ns status-im.chat.models.delete-message-for-me-test
(:require [cljs.test :refer-macros [deftest is testing]]
[status-im.utils.datetime :as datetime]
[status-im2.common.json-rpc.events :as json-rpc]
[status-im2.contexts.chat.messages.message.delete-message-for-me.events :as
delete-message-for-me]))
[status-im.chat.models.delete-message-for-me :as delete-message-for-me]
[status-im.utils.datetime :as datetime]))
(def mid "message-id")
(def cid "chat-id")
@@ -64,7 +62,7 @@
(let [expected-db {:messages {cid {mid {:id mid}}}}
effects (delete-message-for-me/delete-and-sync {:db db} message)
result-db (:db effects)
rpc-calls (::json-rpc/call effects)]
rpc-calls (:status-im.ethereum.json-rpc/call effects)]
(is (= result-db expected-db))
(is (= (count rpc-calls) 1))
(is (= (-> rpc-calls
@@ -1,8 +1,7 @@
(ns status-im2.contexts.chat.messages.message.delete-message.events-test
(ns status-im.chat.models.delete-message-test
(:require [cljs.test :refer-macros [deftest is testing]]
[status-im.utils.datetime :as datetime]
[status-im2.common.json-rpc.events :as json-rpc]
[status-im2.contexts.chat.messages.message.delete-message.events :as delete-message]))
[status-im.chat.models.delete-message :as delete-message]
[status-im.utils.datetime :as datetime]))
(def mid "message-id")
(def cid "chat-id")
@@ -62,7 +61,7 @@
(let [expected-db {:messages {cid {mid {:id mid}}}}
effects (delete-message/delete-and-send {:db db} message)
result-db (:db effects)
rpc-calls (::json-rpc/call effects)]
rpc-calls (:status-im.ethereum.json-rpc/call effects)]
(is (= result-db expected-db))
(is (= (count rpc-calls) 1))
(is (= (-> rpc-calls
+1 -1
View File
@@ -2,6 +2,7 @@
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.chat.models :as chat-model]
[status-im.chat.models.delete-message :as delete-message]
[status-im.chat.models.loading :as chat.loading]
[status-im.chat.models.mentions :as mentions]
[status-im.chat.models.message-list :as message-list]
@@ -14,7 +15,6 @@
[status-im.utils.gfycat.core :as gfycat]
[status-im.utils.platform :as platform]
[status-im.utils.types :as types]
[status-im2.contexts.chat.messages.message.delete-message.events :as delete-message]
[taoensso.timbre :as log]))
(defn- message-loaded?
+1 -2
View File
@@ -195,8 +195,7 @@
(array-seq (.-values message-list))
[]))
;; NOTE(performance): this is too expensive, probably we could mark message somehow and just hide it in
;; the UI
;;TODO this is too expensive, probably we could mark message somehow and just hide it in the UI
(fx/defn rebuild-message-list
[{:keys [db]} chat-id]
{:db (assoc-in db
+2 -2
View File
@@ -73,13 +73,13 @@
(fx/defn send-emoji-reaction
{:events [::send-emoji-reaction]}
{:events [:models.reactions/send-emoji-reaction]}
[{{:keys [current-chat-id]} :db :as cofx} reaction]
(message.protocol/send-reaction cofx
(update reaction :chat-id #(or % current-chat-id))))
(fx/defn send-retract-emoji-reaction
{:events [::send-emoji-reaction-retraction]}
{:events [:models.reactions/send-emoji-reaction-retraction]}
[{{:keys [current-chat-id]} :db :as cofx} reaction]
(message.protocol/send-retract-reaction cofx
(update reaction :chat-id #(or % current-chat-id))))
-3
View File
@@ -6,9 +6,6 @@
[status-im.utils.utils :as utils]
[taoensso.timbre :as log]))
;; NOTE(19/12/22 yqrashawn) this namespace has been moved to the
;; status-im2.common.json-rpc.events namespace,
;; we keep this only for old (status 1.0) code, can be removed with old code later
(defn on-error-retry
[call-method {:keys [method number-of-retries delay on-error] :as arg}]
(if (pos? number-of-retries)
+2 -2
View File
@@ -8,11 +8,11 @@
status-im.events
[status-im.multiaccounts.logout.core :as logout]
[status-im.transport.core :as transport]
[status-im.utils.security :as security]
[status-im.utils.test :as utils.test]
status-im2.navigation.core
status-im2.subs.root ;;so integration tests can run independently
[taoensso.timbre :as log]
[utils.security.core :as security]))
[taoensso.timbre :as log]))
(def password "testabc")
+2 -2
View File
@@ -3,9 +3,9 @@
[status-im.keycard.common :as common]
[status-im.keycard.onboarding :as onboarding]
[status-im.utils.fx :as fx]
[status-im.utils.security :as security]
[status-im2.navigation.events :as navigation]
[taoensso.timbre :as log]
[utils.security.core :as security]))
[taoensso.timbre :as log]))
(fx/defn change-credentials-pressed
{:events [:keycard-settings.ui/change-credentials-pressed]}
+2 -2
View File
@@ -16,10 +16,10 @@
[status-im.utils.fx :as fx]
[status-im.utils.keychain.core :as keychain]
[status-im.utils.platform :as platform]
[status-im.utils.security :as security]
[status-im.utils.types :as types]
[status-im2.navigation.events :as navigation]
[taoensso.timbre :as log]
[utils.security.core :as security]))
[taoensso.timbre :as log]))
(fx/defn pair*
[_ password]
+2 -2
View File
@@ -10,9 +10,9 @@
[status-im.node.core :as node]
[status-im.utils.config :as config]
[status-im.utils.fx :as fx]
[status-im.utils.security :as security]
[status-im.utils.signing-phrase.core :as signing-phrase]
[status-im.utils.types :as types]
[utils.security.core :as security]))
[status-im.utils.types :as types]))
(defn normalize-derived-data-keys
[derived-data]
@@ -14,9 +14,9 @@
[status-im.native-module.core :as native-module]
[status-im.popover.core :as popover]
[status-im.utils.fx :as fx]
[status-im.utils.security :as security]
[status-im.utils.types :as types]
[status-im2.navigation.events :as navigation]
[utils.security.core :as security]))
[status-im2.navigation.events :as navigation]))
(fx/defn key-and-storage-management-pressed
"This event can be dispatched before login and from profile and needs to redirect accordingly"
@@ -2,7 +2,7 @@
(:require [cljs.test :refer-macros [deftest is testing]]
[clojure.string :as string]
[status-im.multiaccounts.key-storage.core :as models]
[utils.security.core :as security]))
[status-im.utils.security :as security]))
(deftest move-keystore-checked
(testing "Checks checkbox on-press"
+2 -2
View File
@@ -32,6 +32,7 @@
[status-im.utils.keychain.core :as keychain]
[status-im.utils.mobile-sync :as utils.mobile-sync]
[status-im.utils.platform :as platform]
[status-im.utils.security :as security]
[status-im.utils.types :as types]
[status-im.utils.utils :as utils]
[status-im.utils.wallet-connect :as wallet-connect]
@@ -41,8 +42,7 @@
[status-im2.contexts.activity-center.events :as activity-center]
[status-im2.navigation.events :as navigation]
[status-im2.setup.log :as logging]
[taoensso.timbre :as log]
[utils.security.core :as security]))
[taoensso.timbre :as log]))
(re-frame/reg-fx
::initialize-communities-enabled
@@ -12,11 +12,11 @@
[status-im.native-module.core :as status]
[status-im.popover.core :as popover]
[status-im.utils.fx :as fx]
[status-im.utils.security :as security]
[status-im.utils.types :as types]
[status-im.utils.utils :as utils]
[status-im2.navigation.events :as navigation]
[taoensso.timbre :as log]
[utils.security.core :as security]))
[taoensso.timbre :as log]))
(defn existing-account?
[multiaccounts key-uid]
@@ -2,7 +2,7 @@
(:require [cljs.test :refer-macros [deftest is testing]]
[status-im.multiaccounts.create.core :as multiaccounts.create]
[status-im.multiaccounts.recover.core :as models]
[utils.security.core :as security]))
[status-im.utils.security :as security]))
;;;; helpers
@@ -6,8 +6,8 @@
[status-im.popover.core :as popover]
[status-im.utils.fx :as fx]
[status-im.utils.keychain.core :as keychain]
[status-im.utils.types :as types]
[utils.security.core :as security]))
[status-im.utils.security :as security]
[status-im.utils.types :as types]))
(fx/defn on-input-change
{:events [::handle-input-change]}
+6 -13
View File
@@ -64,20 +64,10 @@
(assoc :ListenAddr ":30304"
:DataDir (str (:DataDir config) "_dev"))))
(def wakuv2-default-config
{:DiscoveryLimit 20
:EnableDiscV5 true
:Host "0.0.0.0"
:AutoUpdate true
:PeerExchange true
:Port 0
:UDPPort 0})
(def login-node-config
{:WalletConfig (cond-> {:Enabled true}
(not= config/opensea-api-key "")
(assoc :OpenseaAPIKey config/opensea-api-key))
:WakuV2Config wakuv2-default-config})
(assoc :OpenseaAPIKey config/opensea-api-key))})
(defn- get-login-node-config
[config]
@@ -162,8 +152,11 @@
:BloomFilterMode waku-bloom-filter-mode
:LightClient true
:MinimumPoW 0.000001}
:WakuV2Config (merge (assoc wakuv2-config :Enabled wakuv2-enabled)
wakuv2-default-config)
:WakuV2Config (assoc wakuv2-config
:DiscoveryLimit 20
:EnableDiscV5 true
:Enabled wakuv2-enabled
:Host "0.0.0.0")
:ShhextConfig
{:BackupDisabledDataDir (utils.platform/no-backup-directory)
:InstallationID installation-id
+2 -2
View File
@@ -11,9 +11,9 @@
[status-im.ethereum.stateofus :as stateofus]
[status-im.utils.db :as utils.db]
[status-im.utils.http :as http]
[status-im.utils.security :as security]
[status-im.utils.wallet-connect :as wallet-connect]
[taoensso.timbre :as log]
[utils.security.core :as security]))
[taoensso.timbre :as log]))
(def ethereum-scheme "ethereum:")
+2 -2
View File
@@ -16,12 +16,12 @@
[status-im.utils.fx :as fx]
[status-im.utils.hex :as utils.hex]
[status-im.utils.money :as money]
[status-im.utils.security :as security]
[status-im.utils.types :as types]
[status-im.utils.utils :as utils]
[status-im.wallet.core :as wallet]
[status-im.wallet.prices :as prices]
[taoensso.timbre :as log]
[utils.security.core :as security]))
[taoensso.timbre :as log]))
(re-frame/reg-fx
:signing/send-transaction-fx
@@ -9,7 +9,7 @@
[status-im.ui.components.react :as react]
[status-im.ui.screens.chat.message.styles :as styles]
[status-im.ui.screens.communities.icon :as communities.icon]
[utils.security.core :as security])
[status-im.utils.security :as security])
(:require-macros [status-im.utils.views :refer [defview letsubs]]))
(defn link-belongs-to-domain
@@ -4,7 +4,6 @@
[re-frame.core :as re-frame]
[reagent.core :as reagent]
[status-im.chat.models.images :as images]
[status-im.chat.models.reactions :as models.reactions]
[status-im.constants :as constants]
[status-im.i18n.i18n :as i18n]
[status-im.react-native.resources :as resources]
@@ -25,7 +24,7 @@
[status-im.ui.screens.chat.utils :as chat.utils]
[status-im.ui.screens.communities.icon :as communities.icon]
[status-im.utils.config :as config]
[utils.security.core :as security])
[status-im.utils.security :as security])
(:require-macros [status-im.utils.views :refer [defview letsubs]]))
(defn message-timestamp-anim
@@ -827,11 +826,11 @@
:picker-on-close (fn []
(space-keeper false))
:send-emoji (fn [{:keys [emoji-id]}]
(re-frame/dispatch [::models.reactions/send-emoji-reaction
(re-frame/dispatch [:models.reactions/send-emoji-reaction
{:message-id (:message-id message)
:emoji-id emoji-id}]))
:retract-emoji (fn [{:keys [emoji-id emoji-reaction-id]}]
(re-frame/dispatch [::models.reactions/send-emoji-reaction-retraction
(re-frame/dispatch [:models.reactions/send-emoji-reaction-retraction
{:message-id (:message-id message)
:emoji-id emoji-id
:emoji-reaction-id emoji-reaction-id}]))
@@ -1,30 +0,0 @@
(ns status-im.ui.screens.chat.message.reactions-row
(:require [quo.react-native :as rn]
[quo2.components.reactions.reaction :as quo2.reaction]
[status-im.constants :as constants]
[status-im.ui.screens.chat.message.styles :as styles]))
(def default-reaction-margin-top 5)
(def text-reaction-margin-top -3)
(defn message-reactions
[{:keys [content-type]} reactions timeline on-emoji-press on-open]
(when (seq reactions)
[rn/view
{:style (styles/reactions-row
timeline
(if (= content-type constants/content-type-text)
text-reaction-margin-top
default-reaction-margin-top))}
(for [{:keys [own emoji-id quantity] :as emoji-reaction} reactions]
^{:key (str emoji-reaction)}
[rn/view {:style {:margin-right 6 :margin-top 5}}
[quo2.reaction/reaction
{:emoji (get constants/reactions emoji-id)
:neutral? own
:clicks quantity
:on-press #(on-emoji-press emoji-id)
:accessibility-label (str "emoji-reaction-" emoji-id)}]])
;; on-press won't work until we integrate Message Context Drawer
[quo2.reaction/open-reactions-menu (when @on-open {:on-press @on-open})]]))
@@ -1,7 +1,6 @@
(ns status-im.ui.screens.chat.styles.message.message
(:require [quo.design-system.colors :as colors]
[quo2.foundations.colors :as quo2.colors]
[quo2.foundations.typography :as typography]
[status-im.constants :as constants]
[status-im.ui.components.react :as react]
[status-im.ui.screens.chat.styles.photos :as photos]))
@@ -104,12 +103,6 @@
{:flex-direction :row
:margin-top 1})
(defn pin-author-text
[]
(merge typography/font-medium
{:color quo2.colors/primary-50
:bottom 2}))
(defn pinned-by-text
[]
{:margin-left 5})
@@ -12,7 +12,12 @@
[status-im.ui.components.icons.icons :as icons]
[status-im.ui.components.react :as react]
[status-im.ui.components.topbar :as topbar]
[status-im.utils.handlers :refer [<sub]]))
[status-im.utils.handlers :refer [<sub >evt]]))
(defn hide-sheet-and-dispatch
[event]
(>evt [:bottom-sheet/hide])
(>evt event))
(defn request-actions
[community-id request-id]
@@ -5,7 +5,7 @@
[reagent.core :as reagent]
[status-im.i18n.i18n :as i18n]
[status-im.ui.components.toolbar :as toolbar]
[utils.security.core :as security]))
[status-im.utils.security :as security]))
(defn validate-pairing-code
[pairing-code]
@@ -16,7 +16,7 @@
[status-im.ui.components.topbar :as topbar]
[status-im.ui.screens.multiaccounts.key-storage.styles :as styles]
[status-im.ui.screens.multiaccounts.views :as multiaccounts.views]
[utils.security.core]))
[status-im.utils.security]))
(defn local-topbar
[subtitle action]
@@ -149,6 +149,23 @@
:after :main-icons/next}
(i18n/label (if creating-backup? :t/next :t/choose-storage))]}]]))
(defn keycard-subtitle
[]
[react/view
[react/text {:style {:color colors/gray}} (i18n/label :t/empty-keycard-required)]
[react/view
{:flex-direction :row
:align-items :center}
[react/text
{:style {:color colors/blue}
:accessibility-label :learn-more
:on-press #(js/alert :press)}
(i18n/label :learn-more)]
[icons/icon :main-icons/tiny-external
{:color colors/blue
:width 16
:height 16}]]])
(defn keycard-upsell-banner
[]
[react/view
@@ -247,7 +264,7 @@
{:secure-text-entry true
:placeholder (i18n/label :t/current-password)
:on-change-text #(re-frame/dispatch [::multiaccounts.key-storage/password-changed
(utils.security.core/mask-data %)])
(status-im.utils.security/mask-data %)])
:accessibility-label :enter-password-input
:auto-capitalize :none
:error migration-password-error
@@ -382,26 +399,26 @@
;; invalid seed shape
#_(re-frame/dispatch [::multiaccounts.key-storage/seed-phrase-input-changed
(utils.security.core/mask-data "h h h h h h h h h h h h")])
(status-im.utils.security/mask-data "h h h h h h h h h h h h")])
;; valid seed for Trusty Candid Bighornedsheep
;; If you try to select Dim Venerated Yaffle, but use this seed instead,
;; validate-seed-against-key-uid will fail miserably
#_(re-frame/dispatch
[::multiaccounts.key-storage/seed-phrase-input-changed
(utils.security.core/mask-data
(status-im.utils.security/mask-data
"disease behave roof exile ghost head carry item tumble census rocket champion")])
;; valid seed for Swiffy Warlike Seagull
#_(re-frame/dispatch
[::multiaccounts.key-storage/seed-phrase-input-changed
(utils.security.core/mask-data
(status-im.utils.security/mask-data
"dirt agent garlic merge tuna leaf congress hedgehog absent dish pizza scrap")])
;; valid seed for Dim Venerated Yaffle (this is just a test account, okay to leak seed)
(re-frame/dispatch
[::multiaccounts.key-storage/seed-phrase-input-changed
(utils.security.core/mask-data
(status-im.utils.security/mask-data
"rocket mixed rebel affair umbrella legal resemble scene virus park deposit cargo")])
;; Click choose storage
@@ -13,8 +13,8 @@
[status-im.ui.screens.multiaccounts.login.styles :as styles]
[status-im.ui.screens.multiaccounts.styles :as ast]
[status-im.utils.platform :as platform]
[status-im.utils.utils :as utils]
[utils.security.core :as security])
[status-im.utils.security :as security]
[status-im.utils.utils :as utils])
(:require-macros [status-im.utils.views :refer [defview letsubs]]))
(defn login-multiaccount
@@ -11,8 +11,8 @@
[status-im.react-native.resources :as resources]
[status-im.ui.components.icons.icons :as icons]
[status-im.ui.components.react :as react]
[status-im2.setup.config :as config]
[utils.security.core]))
[status-im.utils.security]
[status-im2.setup.config :as config]))
(defn hide-sheet-and-dispatch
[event]
@@ -134,7 +134,7 @@
;; Enter seed phrase for Dim Venerated Yaffle
(re-frame/dispatch
[:multiaccounts.recover/enter-phrase-input-changed
(utils.security.core/mask-data
(status-im.utils.security/mask-data
"rocket mixed rebel affair umbrella legal resemble scene virus park deposit cargo")])
;; Recover multiaccount
@@ -12,7 +12,7 @@
[status-im.ui.screens.chat.photos :as photos]
[status-im.ui.screens.multiaccounts.sheets :as sheets]
[status-im.ui.screens.multiaccounts.styles :as styles]
[utils.security.core :as security]))
[status-im.utils.security :as security]))
(defn multiaccount-view
[{:keys [key-uid name keycard-pairing] :as account}]
@@ -6,7 +6,7 @@
[status-im.constants :as const]
[status-im.i18n.i18n :as i18n]
[status-im.ui.components.toolbar :as toolbar]
[utils.security.core :as security]))
[status-im.utils.security :as security]))
(defn validate-password
[password]
@@ -121,4 +121,4 @@
@processing?)
:type :secondary
:after :main-icons/next}
(i18n/label :t/next)]}))]]))))
(i18n/label :t/next)]}))]]))))
@@ -8,9 +8,9 @@
[status-im.ui.components.react :as react]
[status-im.ui.screens.onboarding.views :as ui]
[status-im.utils.datetime :as datetime]
[status-im.utils.security :as security]
[status-im.utils.utils :as utils]
[utils.debounce :refer [dispatch-and-chill]]
[utils.security.core :as security]))
[utils.debounce :refer [dispatch-and-chill]]))
(defview wizard-recovery-success
[]
@@ -8,7 +8,7 @@
[status-im.ui.components.chat-icon.screen :as chat-icon.screen]
[status-im.ui.components.react :as react]
[status-im.ui.screens.privacy-and-security-settings.events :as delete-profile]
[utils.security.core :as security]))
[status-im.utils.security :as security]))
(defn valid-password?
[password]
@@ -5,9 +5,9 @@
[status-im.i18n.i18n :as i18n]
[status-im.native-module.core :as status]
[status-im.utils.fx :as fx]
[status-im.utils.security :as security]
[status-im.utils.types :as types]
[taoensso.timbre :as log]
[utils.security.core :as security]))
[taoensso.timbre :as log]))
(defn safe-blank?
[s]
@@ -7,7 +7,7 @@
[status-im.ui.components.icons.icons :as icons]
[status-im.ui.components.react :as react]
[status-im.ui.components.toolbar :as toolbar]
[utils.security.core :as security])
[status-im.utils.security :as security])
(:require-macros [status-im.utils.views :refer [defview letsubs]]))
(defn input-field
+2 -2
View File
@@ -23,10 +23,10 @@
[status-im.ui.screens.signing.styles :as styles]
[status-im.ui.screens.wallet.components.views :as wallet.components]
[status-im.utils.platform :as platform]
[status-im.utils.security :as security]
[status-im.utils.types :as types]
[status-im.utils.utils :as utils]
[status-im.wallet.utils :as wallet.utils]
[utils.security.core :as security]))
[status-im.wallet.utils :as wallet.utils]))
(defn separator
[]
+2 -3
View File
@@ -3,7 +3,6 @@
[re-frame.core :as re-frame]
[reagent.core :as reagent]
[status-im.chat.models :as chat]
[status-im.chat.models.reactions :as models.reactions]
[status-im.constants :as constants]
[status-im.i18n.i18n :as i18n]
[status-im.ui.components.fast-image :as fast-image]
@@ -174,12 +173,12 @@
:picker-on-open (fn [])
:picker-on-close (fn [])
:send-emoji (fn [{:keys [emoji-id]}]
(re-frame/dispatch [::models.reactions/send-emoji-reaction
(re-frame/dispatch [:models.reactions/send-emoji-reaction
{:message-id (:message-id message)
:chat-id chat-id
:emoji-id emoji-id}]))
:retract-emoji (fn [{:keys [emoji-id emoji-reaction-id]}]
(re-frame/dispatch [::models.reactions/send-emoji-reaction-retraction
(re-frame/dispatch [:models.reactions/send-emoji-reaction-retraction
{:message-id (:message-id message)
:chat-id chat-id
:emoji-id emoji-id
@@ -10,7 +10,7 @@
[status-im.ui.components.react :as react]
[status-im.ui.components.toolbar :as toolbar]
[status-im.ui.components.topbar :as topbar]
[utils.security.core :as security]))
[status-im.utils.security :as security]))
(defn not-valid-password?
[password]
@@ -15,7 +15,7 @@
[status-im.ui.components.topbar :as topbar]
[status-im.ui.screens.keycard.pin.views :as pin.views]
[status-im.ui.screens.wallet.account-settings.views :as account-settings]
[utils.security.core :as security]))
[status-im.utils.security :as security]))
(defn add-account-topbar
[type]
@@ -13,8 +13,8 @@
[status-im.ui.components.list.views :as list]
[status-im.ui.components.react :as react]
[status-im.ui.screens.wallet-connect.session-proposal.styles :as styles]
[status-im.utils.utils :as status.utils]
[utils.security.core]))
[status-im.utils.security]
[status-im.utils.utils :as status.utils]))
(def chevron-icon-container-width 24)
@@ -1,80 +0,0 @@
(ns status-im.ui2.screens.chat.components.reaction-drawer
(:require [quo.react-native :as rn]
[quo2.components.buttons.button :as quo2.button]
[quo2.components.list-items.menu-item :as quo2.menu-item]
[quo2.components.separator :as quo2.separator]
[quo2.foundations.colors :as colors]
[re-frame.core :as re-frame]
[status-im.constants :as constants]))
(defn message-options
[actions own-reactions send-emoji]
(fn []
(let [main-actions (filter #(= (:type %) :main) actions)
danger-actions (filter #(= (:type %) :danger) actions)
admin-actions (filter #(= (:type %) :admin) actions)]
[rn/view
[rn/view
{:style {:width "100%"
:flex-direction :row
:justify-content :space-between
:padding-horizontal 30
:padding-top 5
:padding-bottom 15}}
(doall
(for [[id icon] constants/reactions
:let [active (own-reactions id)]]
;;TODO reactions selector should be used
;;https://www.figma.com/file/WQZcp6S0EnzxdTL4taoKDv/Design-System?node-id=9961%3A166549
;; not implemented yet
^{:key id}
[quo2.button/button
(merge
{:size 40
:type :grey
:icon true
:icon-no-color true
:accessibility-label (str "emoji-picker-" id)
:on-press #(do
(send-emoji id)
(re-frame/dispatch [:bottom-sheet/hide]))}
(when active {:style {:background-color colors/neutral-10}}))
icon]))]
[rn/view {:style {:padding-horizontal 8}}
(for [action main-actions]
(let [on-press (:on-press action)]
^{:key (:id action)}
[quo2.menu-item/menu-item
{:type :main
:title (:label action)
:accessibility-label (:label action)
:icon (:icon action)
:on-press #(do
(when on-press (on-press))
(re-frame/dispatch [:bottom-sheet/hide]))}]))
(when-not (empty? danger-actions)
[quo2.separator/separator])
(for [action danger-actions]
(let [on-press (:on-press action)]
^{:key (:id action)}
[quo2.menu-item/menu-item
{:type :danger
:title (:label action)
:accessibility-label (:label action)
:icon (:icon action)
:on-press #(do
(when on-press (on-press))
(re-frame/dispatch [:bottom-sheet/hide]))}]))
(when-not (empty? admin-actions)
[quo2.separator/separator])
(for [action admin-actions]
(let [on-press (:on-press action)]
^{:key (:id action)}
[quo2.menu-item/menu-item
{:type :danger
:title (:label action)
:accessibility-label (:label action)
:icon (:icon action)
:on-press #(do
(when on-press (on-press))
(re-frame/dispatch [:bottom-sheet/hide]))}]))]])))
@@ -15,8 +15,8 @@
[status-im.ui2.screens.chat.composer.style :as style]
[status-im.utils.handlers :refer [<sub >evt]]
[status-im.utils.platform :as platform]
[status-im.utils.utils :as utils.utils]
[utils.transforms :as transforms]))
[status-im.utils.types :as types]
[status-im.utils.utils :as utils.utils]))
(defonce input-texts (atom {}))
(defonce mentions-enabled? (reagent/atom {}))
@@ -360,7 +360,7 @@
on-selection
(fn [event]
(let [native-event (.-nativeEvent event)
native-event (transforms/js->clj native-event)
native-event (types/js->clj native-event)
{:keys [eventType content selectionStart selectionEnd]} native-event
full-text (:input-text (<sub [:chats/current-chat-inputs]))]
(on-menu-item-touched {:first-level first-level
@@ -1,21 +1,19 @@
(ns status-im.ui2.screens.chat.messages.message
(:require [quo.core :as quo]
[quo.design-system.colors :as quo.colors]
(:require [quo.design-system.colors :as quo.colors]
[quo.react-native :as rn]
[quo2.components.avatars.user-avatar :as user-avatar]
[quo2.components.icon :as icons]
[quo2.components.markdown.text :as text]
[quo2.components.messages.system-message :as system-message]
[quo2.core :as quo]
[quo2.foundations.colors :as colors]
[quo2.foundations.typography :as typography]
[re-frame.core :as re-frame]
[reagent.core :as reagent]
[status-im.chat.models.images :as images]
[status-im.chat.models.reactions :as models.reactions]
[status-im.chat.models.delete-message]
[status-im.chat.models.delete-message-for-me]
[status-im.constants :as constants]
[status-im.i18n.i18n :as i18n]
[status-im.react-native.resources :as resources]
[status-im.ui.components.animation :as animation]
[status-im.ui.components.fast-image :as fast-image]
[status-im.ui.components.react :as react]
[status-im.ui.screens.chat.image.preview.views :as preview]
@@ -23,32 +21,112 @@
[status-im.ui.screens.chat.message.command :as message.command]
[status-im.ui.screens.chat.message.gap :as message.gap]
[status-im.ui.screens.chat.message.link-preview :as link-preview]
[status-im.ui.screens.chat.message.reactions :as reactions]
[status-im.ui.screens.chat.message.reactions-row :as reaction-row]
[status-im.ui.screens.chat.sheets :as sheets]
[status-im.ui.screens.chat.styles.message.message :as style]
[status-im.ui.screens.chat.styles.photos :as photos.style]
[status-im.ui.screens.chat.utils :as chat.utils]
[status-im.ui.screens.communities.icon :as communities.icon]
[status-im.ui2.screens.chat.components.reaction-drawer :as reaction-drawer]
[status-im.ui2.screens.chat.components.reply :as components.reply]
[status-im.utils.config :as config]
[status-im.utils.datetime :as time]
[status-im.utils.utils :as utils]
[status-im2.contexts.chat.home.chat-list-item.view :as home.chat-list-item]
[status-im2.contexts.chat.messages.message.delete-message-for-me.events]
[status-im2.contexts.chat.messages.message.delete-message.events]
[utils.re-frame :as rf]
[utils.security.core :as security])
[utils.re-frame :as rf])
(:require-macros [status-im.utils.views :refer [defview letsubs]]))
(defview mention-element
[from]
(letsubs [contact-name [:contacts/contact-name-by-identity from]]
contact-name))
(def edited-at-text (str " ⌫ " (i18n/label :t/edited)))
(defn system-text?
[content-type]
(= content-type constants/content-type-system-text))
(defn mention-element
[from]
(rf/sub [:contacts/contact-name-by-identity from]))
(defn render-inline
[_message-text content-type acc {:keys [type literal destination]}]
(case type
""
(conj acc literal)
"code"
(conj acc [rn/text literal])
"emph"
(conj acc [rn/text (style/emph-style) literal])
"strong"
(conj acc [rn/text (style/strong-style) literal])
"strong-emph"
(conj acc [quo/text (style/strong-emph-style) literal])
"del"
(conj acc [rn/text (style/strikethrough-style) literal])
"link"
(conj acc
[rn/text
{:style {:color :blue
:text-decoration-line :underline}
:on-press #(rf/dispatch [:browser.ui/message-link-pressed destination])}
destination])
"mention"
(conj
acc
[rn/view
{:style {:background-color colors/primary-50-opa-10 :border-radius 6 :padding-horizontal 3}}
[rn/text
{:style (merge {:color (if (system-text? content-type) quo.colors/black colors/primary-50)}
(if (system-text? content-type) typography/font-regular typography/font-medium))
:on-press (when-not (system-text? content-type)
#(rf/dispatch [:chat.ui/show-profile literal]))}
[mention-element literal]]])
"status-tag"
(conj acc
[rn/text
{:style {:color :blue
:text-decoration-line :underline}
:on-press #(rf/dispatch [:chat.ui/start-public-chat literal])}
"#"
literal])
(conj acc literal)))
;; TEXT
(defn render-block
[{:keys [content content-type in-popover?]} acc
{:keys [type ^js literal children]}]
(case type
"paragraph"
(conj acc
(reduce
(fn [acc e] (render-inline (:text content) content-type acc e))
[rn/text (style/text-style content-type in-popover?)]
children))
"blockquote"
(conj acc
[rn/view (style/blockquote-style)
[rn/text (style/blockquote-text-style)
(.substring literal 0 (.-length literal))]])
"codeblock"
(conj acc
[rn/view {:style style/codeblock-style}
[rn/text (.substring literal 0 (dec (.-length literal)))]])
acc))
(defn render-parsed-text
[{:keys [content] :as message-data}]
(reduce (fn [acc e]
(render-block message-data acc e))
[:<>]
(:parsed-text content)))
(defn message-status
[{:keys [outgoing content outgoing-status pinned edited-at in-popover?]}]
(when-not in-popover? ;; We keep track if showing this message in a list in pin-limit-popover
@@ -73,16 +151,6 @@
:accessibility-label (name outgoing-status)}])
(when edited-at [rn/text {:style (style/message-status-text)} edited-at-text])]))
(defn message-timestamp
[{:keys [timestamp-str in-popover?]}]
(when-not in-popover? ;; We keep track if showing this message in a list in pin-limit-popover
(let [anim-opacity (animation/create-value 0)]
[rn/animated-view {:style (style/message-timestamp-wrapper) :opacity anim-opacity}
[rn/text
{:style (style/message-timestamp-text)
:accessibility-label :message-timestamp}
timestamp-str]])))
(defn quoted-message
[{:keys [message-id chat-id]} reply pin?]
(let [{:keys [deleted? deleted-for-me?]} (get @(re-frame/subscribe [:chats/chat-messages chat-id])
@@ -93,131 +161,6 @@
[rn/view {:style (when-not pin? (style/quoted-message-container))}
[components.reply/reply-message reply false pin?]]))
(defn system-text?
[content-type]
(= content-type constants/content-type-system-text))
(defn render-inline
[message-text content-type acc {:keys [type literal destination]}]
(case type
""
(conj acc literal)
"code"
(conj acc
[quo/text
{:max-font-size-multiplier react/max-font-size-multiplier
:style (style/inline-code-style)
:monospace true}
literal])
"emph"
(conj acc [rn/text (style/emph-style) literal])
"strong"
(conj acc [rn/text (style/strong-style) literal])
"strong-emph"
(conj acc [quo/text (style/strong-emph-style) literal])
"del"
(conj acc [rn/text (style/strikethrough-style) literal])
"link"
(conj acc
[rn/text
{:style
{:color quo.colors/blue
:text-decoration-line :underline}
:on-press
#(when (and (security/safe-link? destination)
(security/safe-link-text? message-text))
(re-frame/dispatch
[:browser.ui/message-link-pressed destination]))}
destination])
"mention"
(conj
acc
[rn/view
{:style {:background-color colors/primary-50-opa-10 :border-radius 6 :padding-horizontal 3}}
[rn/text
{:style (merge {:color (if (system-text? content-type) quo.colors/black colors/primary-50)}
(if (system-text? content-type) typography/font-regular typography/font-medium))
:on-press (when-not (system-text? content-type)
#(rf/dispatch [:chat.ui/show-profile literal]))}
[mention-element literal]]])
"status-tag"
(conj acc
[rn/text
{:style {:color quo.colors/blue
:text-decoration-line :underline}
:on-press
#(re-frame/dispatch
[:chat.ui/start-public-chat literal])}
"#"
literal])
(conj acc literal)))
(defn render-block
[{:keys [content content-type in-popover?]} acc
{:keys [type ^js literal children]}]
(case type
"paragraph"
(conj acc
(reduce
(fn [acc e] (render-inline (:text content) content-type acc e))
[rn/text (style/text-style content-type in-popover?)]
children))
"blockquote"
(conj acc
[rn/view (style/blockquote-style)
[rn/text (style/blockquote-text-style)
(.substring literal 0 (.-length literal))]])
"codeblock"
(conj acc
[rn/view {:style style/codeblock-style}
[quo/text
{:max-font-size-multiplier react/max-font-size-multiplier
:style style/codeblock-text-style
:monospace true}
(.substring literal 0 (dec (.-length literal)))]])
acc))
(defn render-parsed-text
[message tree]
(reduce (fn [acc e] (render-block message acc e)) [:<>] tree))
(defn render-parsed-text-with-message-status
[{:keys [edited-at in-popover?] :as message} tree]
(let [elements (render-parsed-text message tree)
message-status [rn/text {:style (style/message-status-placeholder)}
(str (if (not in-popover?) " " " ")
(when (and (not in-popover?) edited-at) edited-at-text))]
last-element (peek elements)]
;; Using `nth` here as slightly faster than `first`, roughly 30%
;; It's worth considering pure js structures for this code path as
;; it's perfomance critical
(if (= rn/text (nth last-element 0))
;; Append message status to last text
(conj (pop elements) (conj last-element message-status))
;; Append message status to new block
(conj elements message-status))))
(defn unknown-content-type
[{:keys [content-type content] :as message}]
[rn/view (style/message-view message)
[rn/text
{:style {:color quo.colors/white-persist}}
(if (seq (:text content))
(:text content)
(str "Unhandled content-type " content-type))]])
(defn message-not-sent-text
[chat-id message-id]
[rn/touchable-opacity
@@ -234,33 +177,6 @@
[rn/view style/not-sent-icon
[icons/icon :i/warning {:color quo.colors/red}]]]])
(defn pin-author-name
[pinned-by]
(let [user-contact @(re-frame/subscribe [:multiaccount/contact])
contact-names @(re-frame/subscribe [:contacts/contact-two-names-by-identity pinned-by])]
;; We append empty spaces to the name as a workaround to make one-line and multi-line label
;; components show correctly
(str " " (if (= pinned-by (user-contact :public-key)) (i18n/label :t/You) (first contact-names)))))
(defn pin-icon
[color size]
[icons/icon :i/pin
{:color color
:height size
:width size}])
(defn pinned-by-indicator
[pinned-by]
[rn/view
{:style (style/pin-indicator)
:accessibility-label :pinned-by}
[pin-icon colors/primary-50 16]
[quo/text
{:size :small
:color :main
:style (style/pin-author-text)}
(pin-author-name pinned-by)]])
(defn message-delivery-status
[{:keys [chat-id message-id outgoing-status message-type]}]
(when (and (not= constants/message-type-private-group-system-message message-type)
@@ -278,44 +194,6 @@
(letsubs [contact-with-names [:multiaccount/contact]]
(chat.utils/format-author contact-with-names opts nil)))
(defview community-content
[{:keys [community-id] :as message}]
(letsubs [{:keys [name description verified] :as community} [:communities/community community-id]
communities-enabled? [:communities/enabled?]]
(when (and communities-enabled? community)
[rn/view
{:style (assoc (style/message-wrapper message)
:margin-vertical 10
:margin-left 8
:width 271)}
(when verified
[rn/view (style/community-verified)
[rn/text
{:style {:font-size 13
:color quo.colors/blue}} (i18n/label :t/communities-verified)]])
[rn/view (style/community-message verified)
[rn/view
{:width 62
:padding-left 14}
(if (= community-id constants/status-community-id)
[rn/image
{:source (resources/get-image :status-logo)
:style {:width 40
:height 40}}]
[communities.icon/community-icon community])]
[rn/view {:padding-right 14 :flex 1}
[rn/text {:style {:font-weight "700" :font-size 17}}
name]
[rn/text description]]]
[rn/view (style/community-view-button)
[rn/touchable-opacity
{:on-press #(re-frame/dispatch
[:communities/navigate-to-community
{:community-id (:id community)}])}
[rn/text
{:style {:text-align :center
:color quo.colors/blue}} (i18n/label :t/view)]]]])))
(defn display-name-view
[display-name contact timestamp show-key?]
[rn/view {:style {:flex-direction :row}}
@@ -343,55 +221,43 @@
(defn message-content-wrapper
"Author, userpic and delivery wrapper"
[{:keys [last-in-group? timestamp-str timestamp deleted? deleted-undoable-till
deleted-for-me? deleted-for-me-undoable-till pinned from chat-id]
[{:keys [last-in-group? timestamp pinned from chat-id]
:as message} content]
(let [response-to (:response-to (:content message))
display-name (first (rf/sub [:contacts/contact-two-names-by-identity from]))
contact (rf/sub [:contacts/contact-by-address from])
photo-path (when-not (empty? (:images contact)) (rf/sub [:chats/photo-path from]))
online? (rf/sub [:visibility-status-updates/online? from])]
(if (or deleted? deleted-for-me?)
[system-message/system-message
{:type :deleted
:label (if deleted? :message-deleted :message-deleted-for-you)
:labels {:pinned-a-message (i18n/label :pinned-a-message)
:message-deleted (i18n/label :message-deleted-for-everyone)
:message-deleted-for-you (i18n/label :message-deleted-for-you)
:added (i18n/label :added)}
:timestamp-str timestamp-str
:non-pressable? true
:animate-landing? (if (or deleted-undoable-till deleted-for-me-undoable-till)
true
false)}]
[rn/view
{:style (style/message-wrapper message)
:pointer-events :box-none
:accessibility-label :chat-item}
(when (and (seq response-to) (:quoted-message message))
[quoted-message {:message-id response-to :chat-id chat-id} (:quoted-message message)])
[rn/view
{:style (style/message-body)
:pointer-events :box-none}
[rn/view {:style {:width 40}}
(when (or (and (seq response-to) (:quoted-message message)) last-in-group? pinned)
[react/touchable-highlight {:on-press #(re-frame/dispatch [:chat.ui/show-profile from])}
[user-avatar/user-avatar
{:full-name display-name
:profile-picture photo-path
:status-indicator? true
:online? online?
:size :small
:ring? false}]])]
[rn/view {:style (style/message-author-wrapper)}
(when (or (and (seq response-to) (:quoted-message message)) last-in-group? pinned)
[display-name-view display-name contact timestamp true])
;; MESSAGE CONTENT
content
[link-preview/link-preview-wrapper (:links (:content message)) false false]]]
;; delivery status
[rn/view (style/delivery-status)
[message-delivery-status message]]])))
[rn/view
{:style (style/message-wrapper message)
:pointer-events :box-none
:accessibility-label :chat-item}
(when (and (seq response-to) (:quoted-message message))
[quoted-message {:message-id response-to :chat-id chat-id} (:quoted-message message)])
[rn/view
{:style (style/message-body)
:pointer-events :box-none}
;; AVATAR
[rn/view {:style {:width 40}}
(when (or (and (seq response-to) (:quoted-message message)) last-in-group? pinned)
[react/touchable-highlight {:on-press #(re-frame/dispatch [:chat.ui/show-profile from])}
[user-avatar/user-avatar
{:full-name display-name
:profile-picture photo-path
:status-indicator? true
:online? online?
:size :small
:ring? false}]])]
[rn/view {:style (style/message-author-wrapper)}
;; AUTHOR NAME
(when (or (and (seq response-to) (:quoted-message message)) last-in-group? pinned)
[display-name-view display-name contact timestamp true])
;; MESSAGE CONTENT
content
[link-preview/link-preview-wrapper (:links (:content message)) false false]]]
;; delivery status
[rn/view (style/delivery-status)
[message-delivery-status message]]]))
(def image-max-width 260)
(def image-max-height 192)
@@ -408,46 +274,6 @@
(reset! dimensions {:width (/ width k) :height image-max-height :loaded true})))
(swap! dimensions assoc :loaded true)))))
(defn message-content-image
[{:keys [content]} _]
(let [dimensions (reagent/atom {:width image-max-width :height image-max-height :loaded false})
visible (reagent/atom false)
uri (:image content)]
(fn [{:keys [in-popover?] :as message}
{:keys [on-long-press]}]
(let [style-opts {:outgoing false
:opacity (if (:loaded @dimensions) 1 0)
:width (:width @dimensions)
:height (:height @dimensions)}]
[:<>
[preview/preview-image
{:message message
:visible @visible
:on-close #(do (reset! visible false)
(reagent/flush))}]
[rn/touchable-opacity
{:on-press (fn []
(reset! visible true)
(rn/dismiss-keyboard!))
:on-long-press @on-long-press
:disabled in-popover?}
[rn/view
{:style (style/image-message style-opts)
:accessibility-label :image-message}
(when (or (:error @dimensions) (not (:loaded @dimensions)))
[rn/view
(merge (dissoc style-opts :opacity)
{:flex 1 :align-items :center :justify-content :center :position :absolute})
(if (:error @dimensions)
[icons/icon :i/cancel]
[rn/activity-indicator {:animating true}])])
[fast-image/fast-image
{:style (dissoc style-opts :outgoing)
:on-load (image-set-size dimensions)
:on-error #(swap! dimensions assoc :error true)
:source {:uri uri}}]
[rn/view {:style (style/image-message-border style-opts)}]]]]))))
(defmulti ->message :content-type)
(defmethod ->message constants/content-type-command
@@ -519,39 +345,7 @@
:icon :i/delete
:id :delete-for-all}]))))
(defn collapsible-text-message
[_ _]
(let [collapsed? (reagent/atom false)
show-timestamp? (reagent/atom false)]
(fn [{:keys [content in-popover?] :as message} on-long-press modal ref]
(let [on-long-press (fn []
(if @collapsed?
(do (reset! collapsed? false)
(js/setTimeout #(on-long-press-fn on-long-press message content) 200))
(on-long-press-fn on-long-press message content)))]
(reset! ref on-long-press)
[rn/touchable-opacity
(when-not modal
{:delay-long-press 100
:on-long-press on-long-press
:disabled in-popover?})
[rn/view style/message-view-wrapper
[message-timestamp message show-timestamp?]
[rn/view {:style (style/message-view message)}
[rn/view {:style (style/message-view-content)}
[rn/view
[render-parsed-text-with-message-status message (:parsed-text content)]]]]]]))))
(defmethod ->message constants/content-type-text
[message {:keys [on-long-press modal ref] :as reaction-picker}]
[message-content-wrapper message
[collapsible-text-message message on-long-press modal ref]
reaction-picker])
(defmethod ->message constants/content-type-community
[message]
[community-content message])
;; STATUS ? whats that ?
(defmethod ->message constants/content-type-status
[{:keys [content content-type] :as message}]
[message-content-wrapper message
@@ -562,177 +356,72 @@
[rn/text {:style (style/status-text)}]
(-> content :parsed-text peek :children))]]])
(defmethod ->message constants/content-type-emoji
;; EMOJI
(defn emoji
[]
(let [show-timestamp? (reagent/atom false)]
(fn [{:keys [content pinned in-popover? message-pin-enabled] :as message}
{:keys [on-long-press modal ref]
:as reaction-picker}]
(let [on-long-press (fn []
(on-long-press
(concat
[{:type :main
:on-press #(re-frame/dispatch [:chat.ui/reply-to-message message])
:id :reply
:icon :i/reply
:label (i18n/label :t/message-reply)}
{:type :main
:on-press #(react/copy-to-clipboard (get content :text))
:id :copy
:icon :i/copy
:label (i18n/label :t/copy-text)}]
(when message-pin-enabled
[{:type :main
:on-press #(pin-message message)
:id :pin
:icon :i/pin
:label (if pinned (i18n/label :t/unpin) (i18n/label :t/pin))}]))))]
(reset! ref on-long-press)
[message-content-wrapper message
(fn [{:keys [content] :as message}]
[rn/view style/message-view-wrapper
[rn/view (style/message-view message)
[rn/view {:style (style/message-view-content)}
[rn/view {:style (style/style-message-text)}
[rn/text {:style (style/emoji-message message)}
(:text content)]]]]]))
;; STICKER
(defn sticker
[{:keys [content]}]
[fast-image/fast-image
{:style {:margin 10 :width 140 :height 140}
:source {:uri (str (-> content :sticker :url) "&download=true")}}])
;;IMAGE
(defn message-content-image
[{:keys [content]}]
(let [dimensions (reagent/atom {:width image-max-width :height image-max-height :loaded false})
visible (reagent/atom false)
uri (:image content)]
(fn [{:keys [in-popover?] :as message}
{:keys [on-long-press]}]
(let [style-opts {:outgoing false
:opacity (if (:loaded @dimensions) 1 0)
:width (:width @dimensions)
:height (:height @dimensions)}]
[:<>
[preview/preview-image
{:message message
:visible @visible
:on-close #(do (reset! visible false)
(reagent/flush))}]
[rn/touchable-opacity
(when-not modal
{:disabled in-popover?
:on-press (fn []
(rn/dismiss-keyboard!)
(reset! show-timestamp? true))
:delay-long-press 100
:on-long-press on-long-press})
[rn/view style/message-view-wrapper
[message-timestamp message show-timestamp?]
[rn/view (style/message-view message)
[rn/view {:style (style/message-view-content)}
[rn/view {:style (style/style-message-text)}
[rn/text {:style (style/emoji-message message)}
(:text content)]]
[message-status message]]]]]
reaction-picker]))))
{:on-press (fn []
(reset! visible true)
(rn/dismiss-keyboard!))
:on-long-press @on-long-press
:disabled in-popover?}
[rn/view
{:style (style/image-message style-opts)
:accessibility-label :image-message}
(when (or (:error @dimensions) (not (:loaded @dimensions)))
[rn/view
(merge (dissoc style-opts :opacity)
{:flex 1 :align-items :center :justify-content :center :position :absolute})
(if (:error @dimensions)
[icons/icon :i/cancel]
[rn/activity-indicator {:animating true}])])
[fast-image/fast-image
{:style (dissoc style-opts :outgoing)
:on-load (image-set-size dimensions)
:on-error #(swap! dimensions assoc :error true)
:source {:uri uri}}]
[rn/view {:style (style/image-message-border style-opts)}]]]]))))
(defmethod ->message constants/content-type-sticker
[{:keys [content from outgoing in-popover?]
:as message}
{:keys [on-long-press modal ref]
:as reaction-picker}]
(let [pack (get-in content [:sticker :pack])
on-long-press (fn []
(on-long-press
(when-not outgoing
[{:type :main
:icon :i/stickers
:on-press #(when pack
(re-frame/dispatch [:chat.ui/show-profile from]))
:label (i18n/label :t/see-sticker-set)}])))]
(reset! ref on-long-press)
[message-content-wrapper message
[rn/touchable-opacity
(when-not modal
{:disabled in-popover?
:accessibility-label :sticker-message
:on-press (fn [_]
(when pack
(re-frame/dispatch [:stickers/open-sticker-pack (str pack)]))
(rn/dismiss-keyboard!))
:delay-long-press 100
:on-long-press on-long-press})
[fast-image/fast-image
{:style {:margin 10 :width 140 :height 140}
:source {:uri (str (-> content :sticker :url) "&download=true")}}]]
reaction-picker]))
(defmethod ->message constants/content-type-image
[{:keys [content in-popover? outgoing] :as message}
{:keys [on-long-press modal ref]
:as reaction-picker}]
(let [on-long-press
(fn []
(on-long-press
(concat [{:type :main
:on-press #(re-frame/dispatch [:chat.ui/reply-to-message message])
:id :reply
:icon :i/reply
:label (i18n/label :t/message-reply)}
{:type :main
:on-press #(re-frame/dispatch [:chat.ui/save-image-to-gallery (:image content)])
:id :save
:icon :i/save
:label (i18n/label :t/save-image-library)}
{:type :main
:on-press #(images/download-image-http
(get-in message [:content :image])
preview/share)
:id :share
:icon :i/share
:label (i18n/label :t/share-image)}]
[{:type :danger
:on-press #(re-frame/dispatch
[:chat.ui/delete-message-for-me message
config/delete-message-undo-time-limit-ms])
:label (i18n/label :t/delete-for-me)
:icon :i/delete
:id :delete-for-me}]
(when (and outgoing config/delete-message-enabled?)
[{:type :danger
:on-press #(re-frame/dispatch [:chat.ui/delete-message
message
config/delete-message-undo-time-limit-ms])
:label (i18n/label :t/delete-for-everyone)
:icon :i/delete
:id :delete}]))))]
(reset! ref on-long-press)
[message-content-wrapper message
[message-content-image message
{:modal modal
:disabled in-popover?
:delay-long-press 100
:on-long-press ref}]
reaction-picker]))
(defmethod ->message constants/content-type-audio
[]
(let [show-timestamp? (reagent/atom false)]
(fn [{:keys [outgoing pinned] :as message}
{:keys [on-long-press modal ref]
:as reaction-picker}]
(let [on-long-press
(fn []
(on-long-press
[{:type :main
:on-press #(re-frame/dispatch [:chat.ui/reply-to-message message])
:label (i18n/label :t/message-reply)
:icon :i/reply
:id :reply}
{:type :main
:on-press #(pin-message message)
:label (i18n/label (if pinned :t/unpin-from-chat :t/pin-to-chat))
:icon :i/pin
:id (if pinned :unpin :pin)}
{:type :danger
:on-press #(re-frame/dispatch
[:chat.ui/delete-message-for-me message
config/delete-message-for-me-undo-time-limit-ms])
:label (i18n/label :t/delete-for-me)
:icon :i/delete
:id :delete-for-me}
(when (and outgoing config/delete-message-enabled?)
{:type :danger
:on-press #(re-frame/dispatch [:chat.ui/delete-message
message
config/delete-message-undo-time-limit-ms])
:label (i18n/label :t/delete-for-everyone)
:icon :i/delete
:id :delete})]))]
(reset! ref on-long-press)
[message-content-wrapper message
[rn/touchable-opacity
(when-not modal
{:on-long-press on-long-press
:on-press (fn []
(reset! show-timestamp? true))})
[rn/view style/message-view-wrapper
[message-timestamp message show-timestamp?]
[rn/view {:style (style/message-view message) :accessibility-label :audio-message}
[rn/view {:style (style/message-view-content)}
[message.audio/message-content message] [message-status message]]]]]
reaction-picker]))))
;; AUDIO
(defn audio
[message]
[rn/view style/message-view-wrapper
[rn/view {:style (style/message-view message) :accessibility-label :audio-message}
[rn/view {:style (style/message-view-content)}
[message.audio/message-content message]]]])
(defn contact-request-status-pending
[]
@@ -769,7 +458,10 @@
constants/contact-request-message-state-accepted [contact-request-status-accepted]
constants/contact-request-message-state-declined [contact-request-status-declined])])
(defmethod ->message constants/content-type-contact-request
;;;; SYSTEM
;; CONTACT REQUEST (like system message ? ) no wrapper
(defn system-contact-request
[message _]
[rn/view {:style (style/content-type-contact-request)}
[rn/image
@@ -788,120 +480,45 @@
(get-in message [:content :text])]]
[contact-request-status-label (:contact-request-state message)]])
(defmethod ->message :default
(defview community-content
[{:keys [community-id] :as message}]
(letsubs [{:keys [name description verified] :as community} [:communities/community community-id]
communities-enabled? [:communities/enabled?]]
(when (and communities-enabled? community)
[rn/view
{:style (assoc (style/message-wrapper message)
:margin-vertical 10
:margin-left 8
:width 271)}
(when verified
[rn/view (style/community-verified)
[rn/text
{:style {:font-size 13
:color quo.colors/blue}} (i18n/label :t/communities-verified)]])
[rn/view (style/community-message verified)
[rn/view
{:width 62
:padding-left 14}
(if (= community-id constants/status-community-id)
[rn/image
{:source (resources/get-image :status-logo)
:style {:width 40
:height 40}}]
[communities.icon/community-icon community])]
[rn/view {:padding-right 14 :flex 1}
[rn/text {:style {:font-weight "700" :font-size 17}}
name]
[rn/text description]]]
[rn/view (style/community-view-button)
[rn/touchable-opacity
{:on-press #(re-frame/dispatch
[:communities/navigate-to-community
{:community-id (:id community)}])}
[rn/text
{:style {:text-align :center
:color quo.colors/blue}} (i18n/label :t/view)]]]])))
;; COMMUNITY (like system ? ) no wrapper
(defn community
[message]
[message-content-wrapper message
[unknown-content-type message]])
(defn chat-message
[{:keys [pinned pinned-by mentioned in-pinned-view? last-in-group? deleted? deleted-for-me?]
:as message}]
(let [reactions @(re-frame/subscribe [:chats/message-reactions (:message-id message)
(:chat-id message)])
own-reactions (reduce (fn [acc {:keys [emoji-id own]}]
(if own (conj acc emoji-id) acc))
[]
reactions)
send-emoji (fn [{:keys [emoji-id]}]
(re-frame/dispatch [::models.reactions/send-emoji-reaction
{:message-id (:message-id message)
:emoji-id emoji-id}]))
retract-emoji (fn [{:keys [emoji-id emoji-reaction-id]}]
(re-frame/dispatch [::models.reactions/send-emoji-reaction-retraction
{:message-id (:message-id message)
:emoji-id emoji-id
:emoji-reaction-id emoji-reaction-id}]))
on-emoji-press (fn [emoji-id]
(let [active ((set own-reactions) emoji-id)]
(if active
(retract-emoji {:emoji-id emoji-id
:emoji-reaction-id (reactions/extract-id reactions
emoji-id)})
(send-emoji {:emoji-id emoji-id}))))
on-open-drawer (fn [actions]
(re-frame/dispatch [:bottom-sheet/show-sheet
{:content (reaction-drawer/message-options
actions
(into #{} (js->clj own-reactions))
#(on-emoji-press %))}]))
on-long-press (atom nil)]
[rn/view
{:style (merge (when (and (not in-pinned-view?) (or mentioned pinned))
{:background-color colors/primary-50-opa-5
:border-radius 16
:margin-bottom 4})
(when (or mentioned pinned last-in-group?) {:margin-top 8})
{:margin-horizontal 8})}
(when (and pinned (not (or deleted? deleted-for-me?)))
[rn/view {:style (style/pin-indicator-container)}
[pinned-by-indicator pinned-by]])
[->message message
{:ref on-long-press
:modal false
:on-long-press on-open-drawer}]
(when-not (or deleted? deleted-for-me?)
[reaction-row/message-reactions message reactions nil on-emoji-press on-long-press])])) ;; TODO: pass on-open-drawer function
(defn message-render-fn
[{:keys [outgoing whisper-timestamp] :as message}
_
{:keys [group-chat public? community? current-public-key show-input? edit-enabled]}]
[chat-message
(assoc message
:incoming-group (and group-chat (not outgoing))
:group-chat group-chat
:public? public?
:community? community?
:current-public-key current-public-key
:show-input? show-input?
:message-pin-enabled true
:in-pinned-view? true
:pinned true
:timestamp-str (time/timestamp->time whisper-timestamp)
:edit-enabled edit-enabled)])
(defn pin-system-message
[{:keys [from in-popover? timestamp-str chat-id] :as message} {:keys [modal close-modal]}]
(let [response-to (:response-to (:content message))]
[rn/touchable-opacity
{:on-press #(rf/dispatch [:bottom-sheet/show-sheet :pinned-messages-list chat-id])
:active-opacity 1
:style (merge {:flex-direction :row :margin-vertical 8} (style/message-wrapper message))}
[rn/view
{:style {:width photos.style/default-size
:height photos.style/default-size
:margin-right 16
:border-radius photos.style/default-size
:justify-content :center
:align-items :center
:background-color colors/primary-50-opa-10}
:accessibility-label :content-type-pin-icon}
[pin-icon colors/primary-50 16]]
[rn/view
[rn/view {:style {:flex-direction :row :align-items :center}}
[rn/touchable-opacity
{:style style/message-author-touchable
:disabled in-popover?
:on-press #(do (when modal (close-modal))
(re-frame/dispatch [:chat.ui/show-profile from]))}
[message-author-name from {:modal modal} 20]]
[rn/text {:style {:font-size 13}} (str " " (i18n/label :t/pinned-a-message))]
[rn/text
{:style (merge
{:padding-left 5
:margin-top 2}
(style/message-timestamp-text))
:accessibility-label :message-timestamp}
timestamp-str]]
[quoted-message {:message-id response-to :chat-id chat-id} (:quoted-message message) true]]]))
(defmethod ->message constants/content-type-system-text
[{:keys [content quoted-message] :as message}]
(if quoted-message
[pin-system-message message]
[rn/view {:accessibility-label :chat-item}
[rn/view (style/system-message-body message)
[rn/view (style/message-view message)
[rn/view (style/message-view-content)
[render-parsed-text message (:parsed-text content)]]]]]))
[community-content message])
+2 -1
View File
@@ -152,8 +152,9 @@
(def wallet-connect-project-id "87815d72a81d739d2a7ce15c2cfdefb3")
;; NOTE moved to status-im2.common.constants
(def delete-message-undo-time-limit-ms 4000)
(def delete-message-for-me-undo-time-limit-ms 4000)
;;TODO for development only should be removed in status 2.0
;; NOTE for development only should be removed in status 2.0
(def new-ui-enabled? true)
+64 -52
View File
@@ -1,66 +1,76 @@
(ns status-im.utils.datetime
(:require [cljs-time.coerce :as t.coerce]
[cljs-time.core :as t]
[cljs-time.format :as t.format]
(:require [cljs-time.coerce :refer [from-long]]
[cljs-time.core :as t :refer [before? days hours minus plus]]
[cljs-time.format :refer [formatter formatters unparse]]
[clojure.string :as string]
[i18n.i18n :as i18n]
[re-frame.core :as re-frame]
[status-im.goog.i18n :as goog.18n]
[status-im.i18n.i18n :refer [label label-pluralize]]
[status-im.native-module.core :as status]))
;;;; Datetime constants
(defn now [] (t/now))
(defn now
[]
(t/now))
(def one-second 1000)
(def minute (* 60 one-second))
(defn minutes [m] (* m minute))
(defn minutes
[m]
(* m minute))
(def hour (* 60 minute))
(def day (* 24 hour))
(def week (* 7 day))
(defn weeks [w] (* w week))
(defn weeks
[w]
(* w week))
(def units
[{:name :t/datetime-second-short :limit 60 :in-second 1}
{:name :t/datetime-minute-short :limit 3600 :in-second 60}
{:name :t/datetime-hour-short :limit 86400 :in-second 3600}
{:name :t/datetime-day-short :limit nil :in-second 86400}])
(def time-zone-offset (t/hours (- (/ (.getTimezoneOffset ^js (js/Date.)) 60))))
(def time-zone-offset (hours (- (/ (.getTimezoneOffset ^js (js/Date.)) 60))))
;;;; Utilities
(defn- is-24-hour-locsym
(defn- is24Hour-locsym
"Detects if given locale symbols timeformat generates AM/PM ('a')."
[^js locsym]
(not (string/includes?
(nth (.-TIMEFORMATS locsym) 2)
"a")))
(defn- is-24-hour
(defn- is24Hour
"Returns is24Hour from device or from given locale symbols. Whenever we get
non-nil value use it, else calculate it from the given locale symbol."
[^js locsym]
(if-some [fromdev (status/is24Hour)]
fromdev
(is-24-hour-locsym locsym)))
(is24Hour-locsym locsym)))
;;;; Time formats
(defn- short-time-format
[^js locsym]
(if (is-24-hour locsym)
(if (is24Hour locsym)
"HH:mm"
"h:mm a"))
(defn- time-format
[^js locsym]
(if (is-24-hour locsym)
(if (is24Hour locsym)
"HH:mm:ss"
"h:mm:ss a"))
;;;; Date formats
(defn- short-date-format [_] "dd MMM")
(defn- datetime-within-one-week-format
[^js locsym]
(if (is-24-hour locsym)
(if (is24Hour locsym)
"E HH:mm"
"E h:mm a"))
@@ -70,6 +80,7 @@
(nth (.-DATEFORMATS locsym) 2))
;;;; Datetime formats
(defn- medium-date-time-format
[locsym]
(str (medium-date-format locsym) ", " (time-format locsym)))
@@ -80,7 +91,7 @@
(fn []
(or @formatter
(reset! formatter
(goog.18n/mk-fmt i18n/locale format))))))
(goog.18n/mk-fmt status-im.i18n.i18n/locale format))))))
(def date-time-fmt (get-formatter-fn medium-date-time-format))
(def date-fmt (get-formatter-fn medium-date-format))
@@ -89,6 +100,7 @@
(def datetime-within-one-week-fmt (get-formatter-fn datetime-within-one-week-format))
;;;; Utilities
(defn previous-years?
[datetime]
(< (t/year datetime) (t/year (t/now))))
@@ -113,42 +125,42 @@
(t/within? start end datetime)))
;;;; Timestamp formatters
(defn- to-str
[ms old-fmt-fn yesterday-fmt-fn today-fmt-fn]
(let [date (t.coerce/from-long ms)
local (t/plus date time-zone-offset) ; NOTE(edge-case): this is wrong, it uses the current
; timezone offset,
; regardless of DST
today (t/minus (t/today-at-midnight) time-zone-offset)
yesterday (t/plus today (t/days -1))]
(let [date (from-long ms)
local (plus date time-zone-offset) ; this is wrong, it uses the current timezone offset,
; regardless of DST
today (minus (t/today-at-midnight) time-zone-offset)
yesterday (plus today (days -1))]
(cond
(t/before? date yesterday) (old-fmt-fn local)
(t/before? date today) (yesterday-fmt-fn local)
:else (today-fmt-fn local))))
(before? date yesterday) (old-fmt-fn local)
(before? date today) (yesterday-fmt-fn local)
:else (today-fmt-fn local))))
(defn to-short-str
[ms]
(to-str ms
#(.format ^js (date-fmt) %)
#(i18n/label :t/datetime-yesterday)
#(label :t/datetime-yesterday)
#(.format ^js (time-fmt) %)))
(defn day-relative
[ms]
(to-str ms
#(.format ^js (date-fmt) %)
#(i18n/label :t/datetime-yesterday)
#(i18n/label :t/datetime-today)))
#(label :t/datetime-yesterday)
#(label :t/datetime-today)))
(defn timestamp->relative
[ms]
(let [datetime (t.coerce/from-long ms)]
(let [datetime (from-long ms)]
(cond
(today? datetime)
(.format ^js (time-fmt) datetime)
(within-last-n-days? datetime 1)
(str (string/capitalize (i18n/label :t/datetime-yesterday))
(str (string/capitalize (label :t/datetime-yesterday))
" "
(.format ^js (time-fmt) datetime))
@@ -165,39 +177,39 @@
[ms]
(.format ^js (short-date-fmt)
(-> ms
t.coerce/from-long
(t/plus time-zone-offset))))
from-long
(plus time-zone-offset))))
(defn timestamp->time
[ms]
(.format ^js (time-fmt)
(-> ms
t.coerce/from-long
(t/plus time-zone-offset))))
from-long
(plus time-zone-offset))))
(defn timestamp->date-key
[ms]
(keyword (t.format/unparse (t.format/formatter "YYYYMMDD")
(-> ms
t.coerce/from-long
(t/plus time-zone-offset)))))
(keyword (unparse (formatter "YYYYMMDD")
(-> ms
from-long
(plus time-zone-offset)))))
(defn timestamp->long-date
[ms]
(.format ^js (date-time-fmt)
(-> ms
t.coerce/from-long
(t/plus time-zone-offset))))
from-long
(plus time-zone-offset))))
(defn format-time-ago
[diff unit]
(let [name (i18n/label-pluralize diff (:name unit))]
(let [name (label-pluralize diff (:name unit))]
(if (= :t/datetime-second-short (:name unit))
(i18n/label :t/now)
(i18n/label :t/datetime-ago-format-short
{:ago (i18n/label :t/datetime-ago)
:number diff
:time-intervals name}))))
(label :t/now)
(label :t/datetime-ago-format-short
{:ago (label :t/datetime-ago)
:number diff
:time-intervals name}))))
(defn seconds-ago
[time]
(let [now (t/now)]
@@ -226,15 +238,15 @@
Math/floor
int)
name (i18n/label-pluralize diff (:name unit))]
(i18n/label :t/datetime-ago-format
{:ago (i18n/label :t/datetime-ago)
:number diff
:time-intervals name})))
name (label-pluralize diff (:name unit))]
(label :t/datetime-ago-format
{:ago (label :t/datetime-ago)
:number diff
:time-intervals name})))
(defn to-date
[ms]
(t.coerce/from-long ms))
(from-long ms))
(defn timestamp
[]
@@ -246,7 +258,7 @@
(defn timestamp->year-month-day-date
[ms]
(t.format/unparse (:year-month-day t.format/formatters) (to-date ms)))
(unparse (:year-month-day formatters) (to-date ms)))
(re-frame/reg-cofx
:now
+11 -11
View File
@@ -24,14 +24,14 @@
;; 1970-01-03 00:00:00 UTC
(def epoch-plus-3d 172800000)
(deftest is-24-hour-locale-en-test
(is (= (#'status-im.utils.datetime/is-24-hour-locsym (i18n/locale-symbols "en")) false)))
(deftest is24Hour-locale-en-test
(is (= (#'status-im.utils.datetime/is24Hour-locsym (i18n/locale-symbols "en")) false)))
(deftest is-24-hour-locale-it-test
(is (= (#'status-im.utils.datetime/is-24-hour-locsym (i18n/locale-symbols "it")) true)))
(deftest is24Hour-locale-it-test
(is (= (#'status-im.utils.datetime/is24Hour-locsym (i18n/locale-symbols "it")) true)))
(deftest is-24-hour-locale-nb-test
(is (= (#'status-im.utils.datetime/is-24-hour-locsym (i18n/locale-symbols "nb-NO")) true)))
(deftest is24Hour-locale-nb-test
(is (= (#'status-im.utils.datetime/is24Hour-locsym (i18n/locale-symbols "nb-NO")) true)))
(deftest to-short-str-today-test
(with-redefs [t/*ms-fn* (constantly epoch-plus-3d)
@@ -42,14 +42,14 @@
#_((deftest to-short-str-today-force-24H-test
(with-redefs [t/*ms-fn* (constantly epoch-plus-3d)
d/is-24-hour (constantly true)
d/is24Hour (constantly true)
d/time-fmt (i18n-module/mk-fmt "us" d/short-time-format)
d/time-zone-offset (t/period :hours 0)]
(is (= (d/to-short-str epoch-plus-3d) "00:00"))))
(deftest to-short-str-today-force-AMPM-test
(with-redefs [t/*ms-fn* (constantly epoch-plus-3d)
d/is-24-hour (constantly false)
d/is24Hour (constantly false)
d/time-fmt (i18n-module/mk-fmt "it" d/short-time-format)
d/time-zone-offset (t/period :hours 0)]
(is (= (d/to-short-str epoch-plus-3d) "12:00 AM")))))
@@ -143,7 +143,7 @@
;; Today is Monday, 1975-03-10 15:15:45Z
(with-redefs [t/*ms-fn* (constantly 163696545000)
d/time-zone-offset (t/period :hours 0)
d/is-24-hour (constantly false)]
d/is24Hour (constantly false)]
(testing "formats previous years"
;; 1974-12-31 23:59:59Z
(is (= "Dec 31, 1974" (d/timestamp->relative 157766399000)))
@@ -173,7 +173,7 @@
#_((deftest day-relative-before-yesterday-force-24H-test
(with-redefs [t/*ms-fn* (constantly epoch-plus-3d)
d/is-24-hour (constantly true)
d/is24Hour (constantly true)
d/time-zone-offset (t/period :hours 0)
d/date-fmt (i18n-module/mk-fmt
"us"
@@ -182,7 +182,7 @@
(deftest day-relative-before-yesterday-force-AMPM-test
(with-redefs [t/*ms-fn* (constantly epoch-plus-3d)
d/is-24-hour (constantly false)
d/is24Hour (constantly false)
d/time-zone-offset (t/period :hours 0)
d/date-fmt (i18n-module/mk-fmt
"it"
+1 -3
View File
@@ -2,7 +2,6 @@
(:require-macros status-im.utils.fx)
(:require [status-im.ethereum.json-rpc :as json-rpc]
[status-im.utils.handlers :as handlers]
[status-im2.common.json-rpc.events :as json-rpc-status-im2]
[taoensso.timbre :as log])
(:refer-clojure :exclude [merge reduce]))
@@ -22,8 +21,7 @@
:transport/confirm-messages-processed
:group-chats/extract-membership-signature
:utils/dispatch-later
::json-rpc/call
::json-rpc-status-im2/call})
::json-rpc/call})
(defn- safe-merge
[fx new-fx]
+2 -2
View File
@@ -5,8 +5,8 @@
[status-im.native-module.core :as status]
[status-im.utils.fx :as fx]
[status-im.utils.platform :as platform]
[taoensso.timbre :as log]
[utils.security.core :as security]))
[status-im.utils.security :as security]
[taoensso.timbre :as log]))
(defn- check-conditions
[callback & checks]
@@ -1,5 +1,5 @@
(ns utils.security.core
(:require [utils.security.security-html :as h]))
(ns status-im.utils.security
(:require [status-im.utils.security-html :as h]))
(defprotocol Unmaskable
;; Retrieve the stored value.
@@ -1,4 +1,4 @@
(ns utils.security.security-html
(ns status-im.utils.security-html
(:require [clojure.string :as string]))
; Taken from https://github.com/sindresorhus/is-html
@@ -1,6 +1,6 @@
(ns utils.security.security-html-test
(ns status-im.utils.security-html-test
(:require [cljs.test :refer-macros [deftest is testing]]
[utils.security.security-html :as s]))
[status-im.utils.security-html :as s]))
(deftest with-doctype
(is (s/is-html? "<!doctype html>"))
@@ -1,6 +1,6 @@
(ns utils.security.security-test
(ns status-im.utils.security-test
(:require [cljs.test :refer-macros [deftest is testing]]
[utils.security.core :as security]))
[status-im.utils.security :as security]))
(def rtlo-link "http://google.com")
(def rtlo-link-text "blah blah some other blah blah http://google.com blah bash")
-3
View File
@@ -2,9 +2,6 @@
(:refer-clojure :exclude [js->clj])
(:require [cljs-bean.core :as clj-bean]))
;; NOTE(19/12/22 yqrashawn) this namespace has been moved to the utils.transforms namespace,
;; we keep this only for old (status 1.0) code, can be removed with old code later
(defn to-string
[s]
(if (keyword? s)
+2 -2
View File
@@ -19,12 +19,12 @@
[status-im.utils.fx :as fx]
[status-im.utils.hex :as hex]
[status-im.utils.mobile-sync :as utils.mobile-sync]
[status-im.utils.security :as security]
[status-im.utils.types :as types]
[status-im.wallet.core :as wallet]
[status-im.wallet.prices :as prices]
[status-im2.navigation.events :as navigation]
[taoensso.timbre :as log]
[utils.security.core :as security]))
[taoensso.timbre :as log]))
(fx/defn start-adding-new-account
{:events [:wallet.accounts/start-adding-new-account]}
+3
View File
@@ -195,3 +195,6 @@
(def ^:const community-member-role-all 1)
(def ^:const community-member-role-manage-users 2)
(def ^:const community-member-role-moderator 3)
(def ^:const delete-message-undo-time-limit-ms 4000)
(def ^:const delete-message-for-me-undo-time-limit-ms 4000)
@@ -1,51 +0,0 @@
(ns status-im2.common.json-rpc.events
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[react-native.background-timer :as background-timer]
[status-im.native-module.core :as status]
[taoensso.timbre :as log]
[utils.transforms :as transforms]))
(defn on-error-retry
[call-method {:keys [method number-of-retries delay on-error] :as arg}]
(if (pos? number-of-retries)
(fn [error]
(let [updated-delay (if delay
(min 2000 (* 2 delay))
50)]
(log/debug "[on-error-retry]" method
"number-of-retries" number-of-retries
"delay" delay
"error" error)
(background-timer/set-timeout #(call-method (-> arg
(update :number-of-retries dec)
(assoc :delay updated-delay)))
updated-delay)))
on-error))
(defn call
[{:keys [method params on-success on-error js-response] :as arg}]
(let [params (or params [])
on-error (or on-error
(on-error-retry call arg)
#(log/warn :json-rpc/error method :error % :params params))]
(status/call-private-rpc
(transforms/clj->json {:jsonrpc "2.0"
:id 1
:method method
:params params})
(fn [response]
(if (string/blank? response)
(on-error {:message "Blank response"})
(let [response-js (transforms/json->js response)]
(if (.-error response-js)
(on-error (transforms/js->clj (.-error response-js)))
(on-success (if js-response
(.-result response-js)
(transforms/js->clj (.-result response-js)))))))))))
(re-frame/reg-fx
::call
(fn [params]
(doseq [param params]
(call param))))
-47
View File
@@ -1,47 +0,0 @@
(ns status-im2.common.toasts.events
(:require [utils.re-frame :as rf]))
(rf/defn upsert
{:events [:toasts/upsert]}
[{:keys [db]} id opts]
(let [{:keys [ordered toasts]} (:toasts db)
update? (some #(= % id) ordered)
ordered (if (not update?) (conj ordered id) ordered)
toasts (assoc toasts id opts)
db (-> db
(update :toasts assoc :ordered ordered :toasts toasts)
(update :toasts dissoc :hide-toasts-timer-set))]
(if (and (not update?) (= (count ordered) 1))
{:show-toasts []
:db db}
{:db db})))
(rf/defn create
{:events [:toasts/create]}
[{:keys [db]} opts]
(let [next-toast-id (or (get-in [:toasts :next-toast-id] db) 1)]
{:db (assoc-in db [:toasts :next-toast-id] (inc next-toast-id))
:dispatch [:toasts/upsert (str "toast-" next-toast-id) opts]}))
(rf/defn hide-toasts-with-check
{:events [:toasts/hide-with-check]}
[{:keys [db]}]
(when (get-in db [:toasts :hide-toasts-timer-set])
{:db (update db :toasts dissoc :hide-toasts-timer-set)
:hide-toasts nil}))
(rf/defn close
{:events [:toasts/close]}
[{:keys [db]} id]
(when (get-in db [:toasts :toasts id])
(let [{:keys [toasts ordered]} (:toasts db)
toasts (dissoc toasts id)
ordered (remove #(= % id) ordered)
empty-ordered? (not (seq ordered))
db (update db :toasts assoc :ordered ordered :toasts toasts)
effect {:db db}]
(if empty-ordered?
(-> effect
(update-in [:db :toasts] assoc :hide-toasts-timer-set true)
(assoc :dispatch-later [{:ms 500 :dispatch [:toasts/hide-with-check]}]))
effect))))
-14
View File
@@ -1,14 +0,0 @@
(ns status-im2.common.toasts.style)
(def outmost-transparent-container
{:elevation 2
:pointer-events :box-none
:padding-top 52
:flex-direction :column
:justify-content :center
:align-items :center
:background-color :transparent})
(def each-toast-container
{:width "100%"
:margin-bottom 5})
-97
View File
@@ -1,97 +0,0 @@
(ns status-im2.common.toasts.view
(:require [quo2.core :as quo]
[react-native.core :as rn]
[react-native.gesture :as gesture]
[react-native.reanimated :as reanimated]
[reagent.core :as reagent]
[status-im.utils.utils :as utils.utils]
[status-im2.common.toasts.style :as style]
[utils.re-frame :as rf]))
(def ^:private slide-out-up-animation
(-> ^js reanimated/slide-out-up-animation
.springify
(.damping 20)
(.stiffness 300)))
(def ^:private slide-in-up-animation
(-> ^js reanimated/slide-in-up-animation
.springify
(.damping 20)
(.stiffness 300)))
(def ^:private linear-transition
(-> ^js reanimated/linear-transition
.springify
(.damping 20)
(.stiffness 300)))
(defn container
[id]
(let [dismissed-locally? (reagent/atom false)
close! #(rf/dispatch [:toasts/close id])
timer (reagent/atom nil)
clear-timer #(utils.utils/clear-timeout @timer)]
(fn []
[:f>
(fn []
(let [toast-opts (rf/sub [:toasts/toast id])
duration (get toast-opts :duration 3000)
on-dismissed #((get toast-opts :on-dismissed identity) id)
translate-y (reanimated/use-shared-value 0)
create-timer (fn []
(reset! timer (utils.utils/set-timeout #(do (close!) (on-dismissed))
duration)))
pan
(->
(gesture/gesture-pan)
;; remove timer on pan start
(gesture/on-start clear-timer)
(gesture/on-update
(fn [^js evt]
(let [evt-translation-y (.-translationY evt)]
(cond
;; reset translate y on pan down
(> evt-translation-y 100)
(reanimated/animate-shared-value-with-spring translate-y
0
{:mass 1
:damping 20
:stiffness 300})
;; dismiss on pan up
(< evt-translation-y -30)
(do (reanimated/animate-shared-value-with-spring
translate-y
-500
{:mass 1 :damping 20 :stiffness 300})
(reset! dismissed-locally? true)
(close!))
:else
(reanimated/set-shared-value translate-y
evt-translation-y)))))
(gesture/on-end (fn [_]
(when-not @dismissed-locally?
(reanimated/set-shared-value translate-y 0)
(create-timer)))))]
;; create auto dismiss timer, clear timer when unmount or duration changed
(rn/use-effect (fn [] (create-timer) clear-timer) [duration])
(rn/use-unmount on-dismissed)
[gesture/gesture-detector {:gesture pan}
[reanimated/view
{:entering slide-in-up-animation
:exiting slide-out-up-animation
:layout reanimated/linear-transition
:style (reanimated/apply-animations-to-style
{:transform [{:translateY translate-y}]}
style/each-toast-container)}
[quo/toast toast-opts]]]))])))
(defn toasts
[]
(let [toasts-ordered (:ordered (rf/sub [:toasts]))]
[into
[rn/view
{:style style/outmost-transparent-container}]
(->> toasts-ordered
reverse
(map (fn [id] ^{:key id} [container id])))]))
@@ -1,8 +1,8 @@
(ns status-im2.contexts.activity-center.events
(:require [re-frame.core :as rf]
[status-im.data-store.activities :as data-store.activities]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.utils.fx :as fx]
[status-im2.common.json-rpc.events :as json-rpc]
[status-im2.contexts.activity-center.notification-types :as types]
[taoensso.timbre :as log]))
@@ -3,9 +3,9 @@
[day8.re-frame.test :as rf-test]
[re-frame.core :as rf]
[status-im.constants :as constants]
[status-im.ethereum.json-rpc :as json-rpc]
status-im.events
[status-im.test-helpers :as h]
[status-im2.common.json-rpc.events :as json-rpc]
[status-im2.contexts.activity-center.events :as activity-center]
[status-im2.contexts.activity-center.notification-types :as types]))
@@ -0,0 +1,16 @@
(ns status-im2.contexts.chat.messages.content.deleted.view
(:require [i18n.i18n :as i18n]
[quo2.core :as quo]))
(defn deleted-message
[{:keys [deleted? deleted-undoable-till timestamp-str deleted-for-me-undoable-till]}]
[quo/system-message
{:type :deleted
:label (if deleted? :message-deleted :message-deleted-for-you)
:labels {:pinned-a-message (i18n/label :t/pinned-a-message)
:message-deleted (i18n/label :t/message-deleted-for-everyone)
:message-deleted-for-you (i18n/label :t/message-deleted-for-you)
:added (i18n/label :t/added)}
:timestamp-str timestamp-str
:non-pressable? true
:animate-landing? (or deleted-undoable-till deleted-for-me-undoable-till)}])
@@ -0,0 +1,14 @@
(ns status-im2.contexts.chat.messages.content.pin.style
(:require [quo2.foundations.colors :as colors]))
(def pin-indicator-container
{:margin-top 4
:margin-left 54
:justify-content :center
:align-self :flex-start
:align-items :flex-start
:flex-direction :row})
(def pin-author-text
{:color colors/primary-50
:bottom 2})
@@ -0,0 +1,59 @@
(ns status-im2.contexts.chat.messages.content.pin.view
(:require [i18n.i18n :as i18n]
[quo2.core :as quo]
[quo2.foundations.colors :as colors]
[react-native.core :as rn]
[status-im.ui.screens.chat.styles.message.message :as old-style]
[status-im.ui2.screens.chat.messages.message :as old-message]
[status-im2.contexts.chat.messages.content.pin.style :as style]
[utils.re-frame :as rf]))
(defn pinned-by-view
[pinned-by]
(let [{:keys [public-key]} (rf/sub [:multiaccount/contact])
contact-names (rf/sub [:contacts/contact-two-names-by-identity pinned-by])
author-name (if (= pinned-by public-key) (i18n/label :t/You) (first contact-names))]
[rn/view {:style style/pin-indicator-container}
[quo/icon :i/pin {:color colors/primary-50 :size 16}]
[quo/text
{:size :label
:weight :medium
:style style/pin-author-text}
author-name]]))
(defn system-message
[{:keys [from in-popover? timestamp-str chat-id] :as message}]
(let [response-to (:response-to (:content message))
default-size 36]
[rn/touchable-opacity
{:on-press #(rf/dispatch [:bottom-sheet/show-sheet :pinned-messages-list chat-id])
:active-opacity 1
:style (merge {:flex-direction :row :margin-vertical 8}
(old-style/message-wrapper message))}
[rn/view
{:style {:width default-size
:height default-size
:margin-right 16
:border-radius default-size
:justify-content :center
:align-items :center
:background-color colors/primary-50-opa-10}
:accessibility-label :content-type-pin-icon}
[quo/icon :i/pin {:color colors/primary-50 :size 16}]]
[:<>
[rn/view {:style {:flex-direction :row :align-items :center}}
[rn/touchable-opacity
{:style old-style/message-author-touchable
:disabled in-popover?
:on-press #(rf/dispatch [:chat.ui/show-profile from])}
[old-message/message-author-name from {} 20]]
[rn/text {:style {:font-size 13}} (str " " (i18n/label :t/pinned-a-message))]
[rn/text
{:style (merge
{:padding-left 5
:margin-top 2}
(old-style/message-timestamp-text))
:accessibility-label :message-timestamp}
timestamp-str]]
[old-message/quoted-message {:message-id response-to :chat-id chat-id} (:quoted-message message)
true]]]))
@@ -0,0 +1,26 @@
(ns status-im2.contexts.chat.messages.content.reactions.view
(:require [quo2.core :as quo]
[react-native.core :as rn]
[status-im2.common.constants :as constants]
[status-im2.contexts.chat.messages.drawers.view :as drawers]
[utils.re-frame :as rf]))
(defn message-reactions-row
[chat-id message-id]
(let [reactions (rf/sub [:chats/message-reactions message-id chat-id])]
(when (seq reactions)
[rn/view {:margin-left 52 :margin-bottom 12 :flex-direction :row}
(for [{:keys [own emoji-id quantity] :as emoji-reaction} reactions]
^{:key (str emoji-reaction)}
[rn/view {:style {:margin-right 6}}
[quo/reaction
{:emoji (get constants/reactions emoji-id)
:neutral? own
:clicks quantity
:on-press #(rf/dispatch [:models.reactions/send-emoji-reaction-retraction
{:message-id message-id
:emoji-id emoji-id}])
:accessibility-label (str "emoji-reaction-" emoji-id)}]])
[quo/add-reaction
{:on-press #(rf/dispatch [:bottom-sheet/show-sheet
{:content (fn [] [drawers/reactions message-id])}])}]])))
@@ -0,0 +1,6 @@
(ns status-im2.contexts.chat.messages.content.status.view
(:require [status-im.ui2.screens.chat.messages.message :as old-message]))
(defn status
[message-data]
[old-message/message-status message-data])
@@ -0,0 +1,11 @@
(ns status-im2.contexts.chat.messages.content.style
(:require [quo2.foundations.colors :as colors]))
(defn message-container
[in-pinned-view? pinned mentioned last-in-group?]
(merge (when (and (not in-pinned-view?) (or mentioned pinned))
{:background-color colors/primary-50-opa-5
:margin-bottom 4})
(when (or mentioned pinned last-in-group?)
{:margin-top 8})
{:border-radius 16}))
@@ -0,0 +1,8 @@
(ns status-im2.contexts.chat.messages.content.system.text.view
(:require [react-native.core :as rn]
[status-im.ui2.screens.chat.messages.message :as old-message]))
(defn text-content
[message-data]
[rn/view {:accessibility-label :chat-item}
[old-message/render-parsed-text message-data]])
@@ -0,0 +1 @@
(ns status-im2.contexts.chat.messages.content.text.style)

Some files were not shown because too many files have changed in this diff Show More