Compare commits

..
2 Commits
Author SHA1 Message Date
Omar Basem 3537522796 lint 2024-05-08 17:18:29 +04:00
Icaro Motta a6574856d8 Optimize opening of Settings screens 2024-05-08 09:59:52 -03:00
54 changed files with 493 additions and 1167 deletions
-7
View File
@@ -1,5 +1,4 @@
{:config-paths ["status-im"]
:output {:exclude-files ["src/user.cljs" "src/dev/user.cljs"]}
:lint-as {legacy.status-im.utils.views/defview clojure.core/defn
legacy.status-im.utils.views/letsubs clojure.core/let
reagent.core/with-let clojure.core/let
@@ -16,8 +15,6 @@
:case-symbol-test {:level :error}
:clj-kondo-config {:level :error}
:cond-else {:level :error}
:condition-always-true {:level :error}
:conflicting-alias {:level :error}
:consistent-alias {:level :error
:aliases {clojure.set set
clojure.string string
@@ -45,13 +42,11 @@
:missing-body-in-when {:level :error}
:missing-clause-in-try {:level :error}
:missing-else-branch {:level :error}
:multiple-async-in-deftest {:level :error}
:not-empty? {:level :error}
:plus-one {:level :error}
:redundant-do {:level :error}
:redundant-let {:level :error}
:refer-all {:level :error}
:shadowed-fn-param {:level :error}
:shadowed-var {:level :error
;; We temporarily use :include to define an
;; allowlist of core Clojure vars. In the
@@ -59,11 +54,9 @@
;; vars, we should be able to delete this
;; option and lint all vars.
:exclude [type name]}
:self-requiring-namespace {:level :error}
:single-operand-comparison {:level :error}
:syntax {:level :error}
:unbound-destructuring-default {:level :error}
:underscore-in-namespace {:level :error}
:uninitialized-var {:level :error}
:unknown-require-option {:level :error}
:unreachable-code {:level :error}
-2
View File
@@ -127,8 +127,6 @@ fastlane/README.md
# Clj
.cpcache/
src/user.cljs
src/dev/user.cljs
# emacs
.dir-locals.el
+6 -13
View File
@@ -1,9 +1,5 @@
// This code has pieces that were autogenerated but is now managed manually
// Here lies the node bindings used for integration tests
// These are basically C calls to exported status-go functions
// Along 1 additional Poll function to get signals to work
// function names registered here in init() are used in various places
// ref -> status-mobile/src/tests/test_utils.cljs
// DO NOT EDIT: code is autogenerated by go2nodebinding from Go code.
// https://github.com/divan/go2nodebinding
#include <node.h>
#include <string>
@@ -1151,13 +1147,10 @@ void _PollSignal(const FunctionCallbackInfo<Value>& args) {
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(args[0]);
if (!q.empty()) {
const unsigned argc = 1;
v8::Local<v8::Value> argv[argc] = {v8::String::NewFromUtf8(isolate, q.front().c_str()).ToLocalChecked()};
v8::MaybeLocal<v8::Value> result = func->Call(isolate->GetCurrentContext(), v8::Null(isolate), argc, argv);
if (result.IsEmpty()) {
isolate->ThrowException(Exception::Error(
String::NewFromUtf8Literal(isolate, "Error calling the callback function")));
return;
}
v8::Local<v8::Value> argv[argc] =
{ v8::String::NewFromUtf8(isolate,q.front().c_str()).ToLocalChecked()};
func->Call(isolate->GetCurrentContext(), v8::Null(isolate), argc, argv);
q.pop();
}
}
+97 -115
View File
@@ -90,20 +90,11 @@
},
{
"path": "cider/cider-nrepl/0.44.0/cider-nrepl-0.44.0",
"path": "cider/cider-nrepl/0.31.0/cider-nrepl-0.31.0",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "c3d3a729beaa728d0ee6a3678a48c880b6bc95f1",
"sha256": "0klcppvydxlx9ji376mvz40yv3s7awq6p9yd57wigpfy4m2yv0w6"
}
},
{
"path": "cider/orchard/0.21.0/orchard-0.21.0",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "073617f16a132c7f20608d971244753d4e704129",
"sha256": "1n2afbyhw9x9kvfna4m4x6n6pwjiqsqcayql644bw2932i1isrkj"
"sha1": "1f28a4a834a7a46cf24def971b1a705a6795c73a",
"sha256": "0h4pyzy8rzzh567khvimw2cs8jr640kqxgaxvbfx1s5yfp56fka2"
}
},
@@ -117,11 +108,11 @@
},
{
"path": "clj-kondo/clj-kondo/2024.03.13/clj-kondo-2024.03.13",
"path": "clj-kondo/clj-kondo/2023.09.07/clj-kondo-2023.09.07",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "adec398a95322f3a27baf0a92b658493335464d1",
"sha256": "0r97hsj7m3qc12xwyxx6m1a71gqp5aiy99imcf8r0nz2dnjmj0kz"
"sha1": "9bf516b973a0b77d7dc5a3c6c84a884e3470e7b7",
"sha256": "1qkw5ryqdzy4wl3xbr0r72ikrch75z5vh1dny569y3jlc888gkv8"
}
},
@@ -260,15 +251,6 @@
}
},
{
"path": "com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "c9ad4a0850ab676c5c64461a05ca524cdfff59f1",
"sha256": "170rflxnqnah0265ik2aylmxkshyqbf2zas9bp2l32xqj9l6jsaf"
}
},
{
"path": "com/google/errorprone/error_prone_annotations/2.15.0/error_prone_annotations-2.15.0",
"host": "https://repo1.maven.org/maven2",
@@ -342,38 +324,11 @@
},
{
"path": "commons-codec/commons-codec/1.15/commons-codec-1.15",
"path": "com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "49d94806b6e3dc933dacbd8acb0fdbab8ebd1e5d",
"sha256": "0qzd8v96j4x7jjcfpvvdh9ar1xhwxpxi2rh51nzhj0br7bbgdsdk"
}
},
{
"path": "commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "f95188e3d372e20e7328706c37ef366e5d7859b0",
"sha256": "1xyyl54sfxsdcwxdyq6b0azmr31b4dwqns850jjkw9a9dwrh5v54"
}
},
{
"path": "commons-io/commons-io/2.11.0/commons-io-2.11.0",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "a2503f302b11ebde7ebc3df41daebe0e4eea3689",
"sha256": "020946yakki3qzc652arfndzi594drxanidz9bawbb6vhxnjy6wn"
}
},
{
"path": "compojure/compojure/1.5.2/compojure-1.5.2",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "0b5258d0616ffc5f64c2b6d95f09de56d24df439",
"sha256": "1s2k05lwnlm9a66mxnsss437i9gp70dny8y2rlfkl090s6mdqsaf"
"sha1": "c9ad4a0850ab676c5c64461a05ca524cdfff59f1",
"sha256": "170rflxnqnah0265ik2aylmxkshyqbf2zas9bp2l32xqj9l6jsaf"
}
},
@@ -413,6 +368,42 @@
}
},
{
"path": "commons-codec/commons-codec/1.15/commons-codec-1.15",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "49d94806b6e3dc933dacbd8acb0fdbab8ebd1e5d",
"sha256": "0qzd8v96j4x7jjcfpvvdh9ar1xhwxpxi2rh51nzhj0br7bbgdsdk"
}
},
{
"path": "commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "f95188e3d372e20e7328706c37ef366e5d7859b0",
"sha256": "1xyyl54sfxsdcwxdyq6b0azmr31b4dwqns850jjkw9a9dwrh5v54"
}
},
{
"path": "commons-io/commons-io/2.11.0/commons-io-2.11.0",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "a2503f302b11ebde7ebc3df41daebe0e4eea3689",
"sha256": "020946yakki3qzc652arfndzi594drxanidz9bawbb6vhxnjy6wn"
}
},
{
"path": "compojure/compojure/1.5.2/compojure-1.5.2",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "0b5258d0616ffc5f64c2b6d95f09de56d24df439",
"sha256": "1s2k05lwnlm9a66mxnsss437i9gp70dny8y2rlfkl090s6mdqsaf"
}
},
{
"path": "crypto-equality/crypto-equality/1.0.1/crypto-equality-1.0.1",
"host": "https://repo.clojars.org",
@@ -584,15 +575,6 @@
}
},
{
"path": "mx/cider/logjam/0.1.1/logjam-0.1.1",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "0e9a1c08d4e80e46be8ed8b8cb894bef5e56f39d",
"sha256": "1p6hnacyfjn365r0li639lf9fnqpgx1cs7jz7066cn566wjw46az"
}
},
{
"path": "net/cgrand/macrovich/0.2.1/macrovich-0.2.1",
"host": "https://repo.clojars.org",
@@ -621,11 +603,11 @@
},
{
"path": "nrepl/nrepl/1.1.0/nrepl-1.1.0",
"path": "nrepl/nrepl/0.9.0/nrepl-0.9.0",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "69f138d4a778c199e5d72446ca25998222ba0862",
"sha256": "0n29xczgwpqv98vz36sdic98mf07dmzhjawlxd63p2s2zafkp1ss"
"sha1": "49beada131959f08f9a20899affbd1b10c03a668",
"sha256": "1phak0479s27ffw9wzz7pi8cqqs6ipsm15dhgw9szxxcfhx529qa"
}
},
@@ -638,15 +620,6 @@
}
},
{
"path": "org/apache/ant/ant/1.10.11/ant-1.10.11",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "b875cd48a0bc955ae9c5c477ad991e1f26fb24d2",
"sha256": "0m07pifkdpwghpp8wvqh14sbxazmjbkkpsfakw6ixq5apfdvih48"
}
},
{
"path": "org/apache/ant/ant-launcher/1.10.11/ant-launcher-1.10.11",
"host": "https://repo1.maven.org/maven2",
@@ -657,11 +630,11 @@
},
{
"path": "org/babashka/sci/0.8.41/sci-0.8.41",
"host": "https://repo.clojars.org",
"path": "org/apache/ant/ant/1.10.11/ant-1.10.11",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "e8d59dc588a1e1f0c62c21fb47c093eeed043f04",
"sha256": "1lhv283fs0bnqbj1jhfgyy2rv6hspnhdgsiklqy3rqxrqbnrww6w"
"sha1": "b875cd48a0bc955ae9c5c477ad991e1f26fb24d2",
"sha256": "0m07pifkdpwghpp8wvqh14sbxazmjbkkpsfakw6ixq5apfdvih48"
}
},
@@ -674,6 +647,15 @@
}
},
{
"path": "org/babashka/sci/0.7.38/sci-0.7.38",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "ef2d8c74065b9a7d685a11bff017676db308a923",
"sha256": "04pkxwcgkd1p4f4rszsr6pp18fl0vni1az47a390llrhyyrjcckn"
}
},
{
"path": "org/checkerframework/checker-qual/3.12.0/checker-qual-3.12.0",
"host": "https://repo1.maven.org/maven2",
@@ -764,15 +746,6 @@
}
},
{
"path": "org/clojure/google-closure-library/0.0-20230227-c7c0a541/google-closure-library-0.0-20230227-c7c0a541",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "533ce2bdbb7925db781449abb6527af1e6c5e782",
"sha256": "0js19lw8bp9gym3pn47h867vhf65j18qc6x1pfn883vkwyasm18l"
}
},
{
"path": "org/clojure/google-closure-library-third-party/0.0-20230227-c7c0a541/google-closure-library-third-party-0.0-20230227-c7c0a541",
"host": "https://repo1.maven.org/maven2",
@@ -782,6 +755,15 @@
}
},
{
"path": "org/clojure/google-closure-library/0.0-20230227-c7c0a541/google-closure-library-0.0-20230227-c7c0a541",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "533ce2bdbb7925db781449abb6527af1e6c5e782",
"sha256": "0js19lw8bp9gym3pn47h867vhf65j18qc6x1pfn883vkwyasm18l"
}
},
{
"path": "org/clojure/math.combinatorics/0.2.0/math.combinatorics-0.2.0",
"host": "https://repo1.maven.org/maven2",
@@ -809,15 +791,6 @@
}
},
{
"path": "org/clojure/tools.analyzer/1.1.0/tools.analyzer-1.1.0",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "692882a35d7b50947d6e4852fba8a51d8d5e3646",
"sha256": "08fzw3srrppgq1d11sh1ghnyvi24ixa10kbqsncc7xyx7fybcs0k"
}
},
{
"path": "org/clojure/tools.analyzer.jvm/1.2.2/tools.analyzer.jvm-1.2.2",
"host": "https://repo1.maven.org/maven2",
@@ -827,6 +800,15 @@
}
},
{
"path": "org/clojure/tools.analyzer/1.1.0/tools.analyzer-1.1.0",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "692882a35d7b50947d6e4852fba8a51d8d5e3646",
"sha256": "08fzw3srrppgq1d11sh1ghnyvi24ixa10kbqsncc7xyx7fybcs0k"
}
},
{
"path": "org/clojure/tools.cli/1.0.206/tools.cli-1.0.206",
"host": "https://repo1.maven.org/maven2",
@@ -980,15 +962,6 @@
}
},
{
"path": "reagent/reagent/1.2.0/reagent-1.2.0",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "1b9a181b5c7ed3557768d2ea0c66f5616aef5e97",
"sha256": "0scvkzfqjs613z10rngh7427v3pxdqablf0fcl65pbpkzz16wgav"
}
},
{
"path": "re-com/re-com/2.8.0/re-com-2.8.0",
"host": "https://repo.clojars.org",
@@ -998,15 +971,6 @@
}
},
{
"path": "refactor-nrepl/refactor-nrepl/3.9.1/refactor-nrepl-3.9.1",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "f949af92dd1d6fef59d7447bd0cb62118e34eca1",
"sha256": "0dml9yvjmji6xk2sk3cdmkvvnh13rw29szxxl363hap8yg28xcs1"
}
},
{
"path": "re-frame/re-frame/1.3.0/re-frame-1.3.0",
"host": "https://repo.clojars.org",
@@ -1034,6 +998,24 @@
}
},
{
"path": "reagent/reagent/1.2.0/reagent-1.2.0",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "1b9a181b5c7ed3557768d2ea0c66f5616aef5e97",
"sha256": "0scvkzfqjs613z10rngh7427v3pxdqablf0fcl65pbpkzz16wgav"
}
},
{
"path": "refactor-nrepl/refactor-nrepl/3.9.1/refactor-nrepl-3.9.1",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "f949af92dd1d6fef59d7447bd0cb62118e34eca1",
"sha256": "0dml9yvjmji6xk2sk3cdmkvvnh13rw29szxxl363hap8yg28xcs1"
}
},
{
"path": "ring-cors/ring-cors/0.1.8/ring-cors-0.1.8",
"host": "https://repo.clojars.org",
+14 -16
View File
@@ -8,10 +8,9 @@ borkdude/edamame/1.3.23/edamame-1.3.23.jar
borkdude/sci.impl.reflector/0.0.1/sci.impl.reflector-0.0.1.jar
camel-snake-kebab/camel-snake-kebab/0.4.3/camel-snake-kebab-0.4.3.jar
cheshire/cheshire/5.11.0/cheshire-5.11.0.jar
cider/cider-nrepl/0.44.0/cider-nrepl-0.44.0.jar
cider/orchard/0.21.0/orchard-0.21.0.jar
cider/cider-nrepl/0.31.0/cider-nrepl-0.31.0.jar
cider/piggieback/0.5.2/piggieback-0.5.2.jar
clj-kondo/clj-kondo/2024.03.13/clj-kondo-2024.03.13.jar
clj-kondo/clj-kondo/2023.09.07/clj-kondo-2023.09.07.jar
cljs-bean/cljs-bean/1.9.0/cljs-bean-1.9.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
@@ -27,7 +26,6 @@ com/github/javaparser/javaparser-core/3.25.3/javaparser-core-3.25.3.jar
com/google/auto/value/auto-value-annotations/1.6/auto-value-annotations-1.6.jar
com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar
com/google/code/gson/gson/2.9.1/gson-2.9.1.jar
com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar
com/google/errorprone/error_prone_annotations/2.15.0/error_prone_annotations-2.15.0.jar
com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar
com/google/guava/guava/31.0.1-jre/guava-31.0.1-jre.jar
@@ -36,14 +34,15 @@ com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar
com/google/javascript/closure-compiler-unshaded/v20230802/closure-compiler-unshaded-v20230802.jar
com/google/protobuf/protobuf-java/3.21.12/protobuf-java-3.21.12.jar
com/google/re2j/re2j/1.3/re2j-1.3.jar
commons-codec/commons-codec/1.15/commons-codec-1.15.jar
commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4.jar
commons-io/commons-io/2.11.0/commons-io-2.11.0.jar
compojure/compojure/1.5.2/compojure-1.5.2.jar
com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar
com/taoensso/encore/3.68.0/encore-3.68.0.jar
com/taoensso/timbre/6.3.1/timbre-6.3.1.jar
com/taoensso/truss/1.11.0/truss-1.11.0.jar
com/taoensso/tufte/2.6.3/tufte-2.6.3.jar
commons-codec/commons-codec/1.15/commons-codec-1.15.jar
commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4.jar
commons-io/commons-io/2.11.0/commons-io-2.11.0.jar
compojure/compojure/1.5.2/compojure-1.5.2.jar
crypto-equality/crypto-equality/1.0.1/crypto-equality-1.0.1.jar
crypto-random/crypto-random/1.2.1/crypto-random-1.2.1.jar
day8/re-frame/test/0.1.5/test-0.1.5.jar
@@ -63,16 +62,15 @@ javax/xml/bind/jaxb-api/2.3.0/jaxb-api-2.3.0.jar
medley/medley/0.8.2/medley-0.8.2.jar
metosin/malli/0.13.0/malli-0.13.0.jar
mvxcvi/arrangement/2.1.0/arrangement-2.1.0.jar
mx/cider/logjam/0.1.1/logjam-0.1.1.jar
net/cgrand/macrovich/0.2.1/macrovich-0.2.1.jar
net/java/dev/jna/jna/5.12.1/jna-5.12.1.jar
nrepl/bencode/1.1.0/bencode-1.1.0.jar
nrepl/nrepl/1.1.0/nrepl-1.1.0.jar
nrepl/nrepl/0.9.0/nrepl-0.9.0.jar
nubank/matcher-combinators/3.8.8/matcher-combinators-3.8.8.jar
org/apache/ant/ant/1.10.11/ant-1.10.11.jar
org/apache/ant/ant-launcher/1.10.11/ant-launcher-1.10.11.jar
org/babashka/sci/0.8.41/sci-0.8.41.jar
org/apache/ant/ant/1.10.11/ant-1.10.11.jar
org/babashka/sci.impl.types/0.0.2/sci.impl.types-0.0.2.jar
org/babashka/sci/0.7.38/sci-0.7.38.jar
org/checkerframework/checker-qual/3.12.0/checker-qual-3.12.0.jar
org/clojure/clojure/1.11.1/clojure-1.11.1.jar
org/clojure/clojurescript/1.11.60/clojurescript-1.11.60.jar
@@ -83,13 +81,13 @@ org/clojure/core.rrb-vector/0.1.2/core.rrb-vector-0.1.2.jar
org/clojure/core.specs.alpha/0.2.62/core.specs.alpha-0.2.62.jar
org/clojure/data.json/2.4.0/data.json-2.4.0.jar
org/clojure/data.priority-map/1.1.0/data.priority-map-1.1.0.jar
org/clojure/google-closure-library/0.0-20230227-c7c0a541/google-closure-library-0.0-20230227-c7c0a541.jar
org/clojure/google-closure-library-third-party/0.0-20230227-c7c0a541/google-closure-library-third-party-0.0-20230227-c7c0a541.jar
org/clojure/google-closure-library/0.0-20230227-c7c0a541/google-closure-library-0.0-20230227-c7c0a541.jar
org/clojure/math.combinatorics/0.2.0/math.combinatorics-0.2.0.jar
org/clojure/spec.alpha/0.3.218/spec.alpha-0.3.218.jar
org/clojure/test.check/1.1.1/test.check-1.1.1.jar
org/clojure/tools.analyzer/1.1.0/tools.analyzer-1.1.0.jar
org/clojure/tools.analyzer.jvm/1.2.2/tools.analyzer.jvm-1.2.2.jar
org/clojure/tools.analyzer/1.1.0/tools.analyzer-1.1.0.jar
org/clojure/tools.cli/1.0.206/tools.cli-1.0.206.jar
org/clojure/tools.logging/1.1.0/tools.logging-1.1.0.jar
org/clojure/tools.macro/0.1.5/tools.macro-0.1.5.jar
@@ -107,12 +105,12 @@ org/slf4j/slf4j-nop/2.0.9/slf4j-nop-2.0.9.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.4.Final/wildfly-common-1.5.4.Final.jar
prismatic/schema/1.1.7/schema-1.1.7.jar
reagent/reagent/1.2.0/reagent-1.2.0.jar
re-com/re-com/2.8.0/re-com-2.8.0.jar
refactor-nrepl/refactor-nrepl/3.9.1/refactor-nrepl-3.9.1.jar
re-frame/re-frame/1.3.0/re-frame-1.3.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.2.0/reagent-1.2.0.jar
refactor-nrepl/refactor-nrepl/3.9.1/refactor-nrepl-3.9.1.jar
ring-cors/ring-cors/0.1.8/ring-cors-0.1.8.jar
ring/ring-codec/1.2.0/ring-codec-1.2.0.jar
ring/ring-core/1.9.6/ring-core-1.9.6.jar
+5 -6
View File
@@ -1,9 +1,8 @@
{ stdenv, meta, source, buildGo119Package, buildGo120Package }:
let
# https://github.com/status-im/status-mobile/issues/19802
# only for Darwin to fix Integration Tests failing with missing symbols on go 1.20
buildGoPackageIntegrationTest = if stdenv.isDarwin then buildGo119Package else buildGo120Package;
in buildGoPackageIntegrationTest {
{ buildGoPackage
# object with source attributes
, meta, source}:
buildGoPackage {
pname = source.repo;
version = "${source.cleanVersion}-${source.shortRev}";
+1 -1
View File
@@ -21,7 +21,7 @@
[nubank/matcher-combinators "3.8.8"]
;; Use the same version specified in the Nix dependency.
[clj-kondo/clj-kondo "2024.03.13"]
[clj-kondo/clj-kondo "2023.09.07"]
;; Routing
[bidi "2.1.6"]
-23
View File
@@ -1,23 +0,0 @@
# The `dev/` directory
The `src/dev/` directory is a place where developers can commit non-production
and non-test code which can facilitate development in general. The code should,
ideally, be useful to more than one team member.
**Note**: As of today (2024-05-07), we don't have further guidelines or examples
about how mobile teams should use and maintain these dev-only namespaces. Before
opening a PR introducing new dev-only namespaces, consider sharing and
discussing with as many team members as you can.
### The `user` namespace
You may optionally create a `src/dev/user.cljs` and/or `src/user.cljs` file.
These files are git-ignored and are meant to be your own playground. Clojure
developers usually use such namespaces to create temporary utilities and
experiments that aren't necessarily useful to others. They are particularly
valuable for developers adept at the REPL-Driven Development workflow.
Be careful with `make clean` because it will delete all non-tracked git files.
If you rely on this file, you may prefer to create a symbolic link and store the
original `user.cljs` file outside the `status-mobile` repository. Then, after
`make clean`, you will need to recreate the symlink.
@@ -12,8 +12,7 @@
[re-frame.core :as re-frame.core]
[react-native.core :as rn]
[status-im.contexts.profile.utils :as profile.utils]
[utils.ens.core :as utils.ens]
[utils.image-server :as image-server]))
[utils.ens.core :as utils.ens]))
;;TODO REWORK THIS NAMESPACE
@@ -157,11 +156,9 @@
(styles/default-chat-icon-text size)
(styles/emoji-chat-icon-text size))}
override-styles)
img-config (:config photo-path)
photo-path (if img-config
photo-path (if (:fn photo-path)
;; temp support new media server avatar for old component
{:uri (image-server/get-image-uri
img-config
{:uri ((:fn photo-path)
{:size size
:full-name name
:font-size (get-in styles [:default-chat-icon-text :font-size])
@@ -8,7 +8,6 @@
[react-native.core :as rn]
[react-native.fast-image :as fast-image]
[schema.core :as schema]
[utils.image-server :as image-server]
utils.string))
(defn initials-avatar
@@ -39,23 +38,23 @@
online? true
ring? true}
:as props}]
(let [theme (quo.theme/use-theme)
picture-config (:config profile-picture)
full-name (or full-name "Your Name")
(let [theme (quo.theme/use-theme)
full-name (or full-name "Your Name")
;; image generated with `profile-picture-fn` is round cropped
;; no need to add border-radius for them
outer-styles (style/outer size (not picture-config))
outer-styles (style/outer size (not (:fn profile-picture)))
;; Once image is loaded, fast image re-renders view with the help of reagent atom,
;; But dynamic updates don't work when user-avatar is used inside hole-view
;; https://github.com/status-im/status-mobile/issues/15553
image-view (if static? no-flicker-image/image fast-image/fast-image)
font-size (get-in style/sizes [size :font-size])
amount-initials (if (#{:xs :xxs :xxxs} size) 1 2)
sizes (get style/sizes size)
indicator-color (get (style/indicator-color theme) (if online? :online :offline))]
image-view (if static? no-flicker-image/image fast-image/fast-image)
font-size (get-in style/sizes [size :font-size])
amount-initials (if (#{:xs :xxs :xxxs} size) 1 2)
sizes (get style/sizes size)
indicator-color (get (style/indicator-color theme) (if online? :online :offline))
profile-picture-fn (:fn profile-picture)]
[rn/view {:style outer-styles :accessibility-label :user-avatar}
(if (and full-name (not (or picture-config profile-picture)))
(if (and full-name (not (or profile-picture-fn profile-picture)))
;; this is for things that's not user-avatar but are currently using user-avatar to render
;; the initials e.g. community avatar
[initials-avatar props]
@@ -63,9 +62,8 @@
{:accessibility-label :profile-picture
:style outer-styles
:source
(cond picture-config
{:uri (image-server/get-image-uri
picture-config
(cond profile-picture-fn
{:uri (profile-picture-fn
{:length amount-initials
:full-name full-name
:font-size (:font-size (text/text-style {:size
@@ -78,7 +76,7 @@
:indicator-center-to-edge (when status-indicator?
(:status-indicator-center-to-edge sizes))
:indicator-color indicator-color
:theme theme
:override-theme theme
:color (:color style/initials-avatar-text)
:size (:width outer-styles)
:ring? ring?
@@ -8,10 +8,9 @@
[rn/view {:style (assoc container-style :flex-direction :row)}
(map-indexed
(fn [index action]
(when action
^{:key index}
[:<>
[channel-action/view action]
(when (not= action (last actions))
[rn/view {:style {:width 16}}])]))
^{:key index}
[:<>
[channel-action/view action]
(when (not= action (last actions))
[rn/view {:width 16}])])
actions)])
@@ -1,6 +1,5 @@
(ns quo.components.list-items.saved-address.view
(:require
[clojure.string :as string]
[quo.components.avatars.wallet-user-avatar.view :as wallet-user-avatar]
[quo.components.icon :as icon]
[quo.components.list-items.saved-address.style :as style]
@@ -10,51 +9,32 @@
[react-native.core :as rn]
[utils.address :as address]))
(def ^:private chains-map
{:eth :ethereum
:arb :arbitrum
:opt :optimism})
(defn- left-container
[{:keys [blur? ens address customization-color chain-color-map] address-name :name}]
[{:keys [blur? name ens address customization-color]}]
(let [theme (quo.theme/use-theme)]
[rn/view {:style style/left-container}
[wallet-user-avatar/wallet-user-avatar
{:size :size-32
:full-name address-name
:full-name name
:customization-color customization-color}]
[rn/view {:style style/account-container}
[text/text
{:weight :semi-bold
:size :paragraph-1
:style style/name-text}
address-name]
name]
[text/text {:size :paragraph-2}
[text/text
{:size :paragraph-2
:weight :monospace
:style (style/account-address blur? theme)}
(map (fn [[chain color]]
^{:key chain}
[text/text
{:size :paragraph-2
:weight :monospace
:style {:color color}} (str (name chain) ":")])
chain-color-map)
(or ens (address/get-shortened-key address))]]]]))
(defn view
[{:keys [blur? user-props active-state? customization-color on-press on-options-press chains]
[{:keys [blur? user-props active-state? customization-color on-press on-options-press]
:or {customization-color :blue
blur? false}}]
(let [theme (quo.theme/use-theme)
chains-vector (map keyword (string/split chains #":"))
chain-color-map (->> chains-vector
(map (fn [chain-short-keyword]
(let [chain-full-name (get chains-map chain-short-keyword)]
{chain-short-keyword (colors/resolve-color chain-full-name
theme)})))
(into {}))
[state set-state] (rn/use-state :default)
active? (rn/use-ref-atom false)
timer (rn/use-ref-atom nil)
@@ -84,8 +64,7 @@
:name (:name user-props)
:ens (:ens user-props)
:address (:address user-props)
:customization-color (or (:customization-color user-props) :blue)
:chain-color-map (when chains chain-color-map)}]
:customization-color (or (:customization-color user-props) :blue)}]
(when on-options-press
[rn/pressable
{:accessibility-label :options-button
@@ -12,8 +12,8 @@
[:lower-case? :boolean]
[:upper-case? :boolean]
[:numbers? :boolean]
[:symbols? :boolean]]]
:any])
[:symbols? :boolean]]
[:any]]])
(defn- view-internal
[{:keys [lower-case? upper-case? numbers? symbols?]}]
+1 -1
View File
@@ -204,7 +204,7 @@
(let [[render? set-render] (use-state false)]
(use-mount
(fn []
(js/setTimeout #(set-render true) 0)))
(reagent/next-tick #(set-render true))))
(when render?
content)))
+1 -1
View File
@@ -19,5 +19,5 @@
(catch js/Error e#
(taoensso.timbre/error "Failed to instrument function"
{:symbol ~sym :error e#})
(throw e#)))
~sym))
~sym))
+1 -1
View File
@@ -91,5 +91,5 @@
{:schema-id schema-id
:error e
:function f})
(throw e)))
f))
f)))
+7 -54
View File
@@ -3,9 +3,7 @@
[quo.foundations.colors :as colors]
[schema.registry :as registry]))
(def ^:private ?customization-color (into [:enum :primary] colors/account-colors))
(def ^:private ?profile-picture-options
(def ^:private ?profile-picture-fn-params
[:map
[:length :int]
[:full-name :string]
@@ -13,67 +11,22 @@
[:indicator-size {:optional true} [:maybe :int]]
[:indicator-color {:optional true} [:maybe :string]]
[:indicator-center-to-edge {:optional true} [:maybe :int]]
[:theme :schema.common/theme]
[:override-theme :schema.common/theme]
[:background-color :string]
[:color :string]
[:size :int]
[:ring? :boolean]
[:ring-width :int]])
(def ^:private ?account-image-uri-options
[:map
[:port :int]
[:ratio :double]
[:key-uid :string]
[:image-name :string]
[:theme :schema.common/theme]
[:override-ring? [:maybe :boolean]]])
(def ^:private ?initials-image-uri-options
[:map
[:port :int]
[:ratio :double]
[:uppercase-ratio :double]
[:font-file :string]
[:theme :schema.common/theme]
[:customization-color ?customization-color]
[:key-uid {:optional true} [:maybe :string]]
[:public-key {:optional true} [:maybe :string]]
[:override-ring? {:optional true} [:maybe :boolean]]])
(def ^:private ?contact-image-uri-options
[:map
[:port :int]
[:clock :int]
[:ratio :double]
[:image-name :string]
[:public-key :string]
[:theme :schema.common/theme]
[:override-ring? [:maybe :boolean]]])
(def ^:private ?image-uri-config
[:multi {:dispatch :type}
[:account
[:map
[:type [:= :account]]
[:options ?account-image-uri-options]]]
[:contact
[:map
[:type [:= :contact]]
[:options ?contact-image-uri-options]]]
[:initials
[:map
[:type [:= :initials]]
[:options ?initials-image-uri-options]]]])
(def ^:private ?profile-picture-source
[:or
:schema.common/image-source
[:map
[:config ?image-uri-config]]])
[:fn [:=> [:cat ?profile-picture-fn-params] :string]]]])
(def ^:private ?customization-color (into [:enum] colors/account-colors))
(defn register-schemas
[]
(registry/register ::customization-color ?customization-color)
(registry/register ::image-uri-config ?image-uri-config)
(registry/register ::profile-picture-source ?profile-picture-source)
(registry/register ::profile-picture-options ?profile-picture-options))
(registry/register ::customization-color ?customization-color))
@@ -78,10 +78,9 @@
(defn add-character
[state character]
(if (can-add-character? state character)
(when (can-add-character? state character)
(set-input-value state
(normalize-value-as-numeric (input-value state) character))
state))
(normalize-value-as-numeric (input-value state) character))))
(defn delete-last
[state]
+11 -6
View File
@@ -365,21 +365,23 @@
:sub-label nil
:chevron? false}))
;; TODO(OmarBasem): to be implemented.
(defn add-members-entry
[chat-id]
[]
(entry {:icon :i/add-user
:label (i18n/label :t/add-members)
:on-press #(rf/dispatch [:open-modal :group-add-manage-members chat-id])
:on-press #(js/alert "TODO: to be implemented")
:danger? false
:accessibility-label :add-members
:sub-label nil
:chevron? false}))
;; TODO(OmarBasem): to be implemented.
(defn manage-members-entry
[chat-id]
[]
(entry {:icon :i/add-user
:label (i18n/label :t/manage-members)
:on-press #(rf/dispatch [:open-modal :group-add-manage-members chat-id])
:on-press #(js/alert "TODO: to be implemented")
:danger? false
:accessibility-label :manage-members
:sub-label nil
@@ -433,8 +435,11 @@
admin? (get admins current-pub-key)]
[(group-details-entry chat-id)
(when inside-chat?
(when admin?
(manage-members-entry chat-id)))
(if admin?
(when config/show-not-implemented-features?
(manage-members-entry))
(when config/show-not-implemented-features?
(add-members-entry))))
(when (and admin? inside-chat?)
(when config/show-not-implemented-features?
(edit-group-entry)))
@@ -1,10 +0,0 @@
(ns status-im.common.refreshable-flat-list.view
(:require [react-native.core :as rn]
[reagent.core :as reagent]))
(defn view
[{:keys [refresh-control] :as props}]
[rn/flat-list
(merge {:refresh-control (reagent/as-element
refresh-control)}
(dissoc props :refresh-control))])
@@ -4,7 +4,6 @@
[quo.foundations.colors :as colors]
[quo.theme]
[react-native.core :as rn]
[react-native.gesture :as gesture]
[react-native.safe-area :as safe-area]
[reagent.core :as reagent]
[status-im.common.contact-list-item.view :as contact-list-item]
@@ -43,12 +42,13 @@
item]))))
(defn add-manage-members
[{:keys [scroll-enabled? on-scroll]}]
(let [selected-participants (rf/sub [:group-chat/selected-participants])
deselected-members (rf/sub [:group-chat/deselected-members])
chat-id (rf/sub [:get-screen-params :group-add-manage-members])
group (rf/sub [:chats/chat-by-id chat-id])
theme (quo.theme/use-theme)]
[]
(let [selected-participants (rf/sub [:group-chat/selected-participants])
deselected-members (rf/sub [:group-chat/deselected-members])
chat-id (rf/sub [:get-screen-params :group-details])
{:keys [admins] :as group} (rf/sub [:chats/chat-by-id chat-id])
theme (quo.theme/use-theme)
admin? (get admins (rf/sub [:multiaccount/public-key]))]
[rn/view {:flex 1 :margin-top 20}
[rn/touchable-opacity
{:on-press #(rf/dispatch [:navigate-back])
@@ -59,11 +59,9 @@
{:size :heading-1
:weight :semi-bold
:style {:margin-left 20}}
(i18n/label :t/manage-members)]
[gesture/section-list
(i18n/label (if admin? :t/manage-members :t/add-members))]
[rn/section-list
{:key-fn :title
:scroll-enabled @scroll-enabled?
:on-scroll on-scroll
:sticky-section-headers-enabled false
:sections (rf/sub [:contacts/grouped-by-first-letter])
:render-section-header-fn contact-list/contacts-section-header
@@ -141,8 +139,7 @@
:customization-color color}}]
[quo/channel-actions
{:container-style style/actions-view
:actions [{:big? (not admin?)
:accessibility-label :pinned-messages
:actions [{:accessibility-label :pinned-messages
:label (i18n/label :t/pinned-messages)
:customization-color color
:icon :i/pin
@@ -158,17 +155,16 @@
:on-press #(rf/dispatch [:chat.ui/mute chat-id (not muted)
(when-not muted
constants/mute-till-unmuted)])}
(when admin?
{:accessibility-label :manage-members
:customization-color color
:icon :i/add-user
:label (i18n/label :t/manage-members)
:counter-value (count contacts)
:on-press (fn []
(rf/dispatch [:group/clear-added-participants])
(rf/dispatch [:group/clear-removed-members])
(rf/dispatch [:open-modal :group-add-manage-members
chat-id]))})]}]
{:accessibility-label :manage-members
:customization-color color
:icon :i/add-user
:label (i18n/label (if admin? :t/manage-members :t/add-members))
:counter-value (count contacts)
:on-press (fn []
(rf/dispatch [:group/clear-added-participants])
(rf/dispatch [:group/clear-removed-members])
(rf/dispatch [:open-modal :group-add-manage-members
chat-id]))}]}]
[rn/section-list
{:key-fn :title
:sticky-section-headers-enabled false
@@ -1,6 +1,5 @@
(ns status-im.contexts.preview.feature-flags.style)
(def container
{:flex 1
:margin-left 20
:margin-bottom 20})
{:flex 1
:margin-left 20})
@@ -15,28 +15,25 @@
:text-align :left
:title "Features Flags"
:icon-name :i/arrow-left
:on-press #(rf/dispatch [:navigate-back])
:right-side [{:icon-name :i/rotate
:on-press #(ff/reset-flags)}]}]
[rn/scroll-view
(doall
(for [context-name ff/feature-flags-categories
:let [context-flags (filter (fn [[k]]
(= context-name
(first (string/split (str (name k)) "."))))
(ff/feature-flags))]]
^{:key (str context-name)}
[rn/view {:style style/container}
[quo/text
context-name]
(doall
(for [i (range (count context-flags))
:let [[flag] (nth context-flags i)]]
^{:key (str context-name flag i)}
[rn/view {:style {:flex-direction :row}}
[quo/selectors
{:type :toggle
:checked? (ff/enabled? flag)
:container-style {:margin-right 8}
:on-change #(ff/toggle flag)}]
[quo/text (second (string/split (name flag) "."))]]))]))]])
:on-press #(rf/dispatch [:navigate-back])}]
(doall
(for [context-name ff/feature-flags-categories
:let [context-flags (filter (fn [[k]]
(string/includes? (str k) context-name))
(ff/feature-flags))]]
^{:key (str context-name)}
[rn/view {:style style/container}
[quo/text
context-name]
(doall
(for [i (range (count context-flags))
:let [[flag] (nth context-flags i)]]
^{:key (str context-name flag i)}
[rn/view {:style {:flex-direction :row}}
[quo/selectors
{:type :toggle
:checked? (ff/enabled? flag)
:container-style {:margin-right 8}
:on-change #(ff/toggle flag)}]
[quo/text (second (string/split (name flag) "."))]]))]))])
@@ -8,8 +8,7 @@
[(preview/customization-color-option {:key :account-color})
{:key :blur? :type :boolean}
{:key :title :type :text}
(preview/customization-color-option)
{:key :chains :type :text}])
(preview/customization-color-option)])
(defn view
[]
@@ -18,8 +17,7 @@
:account-color :flamingo
:title "Alisher Yakupov"
:address "0x21a...49e"
:on-options-press #(js/alert "Options button pressed!")
:chains "eth:opt:arb:"})]
:on-options-press #(js/alert "Options button pressed!")})]
(fn []
[preview/preview-container
{:state state
@@ -1,7 +1,6 @@
(ns status-im.contexts.profile.settings.list-items
(:require [status-im.common.not-implemented :as not-implemented]
[status-im.config :as config]
[status-im.feature-flags :as ff]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
@@ -35,13 +34,12 @@
:image :icon
:blur? true
:action :arrow}
{:title (i18n/label :t/wallet)
:on-press #(rf/dispatch [:open-modal :screen/settings.wallet])
:image-props :i/wallet
:image :icon
:blur? true
:action :arrow
:feature-flag ::ff/settings.wallet-settings}
{:title (i18n/label :t/wallet)
:on-press #(rf/dispatch [:open-modal :screen/settings.wallet])
:image-props :i/wallet
:image :icon
:blur? true
:action :arrow}
(when config/show-not-implemented-features?
{:title (i18n/label :t/dapps)
:on-press not-implemented/alert
@@ -9,24 +9,18 @@
[status-im.contexts.profile.settings.list-items :as settings.items]
[status-im.contexts.profile.settings.style :as style]
[status-im.contexts.profile.utils :as profile.utils]
[status-im.feature-flags :as ff]
[utils.debounce :as debounce]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn show-settings-item?
[{:keys [feature-flag]}]
(or (ff/enabled? feature-flag)
(nil? feature-flag)))
(defn- settings-category-view
(defn- settings-item-view
[data]
(rn/delay-render
[quo/category
{:list-type :settings
:container-style {:padding-bottom 12}
:blur? true
:data (filter show-settings-item? data)}]))
:data data}]))
(defn scroll-handler
[event scroll-y]
@@ -58,7 +52,8 @@
on-scroll (rn/use-callback #(scroll-handler % scroll-y))]
[quo/overlay {:type :shell}
[rn/view
{:style (style/navigation-wrapper {:customization-color customization-color
{:key :header
:style (style/navigation-wrapper {:customization-color customization-color
:inset (:top insets)
:theme theme})}
[quo/page-nav
@@ -77,10 +72,11 @@
{:options {:message (:universal-profile-url
profile)}}])}]}]]
[rn/flat-list
{:header [settings.header/view {:scroll-y scroll-y}]
{:key :list
:header [settings.header/view {:scroll-y scroll-y}]
:data (settings.items/items (boolean (:mnemonic profile)))
:shows-vertical-scroll-indicator false
:render-fn settings-category-view
:render-fn settings-item-view
:get-item-layout get-item-layout
:footer [footer insets logout-press]
:scroll-event-throttle 16
@@ -88,7 +84,8 @@
:bounces false
:over-scroll-mode :never}]
[quo/floating-shell-button
{:jump-to
{:key :shell
:jump-to
{:on-press #(rf/dispatch [:shell/navigate-to-jump-to])
:customization-color customization-color
:label (i18n/label :t/jump-to)}}
@@ -1,6 +0,0 @@
(ns status-im.contexts.settings.wallet.keypairs-and-accounts.actions.view
(:require [quo.core :as quo]))
(defn view
[props]
[quo/drawer-top props])
@@ -1,18 +0,0 @@
(ns status-im.contexts.settings.wallet.keypairs-and-accounts.style)
(def title-container
{:padding-horizontal 20
:margin-vertical 12})
(defn page-wrapper
[top-inset]
{:padding-top top-inset
:flex 1})
(defn list-container
[bottom-inset]
{:padding-bottom bottom-inset})
(def keypair-container-style
{:margin-horizontal 20
:margin-vertical 8})
@@ -1,89 +0,0 @@
(ns status-im.contexts.settings.wallet.keypairs-and-accounts.view
(:require [quo.core :as quo]
[quo.theme]
[react-native.core :as rn]
[react-native.safe-area :as safe-area]
[status-im.contexts.settings.wallet.keypairs-and-accounts.actions.view :as actions]
[status-im.contexts.settings.wallet.keypairs-and-accounts.style :as style]
[utils.address :as utils]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn navigate-back
[]
(rf/dispatch [:navigate-back]))
(defn on-options-press
[{:keys [theme]
:as props}]
(rf/dispatch [:show-bottom-sheet
{:content (fn [] [actions/view props])
:theme theme}]))
(defn- keypair
[{keypair-type :type
:keys [accounts name]}
_ _
{:keys [profile-picture compressed-key customization-color]}]
(let [theme (quo.theme/use-theme)
default-keypair? (= keypair-type :profile)
shortened-key (when default-keypair?
(utils/get-shortened-compressed-key compressed-key))
on-press (rn/use-callback
(fn []
(on-options-press
(cond-> {:theme theme
:blur? true
:title name}
default-keypair?
(assoc :type :default-keypair
:description shortened-key
:customization-color customization-color
:profile-picture profile-picture)
(not default-keypair?)
(assoc :type :keypair
:icon-avatar :i/seed))))
[customization-color default-keypair? name
profile-picture shortened-key theme])]
[quo/keypair
{:blur? false
:status-indicator false
:stored :on-device
:action :options
:accounts accounts
:customization-color customization-color
:container-style style/keypair-container-style
:profile-picture (when default-keypair? profile-picture)
:type (if default-keypair? :default-keypair :other)
:on-options-press on-press
:details {:full-name name
:address shortened-key}}]))
(defn view
[]
(let [insets (safe-area/get-insets)
compressed-key (rf/sub [:profile/compressed-key])
profile-picture (rf/sub [:profile/image])
customization-color (rf/sub [:profile/customization-color])
quo-keypairs-accounts (rf/sub [:wallet/settings-keypairs-accounts])]
[quo/overlay
{:type :shell
:container-style (style/page-wrapper (:top insets))}
[quo/page-nav
{:key :header
:background :blur
:icon-name :i/arrow-left
:on-press navigate-back}]
[rn/view {:style style/title-container}
[quo/standard-title
{:title (i18n/label :t/keypairs-and-accounts)
:accessibility-label :keypairs-and-accounts-header
:customization-color customization-color}]]
[rn/view {:style {:flex 1}}
[rn/flat-list
{:data quo-keypairs-accounts
:render-fn keypair
:render-data {:profile-picture profile-picture
:compressed-key compressed-key
:customization-color customization-color}
:content-container-style (style/list-container (:bottom insets))}]]]))
@@ -1,20 +0,0 @@
(ns status-im.contexts.settings.wallet.saved-addresses.events
(:require [taoensso.timbre :as log]
[utils.re-frame :as rf]))
(rf/reg-event-fx
:wallet/remove-account-success
(fn [_ [toast-message _]]
{:fx [[:dispatch [:wallet/get-saved-addresses]]
[:dispatch-later
{:ms 100
:dispatch [:wallet/show-account-deleted-toast toast-message]}]]}))
(rf/defn delete-saved-address
{:events [:wallet/delete-saved-address]}
[_ {:keys [address test? toast-message]}]
{:json-rpc/call
[{:method "wakuext_deleteSavedAddress"
:params [address test?]
:on-success [:wallet/remove-account-success toast-message]
:on-error #(log/error "Failed to delete saved address" %)}]})
@@ -2,8 +2,7 @@
(def title-container
{:padding-horizontal 20
:margin-top 12
:margin-bottom 16})
:margin-top 12})
(defn page-wrapper
[inset-top]
@@ -1,18 +1,14 @@
(ns status-im.contexts.settings.wallet.saved-addresses.view
(:require [quo.core :as quo]
[quo.foundations.colors :as colors]
[quo.theme :as quo.theme]
[react-native.core :as rn]
[react-native.platform :as platform]
[react-native.safe-area :as safe-area]
[status-im.common.not-implemented :as not-implemented]
[status-im.common.resources :as resources]
[status-im.config :as config]
[status-im.contexts.settings.wallet.saved-addresses.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn- empty-state
(defn empty-state
[]
(let [theme (quo.theme/use-theme)]
[quo/empty-state
@@ -21,169 +17,12 @@
:image (resources/get-themed-image :sweating-man theme)
:container-style style/empty-container-style}]))
(defn- option
[{:keys [icon label on-press danger? sub-label add-divider? accessibility-label right-icon] :as opt}]
(when opt
^{:key label}
{:icon icon
:label label
:on-press on-press
:danger? danger?
:sub-label sub-label
:right-icon right-icon
:add-divider? add-divider?
:accessibility-label accessibility-label}))
(defn- remove-account
[address account-name customization-color]
(rf/dispatch [:hide-bottom-sheet])
(rf/dispatch
[:show-bottom-sheet
{:theme :dark
:content (fn []
[:<>
[quo/drawer-top
{:title (i18n/label :t/remove-saved-address)
:customization-color customization-color}]
[quo/context-tag
{:type :default
:customization-color customization-color
:size 24
:full-name account-name
:container-style {:padding-horizontal 20
:margin-bottom 16}}]
[quo/text
{:style {:padding-horizontal 20
:margin-bottom 8}}
(i18n/label :t/remove-saved-address-description {:name account-name})]
[quo/bottom-actions
{:actions :two-actions
:button-one-label (i18n/label :t/remove)
:button-one-props {:on-press (fn []
(rf/dispatch [:wallet/delete-saved-address
{:address address
:toast-message
(i18n/label :t/saved-address-removed)
:test? false}]))
:type :danger}
:button-two-label (i18n/label :t/cancel)
:button-two-props {:on-press #(rf/dispatch [:hide-bottom-sheet])
:type :grey}}]])}]))
(defn- options
[account-name address customization-color]
[(when config/show-not-implemented-features?
{:icon :i/arrow-up
:label (i18n/label :t/send-to-user {:user account-name})
:on-press not-implemented/alert
:accessibility-label :send-to-user})
(when config/show-not-implemented-features?
{:icon :i/link
:right-icon :i/external
:label (i18n/label :t/view-address-on-website {:website "Etherscan"})
:on-press not-implemented/alert
:accessibility-label :view-address-on-etherscan})
(when config/show-not-implemented-features?
{:icon :i/link
:right-icon :i/external
:label (i18n/label :t/view-address-on-website {:website "Optimistic"})
:on-press not-implemented/alert
:accessibility-label :view-address-on-optimistic})
{:icon :i/share
:on-press #(rf/dispatch
[:open-share
{:options (if platform/ios?
{:activityItemSources [{:placeholderItem {:type :text
:content address}
:item {:default {:type :text
:content
address}}
:linkMetadata {:title address}}]}
{:title address
:subject address
:message address
:isNewTask true})}])
:label (i18n/label :t/share-address)
:accessibility-label :share-saved-address}
{:icon :i/qr-code
:label (i18n/label :t/show-address-qr)
:on-press (fn []
(rf/dispatch [:wallet/set-current-viewing-account address])
(rf/dispatch [:open-modal :screen/wallet.share-address {:status :share}]))
:accessibility-label :show-address-qr-code}
(when config/show-not-implemented-features?
{:icon :i/edit
:label (i18n/label :t/edit-account)
:on-press #(rf/dispatch [:navigate-to :screen/wallet.edit-account])
:accessibility-label :edit-saved-address})
(when config/show-not-implemented-features?
{:icon :i/delete
:label (i18n/label :t/remove-address)
:on-press #(remove-account address account-name customization-color)
:danger? true
:accessibility-label :remove-saved-address
:add-divider? true})])
(defn- sample-options
[account-name address customization-color]
(keep option (options account-name address customization-color)))
(defn- account-sheet
[address account-name customization-color]
[quo/action-drawer
[(sample-options account-name address customization-color)]])
(defn- on-press-saved-address
[{:keys [address account-name ens-name customization-color]}]
(rf/dispatch
[:show-bottom-sheet
{:theme :dark
:selected-item (fn []
[quo/saved-address
{:active-state? false
:user-props {:name account-name
:address address
:ens ens-name
:customization-color customization-color}}])
:content (fn []
[account-sheet
address account-name customization-color])}]))
(defn- saved-address
[{:keys [address colorId _chain-short-names _test? ens?]
account-name :name}]
[quo/saved-address
{:on-press #(on-press-saved-address
{:account-name account-name
:address address
:ens-name (when ens? address)
:customization-color (keyword colorId)})
:user-props {:name account-name
:address address
:customization-color (keyword colorId)}}])
(defn- header
[{:keys [title]}]
[quo/divider-label
{:container-style {:border-top-color colors/white-opa-5}}
title])
(defn- footer
[]
[rn/view {:height 8}])
(defn- navigate-back
[]
(rf/dispatch [:navigate-back]))
(defn- view
(defn view
[]
(let [inset-top (safe-area/get-top)
customization-color (rf/sub [:profile/customization-color])
saved-addresses (rf/sub [:wallet/grouped-saved-addresses])]
(rn/use-effect
(fn []
(rf/dispatch [:wallet/get-saved-addresses])))
saved-addresses []
navigate-back (rn/use-callback #(rf/dispatch [:navigate-back]))]
[quo/overlay
{:type :shell
:container-style (style/page-wrapper inset-top)}
@@ -199,13 +38,5 @@
:right :action
:customization-color customization-color
:icon :i/add}]]
[rn/section-list
{:key-fn :title
:sticky-section-headers-enabled false
:render-section-header-fn header
:render-section-footer-fn footer
:sections saved-addresses
:render-fn saved-address
:separator [rn/view {:style {:height 4}}]}]
(when-not (seq saved-addresses)
[empty-state])]))
@@ -1,8 +1,8 @@
(ns status-im.contexts.settings.wallet.wallet-options.view
(:require [quo.core :as quo]
[react-native.core :as rn]
[react-native.safe-area :as safe-area]
[status-im.contexts.settings.wallet.wallet-options.style :as style]
[status-im.feature-flags :as ff]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
@@ -10,18 +10,9 @@
[]
(rf/dispatch [:open-modal :screen/settings.saved-addresses]))
(defn open-keypairs-and-accounts-settings-modal
[]
(rf/dispatch [:open-modal :screen/settings.keypairs-and-accounts]))
(defn gen-basic-settings-options
[]
[(when (ff/enabled? ::ff/settings.keypairs-and-accounts)
{:title (i18n/label :t/keypairs-and-accounts)
:blur? true
:on-press open-keypairs-and-accounts-settings-modal
:action :arrow})
{:title (i18n/label :t/saved-addresses)
[{:title (i18n/label :t/saved-addresses)
:blur? true
:on-press open-saved-addresses-settings-modal
:action :arrow}])
@@ -35,13 +26,11 @@
:blur? true
:list-type :settings}])
(defn navigate-back
[]
(rf/dispatch [:navigate-back]))
(defn view
[]
(let [inset-top (safe-area/get-top)]
(let [inset-top (safe-area/get-top)
navigate-back (rn/use-callback
#(rf/dispatch [:navigate-back]))]
[quo/overlay
{:type :shell
:container-style (style/page-wrapper inset-top)}
@@ -33,12 +33,11 @@
{:type :wallet-networks
:on-press #(rf/dispatch [:wallet/close-account-page])}]
[quo/account-overview
{:container-style style/account-overview
:current-value formatted-balance
{:current-value formatted-balance
:account-name name
:account (if watch-only? :watched-address :default)
:customization-color color}]
(when (ff/enabled? ::ff/wallet.graph) [quo/wallet-graph {:time-frame :empty}])
[quo/wallet-graph {:time-frame :empty}]
(when (not watch-only?)
[quo/wallet-ctas
{:container-style style/cta-buttons
@@ -28,16 +28,15 @@
collection-name]]])
(defn cta-buttons
[{:keys [chain-id token-id contract-address watch-only?]}]
[chain-id token-id contract-address]
(let [theme (quo.theme/use-theme)]
[rn/view {:style style/buttons-container}
(when-not watch-only?
[quo/button
{:container-style style/send-button
:type :outline
:size 40
:icon-left :i/send}
(i18n/label :t/send)])
[quo/button
{:container-style style/send-button
:type :outline
:size 40
:icon-left :i/send}
(i18n/label :t/send)]
[quo/button
{:container-style style/opensea-button
:type :outline
@@ -67,7 +66,7 @@
(let [theme (quo.theme/use-theme)
collectible (rf/sub [:wallet/last-collectible-details])
animation-shared-element-id (rf/sub [:animation-shared-element-id])
collectible-owner (rf/sub [:wallet/last-collectible-details-owner])
wallet-address (rf/sub [:wallet/current-viewing-account-address])
{:keys [id
preview-url
collection-data
@@ -91,7 +90,7 @@
:header collectible-name
:description collection-name}
total-owned (utils/total-owned-collectible (:ownership collectible)
(:address collectible-owner))]
wallet-address)]
(rn/use-unmount #(rf/dispatch [:wallet/clear-last-collectible-details]))
[scroll-page/scroll-page
{:navigate-back? true
@@ -129,11 +128,7 @@
{:name collectible-name
:image preview-uri}])}])}])))}]
[header collectible-name collection-name collection-image]
[cta-buttons
{:chain-id chain-id
:token-id token-id
:contract-address contract-address
:watch-only? (:watch-only? collectible-owner)}]
[cta-buttons chain-id token-id contract-address]
[quo/tabs
{:size 32
:style style/tabs
+3 -9
View File
@@ -27,16 +27,10 @@
:type :positive
:text (i18n/label :t/account-created {:name (:name account)})}]]]})))
(defn set-current-viewing-account
[{:keys [db]} [address]]
{:db (assoc-in db [:wallet :current-viewing-account-address] address)})
(rf/reg-event-fx :wallet/set-current-viewing-account set-current-viewing-account)
(rf/reg-event-fx :wallet/navigate-to-account
(fn [_cofx [address]]
{:fx [[:dispatch [:wallet/set-current-viewing-account address]]
[:dispatch [:navigate-to :screen/wallet.accounts address]]]}))
(fn [{:keys [db]} [address]]
{:db (assoc-in db [:wallet :current-viewing-account-address] address)
:fx [[:dispatch [:navigate-to :screen/wallet.accounts address]]]}))
(rf/reg-event-fx :wallet/navigate-to-new-account
(fn [{:keys [db]} [address]]
@@ -1,6 +1,5 @@
(ns status-im.contexts.wallet.home.style
(:require
[quo.foundations.colors :as colors]
[react-native.safe-area :as safe-area]))
(def tabs
@@ -23,7 +22,3 @@
[]
{:margin-top (+ (safe-area/get-top) 8)
:flex 1})
(defn header-container
[theme]
{:background-color (colors/theme-colors colors/white colors/neutral-95 theme)})
+29 -54
View File
@@ -1,11 +1,8 @@
(ns status-im.contexts.wallet.home.view
(:require
[quo.core :as quo]
[quo.foundations.colors :as colors]
[quo.theme]
[react-native.core :as rn]
[status-im.common.home.top-nav.view :as common.top-nav]
[status-im.common.refreshable-flat-list.view :as refreshable-flat-list]
[status-im.contexts.wallet.home.style :as style]
[status-im.contexts.wallet.home.tabs.view :as tabs]
[status-im.contexts.wallet.sheets.network-filter.view :as network-filter]
@@ -40,27 +37,6 @@
(when (ff/enabled? ::ff/wallet.home-activity)
{:id :activity :label (i18n/label :t/activity) :accessibility-label :activity-tab})])
(defn- render-cards
[cards ref]
[rn/flat-list
{:ref #(reset! ref %)
:style style/accounts-list
:content-container-style style/accounts-list-container
:data cards
:horizontal true
:separator [rn/view {:style style/separator}]
:render-fn (fn [item] [quo/account-card item])
:shows-horizontal-scroll-indicator false}])
(defn- render-tabs
[data on-change default-active]
[quo/tabs
{:style style/tabs
:size 32
:default-active default-active
:data data
:on-change #(on-change %)}])
(defn view
[]
(let [[selected-tab set-selected-tab] (rn/use-state (:id (first tabs-data)))
@@ -69,9 +45,7 @@
networks (rf/sub [:wallet/selected-network-details])
account-cards-data (rf/sub [:wallet/account-cards-data])
cards (conj account-cards-data (new-account-card-data))
[init-loaded? set-init-loaded] (rn/use-state false)
{:keys [formatted-balance]} (rf/sub [:wallet/aggregated-token-values-and-balance])
theme (quo.theme/use-theme)]
{:keys [formatted-balance]} (rf/sub [:wallet/aggregated-token-values-and-balance])]
(rn/use-effect (fn []
(when (and @account-list-ref (pos? (count cards)))
(.scrollToOffset ^js @account-list-ref
@@ -79,32 +53,33 @@
{:animated true
:offset 0})))
[(count cards)])
(rn/use-effect
#(when (and (boolean? tokens-loading?) (not tokens-loading?) (not init-loaded?))
(set-init-loaded true))
[tokens-loading?])
[rn/view {:style (style/home-container)}
[common.top-nav/view]
[refreshable-flat-list/view
{:refresh-control [rn/refresh-control
{:refreshing (and tokens-loading? init-loaded?)
:colors [colors/neutral-40]
:tint-color colors/neutral-40
:on-refresh #(rf/dispatch [:wallet/get-accounts])}]
:header [rn/view {:style (style/header-container theme)}
[quo/wallet-overview
{:state (if tokens-loading? :loading :default)
:time-frame :none
:metrics :none
:balance formatted-balance
:networks networks
:dropdown-on-press #(rf/dispatch [:show-bottom-sheet
{:content network-filter/view}])}]
(when (ff/enabled? ::ff/wallet.graph)
[quo/wallet-graph {:time-frame :empty}])
[render-cards cards account-list-ref]
[render-tabs tabs-data set-selected-tab selected-tab]]
:sticky-header-indices [0]
:data []
:render-fn #()
:footer [tabs/view {:selected-tab selected-tab}]}]]))
[rn/view
[quo/wallet-overview
{:state (if tokens-loading? :loading :default)
:time-frame :none
:metrics :none
:balance formatted-balance
:networks networks
:dropdown-on-press #(rf/dispatch [:show-bottom-sheet {:content network-filter/view}])}]]
(when (ff/enabled? ::ff/wallet.graph) [quo/wallet-graph {:time-frame :empty}])
[rn/flat-list
{:ref #(reset! account-list-ref %)
:style style/accounts-list
:content-container-style style/accounts-list-container
:data cards
:horizontal true
:separator [rn/view {:style style/separator}]
:render-fn (fn [item] [quo/account-card item])
:shows-horizontal-scroll-indicator false}]
[quo/tabs
{:style style/tabs
:size 32
:default-active selected-tab
:data tabs-data
:on-change (fn [tab]
(when (= :activity tab)
(rf/dispatch [:wallet/fetch-activities]))
(set-selected-tab tab))}]
[tabs/view {:selected-tab selected-tab}]]))
@@ -29,7 +29,7 @@
(rf/reg-event-fx
:wallet/get-saved-addresses-success
(fn [{:keys [db]} [saved-addresses]]
{:db (assoc-in db [:wallet :saved-addresses] (group-by :address saved-addresses))}))
{:db (assoc-in db [:wallet :saved-addresses] saved-addresses)}))
(rf/reg-event-fx
:wallet/get-saved-addresses-error
+1 -4
View File
@@ -21,10 +21,10 @@
[status-im.contexts.profile.push-notifications.events :as notifications]
[status-im.contexts.shell.jump-to.state :as shell.state]
[status-im.contexts.shell.jump-to.utils :as shell.utils]
[status-im.feature-flags :as ff]
[status-im.navigation.core :as navigation]
status-im.contexts.wallet.signals
status-im.events
status-im.navigation.core
[status-im.setup.dev :as dev]
[status-im.setup.global-error :as global-error]
[status-im.setup.interceptors :as interceptors]
@@ -63,9 +63,6 @@
(async-storage/get-item :selected-stack-id #(shell.utils/change-selected-stack-id % nil nil))
(async-storage/get-item :screen-height #(reset! shell.state/screen-height %))
(when config/quo-preview-enabled?
(ff/load-flags))
(dev/setup)
(log/info "hermesEnabled ->" (is-hermes))
-2
View File
@@ -28,7 +28,6 @@
status-im.contexts.onboarding.events
status-im.contexts.profile.events
status-im.contexts.profile.settings.events
status-im.contexts.settings.wallet.saved-addresses.events
status-im.contexts.shell.qr-reader.events
status-im.contexts.shell.share.events
status-im.contexts.syncing.events
@@ -38,7 +37,6 @@
status-im.contexts.wallet.common.wizard.events
status-im.contexts.wallet.effects
status-im.contexts.wallet.events
status-im.contexts.wallet.save-address.events
status-im.contexts.wallet.send.events
status-im.contexts.wallet.signals
status-im.contexts.wallet.swap.events
+14 -41
View File
@@ -1,7 +1,6 @@
(ns status-im.feature-flags
(:require
[clojure.string :as string]
[react-native.async-storage :as async-storage]
[react-native.config :as config]
[reagent.core :as reagent]))
@@ -9,25 +8,20 @@
[k]
(= "1" (config/get-config k)))
(def ^:private initial-flags
{::community.edit-account-selection (enabled-in-env? :FLAG_EDIT_ACCOUNT_SELECTION_ENABLED)
::settings.wallet-settings (enabled-in-env? :FLAG_WALLET_SETTINGS_ENABLED)
::settings.keypairs-and-accounts (enabled-in-env?
:FLAG_WALLET_SETTINGS_KEYPAIRS_AND_ACCOUNTS_ENABLED)
::wallet.activities (enabled-in-env? :FLAG_WALLET_ACTIVITY_ENABLED)
::wallet.assets-modal-hide (enabled-in-env? :FLAG_ASSETS_MODAL_HIDE)
::wallet.assets-modal-manage-tokens (enabled-in-env? :FLAG_ASSETS_MODAL_MANAGE_TOKENS)
::wallet.bridge-token (enabled-in-env? :FLAG_BRIDGE_TOKEN_ENABLED)
::wallet.contacts (enabled-in-env? :FLAG_CONTACTS_ENABLED)
::wallet.edit-derivation-path (enabled-in-env? :FLAG_EDIT_DERIVATION_PATH)
::wallet.graph (enabled-in-env? :FLAG_GRAPH_ENABLED)
::wallet.import-private-key (enabled-in-env? :FLAG_IMPORT_PRIVATE_KEY_ENABLED)
::wallet.long-press-watch-only-asset (enabled-in-env? :FLAG_LONG_PRESS_WATCH_ONLY_ASSET_ENABLED)
::wallet.swap (enabled-in-env? :FLAG_SWAP_ENABLED)
::wallet.wallet-connect (enabled-in-env? :FLAG_WALLET_CONNECT_ENABLED)})
(defonce ^:private feature-flags-config
(reagent/atom initial-flags))
(reagent/atom
{::community.edit-account-selection (enabled-in-env? :FLAG_EDIT_ACCOUNT_SELECTION_ENABLED)
::wallet.activities (enabled-in-env? :FLAG_WALLET_ACTIVITY_ENABLED)
::wallet.assets-modal-hide (enabled-in-env? :FLAG_ASSETS_MODAL_HIDE)
::wallet.assets-modal-manage-tokens (enabled-in-env? :FLAG_ASSETS_MODAL_MANAGE_TOKENS)
::wallet.bridge-token (enabled-in-env? :FLAG_BRIDGE_TOKEN_ENABLED)
::wallet.contacts (enabled-in-env? :FLAG_CONTACTS_ENABLED)
::wallet.edit-derivation-path (enabled-in-env? :FLAG_EDIT_DERIVATION_PATH)
::wallet.graph (enabled-in-env? :FLAG_GRAPH_ENABLED)
::wallet.import-private-key (enabled-in-env? :FLAG_IMPORT_PRIVATE_KEY_ENABLED)
::wallet.long-press-watch-only-asset (enabled-in-env? :FLAG_LONG_PRESS_WATCH_ONLY_ASSET_ENABLED)
::wallet.swap (enabled-in-env? :FLAG_SWAP_ENABLED)
::wallet.wallet-connect (enabled-in-env? :FLAG_WALLET_CONNECT_ENABLED)}))
(defn feature-flags [] @feature-flags-config)
@@ -43,28 +37,7 @@
(defn toggle
[flag]
(let [new-flags (update @feature-flags-config flag not)]
(async-storage/set-item!
:feature-flags
new-flags
(fn []
(reset! feature-flags-config new-flags)))))
(defn load-flags
[]
(async-storage/get-item
:feature-flags
(fn [flags]
(when flags
(reset! feature-flags-config flags)))))
(defn reset-flags
[]
(async-storage/set-item!
:feature-flags
initial-flags
(fn []
(reset! feature-flags-config initial-flags))))
(swap! feature-flags-config update flag not))
(defn alert
[flag action]
-7
View File
@@ -57,7 +57,6 @@
[status-im.contexts.profile.settings.screens.password.change-password.view :as change-password]
[status-im.contexts.profile.settings.screens.password.view :as settings-password]
[status-im.contexts.profile.settings.view :as settings]
[status-im.contexts.settings.wallet.keypairs-and-accounts.view :as keypairs-and-accounts]
[status-im.contexts.settings.wallet.saved-addresses.view :as saved-addresses-settings]
[status-im.contexts.settings.wallet.wallet-options.view :as wallet-options]
[status-im.contexts.shell.activity-center.view :as activity-center]
@@ -502,12 +501,6 @@
:options options/transparent-modal-screen-options
:component saved-addresses-settings/view}
{:name :screen/settings.keypairs-and-accounts
:options (merge
options/transparent-modal-screen-options
options/dark-screen)
:component keypairs-and-accounts/view}
{:name :screen/settings-messages
:options options/transparent-modal-screen-options
:component settings.messages/view}
+14 -7
View File
@@ -90,12 +90,19 @@
manually call `setup!`, otherwise you won't see any changes. It is safe and
even expected you will call `setup!` multiple times in REPLs."
[]
(schema.registry/init-global-registry)
(register-schemas)
(try
(schema.registry/init-global-registry)
(register-schemas)
;; In theory not necessary, but sometimes in a REPL session the dev needs to
;; call unstrument! manually.
(malli.instrument/unstrument!)
;; In theory not necessary, but sometimes in a REPL session the dev needs to
;; call unstrument! manually.
(malli.instrument/unstrument!)
(malli.dev/start! {:report (schema/reporter)})
(log/debug "Schemas initialized."))
(malli.dev/start! {:report (schema/reporter)})
(log/debug "Schemas initialized.")
;; It is relatively easy to write invalid schemas, but we don't want to
;; block the app from initializing if such errors happen, at least not until
;; Malli matures in the project.
(catch js/Error e
(log/error "Failed to initialize schemas" {:error e}))))
+32 -46
View File
@@ -8,10 +8,10 @@
[status-im.common.pixel-ratio :as pixel-ratio]
[status-im.constants :as constants]
[status-im.contexts.profile.utils :as profile.utils]
[status-im.subs.chat.utils :as chat.utils]
[utils.address :as address]
[utils.collection]
[utils.i18n :as i18n]))
[utils.i18n :as i18n]
[utils.image-server :as image-server]))
(defn query-chat-contacts
[{:keys [contacts]} all-contacts query-fn]
@@ -44,40 +44,37 @@
(reduce (fn [acc image]
(let [image-name (:type image)
clock (:clock image)
options {:port port
:ratio pixel-ratio/ratio
:public-key
public-key
:image-name
image-name
; We pass the clock so that we reload the
; image if the image is updated
:clock
clock
:theme
theme
:override-ring?
(when ens-name false)}]
(assoc-in acc
[(keyword image-name) :config]
{:type :contact
:options options})))
uri (image-server/get-contact-image-uri-fn
{:port port
:ratio pixel-ratio/ratio
:public-key
public-key
:image-name
image-name
; We pass the clock so that we reload the
; image if the image is updated
:clock
clock
:theme
theme
:override-ring?
(when ens-name false)})]
(assoc-in acc [(keyword image-name) :fn] uri)))
images
(vals images))
images (if (seq images)
images
{:thumbnail
{:config {:type :initials
:options {:port port
:ratio pixel-ratio/ratio
:public-key public-key
:override-ring? (when ens-name false)
:uppercase-ratio (:uppercase-ratio
constants/initials-avatar-font-conf)
:customization-color customization-color
:theme theme
:font-file font-file}}}})]
{:fn (image-server/get-initials-avatar-uri-fn
{:port port
:ratio pixel-ratio/ratio
:public-key public-key
:override-ring? (when ens-name false)
:uppercase-ratio (:uppercase-ratio constants/initials-avatar-font-conf)
:customization-color customization-color
:theme theme
:font-file font-file})}})]
(assoc contact :images images)))
@@ -154,7 +151,7 @@
(fn [[members contacts]]
(-> (reduce
(fn [acc contact]
(let [first-char (first (:primary-name contact))]
(let [first-char (first (:alias contact))]
(if (get acc first-char)
(update-in acc [first-char :data] #(conj % contact))
(assoc acc first-char {:title first-char :data [contact]}))))
@@ -168,7 +165,7 @@
:<- [:contacts/active]
(fn [active-contacts]
(->> active-contacts
(sort-by :primary-name)
(sort-by :alias)
(sort-by
#(visibility-status-utils/visibility-status-order (:public-key %))))))
@@ -361,20 +358,9 @@
(re-frame/reg-sub
:contacts/group-members-sections
(fn [[_ chat-id]]
[(re-frame/subscribe [:contacts/contacts-by-chat chat-id])
(re-frame/subscribe [:visibility-status-updates])
(re-frame/subscribe [:multiaccount/public-key])
(re-frame/subscribe [:multiaccount/current-user-visibility-status])])
(fn [[members status-updates current-user-public-key current-user-visibility-status]]
(let [members (map (fn [{:keys [public-key] :as member}]
(assoc member
:online?
(chat.utils/online?
(if (= public-key current-user-public-key)
(:status-type current-user-visibility-status)
(get-in status-updates [public-key :status-type])))))
members)
admins (filter :admin? members)
[(re-frame/subscribe [:contacts/contacts-by-chat chat-id])])
(fn [[members]]
(let [admins (filter :admin? members)
online (filter #(and (not (:admin? %)) (:online? %)) members)
offline (filter #(and (not (:admin? %)) (not (:online? %))) members)]
(vals (cond-> {}
+38 -45
View File
@@ -10,6 +10,7 @@
[status-im.common.pixel-ratio :as pixel-ratio]
[status-im.constants :as constants]
[status-im.contexts.profile.utils :as profile.utils]
[utils.image-server :as image-server]
[utils.security.core :as security]))
(re-frame/reg-sub
@@ -42,24 +43,23 @@
image-name (-> images first :type)
override-ring? (when ens-name? false)]
(when profile
{:config
{:fn
(if image-name
{:type :account
:options {:port port
:ratio pixel-ratio/ratio
:image-name image-name
:key-uid target-key-uid
:theme theme
:override-ring? override-ring?}}
{:type :initials
:options {:port port
:ratio pixel-ratio/ratio
:key-uid target-key-uid
:theme theme
:uppercase-ratio (:uppercase-ratio constants/initials-avatar-font-conf)
:customization-color customization-color
:override-ring? override-ring?
:font-file font-file}})}))))
(image-server/get-account-image-uri-fn {:port port
:ratio pixel-ratio/ratio
:image-name image-name
:key-uid target-key-uid
:theme theme
:override-ring? override-ring?})
(image-server/get-initials-avatar-uri-fn
{:port port
:ratio pixel-ratio/ratio
:key-uid target-key-uid
:theme theme
:uppercase-ratio (:uppercase-ratio constants/initials-avatar-font-conf)
:customization-color customization-color
:override-ring? override-ring?
:font-file font-file}))}))))
;; DEPRECATED
;; use `:profile/public-key` instead
@@ -244,31 +244,29 @@
ens-name? (or ens-name? (seq ens-names))
avatar-opts (assoc avatar-opts :override-ring? (when ens-name? false))
images-with-uri (mapv (fn [{key-uid :keyUid image-name :type :as image}]
(assoc image
:config
{:type :account
:options (merge
{:port port
:ratio pixel-ratio/ratio
:image-name image-name
:key-uid key-uid
:theme theme}
avatar-opts)}))
(let [uri-fn (image-server/get-account-image-uri-fn
(merge
{:port port
:ratio pixel-ratio/ratio
:image-name image-name
:key-uid key-uid
:theme theme}
avatar-opts))]
(assoc image :fn uri-fn)))
images)
new-images (if (seq images-with-uri)
images-with-uri
[{:config {:type :initials
:options (merge
{:port port
:ratio pixel-ratio/ratio
:uppercase-ratio
(:uppercase-ratio
constants/initials-avatar-font-conf)
:key-uid key-uid
:customization-color customization-color
:theme theme
:font-file font-file}
avatar-opts)}}])]
[{:fn (image-server/get-initials-avatar-uri-fn
(merge {:port port
:ratio pixel-ratio/ratio
:uppercase-ratio
(:uppercase-ratio
constants/initials-avatar-font-conf)
:key-uid key-uid
:customization-color customization-color
:theme theme
:font-file font-file}
avatar-opts))}])]
(assoc profile :images new-images)))
(re-frame/reg-sub
@@ -279,12 +277,7 @@
:<- [:initials-avatar-font-file]
:<- [:theme]
(fn [[profile ens-names port font-file theme] [_ avatar-opts]]
;; Right after logout, this subscription is recomputed, but the sub
;; `:profile/profile` output will always be nil. We skip any further
;; processing because it's wasteful and because it will trigger a schema
;; error.
(when profile
(replace-multiaccount-image-uri profile ens-names port font-file avatar-opts theme))))
(replace-multiaccount-image-uri profile ens-names port font-file avatar-opts theme)))
(re-frame/reg-sub
:profile/image
@@ -1,6 +1,5 @@
(ns status-im.subs.wallet.saved-addresses
(:require
[clojure.string :as string]
[re-frame.core :as rf]))
(rf/reg-sub
@@ -14,16 +13,3 @@
(fn [wallet [address]]
(some #(= address (:address %))
(:saved-addresses wallet))))
(rf/reg-sub
:wallet/grouped-saved-addresses
:<- [:wallet/saved-addresses]
(fn [saved-addresses]
(->> saved-addresses
vals
flatten
(sort-by :name)
(group-by #(string/upper-case (first (:name %))))
(map (fn [[k v]]
{:title k
:data v})))))
@@ -1,25 +0,0 @@
(ns status-im.subs.wallet.saved-addresses-test
(:require [clojure.test :refer [is testing]]
[re-frame.db :as rf-db]
[test-helpers.unit :as h]
[utils.re-frame :as rf]))
(def saved-addresses-data
[{:address "0x0" :colorId "blue" :chainShortNames "eth:" :isTest false :name "Alice's address"}
{:address "0x1" :colorId "purple" :chainShortNames "eth:" :isTest false :name "Bob's address"}])
(def grouped-saved-addresses-data
[{:title "A"
:data
[{:address "0x0" :colorId "blue" :chainShortNames "eth:" :isTest false :name "Alice's address"}]}
{:title "B"
:data
[{:address "0x1" :colorId "purple" :chainShortNames "eth:" :isTest false :name "Bob's address"}]}])
(h/deftest-sub :wallet/grouped-saved-addresses
[sub-name]
(testing "returns data with prod"
(swap! rf-db/app-db assoc-in [:wallet :saved-addresses] saved-addresses-data)
(is
(= grouped-saved-addresses-data
(rf/sub [sub-name])))))
-29
View File
@@ -1,7 +1,6 @@
(ns status-im.subs.wallet.wallet
(:require [clojure.string :as string]
[re-frame.core :as rf]
[status-im.constants :as constants]
[status-im.contexts.wallet.common.utils :as utils]
[status-im.contexts.wallet.common.utils.networks :as network-utils]
[status-im.subs.wallet.add-account.address-to-watch]
@@ -159,34 +158,6 @@
:goerli-enabled? goerli-enabled?})
selected-networks))))
(defn- format-settings-keypair-accounts
[accounts
{:keys [networks size]
:or {networks []
size 32}}]
(->> accounts
(keep (fn [{:keys [path customization-color emoji name address]}]
(when-not (string/starts-with? path constants/path-eip1581)
{:account-props {:customization-color customization-color
:size size
:emoji emoji
:type :default
:name name
:address address}
:networks networks
:state :default
:action :none})))))
(rf/reg-sub
:wallet/settings-keypairs-accounts
:<- [:wallet/keypairs]
(fn [keypairs [_ format-options]]
(->> keypairs
(map (fn [{:keys [accounts name type]}]
{:type (keyword type)
:name name
:accounts (format-settings-keypair-accounts accounts format-options)})))))
(rf/reg-sub
:wallet/derivation-path-state
:<- [:wallet/create-account]
-103
View File
@@ -554,109 +554,6 @@
(= keypairs
(rf/sub [sub-name])))))
(def chat-account
{:path "m/43'/60'/1581'/0'/0"
:emoji ""
:key-uid "abc"
:address "address-1"
:color-id ""
:wallet false
:name "My Profile"
:type "generated"
:chat true
:customization-color :blue
:hidden false
:removed false})
(def wallet-account
{:path "m/44'/60'/0'/0/0"
:emoji "🤡"
:key-uid "abc"
:address "address-2"
:wallet true
:name "My Account"
:type "generated"
:chat false
:customization-color :primary
:hidden false
:removed false})
(def keypairs-accounts
{:key-uid "abc"
:name "My Profile"
:type "profile"
:accounts []})
(h/deftest-sub :wallet/settings-keypairs-accounts
[sub-name]
(testing "returns formatted key-pairs and accounts"
(swap! rf-db/app-db
assoc-in
[:wallet :keypairs]
[(assoc keypairs-accounts
:accounts
[wallet-account])])
(let [{:keys [customization-color name address emoji]} wallet-account]
(is
(match? [{:name (:name keypairs-accounts)
:type (keyword (:type keypairs-accounts))
:accounts [{:account-props {:customization-color customization-color
:size 32
:emoji emoji
:type :default
:name name
:address address}
:networks []
:state :default
:action :none}]}]
(rf/sub [sub-name])))))
(testing "allows for passing account format options"
(swap! rf-db/app-db
assoc-in
[:wallet :keypairs]
[(assoc keypairs-accounts
:accounts
[wallet-account])])
(let [{:keys [customization-color
name
address
emoji]} wallet-account
network-options [{:network-name :ethereum :short-name "eth"}
{:network-name :optimism :short-name "opt"}
{:network-name :arbitrum :short-name "arb1"}]
size-option 20]
(is
(match? [{:name (:name keypairs-accounts)
:type (keyword (:type keypairs-accounts))
:accounts [{:account-props {:customization-color customization-color
:size size-option
:emoji emoji
:type :default
:name name
:address address}
:networks network-options
:state :default
:action :none}]}]
(rf/sub [sub-name
{:networks network-options
:size size-option}])))))
(testing "filters non-wallet accounts"
(swap! rf-db/app-db
assoc-in
[:wallet :keypairs]
[(assoc keypairs-accounts
:accounts
[chat-account])])
(is
(match? [{:name (:name keypairs-accounts)
:type (keyword (:type keypairs-accounts))
:accounts []}]
(rf/sub [sub-name])))))
(def local-suggestions ["a" "b"])
(h/deftest-sub :wallet/local-suggestions
+99 -31
View File
@@ -4,7 +4,6 @@
[react-native.fs :as utils.fs]
[react-native.platform :as platform]
[schema.core :as schema]
[schema.quo]
[utils.datetime :as datetime]))
(def ^:const image-server-uri-prefix "https://localhost:")
@@ -55,7 +54,8 @@
4))
(defn get-account-image-uri
"fn to get the avatar uri when multiaccount has custom image set.
"fn to get the avatar uri when multiaccount has custom image set
not directly called, check `get-account-image-uri-fn`
color formats (for all color options):
#RRGGBB
@@ -67,8 +67,7 @@
placeholder-avatar: pass image file path as `image-name`
`indicator-size` is outer indicator radius
`indicator-size` - `indicator-border` is inner indicator radius
`ring?` shows or hides ring for account with ens name"
`indicator-size` - `indicator-border` is inner indicator radius"
[{:keys [port public-key image-name key-uid size theme indicator-size
indicator-border indicator-center-to-edge indicator-color ring?
ring-width ratio]}]
@@ -101,8 +100,38 @@
"&ringWidth="
(* ring-width ratio)))
(defn get-account-image-uri-fn
"pass the result fn to user-avatar component as `:profile-picture`
use this fn in subs to set multiaccount `:images` as [{:fn ...}]
pass the image to user-avatar
user-avatar can fill the rest style related options
set `override-ring?` to a non-nil value to override `ring?`, mainly used to
hide ring for account with ens name
check `get-account-image-uri` for color formats"
[{:keys [port public-key key-uid image-name theme override-ring? ratio]}]
(fn [{:keys [size indicator-size indicator-border indicator-center-to-edge
indicator-color ring? ring-width override-theme]}]
(get-account-image-uri
{:port port
:image-name image-name
:size size
:public-key public-key
:ratio ratio
:key-uid key-uid
:theme (if (nil? override-theme) theme override-theme)
:indicator-size indicator-size
:indicator-border indicator-border
:indicator-center-to-edge indicator-center-to-edge
:indicator-color indicator-color
:ring? (if (nil? override-ring?) ring? override-ring?)
:ring-width ring-width})))
(defn get-initials-avatar-uri
"fn to get the avatar uri when account/contact/placeholder has no custom pic set
not directly called, check `get-account-initials-uri-fn`
multiaccount: at least one of `key-uid`, `public-key` is required to render the ring
contact: `public-key` is required to render the ring
@@ -110,7 +139,6 @@
check `get-account-image-uri` for color formats
check `get-font-file-ready` for `font-file`
`ring?` shows or hides ring for account with ens name
`uppercase-ratio` is the uppercase-height/line-height for `font-file`"
[{:keys [port public-key key-uid theme ring? length size customization-color
color font-size font-file uppercase-ratio indicator-size
@@ -157,13 +185,56 @@
"&ringWidth="
(* ring-width ratio)))
(defn get-contact-image-uri
"check `get-account-image-uri` for color formats
(schema/=> get-initials-avatar-uri
[:=>
[:cat
[:map
[:theme :schema.common/theme]
[:color string?]
[:background-color {:optional true} [:maybe string?]]
[:size number?]
[:ratio float?]
[:uppercase-ratio number?]
[:customization-color :schema.common/customization-color]
[:font-size number?]
[:font-file string?]]]
[:string]])
(defn get-initials-avatar-uri-fn
"return a fn that calls `get-account-initials-uri`
pass the fn to user-avatar component to fill the style related options
check `get-account-image-uri` for color formats
check `get-font-file-ready` for `font-file`
`public-key` is required to render the ring
`ring?` shows or hides ring for account with ens name
`uppercase-ratio` is the uppercase-height/line-height for `font-file`"
check `get-account-image-uri-fn` for `override-ring?`"
[{:keys [port public-key key-uid theme override-ring? font-file ratio
uppercase-ratio customization-color]}]
(fn [{:keys [full-name length size font-size color indicator-size indicator-border
indicator-color indicator-center-to-edge ring? ring-width
override-theme]}]
(get-initials-avatar-uri
{:port port
:public-key public-key
:ratio ratio
:key-uid key-uid
:full-name full-name
:length length
:size size
:customization-color customization-color
:theme (if (nil? override-theme) theme override-theme)
:ring? (if (nil? override-ring?) ring? override-ring?)
:ring-width ring-width
:font-size font-size
:color color
:font-file font-file
:uppercase-ratio uppercase-ratio
:indicator-size indicator-size
:indicator-border indicator-border
:indicator-center-to-edge indicator-center-to-edge
:indicator-color indicator-color})))
(defn get-contact-image-uri
[{:keys [port public-key image-name clock theme indicator-size indicator-border
indicator-center-to-edge indicator-color size ring? ring-width ratio]}]
(str
@@ -193,6 +264,24 @@
"&ringWidth="
(* ring-width ratio)))
(defn get-contact-image-uri-fn
[{:keys [port public-key image-name theme override-ring? clock ratio]}]
(fn [{:keys [size indicator-size indicator-border indicator-center-to-edge
indicator-color ring? ring-width override-theme]}]
(get-contact-image-uri {:port port
:ratio ratio
:image-name image-name
:public-key public-key
:size size
:theme (if (nil? override-theme) theme override-theme)
:clock clock
:indicator-size indicator-size
:indicator-border indicator-border
:indicator-center-to-edge indicator-center-to-edge
:indicator-color indicator-color
:ring? (if (nil? override-ring?) ring? override-ring?)
:ring-width ring-width})))
(defn get-qr-image-uri-for-any-url
[{:keys [url port qr-size error-level]}]
(let [qr-url-base64 (js/btoa url)
@@ -210,24 +299,3 @@
"&size="
qr-size)]
media-server-url))
(defn get-image-uri
[{:keys [type options]}
profile-picture-options]
((case type
:account get-account-image-uri
:contact get-contact-image-uri
:initials get-initials-avatar-uri
str)
(-> (merge options profile-picture-options)
(assoc :ring?
(if (nil? (:override-ring? options))
(:ring? profile-picture-options)
(:override-ring? options))))))
(schema/=> get-image-uri
[:=>
[:cat
:schema.quo/image-uri-config
:schema.quo/profile-picture-options]
:string])
+3 -3
View File
@@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im",
"repo": "status-go",
"version": "add-emoji-to-saved-addresses",
"commit-sha1": "5c1ae90fa682ffb236f35b71c4d2911455bea8ce",
"src-sha256": "12xfsxdyclz8mx4qm6lywcbzqkxmrspni44450cqsa5qspdhdrxq"
"version": "v0.179.13",
"commit-sha1": "f3f48654f54aebbb4949129f930fef648d8da8f9",
"src-sha256": "09gcr6fgx6v4qdp83w0n2ynnlvwjqid477jgpqjk57l5wfrv2raq"
}
+1 -1
View File
@@ -1,7 +1,7 @@
const WebSocket = require('ws');
const { NativeModules } = require('react-native');
mockAsyncStorage = require('@react-native-async-storage/async-storage/jest/async-storage-mock');
require('@react-native-async-storage/async-storage/jest/async-storage-mock');
require('react-native-gesture-handler/jestSetup');
require('react-native-reanimated/src/reanimated2/jestUtils').setUpTests();
+1 -8
View File
@@ -2484,7 +2484,6 @@
"address-no-activity": "This address has no activity",
"scanning": "Scanning for activity...",
"keypairs": "Key pairs",
"keypairs-and-accounts": "Key pairs and accounts",
"keypairs-accounts-and-addresses": "Key pairs, accounts and addresses",
"keypairs-description": "Select key pair to derive your new account from",
"confirm-account-origin": "Confirm account origin",
@@ -2613,11 +2612,5 @@
"scanning-for-activity": "Scanning for activity...",
"send-community-link": "Send community link",
"at-least-one-network-must-be-activated": "At least 1 network must be activated",
"status-is-a-secure-messaging-app": "Status is a secure messaging app, crypto wallet and web3 browser built with the state of the art technology",
"send-to-user": "Send to {{user}}",
"view-address-on-website": "View address on {{website}}",
"saved-address-removed": "Saved address removed",
"remove-address": "Remove address",
"remove-saved-address-description": "Transaction history relating to this address will no longer be labelled {{name}}.",
"remove-saved-address": "Remove saved address"
"status-is-a-secure-messaging-app": "Status is a secure messaging app, crypto wallet and web3 browser built with the state of the art technology"
}