Compare commits
42
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c777771524 | ||
|
|
e6623ef370 | ||
|
|
91a592a65b | ||
|
|
e377064ca9 | ||
|
|
109647c3be | ||
|
|
01e1ff2b1b | ||
|
|
b69a9933d3 | ||
|
|
b61a8c8a5f | ||
|
|
00c726b7ba | ||
|
|
2bf0fa845e | ||
|
|
a1a71489e8 | ||
|
|
8b45ddce6f | ||
|
|
90251249b0 | ||
|
|
be0e14aea4 | ||
|
|
1e3d90fef6 | ||
|
|
fc318b6e92 | ||
|
|
16398dfd55 | ||
|
|
88df60958c | ||
|
|
947e2369d3 | ||
|
|
a6cd97482c | ||
|
|
112768d13a | ||
|
|
2a03282dd6 | ||
|
|
6be1adb40e | ||
|
|
006824e0ed | ||
|
|
33da4bfabc | ||
|
|
2618a55dbc | ||
|
|
439edc39a6 | ||
|
|
12515a4904 | ||
|
|
f50ca4606f | ||
|
|
22392464e0 | ||
|
|
225e3b1c2f | ||
|
|
037e71bc03 | ||
|
|
cb9a620f40 | ||
|
|
a481a44c72 | ||
|
|
a68b2f357d | ||
|
|
4f0a49f7bf | ||
|
|
c40853456b | ||
|
|
52a6f5c17d | ||
|
|
14aa9e1c20 | ||
|
|
2c5cc6cd08 | ||
|
|
8ad58bb364 | ||
|
|
ab191407ed |
@@ -1,4 +1,5 @@
|
||||
{: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
|
||||
@@ -15,6 +16,8 @@
|
||||
: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
|
||||
@@ -42,11 +45,13 @@
|
||||
: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
|
||||
@@ -54,9 +59,11 @@
|
||||
;; 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}
|
||||
|
||||
@@ -127,6 +127,8 @@ fastlane/README.md
|
||||
# Clj
|
||||
|
||||
.cpcache/
|
||||
src/user.cljs
|
||||
src/dev/user.cljs
|
||||
|
||||
# emacs
|
||||
.dir-locals.el
|
||||
|
||||
@@ -139,7 +139,7 @@ _install-hooks: ##@prepare Create prepare-commit-msg git hook symlink
|
||||
|
||||
# Remove directories and ignored files
|
||||
clean: SHELL := /bin/sh
|
||||
clean: _fix-node-perms _tmpdir-rm ##@prepare Remove all output folders
|
||||
clean: _fix-node-perms _tmpdir-rm ios-clean android-clean ##@prepare Remove all output folders
|
||||
git clean -dXf
|
||||
|
||||
# Remove directories, ignored and non-ignored files
|
||||
@@ -196,6 +196,10 @@ xcode-clean: XCODE_HOME := $(HOME)/Library/Developer/Xcode
|
||||
xcode-clean: ##@prepare Clean XCode derived data and archives
|
||||
rm -fr $(XCODE_HOME)/DerivedData/StatusIm-* $(XCODE_HOME)/Archives/*/StatusIm*
|
||||
|
||||
ios-simulator-cache-clean: SHELL := /bin/sh
|
||||
ios-simulator-cache-clean: ##@prepare Clean iOS Simulator Caches
|
||||
rm -rf ~/Library/Developer/CoreSimulator/Cache
|
||||
|
||||
#----------------
|
||||
# Release builds
|
||||
#----------------
|
||||
@@ -409,13 +413,17 @@ geth-connect: ##@other Connect to Geth on the device
|
||||
build/bin/geth attach http://localhost:8545
|
||||
|
||||
ios-clean: SHELL := /bin/sh
|
||||
ios-clean: ios-simulator-cache-clean
|
||||
ios-clean: ##@prepare Clean iOS build artifacts
|
||||
git clean -dxf -f target/ios
|
||||
|
||||
android-clean: export TARGET := gradle
|
||||
android-clean: SHELL := /bin/sh
|
||||
android-clean: ##@prepare Clean Gradle state
|
||||
git clean -dxf -f ./android/app/build; \
|
||||
[[ -d android/.gradle ]] && cd android && ./gradlew clean
|
||||
rm -rf android/.gradle \
|
||||
rm -rf android/build \
|
||||
rm -rf ~/.gradle
|
||||
|
||||
|
||||
android-ports: export TARGET := android-sdk
|
||||
android-ports: ##@other Add proxies to Android Device/Simulator
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
// DO NOT EDIT: code is autogenerated by go2nodebinding from Go code.
|
||||
// https://github.com/divan/go2nodebinding
|
||||
// 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
|
||||
|
||||
#include <node.h>
|
||||
#include <string>
|
||||
@@ -1147,10 +1151,13 @@ 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()};
|
||||
|
||||
func->Call(isolate->GetCurrentContext(), v8::Null(isolate), argc, argv);
|
||||
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;
|
||||
}
|
||||
q.pop();
|
||||
}
|
||||
}
|
||||
|
||||
+126
-108
@@ -90,11 +90,20 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "cider/cider-nrepl/0.31.0/cider-nrepl-0.31.0",
|
||||
"path": "cider/cider-nrepl/0.44.0/cider-nrepl-0.44.0",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "1f28a4a834a7a46cf24def971b1a705a6795c73a",
|
||||
"sha256": "0h4pyzy8rzzh567khvimw2cs8jr640kqxgaxvbfx1s5yfp56fka2"
|
||||
"sha1": "c3d3a729beaa728d0ee6a3678a48c880b6bc95f1",
|
||||
"sha256": "0klcppvydxlx9ji376mvz40yv3s7awq6p9yd57wigpfy4m2yv0w6"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "cider/orchard/0.21.0/orchard-0.21.0",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "073617f16a132c7f20608d971244753d4e704129",
|
||||
"sha256": "1n2afbyhw9x9kvfna4m4x6n6pwjiqsqcayql644bw2932i1isrkj"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -108,11 +117,11 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "clj-kondo/clj-kondo/2023.09.07/clj-kondo-2023.09.07",
|
||||
"path": "clj-kondo/clj-kondo/2024.03.13/clj-kondo-2024.03.13",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "9bf516b973a0b77d7dc5a3c6c84a884e3470e7b7",
|
||||
"sha256": "1qkw5ryqdzy4wl3xbr0r72ikrch75z5vh1dny569y3jlc888gkv8"
|
||||
"sha1": "adec398a95322f3a27baf0a92b658493335464d1",
|
||||
"sha256": "0r97hsj7m3qc12xwyxx6m1a71gqp5aiy99imcf8r0nz2dnjmj0kz"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -251,6 +260,15 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"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",
|
||||
@@ -324,11 +342,38 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1",
|
||||
"path": "commons-codec/commons-codec/1.15/commons-codec-1.15",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "c9ad4a0850ab676c5c64461a05ca524cdfff59f1",
|
||||
"sha256": "170rflxnqnah0265ik2aylmxkshyqbf2zas9bp2l32xqj9l6jsaf"
|
||||
"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"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -368,42 +413,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"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",
|
||||
@@ -575,6 +584,15 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"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",
|
||||
@@ -603,11 +621,11 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "nrepl/nrepl/0.9.0/nrepl-0.9.0",
|
||||
"path": "nrepl/nrepl/1.1.0/nrepl-1.1.0",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "49beada131959f08f9a20899affbd1b10c03a668",
|
||||
"sha256": "1phak0479s27ffw9wzz7pi8cqqs6ipsm15dhgw9szxxcfhx529qa"
|
||||
"sha1": "69f138d4a778c199e5d72446ca25998222ba0862",
|
||||
"sha256": "0n29xczgwpqv98vz36sdic98mf07dmzhjawlxd63p2s2zafkp1ss"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -620,15 +638,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/apache/ant/ant-launcher/1.10.11/ant-launcher-1.10.11",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "ea0a0475fb6dfcdcf48b30410fd9d4f5c80df07e",
|
||||
"sha256": "0mnj5v660qvmrsi1m6z0dnykw3df8f1213byzp45l2wqgbgk1dfs"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/apache/ant/ant/1.10.11/ant-1.10.11",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -638,6 +647,24 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/apache/ant/ant-launcher/1.10.11/ant-launcher-1.10.11",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "ea0a0475fb6dfcdcf48b30410fd9d4f5c80df07e",
|
||||
"sha256": "0mnj5v660qvmrsi1m6z0dnykw3df8f1213byzp45l2wqgbgk1dfs"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/babashka/sci/0.8.41/sci-0.8.41",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "e8d59dc588a1e1f0c62c21fb47c093eeed043f04",
|
||||
"sha256": "1lhv283fs0bnqbj1jhfgyy2rv6hspnhdgsiklqy3rqxrqbnrww6w"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/babashka/sci.impl.types/0.0.2/sci.impl.types-0.0.2",
|
||||
"host": "https://repo.clojars.org",
|
||||
@@ -647,15 +674,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"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",
|
||||
@@ -746,15 +764,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"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",
|
||||
"jar": {
|
||||
"sha1": "f5ea82eb1309b81ada6a14371bb848323c65e38b",
|
||||
"sha256": "0jk9v4bfrxvz6wq1s86msry2mf47nwcjfplnn41yabqc44g82hva"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/google-closure-library/0.0-20230227-c7c0a541/google-closure-library-0.0-20230227-c7c0a541",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -764,6 +773,15 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"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",
|
||||
"jar": {
|
||||
"sha1": "f5ea82eb1309b81ada6a14371bb848323c65e38b",
|
||||
"sha256": "0jk9v4bfrxvz6wq1s86msry2mf47nwcjfplnn41yabqc44g82hva"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/math.combinatorics/0.2.0/math.combinatorics-0.2.0",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -791,15 +809,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/tools.analyzer.jvm/1.2.2/tools.analyzer.jvm-1.2.2",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "449691b55d7d526258ce02c69b4699f2897c494d",
|
||||
"sha256": "0phfs1z1scvdi00348zjh223xncmgrkmlrnbca4dh7lk701gy34i"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/tools.analyzer/1.1.0/tools.analyzer-1.1.0",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -809,6 +818,15 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/tools.analyzer.jvm/1.2.2/tools.analyzer.jvm-1.2.2",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "449691b55d7d526258ce02c69b4699f2897c494d",
|
||||
"sha256": "0phfs1z1scvdi00348zjh223xncmgrkmlrnbca4dh7lk701gy34i"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/tools.cli/1.0.206/tools.cli-1.0.206",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -819,11 +837,11 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/tools.logging/1.1.0/tools.logging-1.1.0",
|
||||
"path": "org/clojure/tools.logging/1.2.4/tools.logging-1.2.4",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "84cb5d00caa9df2ee504d46f6107f4708271f619",
|
||||
"sha256": "0x2zzivn38z179lxkw9wbi9n9qwsf466lrd9y27khdz7wbxhscb5"
|
||||
"sha1": "3a85764aa30c434a5b0375a2ee72924aa040fa66",
|
||||
"sha256": "0a8riw23pfkiiyz98ccmljpbw1z13mxl73pdgyz80j93s0y0mzj6"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -962,6 +980,15 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"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",
|
||||
@@ -972,11 +999,20 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "re-frame/re-frame/1.3.0/re-frame-1.3.0",
|
||||
"path": "refactor-nrepl/refactor-nrepl/3.9.1/refactor-nrepl-3.9.1",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "b7135a76432b8141027ba1f4eb6bb15a36acfb7c",
|
||||
"sha256": "16wi01z0j4wn04kldwzxvj0pd9dianjyb000nv5611ikhxk1qrps"
|
||||
"sha1": "f949af92dd1d6fef59d7447bd0cb62118e34eca1",
|
||||
"sha256": "0dml9yvjmji6xk2sk3cdmkvvnh13rw29szxxl363hap8yg28xcs1"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "re-frame/re-frame/1.4.3/re-frame-1.4.3",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "74e132cc593ed2d72a5d4874954c58677a905f0e",
|
||||
"sha256": "1xdmbjb0gv6dby98y1nx3brz9sdkfzxz9cjk8ajcr1f4zabcaapb"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -998,24 +1034,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"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",
|
||||
|
||||
+18
-16
@@ -8,9 +8,10 @@ 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.31.0/cider-nrepl-0.31.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/piggieback/0.5.2/piggieback-0.5.2.jar
|
||||
clj-kondo/clj-kondo/2023.09.07/clj-kondo-2023.09.07.jar
|
||||
clj-kondo/clj-kondo/2024.03.13/clj-kondo-2024.03.13.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
|
||||
@@ -26,6 +27,7 @@ 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
|
||||
@@ -34,15 +36,14 @@ 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
|
||||
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
|
||||
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
|
||||
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
|
||||
@@ -62,15 +63,16 @@ 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/0.9.0/nrepl-0.9.0.jar
|
||||
nrepl/nrepl/1.1.0/nrepl-1.1.0.jar
|
||||
nubank/matcher-combinators/3.8.8/matcher-combinators-3.8.8.jar
|
||||
org/apache/ant/ant-launcher/1.10.11/ant-launcher-1.10.11.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/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
|
||||
@@ -81,15 +83,15 @@ 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-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/google-closure-library-third-party/0.0-20230227-c7c0a541/google-closure-library-third-party-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.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.analyzer.jvm/1.2.2/tools.analyzer.jvm-1.2.2.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.logging/1.2.4/tools.logging-1.2.4.jar
|
||||
org/clojure/tools.macro/0.1.5/tools.macro-0.1.5.jar
|
||||
org/clojure/tools.reader/1.3.7/tools.reader-1.3.7.jar
|
||||
org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar
|
||||
@@ -105,12 +107,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
|
||||
re-frame/re-frame/1.3.0/re-frame-1.3.0.jar
|
||||
refactor-nrepl/refactor-nrepl/3.9.1/refactor-nrepl-3.9.1.jar
|
||||
re-frame/re-frame/1.4.3/re-frame-1.4.3.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
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
{ buildGoPackage
|
||||
# object with source attributes
|
||||
, meta, source}:
|
||||
|
||||
buildGoPackage {
|
||||
{ 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 {
|
||||
pname = source.repo;
|
||||
version = "${source.cleanVersion}-${source.shortRev}";
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 221 B |
Binary file not shown.
|
After Width: | Height: | Size: 348 B |
+2
-2
@@ -2,7 +2,7 @@
|
||||
{:source-paths ["src" "test/cljs"]
|
||||
|
||||
:dependencies [[reagent "1.2.0"]
|
||||
[re-frame "1.3.0"]
|
||||
[re-frame "1.4.3"]
|
||||
[binaryage/oops "0.7.2"]
|
||||
[com.andrewmcveigh/cljs-time "0.5.2"]
|
||||
[com.taoensso/timbre "6.3.1"]
|
||||
@@ -21,7 +21,7 @@
|
||||
[nubank/matcher-combinators "3.8.8"]
|
||||
|
||||
;; Use the same version specified in the Nix dependency.
|
||||
[clj-kondo/clj-kondo "2023.09.07"]
|
||||
[clj-kondo/clj-kondo "2024.03.13"]
|
||||
|
||||
;; Routing
|
||||
[bidi "2.1.6"]
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# 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.
|
||||
@@ -7,6 +7,7 @@
|
||||
(defn outer-container
|
||||
[{:keys [size customization-color theme]}]
|
||||
(let [container-size (case size
|
||||
:size-80 80
|
||||
:size-64 64
|
||||
:size-32 32
|
||||
24)]
|
||||
@@ -21,6 +22,7 @@
|
||||
[size]
|
||||
{:text-align :center
|
||||
:font-size (case size
|
||||
:size-80 36
|
||||
:size-64 24
|
||||
:size-32 15
|
||||
11)})
|
||||
|
||||
@@ -11,15 +11,15 @@
|
||||
|
||||
(defn- initials
|
||||
[{:keys [full-name size customization-color theme]}]
|
||||
(let [amount-initials (if (#{:size-32 :size-64} size) 2 1)
|
||||
(let [amount-initials (if (#{:size-32 :size-64 :size-80} size) 2 1)
|
||||
channel-name (utils.string/safe-replace full-name "#" "")]
|
||||
[text/text
|
||||
(cond-> {:accessibility-label :initials
|
||||
:style {:color (colors/resolve-color customization-color theme)}
|
||||
:size :paragraph-2
|
||||
:weight :semi-bold}
|
||||
(= size :size-64) (assoc :size :heading-1
|
||||
:weight :medium))
|
||||
(#{:size-64 :size-80} size) (assoc :size :heading-1
|
||||
:weight :medium))
|
||||
(utils.string/get-initials channel-name amount-initials)]))
|
||||
|
||||
(defn- lock
|
||||
|
||||
@@ -9,10 +9,17 @@
|
||||
:size-20 20
|
||||
nil))
|
||||
|
||||
(defn collection-avatar
|
||||
(defn collection-avatar-container
|
||||
[theme size]
|
||||
{:width (get-dimensions size)
|
||||
:height (get-dimensions size)
|
||||
:border-width 1
|
||||
:border-color (colors/theme-colors colors/neutral-80-opa-10 colors/white-opa-10 theme)
|
||||
:border-radius 6})
|
||||
{:width (get-dimensions size)
|
||||
:height (get-dimensions size)
|
||||
:border-width 1
|
||||
:border-color (colors/theme-colors colors/neutral-80-opa-10 colors/white-opa-10 theme)
|
||||
:border-radius 6
|
||||
:justify-content :center
|
||||
:align-items :center})
|
||||
|
||||
(defn collection-avatar
|
||||
[size]
|
||||
{:width (get-dimensions size)
|
||||
:height (get-dimensions size)})
|
||||
|
||||
@@ -2,18 +2,20 @@
|
||||
(:require
|
||||
[quo.components.avatars.collection-avatar.style :as style]
|
||||
[quo.theme :as quo.theme]
|
||||
[react-native.core :as rn]
|
||||
[react-native.fast-image :as fast-image]))
|
||||
|
||||
(defn view
|
||||
"Opts:
|
||||
|
||||
|
||||
:image - collection image
|
||||
:theme - keyword -> :light/:dark"
|
||||
[{:keys [image size on-load-end on-error] :or {size :size-24}}]
|
||||
(let [theme (quo.theme/use-theme)]
|
||||
[fast-image/fast-image
|
||||
{:accessibility-label :collection-avatar
|
||||
:source image
|
||||
:on-load-end on-load-end
|
||||
:on-error on-error
|
||||
:style (style/collection-avatar theme size)}]))
|
||||
[rn/view {:style (style/collection-avatar-container theme size)}
|
||||
[fast-image/fast-image
|
||||
{:accessibility-label :collection-avatar
|
||||
:source image
|
||||
:on-load-end on-load-end
|
||||
:on-error on-error
|
||||
:style (style/collection-avatar size)}]]))
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
(ns quo.components.avatars.group-avatar.view
|
||||
(:require
|
||||
[clojure.string :as string]
|
||||
[quo.components.avatars.group-avatar.style :as style]
|
||||
[quo.components.icon :as icon]
|
||||
[quo.components.markdown.text :as text]
|
||||
@@ -22,7 +21,7 @@
|
||||
:container 80}})
|
||||
|
||||
(defn view
|
||||
[{:keys [size customization-color picture icon-name emoji chat-name]
|
||||
[{:keys [size customization-color picture icon-name emoji]
|
||||
:or {size :size-20
|
||||
customization-color :blue
|
||||
picture nil
|
||||
@@ -50,14 +49,6 @@
|
||||
{:size :paragraph-1
|
||||
:style (dissoc (style/avatar-identifier theme) :font-size)}
|
||||
emoji])
|
||||
chat-name
|
||||
(if (= size :size-80)
|
||||
[rn/text
|
||||
{:style (style/avatar-identifier theme)}
|
||||
((comp first string/upper-case) chat-name)]
|
||||
[text/text
|
||||
{:size :paragraph-1}
|
||||
((comp first string/upper-case) chat-name)])
|
||||
:else
|
||||
[icon/icon icon-name
|
||||
{:size icon-size
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
size 40
|
||||
customization-color (if (= type :primary) :blue nil)}}
|
||||
children]
|
||||
(when (string? children) (js/console.log "button - " children))
|
||||
(let [[pressed-state? set-pressed-state] (rn/use-state false)
|
||||
theme (quo.theme/use-theme)
|
||||
{:keys [icon-color background-color label-color border-color blur-type
|
||||
|
||||
@@ -44,48 +44,55 @@
|
||||
|
||||
(defn- right-section-spacing [] [rn/view {:style style/right-actions-spacing}])
|
||||
|
||||
(defmulti add-button
|
||||
(fn [{:keys [button-props]}]
|
||||
(:content-type button-props)))
|
||||
|
||||
(defmethod add-button :account-switcher
|
||||
[{:keys [support-account-switcher? button-props]}]
|
||||
(when support-account-switcher?
|
||||
(let [{:keys [customization-color on-press emoji type]} button-props]
|
||||
[rn/pressable {:on-press on-press}
|
||||
[account-avatar/view
|
||||
{:emoji emoji
|
||||
:size 32
|
||||
:type (or type :default)
|
||||
:customization-color customization-color}]])))
|
||||
|
||||
(defmethod add-button :default
|
||||
[{:keys [background behind-overlay? button-props]}]
|
||||
(let [{:keys [label icon-name]} button-props]
|
||||
[button/button
|
||||
(assoc button-props
|
||||
:type (button-type background)
|
||||
:icon-only? (boolean icon-name)
|
||||
:size 32
|
||||
:accessible true
|
||||
:background (if behind-overlay?
|
||||
:blur
|
||||
(when (button-properties/backgrounds background) background)))
|
||||
(or label icon-name)]))
|
||||
|
||||
(defn- add-right-buttons-xf
|
||||
[max-actions background behind-overlay?]
|
||||
[max-actions background behind-overlay? support-account-switcher?]
|
||||
(comp (filter map?)
|
||||
(take max-actions)
|
||||
(map (fn [{:keys [icon-name label] :as button-props}]
|
||||
[button/button
|
||||
(assoc button-props
|
||||
:type (button-type background)
|
||||
:icon-only? icon-name
|
||||
:size 32
|
||||
:accessible true
|
||||
:background (if behind-overlay?
|
||||
:blur
|
||||
(when (button-properties/backgrounds background) background)))
|
||||
(or label icon-name)]))
|
||||
(map (fn [button-props]
|
||||
(add-button {:background background
|
||||
:behind-overlay? behind-overlay?
|
||||
:support-account-switcher? support-account-switcher?
|
||||
:button-props button-props})))
|
||||
(interpose [right-section-spacing])))
|
||||
|
||||
(defn- account-switcher-content
|
||||
[{:keys [customization-color on-press emoji type]}]
|
||||
[rn/pressable {:on-press on-press}
|
||||
[account-avatar/view
|
||||
{:emoji emoji
|
||||
:size 32
|
||||
:type (or type :default)
|
||||
:customization-color customization-color}]])
|
||||
|
||||
(defn- right-content
|
||||
[{:keys [background content max-actions min-size? support-account-switcher? account-switcher
|
||||
[{:keys [background content max-actions min-size? support-account-switcher?
|
||||
behind-overlay?]
|
||||
:or {support-account-switcher? true}}]
|
||||
[rn/view (when min-size? {:style style/right-content-min-size})
|
||||
(cond
|
||||
(and support-account-switcher? (= content :account-switcher))
|
||||
[account-switcher-content account-switcher]
|
||||
|
||||
(coll? content)
|
||||
(when (coll? content)
|
||||
(into [rn/view {:style style/right-actions-container}]
|
||||
(add-right-buttons-xf max-actions background behind-overlay?)
|
||||
content)
|
||||
|
||||
:else
|
||||
nil)])
|
||||
(add-right-buttons-xf max-actions background behind-overlay? support-account-switcher?)
|
||||
content))])
|
||||
|
||||
(def header-height 155)
|
||||
(def page-nav-height 25)
|
||||
@@ -208,19 +215,11 @@
|
||||
- on-press: callback for left button
|
||||
- icon-name: icon for left button
|
||||
- right-side (optional):
|
||||
- The `:account-switcher` keyword
|
||||
- vector of maps to render buttons, e.g.:
|
||||
{:icon-name :i/my-icon
|
||||
:on-press (fn callback [] nil)
|
||||
:accessibility-label \"an optional label\"}
|
||||
|
||||
- account-switcher (optional)
|
||||
- props to render dropdown component (emoji only) e.g.:
|
||||
{:customization-color :purple
|
||||
:on-press (fn [] nil)
|
||||
:state :default (inherit dropdown states)
|
||||
:emoji \"🍑\"}
|
||||
|
||||
Depending on the `type` selected, different properties are accepted:
|
||||
`:title`
|
||||
- title
|
||||
@@ -251,7 +250,7 @@
|
||||
`:network`
|
||||
- network-name
|
||||
- network-logo a valid rn/image `:source` value"
|
||||
[{:keys [type right-side background text-align account-switcher behind-overlay?]
|
||||
[{:keys [type right-side background text-align behind-overlay?]
|
||||
:or {type :no-title
|
||||
text-align :center
|
||||
right-side :none
|
||||
@@ -261,22 +260,20 @@
|
||||
:no-title
|
||||
[page-nav-base props
|
||||
[right-content
|
||||
{:background background
|
||||
:content right-side
|
||||
:max-actions 3
|
||||
:behind-overlay? behind-overlay?
|
||||
:account-switcher account-switcher}]]
|
||||
{:background background
|
||||
:content right-side
|
||||
:max-actions 3
|
||||
:behind-overlay? behind-overlay?}]]
|
||||
|
||||
:title
|
||||
(let [centered? (= text-align :center)]
|
||||
[page-nav-base props
|
||||
[title-center (assoc props :centered? centered?)]
|
||||
[right-content
|
||||
{:background background
|
||||
:content right-side
|
||||
:max-actions (if centered? 1 3)
|
||||
:min-size? centered?
|
||||
:account-switcher account-switcher}]])
|
||||
{:background background
|
||||
:content right-side
|
||||
:max-actions (if centered? 1 3)
|
||||
:min-size? centered?}]])
|
||||
|
||||
:dropdown
|
||||
[page-nav-base props
|
||||
@@ -291,10 +288,9 @@
|
||||
[page-nav-base props
|
||||
[token-center props]
|
||||
[right-content
|
||||
{:background background
|
||||
:content right-side
|
||||
:max-actions 3
|
||||
:account-switcher account-switcher}]]
|
||||
{:background background
|
||||
:content right-side
|
||||
:max-actions 3}]]
|
||||
|
||||
:channel
|
||||
[page-nav-base props
|
||||
@@ -318,11 +314,10 @@
|
||||
[page-nav-base props
|
||||
[wallet-networks-center props]
|
||||
[right-content
|
||||
{:background background
|
||||
:content right-side
|
||||
:max-actions 1
|
||||
:min-size? true
|
||||
:account-switcher account-switcher}]]
|
||||
{:background background
|
||||
:content right-side
|
||||
:max-actions 3
|
||||
:min-size? true}]]
|
||||
|
||||
(:community :network)
|
||||
[page-nav-base props
|
||||
|
||||
@@ -67,27 +67,26 @@
|
||||
|
||||
(defn toast
|
||||
"Options:
|
||||
|
||||
|
||||
:type => :neutral/:negative/:positive
|
||||
"
|
||||
[{:keys [type icon title text action undo-duration undo-on-press container-style theme user]
|
||||
[{:keys [type icon title text action undo-duration undo-on-press container-style user]
|
||||
:or {type :neutral icon :i/placeholder}}]
|
||||
(let [context-theme (quo.theme/use-theme)
|
||||
context-theme (or theme context-theme)
|
||||
icon-name (case type
|
||||
:positive (if (= theme :light)
|
||||
:i/correct
|
||||
:i/correct-dark)
|
||||
:negative (if (= theme :light)
|
||||
:i/incorrect
|
||||
:i/incorrect-dark)
|
||||
:neutral icon)]
|
||||
[quo.theme/provider context-theme
|
||||
(let [theme (quo.theme/use-theme)
|
||||
icon-name (case type
|
||||
:positive (if (= theme :light)
|
||||
:i/correct
|
||||
:i/correct-dark)
|
||||
:negative (if (= theme :light)
|
||||
:i/incorrect
|
||||
:i/incorrect-dark)
|
||||
:neutral icon)]
|
||||
[quo.theme/provider theme
|
||||
[toast-container
|
||||
{:left (cond user
|
||||
[user-avatar/user-avatar user]
|
||||
icon-name
|
||||
[icon/icon icon-name (style/icon type context-theme)])
|
||||
[icon/icon icon-name (style/icon type theme)])
|
||||
:title title
|
||||
:text text
|
||||
:right (if undo-duration
|
||||
@@ -96,3 +95,4 @@
|
||||
:undo-on-press undo-on-press}]
|
||||
action)
|
||||
:container-style container-style}]]))
|
||||
|
||||
|
||||
@@ -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?]}]
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
[quo.foundations.colors :as colors]))
|
||||
|
||||
(defn container
|
||||
[size card? blur? theme]
|
||||
[{:keys [size card? blur? actionable? theme]}]
|
||||
{:flex-direction :row
|
||||
:justify-content :space-between
|
||||
:padding-vertical (when (= size :default) 8)
|
||||
@@ -11,8 +11,11 @@
|
||||
:border-radius 16
|
||||
:border-width (when (and card? (not= size :small)) 1)
|
||||
:background-color (if blur?
|
||||
colors/white-opa-5
|
||||
(colors/theme-colors colors/white colors/neutral-95 theme))
|
||||
(if actionable? :transparent colors/white-opa-5)
|
||||
(colors/theme-colors
|
||||
(if actionable? colors/white colors/neutral-2_5)
|
||||
(if actionable? colors/neutral-95 colors/neutral-90)
|
||||
theme))
|
||||
:border-color (if blur?
|
||||
colors/white-opa-10
|
||||
(colors/theme-colors colors/neutral-10
|
||||
|
||||
@@ -125,7 +125,12 @@
|
||||
{:accessibility-label :data-item
|
||||
:disabled (not icon-right?)
|
||||
:on-press on-press
|
||||
:style (merge (style/container size card? blur? theme) container-style)}
|
||||
:style (merge (style/container {:size size
|
||||
:card? card?
|
||||
:blur? blur?
|
||||
:actionable? on-press
|
||||
:theme theme})
|
||||
container-style)}
|
||||
[left-side props]
|
||||
(when (and (= :default status) (not= :small size))
|
||||
[right-side
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
(def container
|
||||
{:flex-direction :row
|
||||
:flex 1
|
||||
:justify-content :space-between})
|
||||
|
||||
(def right-counter
|
||||
|
||||
@@ -181,6 +181,14 @@
|
||||
#(let [ret (handler)] (if (fn? ret) ret js/undefined))
|
||||
(get-js-deps deps))))
|
||||
|
||||
(defn use-layout-effect
|
||||
([handler]
|
||||
(use-layout-effect handler nil))
|
||||
([handler deps]
|
||||
(react/useLayoutEffect
|
||||
#(let [ret (handler)] (if (fn? ret) ret js/undefined))
|
||||
(get-js-deps deps))))
|
||||
|
||||
(defn use-mount
|
||||
[handler]
|
||||
(use-effect handler []))
|
||||
@@ -199,6 +207,15 @@
|
||||
[handler deps]
|
||||
(react/useMemo handler (get-js-deps deps)))
|
||||
|
||||
(defn delay-render
|
||||
[content]
|
||||
(let [[render? set-render] (use-state false)]
|
||||
(use-mount
|
||||
(fn []
|
||||
(js/setTimeout #(set-render true) 0)))
|
||||
(when render?
|
||||
content)))
|
||||
|
||||
(def layout-animation (.-LayoutAnimation ^js react-native))
|
||||
(def configure-next (.-configureNext ^js layout-animation))
|
||||
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
[{:keys [on-press allow-multiple-presses? throttle-duration]} throttle-id]
|
||||
(if allow-multiple-presses?
|
||||
on-press
|
||||
(fn []
|
||||
(fn [event]
|
||||
(let [id @throttle-id]
|
||||
(when (and id (not (get @throttle id)))
|
||||
(swap! throttle assoc id true)
|
||||
(on-press)
|
||||
(on-press event)
|
||||
(js/setTimeout
|
||||
#(swap! throttle dissoc id)
|
||||
(or throttle-duration 500)))))))
|
||||
|
||||
+1
-1
@@ -19,5 +19,5 @@
|
||||
(catch js/Error e#
|
||||
(taoensso.timbre/error "Failed to instrument function"
|
||||
{:symbol ~sym :error e#})
|
||||
~sym))
|
||||
(throw e#)))
|
||||
~sym))
|
||||
|
||||
@@ -91,5 +91,5 @@
|
||||
{:schema-id schema-id
|
||||
:error e
|
||||
:function f})
|
||||
f))
|
||||
(throw e)))
|
||||
f)))
|
||||
|
||||
@@ -16,4 +16,4 @@
|
||||
|
||||
(def ^:const default-dimension 1000)
|
||||
|
||||
(def ^:const margin 8)
|
||||
(def ^:const margin 16)
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
(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))])
|
||||
@@ -64,7 +64,8 @@
|
||||
[quo/page-nav
|
||||
(cond-> {:margin-top (safe-area/get-top)
|
||||
:type :no-title
|
||||
:background (if (= 1 (reanimated/get-shared-value opacity-animation))
|
||||
:background (if (or (:blur? page-nav-props)
|
||||
(= 1 (reanimated/get-shared-value opacity-animation)))
|
||||
:blur
|
||||
:photo)
|
||||
:right-side page-nav-right-section-buttons
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
(ns status-im.common.validation.keypair
|
||||
(:require [clojure.string :as string]
|
||||
[status-im.common.validation.general :as validators]
|
||||
[status-im.constants :as constants]
|
||||
utils.emojilib
|
||||
[utils.i18n :as i18n]))
|
||||
|
||||
(defn keypair-too-short?
|
||||
[s]
|
||||
(< (-> s str string/trim count) constants/key-pair-name-min-length))
|
||||
|
||||
(defn keypair-too-long?
|
||||
[s]
|
||||
(> (-> s str string/trim count) constants/key-pair-name-max-length))
|
||||
|
||||
(defn validation-keypair-name
|
||||
[s]
|
||||
(cond
|
||||
(string/blank? s) nil
|
||||
(validators/has-emojis? s) (i18n/label :t/key-name-error-emoji)
|
||||
(validators/has-special-characters? s) (i18n/label :t/key-name-error-special-char)
|
||||
(keypair-too-short? s) (i18n/label :t/your-key-pair-name-is-too-short)
|
||||
(keypair-too-long? s) (i18n/label :t/your-key-pair-name-is-too-long)))
|
||||
@@ -0,0 +1,27 @@
|
||||
(ns status-im.common.validation.keypair-test
|
||||
(:require
|
||||
[cljs.test :refer-macros [deftest are]]
|
||||
[status-im.common.validation.keypair :as keypair-validator]
|
||||
[utils.i18n :as i18n]))
|
||||
|
||||
(deftest keypair-name-too-short-test
|
||||
(are [arg expected]
|
||||
(expected (keypair-validator/keypair-too-short? arg))
|
||||
"abc" true?
|
||||
"abcdef" false?))
|
||||
|
||||
(deftest keypair-name-too-long-test
|
||||
(are [arg expected]
|
||||
(expected (keypair-validator/keypair-too-long? arg))
|
||||
(apply str (repeat 25 "a")) true?
|
||||
"abcdef" false?))
|
||||
|
||||
(deftest validation-keypair-name-test
|
||||
(are [arg expected]
|
||||
(= (keypair-validator/validation-keypair-name arg) expected)
|
||||
nil nil
|
||||
"" nil
|
||||
"name !" (i18n/label :t/key-name-error-special-char)
|
||||
"Hello 😊" (i18n/label :t/key-name-error-emoji)
|
||||
"abc" (i18n/label :t/your-key-pair-name-is-too-short)
|
||||
(apply str (repeat 25 "a")) (i18n/label :t/your-key-pair-name-is-too-long)))
|
||||
@@ -77,6 +77,9 @@
|
||||
(def ^:const contact-request-message-state-declined 3)
|
||||
(def ^:const contact-request-message-max-length 280)
|
||||
|
||||
(def ^:const key-pair-name-max-length 20)
|
||||
(def ^:const key-pair-name-min-length 5)
|
||||
|
||||
(def request-to-join-pending-state 1)
|
||||
|
||||
(def reactions
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
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])
|
||||
@@ -62,6 +62,8 @@
|
||||
(i18n/label :t/manage-members)]
|
||||
[gesture/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
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
(:require
|
||||
[oops.core :as oops]
|
||||
[quo.core :as quo]
|
||||
[react-native.platform :as platform]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.common.lightbox.constants :as constants]
|
||||
[status-im.contexts.chat.messenger.messages.content.lightbox.style :as style]
|
||||
@@ -36,7 +35,6 @@
|
||||
[:lightbox/save-image-to-gallery
|
||||
uri
|
||||
#(rf/dispatch [:toasts/upsert
|
||||
{:id :random-id
|
||||
:type :positive
|
||||
:container-style {:bottom (when platform/android? 20)}
|
||||
:text (i18n/label :t/photo-saved)}])]))}]]]))
|
||||
{:id :random-id
|
||||
:type :positive
|
||||
:text (i18n/label :t/photo-saved)}])]))}]]]))
|
||||
|
||||
@@ -48,10 +48,11 @@
|
||||
{:transform [{:scale scale}]
|
||||
:top top
|
||||
:left left}
|
||||
{:position :absolute
|
||||
:border-width 4
|
||||
:border-radius 50
|
||||
:border-color (colors/theme-colors colors/white colors/neutral-95 theme)}))
|
||||
{:position :absolute
|
||||
:border-width 4
|
||||
:border-radius 50
|
||||
:background-color (colors/theme-colors colors/white colors/neutral-95 theme)
|
||||
:border-color (colors/theme-colors colors/white colors/neutral-95 theme)}))
|
||||
|
||||
(defn user-name-container
|
||||
[top left]
|
||||
|
||||
@@ -133,15 +133,21 @@
|
||||
community-channel? (= chat-type constants/community-chat-type)]
|
||||
[reanimated/view
|
||||
{:style (style/header-image scale top left theme)}
|
||||
(if group-chat
|
||||
(cond
|
||||
community-channel?
|
||||
[quo/channel-avatar
|
||||
{:size :size-80
|
||||
:full-name chat-name
|
||||
:customization-color color
|
||||
:emoji (when-not (string/blank? emoji)
|
||||
(string/trim emoji))}]
|
||||
group-chat
|
||||
[quo/group-avatar
|
||||
{:customization-color color
|
||||
:size :size-80
|
||||
:picture profile-picture
|
||||
:emoji (when (and (not (string/blank? emoji))
|
||||
community-channel?)
|
||||
(string/trim emoji))
|
||||
:chat-name chat-name}]
|
||||
:else
|
||||
[quo/user-avatar
|
||||
{:full-name display-name
|
||||
:online? online?
|
||||
|
||||
@@ -21,12 +21,10 @@
|
||||
:align-items :center
|
||||
:margin-top 20})
|
||||
|
||||
(def fetching-placeholder
|
||||
{:align-items :center
|
||||
:justify-content :center
|
||||
:flex 1})
|
||||
|
||||
(def fetching-text {:color :red})
|
||||
(defn fetching-placeholder
|
||||
[top-inset]
|
||||
{:flex 1
|
||||
:margin-top top-inset})
|
||||
|
||||
(def blur-channel-header
|
||||
{:position :absolute
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
[quo.theme]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]
|
||||
[react-native.safe-area :as safe-area]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.common.home.actions.view :as actions]
|
||||
[status-im.common.not-implemented :as not-implemented]
|
||||
[status-im.common.resources :as resources]
|
||||
[status-im.common.scroll-page.style :as scroll-page.style]
|
||||
[status-im.common.scroll-page.view :as scroll-page]
|
||||
[status-im.config :as config]
|
||||
@@ -369,18 +370,25 @@
|
||||
|
||||
(defn- community-fetching-placeholder
|
||||
[id]
|
||||
(let [fetching? (rf/sub [:communities/fetching-community id])]
|
||||
(let [theme (quo.theme/use-theme)
|
||||
top-inset (safe-area/get-top)
|
||||
fetching? (rf/sub [:communities/fetching-community id])]
|
||||
[rn/view
|
||||
{:style style/fetching-placeholder
|
||||
{:style (style/fetching-placeholder top-inset)
|
||||
:accessibility-label (if fetching?
|
||||
:fetching-community-overview
|
||||
:failed-to-fetch-community-overview)}
|
||||
[not-implemented/not-implemented
|
||||
[rn/text
|
||||
{:style style/fetching-text}
|
||||
(if fetching?
|
||||
"Fetching community..."
|
||||
"Failed to fetch community")]]]))
|
||||
[quo/page-nav
|
||||
{:title "Community Overview"
|
||||
:type :title
|
||||
:text-align :left
|
||||
:icon-name :i/close
|
||||
:on-press #(rf/dispatch [:navigate-back])}]
|
||||
[quo/empty-state
|
||||
{:image (resources/get-themed-image :cat-in-box theme)
|
||||
:description (when-not fetching? (i18n/label :t/here-is-a-cat-in-a-box-instead))
|
||||
:title (if fetching? "Fetching community..." "Failed to fetch community")
|
||||
:container-style {:flex 1 :justify-content :center}}]]))
|
||||
|
||||
(defn- community-card-page-view
|
||||
[id]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
(ns status-im.contexts.preview.feature-flags.style)
|
||||
|
||||
(def container
|
||||
{:flex 1
|
||||
:margin-left 20})
|
||||
{:flex 1
|
||||
:margin-left 20
|
||||
:margin-bottom 20})
|
||||
|
||||
@@ -15,25 +15,28 @@
|
||||
:text-align :left
|
||||
:title "Features Flags"
|
||||
:icon-name :i/arrow-left
|
||||
: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) "."))]]))]))])
|
||||
|
||||
: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) "."))]]))]))]])
|
||||
|
||||
@@ -41,6 +41,12 @@
|
||||
:value "Arrow left"}]}])
|
||||
|
||||
|
||||
(def account-switcher-option
|
||||
{:content-type :account-switcher
|
||||
:customization-color :purple
|
||||
:on-press #(js/alert "Pressed Account Switcher")
|
||||
:emoji "🍑"})
|
||||
|
||||
(def right-side-options
|
||||
(let [options [{:icon-name :i/save :on-press #(js/alert "SAVE")}
|
||||
{:icon-name :i/mark-as-read :on-press #(js/alert "MARK AS READ")}
|
||||
@@ -52,20 +58,21 @@
|
||||
{:key (take 2 options)
|
||||
:value "2 actions"}
|
||||
{:key (take 3 options)
|
||||
:value "3 actions"}]))
|
||||
|
||||
(def account-switcher
|
||||
{:key :account-switcher})
|
||||
:value "3 actions"}
|
||||
{:key (conj (take 1 options) account-switcher-option)
|
||||
:value "1 action + account switcher"}
|
||||
{:key (conj (take 2 options) account-switcher-option)
|
||||
:value "2 actions + account switcher"}]))
|
||||
|
||||
(def no-title-descriptor
|
||||
[{:key :right-side
|
||||
:type :select
|
||||
:options (conj right-side-options account-switcher)}])
|
||||
:options right-side-options}])
|
||||
|
||||
(def title-descriptor
|
||||
[{:key :right-side
|
||||
:type :select
|
||||
:options (conj right-side-options account-switcher)}
|
||||
:options right-side-options}
|
||||
{:key :title :type :text}
|
||||
{:key :text-align
|
||||
:type :select
|
||||
@@ -79,7 +86,7 @@
|
||||
(def token-descriptor
|
||||
[{:key :right-side
|
||||
:type :select
|
||||
:options (conj right-side-options account-switcher)}
|
||||
:options right-side-options}
|
||||
{:key :token-logo
|
||||
:type :select
|
||||
:options [{:key (resources/get-mock-image :status-logo)
|
||||
@@ -128,7 +135,7 @@
|
||||
(def wallet-networks-descriptor
|
||||
[{:key :right-side
|
||||
:type :select
|
||||
:options (conj (take 2 right-side-options) account-switcher)}])
|
||||
:options right-side-options}])
|
||||
|
||||
(def community-descriptor
|
||||
[{:key :right-side
|
||||
@@ -195,9 +202,6 @@
|
||||
:community-logo (resources/get-mock-image :coinbase)
|
||||
:network-name "Mainnet"
|
||||
:network-logo (resources/get-mock-image :diamond)
|
||||
:account-switcher {:customization-color :purple
|
||||
:on-press #(js/alert "Pressed Account Switcher")
|
||||
:emoji "🍑"}
|
||||
:networks networks})]
|
||||
(fn []
|
||||
[preview/preview-container
|
||||
|
||||
@@ -1,34 +1,222 @@
|
||||
(ns status-im.contexts.profile.contact.contact-request.view
|
||||
(:require [clojure.string :as string]
|
||||
[quo.core :as quo]
|
||||
[re-frame.core :as re-frame]
|
||||
[react-native.core :as rn]
|
||||
[react-native.platform :as platform]
|
||||
[reagent.ratom]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.contexts.profile.contact.contact-request.style :as style]
|
||||
[status-im.contexts.profile.utils :as profile.utils]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
;; ---
|
||||
|
||||
(def contact-request-message-store
|
||||
(reagent.ratom/atom {}))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:contact-request-message
|
||||
(fn []
|
||||
[contact-request-message-store])
|
||||
(fn [[store] [_ id]]
|
||||
(get store id "")))
|
||||
|
||||
(re-frame/reg-fx
|
||||
:store/set-contact-request-message
|
||||
(fn [[id message]]
|
||||
(swap! contact-request-message-store assoc id message)))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
:ui/set-contact-request-message
|
||||
(fn [_cofx [id message]]
|
||||
{:fx [[:store/set-contact-request-message [id message]]]}))
|
||||
|
||||
;; ---
|
||||
|
||||
(def ^:private lookup-sentinel (js-obj))
|
||||
|
||||
(defn memo
|
||||
"Returns a memoized version of a referentially transparent function. The
|
||||
memoized version of the function keeps a cache of the mapping from arguments
|
||||
to results and, when calls with the same arguments are repeated often, has
|
||||
higher performance at the expense of higher memory use."
|
||||
[mem f]
|
||||
(fn [& args]
|
||||
(js/console.log "lookup")
|
||||
(let [v (get @mem args lookup-sentinel)]
|
||||
(if (identical? v lookup-sentinel)
|
||||
(let [ret (apply f args)]
|
||||
(js/console.log "swap")
|
||||
(swap! mem assoc args ret)
|
||||
ret)
|
||||
v))))
|
||||
|
||||
(defn make-state-ref
|
||||
[state-ratom]
|
||||
(let [state-ref (atom nil)]
|
||||
(js/console.log "init make-state-ref")
|
||||
(let [reaction-sub
|
||||
(reagent.ratom/track!
|
||||
(fn [state-ratom]
|
||||
(js/console.log "reagent reaction")
|
||||
(let [state @state-ratom]
|
||||
(js/console.log
|
||||
(if (nil? @state-ref)
|
||||
"state-ref init"
|
||||
"state-ref update")
|
||||
(clj->js state))
|
||||
(reset! state-ref state)
|
||||
state))
|
||||
state-ratom)]
|
||||
@reaction-sub
|
||||
{:sub reaction-sub
|
||||
:ref state-ref})))
|
||||
|
||||
(defn make-state-handler-factory [state-ref]
|
||||
(let [storage (rn/use-memo #(atom {}) [state-ref])
|
||||
factory (rn/use-memo
|
||||
(fn []
|
||||
(fn [handler]
|
||||
((memo storage
|
||||
(fn [callback]
|
||||
(print "make state handler")
|
||||
(fn [event]
|
||||
(callback @state-ref event))))
|
||||
handler)))
|
||||
[state-ref storage])]
|
||||
{:factory factory
|
||||
:storage storage}))
|
||||
|
||||
(defn make-snapshot-handler-factory [snapshot]
|
||||
(let [storage (rn/use-memo #(atom {}) [])
|
||||
capture (rn/use-memo #(atom snapshot) [])
|
||||
_update (rn/use-layout-effect
|
||||
(fn []
|
||||
(swap! capture (fn [_] snapshot)))
|
||||
snapshot)
|
||||
factory (rn/use-memo
|
||||
(fn []
|
||||
(fn [handler]
|
||||
((memo storage
|
||||
(fn [callback]
|
||||
(fn [event]
|
||||
(callback @capture event))))
|
||||
handler)))
|
||||
[storage capture])]
|
||||
{:factory factory
|
||||
:storage storage}))
|
||||
|
||||
(defn make-past-present-state-handler-factory [state-ref]
|
||||
(let [storage (rn/use-memo #(atom {}) [state-ref])
|
||||
capture (rn/use-memo #(atom @state-ref) [state-ref])
|
||||
factory (rn/use-memo
|
||||
(fn []
|
||||
(fn [handler]
|
||||
(reset! capture @state-ref)
|
||||
((memo storage
|
||||
(fn [callback]
|
||||
(fn [event]
|
||||
(callback @capture @state-ref event))))
|
||||
handler)))
|
||||
[state-ref storage])]
|
||||
{:factory factory
|
||||
:storage storage}))
|
||||
|
||||
(defn use-bind-sub [state-sub]
|
||||
(let [{:keys [ref sub]}
|
||||
(rn/use-memo (fn []
|
||||
(make-state-ref state-sub))
|
||||
[state-sub])
|
||||
{:keys [factory storage]}
|
||||
(make-state-handler-factory ref)]
|
||||
(rn/use-unmount (fn []
|
||||
(js/console.log "unmount bind-sub")
|
||||
(prn "unmount storage" storage)
|
||||
(reagent.ratom/dispose! sub)))
|
||||
factory))
|
||||
|
||||
(defn use-bind-past-present-sub [state-sub]
|
||||
(let [{:keys [ref sub]}
|
||||
(rn/use-memo (fn []
|
||||
(make-state-ref state-sub))
|
||||
[state-sub])
|
||||
{:keys [factory storage]}
|
||||
(make-past-present-state-handler-factory ref)]
|
||||
(rn/use-unmount (fn []
|
||||
(js/console.log "unmount bind-sub-and-snapshot")
|
||||
(prn "unmount storage" storage)
|
||||
(reagent.ratom/dispose! sub)))
|
||||
factory))
|
||||
|
||||
(defn use-bind-snapshot [snapshot]
|
||||
(let [{:keys [factory storage]}
|
||||
(make-snapshot-handler-factory snapshot)]
|
||||
(rn/use-unmount (fn []
|
||||
(js/console.log "unmount bind-snapshot")
|
||||
(prn "unmount storage" storage)))
|
||||
factory))
|
||||
|
||||
;; ---
|
||||
|
||||
(defn on-message-submit
|
||||
([snapshot state _event]
|
||||
(js/console.log "on-press snapshot" (clj->js snapshot))
|
||||
(js/console.log "on-press state" (clj->js state))
|
||||
(let [{:keys [public-key message]} state]
|
||||
;; (rf/dispatch [:hide-bottom-sheet])
|
||||
;; (rf/dispatch [:contact.ui/send-contact-request
|
||||
;; public-key message])
|
||||
(rf/dispatch [:toasts/upsert
|
||||
{:id :send-contact-request
|
||||
:type :positive
|
||||
:text message}])))
|
||||
([state _event]
|
||||
(js/console.log "on-press state" (clj->js state))
|
||||
(let [{:keys [public-key message]} state]
|
||||
;; (rf/dispatch [:hide-bottom-sheet])
|
||||
;; (rf/dispatch [:contact.ui/send-contact-request
|
||||
;; public-key message])
|
||||
(rf/dispatch [:toasts/upsert
|
||||
{:id :send-contact-request
|
||||
:type :positive
|
||||
:text message}]))))
|
||||
|
||||
(defn combine-subs-helper [subs-map]
|
||||
(reduce (fn [result [name sub]]
|
||||
(assoc result name @sub))
|
||||
{}
|
||||
subs-map))
|
||||
|
||||
(defn combine-subs [subs-map]
|
||||
(reagent.ratom/track combine-subs-helper subs-map))
|
||||
|
||||
(defn view
|
||||
[]
|
||||
(let [{:keys [public-key customization-color]
|
||||
:as profile} (rf/sub [:contacts/current-contact])
|
||||
(let [profile-sub (re-frame/subscribe [:contacts/current-contact])
|
||||
{:keys [public-key customization-color]
|
||||
:as profile} (deref profile-sub)
|
||||
customization-color customization-color
|
||||
full-name (profile.utils/displayed-name profile)
|
||||
profile-picture (profile.utils/photo profile)
|
||||
input-ref (rn/use-ref-atom nil)
|
||||
message-sub (re-frame/subscribe [:contact-request-message public-key])
|
||||
[message set-message] (rn/use-state "")
|
||||
on-message-change (rn/use-callback #(set-message %))
|
||||
on-message-submit (rn/use-callback (fn []
|
||||
(rf/dispatch [:hide-bottom-sheet])
|
||||
(rf/dispatch [:contact.ui/send-contact-request
|
||||
public-key message])
|
||||
(rf/dispatch [:toasts/upsert
|
||||
{:id :send-contact-request
|
||||
:type :positive
|
||||
:text (i18n/label
|
||||
:t/contact-request-was-sent)}]))
|
||||
[public-key message])]
|
||||
on-message-change (rn/use-callback #(do
|
||||
(rf/dispatch-sync [:ui/set-contact-request-message public-key %])
|
||||
(set-message %)))
|
||||
state-sub (combine-subs {:message message-sub
|
||||
:public-key (reagent.ratom/cursor
|
||||
profile-sub
|
||||
[:public-key])})
|
||||
bind-sub (use-bind-sub state-sub)
|
||||
bind-past-present-sub (use-bind-past-present-sub state-sub)
|
||||
bind-snapshot (use-bind-snapshot {:public-key public-key
|
||||
:message message})]
|
||||
(rn/use-unmount
|
||||
(fn []
|
||||
(rf/dispatch [:ui/set-contact-request-message public-key ""])))
|
||||
(rn/use-mount
|
||||
(fn []
|
||||
(let [listener (.addListener rn/keyboard
|
||||
@@ -58,6 +246,7 @@
|
||||
:auto-focus true
|
||||
:accessibility-label :contact-request-message
|
||||
:label (i18n/label :t/message)
|
||||
:value @message-sub
|
||||
:on-change-text on-message-change
|
||||
:container-style {:flex-shrink 1}
|
||||
:input-container-style {:flex-shrink 1}}]]
|
||||
@@ -66,7 +255,18 @@
|
||||
:actions :one-action
|
||||
:button-one-props {:disabled? (string/blank? message)
|
||||
:accessibility-label :send-contact-request
|
||||
:customization-color customization-color
|
||||
:on-press on-message-submit}
|
||||
:button-one-label (i18n/label :t/send-contact-request)}]]))
|
||||
:customization-color :purple
|
||||
:on-press (bind-past-present-sub on-message-submit)}
|
||||
:button-one-label "Past Present Sub"}]
|
||||
[quo/bottom-actions
|
||||
{:container-style {:style {:flex 1}}
|
||||
:actions :two-actions
|
||||
:button-one-props {:accessibility-label :send-contact-request
|
||||
:customization-color :blue
|
||||
:on-press (bind-snapshot on-message-submit)}
|
||||
:button-one-label "Snapshot"
|
||||
:button-two-props {:accessibility-label :test-button
|
||||
:customization-color :orange
|
||||
:on-press (bind-sub on-message-submit)}
|
||||
:button-two-label "Sub"}]]))
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
(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]))
|
||||
|
||||
@@ -34,12 +35,13 @@
|
||||
: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}
|
||||
{: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}
|
||||
(when config/show-not-implemented-features?
|
||||
{:title (i18n/label :t/dapps)
|
||||
:on-press not-implemented/alert
|
||||
|
||||
@@ -9,18 +9,24 @@
|
||||
[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- settings-item-view
|
||||
(defn show-settings-item?
|
||||
[{:keys [feature-flag]}]
|
||||
(or (ff/enabled? feature-flag)
|
||||
(nil? feature-flag)))
|
||||
|
||||
(defn- settings-category-view
|
||||
[data]
|
||||
[rf/delay-render
|
||||
(rn/delay-render
|
||||
[quo/category
|
||||
{:list-type :settings
|
||||
:container-style {:padding-bottom 12}
|
||||
:blur? true
|
||||
:data data}]])
|
||||
:data (filter show-settings-item? data)}]))
|
||||
|
||||
(defn scroll-handler
|
||||
[event scroll-y]
|
||||
@@ -29,9 +35,9 @@
|
||||
|
||||
(defn- footer
|
||||
[{:keys [bottom]} logout-press]
|
||||
[rf/delay-render
|
||||
(rn/delay-render
|
||||
[rn/view {:style (style/footer-container bottom)}
|
||||
[quo/logout-button {:on-press logout-press}]]])
|
||||
[quo/logout-button {:on-press logout-press}]]))
|
||||
|
||||
(defn- get-item-layout
|
||||
[_ index]
|
||||
@@ -52,8 +58,7 @@
|
||||
on-scroll (rn/use-callback #(scroll-handler % scroll-y))]
|
||||
[quo/overlay {:type :shell}
|
||||
[rn/view
|
||||
{:key :header
|
||||
:style (style/navigation-wrapper {:customization-color customization-color
|
||||
{:style (style/navigation-wrapper {:customization-color customization-color
|
||||
:inset (:top insets)
|
||||
:theme theme})}
|
||||
[quo/page-nav
|
||||
@@ -72,11 +77,10 @@
|
||||
{:options {:message (:universal-profile-url
|
||||
profile)}}])}]}]]
|
||||
[rn/flat-list
|
||||
{:key :list
|
||||
:header [settings.header/view {:scroll-y scroll-y}]
|
||||
{:header [settings.header/view {:scroll-y scroll-y}]
|
||||
:data (settings.items/items (boolean (:mnemonic profile)))
|
||||
:shows-vertical-scroll-indicator false
|
||||
:render-fn settings-item-view
|
||||
:render-fn settings-category-view
|
||||
:get-item-layout get-item-layout
|
||||
:footer [footer insets logout-press]
|
||||
:scroll-event-throttle 16
|
||||
@@ -84,8 +88,7 @@
|
||||
:bounces false
|
||||
:over-scroll-mode :never}]
|
||||
[quo/floating-shell-button
|
||||
{:key :shell
|
||||
:jump-to
|
||||
{:jump-to
|
||||
{:on-press #(rf/dispatch [:shell/navigate-to-jump-to])
|
||||
:customization-color customization-color
|
||||
:label (i18n/label :t/jump-to)}}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
(ns status-im.contexts.settings.wallet.events
|
||||
(:require
|
||||
[taoensso.timbre :as log]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/rename-keypair-success
|
||||
(fn [{:keys [db]} [key-uid name]]
|
||||
{:db (update-in db
|
||||
[:wallet :keypairs]
|
||||
(fn [keypairs]
|
||||
(map (fn [keypair]
|
||||
(if (= (keypair :key-uid) key-uid)
|
||||
(assoc keypair :name name)
|
||||
keypair))
|
||||
keypairs)))
|
||||
:fx [[:dispatch [:navigate-back]]
|
||||
[:dispatch
|
||||
[:toasts/upsert
|
||||
{:type :positive
|
||||
:text (i18n/label :t/key-pair-name-updated)}]]]}))
|
||||
|
||||
(defn rename-keypair
|
||||
[_ [{:keys [key-uid keypair-name]}]]
|
||||
{:fx [[:json-rpc/call
|
||||
[{:method "accounts_updateKeypairName"
|
||||
:params [key-uid keypair-name]
|
||||
:on-success [:wallet/rename-keypair-success key-uid keypair-name]
|
||||
:on-error #(log/info "failed to rename keypair " %)}]]]})
|
||||
|
||||
(rf/reg-event-fx :wallet/rename-keypair rename-keypair)
|
||||
@@ -0,0 +1,20 @@
|
||||
(ns status-im.contexts.settings.wallet.events-test
|
||||
(:require
|
||||
[cljs.test :refer-macros [deftest is]]
|
||||
matcher-combinators.test
|
||||
[status-im.contexts.settings.wallet.events :as sut]))
|
||||
|
||||
(def key-uid "0xfef454bb492ee4677594f8e05921c84f336fa811deb99b8d922477cc87a38b98")
|
||||
|
||||
(deftest rename-keypair-test
|
||||
(let [new-keypair-name "key pair new"
|
||||
cofx {:db {}}
|
||||
expected {:fx [[:json-rpc/call
|
||||
[{:method "accounts_updateKeypairName"
|
||||
:params [key-uid new-keypair-name]
|
||||
:on-success [:wallet/rename-keypair-success key-uid new-keypair-name]
|
||||
:on-error fn?}]]]}]
|
||||
(is (match? expected
|
||||
(sut/rename-keypair cofx
|
||||
[{:key-uid key-uid
|
||||
:keypair-name new-keypair-name}])))))
|
||||
@@ -0,0 +1,19 @@
|
||||
(ns status-im.contexts.settings.wallet.keypairs-and-accounts.actions.view
|
||||
(:require [quo.core :as quo]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn on-rename-request
|
||||
[data]
|
||||
(rf/dispatch [:open-modal :screen/settings.rename-keypair data]))
|
||||
|
||||
(defn view
|
||||
[props data]
|
||||
[:<>
|
||||
[quo/drawer-top props]
|
||||
[quo/action-drawer
|
||||
[(when (= (:type props) :keypair)
|
||||
[{:icon :i/edit
|
||||
:accessibility-label :rename-key-pair
|
||||
:label (i18n/label :t/rename-key-pair)
|
||||
:on-press #(on-rename-request data)}])]]])
|
||||
@@ -0,0 +1,11 @@
|
||||
(ns status-im.contexts.settings.wallet.keypairs-and-accounts.rename.style)
|
||||
|
||||
(def header-container
|
||||
{:margin-bottom 8})
|
||||
|
||||
(def bottom-action
|
||||
{:margin-horizontal -20})
|
||||
|
||||
(def error-container
|
||||
{:margin-left 20
|
||||
:margin-vertical 8})
|
||||
@@ -0,0 +1,84 @@
|
||||
(ns status-im.contexts.settings.wallet.keypairs-and-accounts.rename.view
|
||||
(:require [clojure.string :as string]
|
||||
[quo.core :as quo]
|
||||
[react-native.core :as rn]
|
||||
[status-im.common.floating-button-page.view :as floating-button-page]
|
||||
[status-im.common.validation.keypair :as keypair-validator]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.contexts.settings.wallet.keypairs-and-accounts.rename.style :as style]
|
||||
[utils.debounce :as debounce]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn navigate-back [] (rf/dispatch [:navigate-back]))
|
||||
|
||||
(defn view
|
||||
[]
|
||||
(let [{:keys [name key-uid]} (rf/sub [:get-screen-params])
|
||||
customization-color (rf/sub [:profile/customization-color])
|
||||
[unsaved-keypair-name set-unsaved-keypair-name] (rn/use-state name)
|
||||
[error-msg set-error-msg] (rn/use-state nil)
|
||||
[typing? set-typing?] (rn/use-state false)
|
||||
validate-keypair-name (rn/use-callback
|
||||
(debounce/debounce
|
||||
(fn [name]
|
||||
(set-error-msg
|
||||
(keypair-validator/validation-keypair-name
|
||||
name))
|
||||
(set-typing? false))
|
||||
300))
|
||||
on-change-text (rn/use-callback (fn [text]
|
||||
(set-typing? true)
|
||||
(set-unsaved-keypair-name
|
||||
text)
|
||||
(validate-keypair-name text)))
|
||||
on-clear (rn/use-callback (fn []
|
||||
(on-change-text "")))
|
||||
on-save (rn/use-callback #(rf/dispatch
|
||||
[:wallet/rename-keypair
|
||||
{:key-uid key-uid
|
||||
:keypair-name
|
||||
unsaved-keypair-name}])
|
||||
[unsaved-keypair-name key-uid])]
|
||||
[floating-button-page/view
|
||||
{:header [quo/page-nav
|
||||
{:icon-name :i/close
|
||||
:on-press navigate-back
|
||||
:accessibility-label :top-bar}]
|
||||
:footer [quo/bottom-actions
|
||||
{:actions :one-action
|
||||
:button-one-label (i18n/label :t/save)
|
||||
:button-one-props {:disabled? (or typing?
|
||||
(string/blank? unsaved-keypair-name)
|
||||
(not (string/blank? error-msg)))
|
||||
:customization-color customization-color
|
||||
:on-press on-save}
|
||||
:container-style style/bottom-action}]}
|
||||
[quo/page-top
|
||||
{:container-style style/header-container
|
||||
:title (i18n/label :t/rename-key-pair)
|
||||
:description :context-tag
|
||||
:context-tag {:type :icon
|
||||
:size 24
|
||||
:context name
|
||||
:icon :i/seed-phrase}}]
|
||||
[quo/input
|
||||
{:container-style {:margin-horizontal 20}
|
||||
:placeholder (i18n/label :t/keypair-name-input-placeholder)
|
||||
:label (i18n/label :t/keypair-name)
|
||||
:default-value unsaved-keypair-name
|
||||
:char-limit constants/key-pair-name-max-length
|
||||
:max-length constants/key-pair-name-max-length
|
||||
:auto-focus true
|
||||
:clearable? (not (string/blank? unsaved-keypair-name))
|
||||
:on-clear on-clear
|
||||
:on-change-text on-change-text
|
||||
:error? (not (string/blank? error-msg))}]
|
||||
(when-not (string/blank? error-msg)
|
||||
[quo/info-message
|
||||
{:type :error
|
||||
:size :default
|
||||
:icon :i/info
|
||||
:container-style style/error-container}
|
||||
error-msg])]))
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
(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})
|
||||
@@ -0,0 +1,91 @@
|
||||
(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} keypair]
|
||||
(rf/dispatch [:show-bottom-sheet
|
||||
{:content (fn [] [actions/view props keypair])
|
||||
:theme theme}]))
|
||||
|
||||
(defn- keypair
|
||||
[{keypair-type :type
|
||||
:keys [accounts name]
|
||||
:as item}
|
||||
_ _
|
||||
{: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))
|
||||
item))
|
||||
[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,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,9 +10,18 @@
|
||||
[]
|
||||
(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
|
||||
[]
|
||||
[{:title (i18n/label :t/saved-addresses)
|
||||
[(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)
|
||||
:blur? true
|
||||
:on-press open-saved-addresses-settings-modal
|
||||
:action :arrow}])
|
||||
@@ -26,11 +35,13 @@
|
||||
:blur? true
|
||||
:list-type :settings}])
|
||||
|
||||
(defn navigate-back
|
||||
[]
|
||||
(rf/dispatch [:navigate-back]))
|
||||
|
||||
(defn view
|
||||
[]
|
||||
(let [inset-top (safe-area/get-top)
|
||||
navigate-back (rn/use-callback
|
||||
#(rf/dispatch [:navigate-back]))]
|
||||
(let [inset-top (safe-area/get-top)]
|
||||
[quo/overlay
|
||||
{:type :shell
|
||||
:container-style (style/page-wrapper inset-top)}
|
||||
|
||||
@@ -33,11 +33,12 @@
|
||||
{:type :wallet-networks
|
||||
:on-press #(rf/dispatch [:wallet/close-account-page])}]
|
||||
[quo/account-overview
|
||||
{:current-value formatted-balance
|
||||
{:container-style style/account-overview
|
||||
:current-value formatted-balance
|
||||
:account-name name
|
||||
:account (if watch-only? :watched-address :default)
|
||||
:customization-color color}]
|
||||
[quo/wallet-graph {:time-frame :empty}]
|
||||
(when (ff/enabled? ::ff/wallet.graph) [quo/wallet-graph {:time-frame :empty}])
|
||||
(when (not watch-only?)
|
||||
[quo/wallet-ctas
|
||||
{:container-style style/cta-buttons
|
||||
|
||||
@@ -90,3 +90,18 @@
|
||||
(cske/transform-keys transforms/->kebab-case-keyword derived-address)))}))
|
||||
|
||||
(rf/reg-event-fx :wallet/get-derived-addresses-success get-derived-addresses-success)
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/set-private-key
|
||||
(fn [{:keys [db]} [value]]
|
||||
{:db (assoc-in db [:wallet :ui :create-account :private-key] (security/mask-data value))}))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/set-public-address
|
||||
(fn [{:keys [db]} [value]]
|
||||
{:db (assoc-in db [:wallet :ui :create-account :public-address] value)}))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/clear-private-key-data
|
||||
(fn [{:keys [db]} _]
|
||||
{:db (update-in db [:wallet :ui :create-account] dissoc :private-key :public-address)}))
|
||||
|
||||
+65
-44
@@ -1,5 +1,6 @@
|
||||
(ns status-im.contexts.wallet.add-account.create-account.import-private-key.view
|
||||
(:require
|
||||
[clojure.string :as string]
|
||||
[quo.core :as quo]
|
||||
[quo.theme :as theme]
|
||||
[react-native.clipboard :as clipboard]
|
||||
@@ -12,45 +13,50 @@
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn- address-input
|
||||
[{:keys [input-value set-input-value set-flow-state error?]}]
|
||||
(let [check-address (rn/use-callback
|
||||
(debounce/debounce (fn [v]
|
||||
(if (empty? v)
|
||||
(set-flow-state nil)
|
||||
;; TODO check for validation
|
||||
(if-not (v/private-key? v)
|
||||
(set-flow-state :invalid-private-key)
|
||||
;; TODO add real requests
|
||||
(do
|
||||
(set-flow-state :scanning)
|
||||
(js/setTimeout
|
||||
set-flow-state
|
||||
400
|
||||
(rand-nth [:active-address :inactive-address]))))))
|
||||
500))
|
||||
on-change (rn/use-callback
|
||||
(fn [v]
|
||||
(set-input-value v)
|
||||
(check-address v)))
|
||||
on-paste (rn/use-callback
|
||||
(fn []
|
||||
(clipboard/get-string
|
||||
(fn [clipboard]
|
||||
(when-not (empty? clipboard)
|
||||
(on-change clipboard))))))]
|
||||
[{:keys [input-value set-flow-state error?]}]
|
||||
(let [check-address
|
||||
(rn/use-callback
|
||||
(debounce/debounce
|
||||
(fn [v]
|
||||
(if (empty? v)
|
||||
(set-flow-state nil)
|
||||
;; TODO check for validation
|
||||
(if-not (v/private-key? v)
|
||||
(set-flow-state :invalid-private-key)
|
||||
;; TODO add real requests
|
||||
(do
|
||||
(set-flow-state :scanning)
|
||||
;; TODO get real address
|
||||
;; Should be fixed in #18819
|
||||
(rf/dispatch [:wallet/set-public-address
|
||||
"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"])
|
||||
(js/setTimeout set-flow-state 400 (rand-nth [:active-address :inactive-address]))))))
|
||||
500))
|
||||
|
||||
on-change (rn/use-callback
|
||||
(fn [v]
|
||||
(rf/dispatch [:wallet/set-private-key v])
|
||||
(check-address v)))
|
||||
on-paste (rn/use-callback
|
||||
(fn []
|
||||
(clipboard/get-string
|
||||
(fn [clipboard]
|
||||
(when-not (empty? clipboard)
|
||||
(on-change clipboard))))))]
|
||||
[quo/input
|
||||
{:accessibility-label :add-address-to-watch
|
||||
{:accessibility-label :import-private-key
|
||||
:placeholder (i18n/label :t/enter-private-key-placeholder)
|
||||
:container-style style/input
|
||||
:label (i18n/label :t/private-key)
|
||||
:type :password
|
||||
:error? error?
|
||||
:return-key-type :done
|
||||
:auto-focus true
|
||||
:on-change-text on-change
|
||||
:button (when (empty? input-value)
|
||||
{:on-press on-paste
|
||||
:text (i18n/label :t/paste)})
|
||||
:value input-value}]))
|
||||
:default-value input-value}]))
|
||||
|
||||
(defn- activity-indicator
|
||||
[state]
|
||||
@@ -84,13 +90,29 @@
|
||||
:style style/indicator)
|
||||
(i18n/label message)])))
|
||||
|
||||
(defn on-unmount
|
||||
[]
|
||||
(rf/dispatch [:wallet/clear-private-key-data]))
|
||||
|
||||
(defn navigate-back
|
||||
[]
|
||||
(rf/dispatch [:navigate-back]))
|
||||
|
||||
(defn navigate-to-keypair-import
|
||||
[]
|
||||
(rf/dispatch [:navigate-to
|
||||
:screen/wallet.keypair-name
|
||||
{:workflow :import-private-key}]))
|
||||
|
||||
(defn view
|
||||
[]
|
||||
(let [theme (theme/use-theme)
|
||||
customization-color (rf/sub [:profile/customization-color])
|
||||
[input-value set-input-value] (rn/use-state "")
|
||||
[flow-state set-flow-state] (rn/use-state)
|
||||
error? (= :invalid-private-key flow-state)]
|
||||
(let [theme (theme/use-theme)
|
||||
customization-color (rf/sub [:profile/customization-color])
|
||||
private-key (rf/sub [:wallet/import-private-key])
|
||||
public-address (rf/sub [:wallet/public-address])
|
||||
[flow-state set-flow-state] (rn/use-state nil)
|
||||
error? (= :invalid-private-key flow-state)]
|
||||
(rn/use-unmount on-unmount)
|
||||
[rn/view {:flex 1}
|
||||
[floating-button-page/view
|
||||
{:customization-color customization-color
|
||||
@@ -98,7 +120,7 @@
|
||||
{:background :white
|
||||
:type :no-title
|
||||
:icon-name :i/close
|
||||
:on-press #(rf/dispatch [:navigate-back])}]
|
||||
:on-press navigate-back}]
|
||||
:footer [:<>
|
||||
(when-not (#{:active-address :inactive-address} flow-state)
|
||||
[quo/information-box
|
||||
@@ -108,8 +130,8 @@
|
||||
(i18n/label :t/import-private-key-info)])
|
||||
[quo/button
|
||||
{:customization-color customization-color
|
||||
:disabled? (or (empty? input-value) error?)
|
||||
:on-press #()}
|
||||
:disabled? (or (string/blank? private-key) error?)
|
||||
:on-press navigate-to-keypair-import}
|
||||
(i18n/label :t/continue)]]}
|
||||
[quo/page-top
|
||||
{:container-style style/page-top
|
||||
@@ -117,17 +139,16 @@
|
||||
:description :text
|
||||
:description-text (i18n/label :t/enter-private-key)}]
|
||||
[address-input
|
||||
{:input-value input-value
|
||||
:set-input-value set-input-value
|
||||
:set-flow-state set-flow-state
|
||||
:error? error?}]
|
||||
{:input-value private-key
|
||||
:set-flow-state set-flow-state
|
||||
:error? error?}]
|
||||
(when (#{:scanning :active-address :inactive-address} flow-state)
|
||||
[rn/view {:style style/key-section}
|
||||
[quo/section-label
|
||||
{:section (i18n/label :t/private-key-public-address)
|
||||
:container-style style/section-label}]
|
||||
;; TODO Get real address
|
||||
[rn/view {:style (style/public-address flow-state theme)}
|
||||
[quo/text "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"]]])
|
||||
(when (seq input-value)
|
||||
(when (seq public-address)
|
||||
[rn/view {:style (style/public-address flow-state theme)}
|
||||
[quo/text public-address]])])
|
||||
(when (seq private-key)
|
||||
[activity-indicator flow-state])]]))
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
(ns status-im.contexts.wallet.add-account.create-account.key-pair-name.style)
|
||||
|
||||
(def page-top
|
||||
{:margin-top 2})
|
||||
|
||||
(def input
|
||||
{:padding-top 12
|
||||
:padding-horizontal 20})
|
||||
|
||||
(def error-container
|
||||
{:padding-horizontal 20
|
||||
:padding-vertical 8})
|
||||
@@ -0,0 +1,92 @@
|
||||
(ns status-im.contexts.wallet.add-account.create-account.key-pair-name.view
|
||||
(:require
|
||||
[clojure.string :as string]
|
||||
[quo.core :as quo]
|
||||
[react-native.core :as rn]
|
||||
[status-im.common.floating-button-page.view :as floating-button-page]
|
||||
[status-im.common.not-implemented :as not-implemented]
|
||||
[status-im.common.validation.general :as validators]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.contexts.wallet.add-account.create-account.key-pair-name.style :as style]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(def error-messages
|
||||
{:too-long (i18n/label :t/key-name-error-length)
|
||||
:too-short (i18n/label :t/key-name-error-too-short {:count constants/key-pair-name-min-length})
|
||||
:emoji (i18n/label :t/key-name-error-emoji)
|
||||
:special-char (i18n/label :t/key-name-error-special-char)})
|
||||
|
||||
(defn navigate-back
|
||||
[]
|
||||
(rf/dispatch [:navigate-back]))
|
||||
|
||||
(defn view
|
||||
[]
|
||||
(let [{:keys [workflow]} (rf/sub [:get-screen-params])
|
||||
customization-color (rf/sub [:profile/customization-color])
|
||||
[key-pair-name set-key-pair-name] (rn/use-state "")
|
||||
[error set-error] (rn/use-state nil)
|
||||
on-change-text (rn/use-callback
|
||||
(fn [value]
|
||||
(set-key-pair-name value)
|
||||
(cond
|
||||
(> (count value) constants/key-pair-name-max-length)
|
||||
(set-error :too-long)
|
||||
|
||||
(< 0 (count value) constants/key-pair-name-min-length)
|
||||
(set-error :too-short)
|
||||
|
||||
(validators/has-emojis? value)
|
||||
(set-error :emoji)
|
||||
|
||||
(validators/has-special-characters? value)
|
||||
(set-error :special-char)
|
||||
|
||||
:else (set-error nil))))
|
||||
on-continue (rn/use-callback
|
||||
(fn [_]
|
||||
(case workflow
|
||||
;; TODO issue #19759. Implement creation account from
|
||||
;; private key
|
||||
:import-private-key
|
||||
(not-implemented/alert)
|
||||
|
||||
:new-key-pair
|
||||
(rf/dispatch [:wallet/new-keypair-continue
|
||||
{:keypair-name key-pair-name}])
|
||||
(js/alert "Unknown workflow")))
|
||||
[workflow key-pair-name])
|
||||
disabled? (or (some? error) (string/blank? key-pair-name))]
|
||||
[rn/view {:style {:flex 1}}
|
||||
[floating-button-page/view
|
||||
{:customization-color customization-color
|
||||
:header [quo/page-nav
|
||||
{:icon-name :i/arrow-left
|
||||
:on-press navigate-back
|
||||
:accessibility-label :top-bar}]
|
||||
:footer [quo/button
|
||||
{:customization-color customization-color
|
||||
:disabled? disabled?
|
||||
:on-press on-continue}
|
||||
(i18n/label :t/continue)]}
|
||||
[quo/page-top
|
||||
{:title (i18n/label :t/keypair-name)
|
||||
:description-text (i18n/label :t/keypair-name-description)
|
||||
:description :text
|
||||
:container-style style/page-top}]
|
||||
[quo/input
|
||||
{:container-style style/input
|
||||
:placeholder (i18n/label :t/keypair-name-input-placeholder)
|
||||
:label (i18n/label :t/keypair-name)
|
||||
:char-limit constants/key-pair-name-max-length
|
||||
:auto-focus true
|
||||
:on-change-text on-change-text
|
||||
:error error}]
|
||||
(when error
|
||||
[quo/info-message
|
||||
{:type :error
|
||||
:size :default
|
||||
:icon :i/info
|
||||
:container-style style/error-container}
|
||||
(get error-messages error)])]]))
|
||||
+2
-1
@@ -81,7 +81,8 @@
|
||||
(reset! show-error? false)
|
||||
(when (= @quiz-index questions-count)
|
||||
(rf/dispatch [:navigate-to
|
||||
:screen/wallet.keypair-name])))
|
||||
:screen/wallet.keypair-name
|
||||
{:workflow :new-key-pair}])))
|
||||
(do
|
||||
(when (> @incorrect-count 0)
|
||||
(rf/dispatch [:show-bottom-sheet
|
||||
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
(ns status-im.contexts.wallet.add-account.create-account.new-keypair.keypair-name.style)
|
||||
|
||||
(def header-container
|
||||
{:margin-horizontal 20
|
||||
:margin-top 12
|
||||
:margin-bottom 20})
|
||||
|
||||
(def bottom-action
|
||||
{:margin-horizontal -20})
|
||||
|
||||
(def error-container
|
||||
{:margin-left 20
|
||||
:margin-vertical 8})
|
||||
-75
@@ -1,75 +0,0 @@
|
||||
(ns status-im.contexts.wallet.add-account.create-account.new-keypair.keypair-name.view
|
||||
(:require
|
||||
[quo.core :as quo]
|
||||
[react-native.core :as rn]
|
||||
[status-im.common.floating-button-page.view :as floating-button-page]
|
||||
[status-im.common.validation.general :as validators]
|
||||
[status-im.contexts.wallet.add-account.create-account.new-keypair.keypair-name.style :as style]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(def keypair-name-max-length 15)
|
||||
(def keypair-name-min-length 5)
|
||||
|
||||
(def error-messages
|
||||
{:length (i18n/label :t/key-name-error-length)
|
||||
:emoji (i18n/label :t/key-name-error-emoji)
|
||||
:special-char (i18n/label :t/key-name-error-special-char)})
|
||||
|
||||
(defn navigate-back [] (rf/dispatch [:navigate-back]))
|
||||
|
||||
(defn view
|
||||
[]
|
||||
(let [[keypair-name set-keypair-name] (rn/use-state "")
|
||||
customization-color (rf/sub [:profile/customization-color])
|
||||
[error set-error] (rn/use-state false)
|
||||
on-change-text (rn/use-callback (fn [value]
|
||||
(set-keypair-name value)
|
||||
(cond
|
||||
(> (count value) keypair-name-max-length)
|
||||
(set-error :length)
|
||||
(validators/has-emojis? value) (set-error
|
||||
:emoji)
|
||||
(validators/has-special-characters? value)
|
||||
(set-error :special-char)
|
||||
:else (set-error nil))))
|
||||
on-continue (rn/use-callback #(rf/dispatch [:wallet/new-keypair-continue
|
||||
{:keypair-name
|
||||
keypair-name}])
|
||||
[keypair-name])]
|
||||
[rn/view {:style {:flex 1}}
|
||||
[floating-button-page/view
|
||||
{:header [quo/page-nav
|
||||
{:icon-name :i/arrow-left
|
||||
:on-press navigate-back
|
||||
:accessibility-label :top-bar}]
|
||||
:footer [quo/bottom-actions
|
||||
{:actions :one-action
|
||||
:button-one-label (i18n/label :t/continue)
|
||||
:button-one-props {:disabled? (or (pos? error)
|
||||
(< (count keypair-name)
|
||||
keypair-name-min-length)
|
||||
(> (count keypair-name)
|
||||
keypair-name-max-length))
|
||||
:customization-color customization-color
|
||||
:on-press on-continue}
|
||||
:container-style style/bottom-action}]}
|
||||
[quo/text-combinations
|
||||
{:container-style style/header-container
|
||||
:title (i18n/label :t/keypair-name)
|
||||
:description (i18n/label :t/keypair-name-description)}]
|
||||
[quo/input
|
||||
{:container-style {:margin-horizontal 20}
|
||||
:placeholder (i18n/label :t/keypair-name-input-placeholder)
|
||||
:label (i18n/label :t/keypair-name)
|
||||
:char-limit keypair-name-max-length
|
||||
:auto-focus true
|
||||
:on-change-text on-change-text
|
||||
:error error}]
|
||||
(when error
|
||||
[quo/info-message
|
||||
{:type :error
|
||||
:size :default
|
||||
:icon :i/info
|
||||
:container-style style/error-container}
|
||||
(get error-messages error)])]]))
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
(ns status-im.contexts.wallet.collectible.options.view
|
||||
(:require
|
||||
[quo.core :as quo]
|
||||
[react-native.platform :as platform]
|
||||
[status-im.contexts.wallet.common.utils.external-links :as external-links]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]
|
||||
@@ -28,10 +27,9 @@
|
||||
[:lightbox/save-image-to-gallery
|
||||
uri
|
||||
#(rf/dispatch [:toasts/upsert
|
||||
{:id :random-id
|
||||
:type :positive
|
||||
:container-style {:bottom (when platform/android? 20)}
|
||||
:text (i18n/label :t/photo-saved)}])]))}]
|
||||
{:id :random-id
|
||||
:type :positive
|
||||
:text (i18n/label :t/photo-saved)}])]))}]
|
||||
[{:icon :i/share
|
||||
:accessibility-label :share-collectible
|
||||
:label (i18n/label :t/share-collectible)
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
[rn/view {:style style/header}
|
||||
[quo/text
|
||||
{:weight :semi-bold
|
||||
:size :heading-1} collectible-name]
|
||||
:size :heading-1}
|
||||
collectible-name]
|
||||
[rn/view {:style style/collection-container}
|
||||
[rn/view {:style style/collection-avatar-container}
|
||||
[quo/collection-avatar {:image collection-image-url}]]
|
||||
@@ -28,15 +29,20 @@
|
||||
collection-name]]])
|
||||
|
||||
(defn cta-buttons
|
||||
[chain-id token-id contract-address]
|
||||
[{:keys [chain-id token-id contract-address collectible watch-only?]}]
|
||||
(let [theme (quo.theme/use-theme)]
|
||||
[rn/view {:style style/buttons-container}
|
||||
[quo/button
|
||||
{:container-style style/send-button
|
||||
:type :outline
|
||||
:size 40
|
||||
:icon-left :i/send}
|
||||
(i18n/label :t/send)]
|
||||
(when-not watch-only?
|
||||
[quo/button
|
||||
{:container-style style/send-button
|
||||
:type :outline
|
||||
:size 40
|
||||
:icon-left :i/send
|
||||
:on-press #(rf/dispatch
|
||||
[:wallet/set-collectible-to-send
|
||||
{:collectible collectible
|
||||
:current-screen :screen/wallet.collectible}])}
|
||||
(i18n/label :t/send)])
|
||||
[quo/button
|
||||
{:container-style style/opensea-button
|
||||
:type :outline
|
||||
@@ -66,7 +72,7 @@
|
||||
(let [theme (quo.theme/use-theme)
|
||||
collectible (rf/sub [:wallet/last-collectible-details])
|
||||
animation-shared-element-id (rf/sub [:animation-shared-element-id])
|
||||
wallet-address (rf/sub [:wallet/current-viewing-account-address])
|
||||
collectible-owner (rf/sub [:wallet/last-collectible-details-owner])
|
||||
{:keys [id
|
||||
preview-url
|
||||
collection-data
|
||||
@@ -90,7 +96,7 @@
|
||||
:header collectible-name
|
||||
:description collection-name}
|
||||
total-owned (utils/total-owned-collectible (:ownership collectible)
|
||||
wallet-address)]
|
||||
(:address collectible-owner))]
|
||||
(rn/use-unmount #(rf/dispatch [:wallet/clear-last-collectible-details]))
|
||||
[scroll-page/scroll-page
|
||||
{:navigate-back? true
|
||||
@@ -105,7 +111,8 @@
|
||||
{:name collectible-name
|
||||
:image preview-uri}])
|
||||
:theme theme}])}]
|
||||
:picture preview-uri}}
|
||||
:picture preview-uri
|
||||
:blur? true}}
|
||||
[rn/view {:style style/container}
|
||||
[quo/expanded-collectible
|
||||
{:image-src preview-uri
|
||||
@@ -128,7 +135,12 @@
|
||||
{:name collectible-name
|
||||
:image preview-uri}])}])}])))}]
|
||||
[header collectible-name collection-name collection-image]
|
||||
[cta-buttons chain-id token-id contract-address]
|
||||
[cta-buttons
|
||||
{:chain-id chain-id
|
||||
:token-id token-id
|
||||
:contract-address contract-address
|
||||
:watch-only? false ;(:watch-only? collectible-owner)
|
||||
:collectible collectible}]
|
||||
[quo/tabs
|
||||
{:size 32
|
||||
:style style/tabs
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
[status-im.contexts.wallet.sheets.account-options.view :as account-options]
|
||||
[status-im.contexts.wallet.sheets.network-filter.view :as network-filter]
|
||||
[status-im.contexts.wallet.sheets.select-account.view :as select-account]
|
||||
[status-im.feature-flags :as ff]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn get-bottom-sheet-args
|
||||
@@ -18,11 +19,12 @@
|
||||
[{:keys [type on-press accessibility-label icon-name switcher-type margin-top]
|
||||
:or {icon-name :i/close
|
||||
accessibility-label :top-bar
|
||||
switcher-type :account-options}}]
|
||||
switcher-type :account-options
|
||||
type :no-title}}]
|
||||
(let [{:keys [color emoji watch-only?]} (rf/sub [:wallet/current-viewing-account])
|
||||
networks (rf/sub [:wallet/selected-network-details])]
|
||||
[quo/page-nav
|
||||
{:type (or type :no-title)
|
||||
{:type type
|
||||
:icon-name icon-name
|
||||
:margin-top margin-top
|
||||
:background :blur
|
||||
@@ -30,9 +32,14 @@
|
||||
:accessibility-label accessibility-label
|
||||
:networks networks
|
||||
:networks-on-press #(rf/dispatch [:show-bottom-sheet {:content network-filter/view}])
|
||||
:right-side :account-switcher
|
||||
:account-switcher {:customization-color color
|
||||
:on-press #(rf/dispatch [:show-bottom-sheet
|
||||
(get-bottom-sheet-args switcher-type)])
|
||||
:emoji emoji
|
||||
:type (when watch-only? :watch-only)}}]))
|
||||
:right-side [(when (and (ff/enabled? ::ff/wallet.wallet-connect)
|
||||
(not watch-only?))
|
||||
{:icon-name :i/dapps
|
||||
:on-press #(rf/dispatch [:navigate-to :screen/wallet.connected-dapps])})
|
||||
|
||||
{:content-type :account-switcher
|
||||
:customization-color color
|
||||
:on-press #(rf/dispatch [:show-bottom-sheet
|
||||
(get-bottom-sheet-args switcher-type)])
|
||||
:emoji emoji
|
||||
:type (when watch-only? :watch-only)}]}]))
|
||||
|
||||
@@ -1,17 +1,26 @@
|
||||
(ns status-im.contexts.wallet.common.scan-account.view
|
||||
(:require [status-im.common.scan-qr-code.view :as scan-qr-code]
|
||||
(:require [clojure.string :as string]
|
||||
[status-im.common.scan-qr-code.view :as scan-qr-code]
|
||||
[status-im.constants :as constants]
|
||||
[utils.debounce :as debounce]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn- contains-address?
|
||||
(def ^:private supported-networks #{:eth :arb1 :opt})
|
||||
|
||||
(defn- contains-supported-address?
|
||||
[s]
|
||||
(boolean (re-find constants/regx-address-contains s)))
|
||||
(let [address? (boolean (re-find constants/regx-address-contains s))
|
||||
networks (when address?
|
||||
(as-> s $
|
||||
(string/split $ ":")
|
||||
(butlast $)))
|
||||
supported? (every? supported-networks (map keyword networks))]
|
||||
(and address? supported?)))
|
||||
|
||||
(defn- extract-address
|
||||
[scanned-text]
|
||||
(first (re-seq constants/regx-address-contains scanned-text)))
|
||||
(first (re-seq constants/regx-multichain-address scanned-text)))
|
||||
|
||||
(defn view
|
||||
[]
|
||||
@@ -20,7 +29,7 @@
|
||||
{:title (i18n/label :t/scan-qr)
|
||||
:subtitle (i18n/label :t/scan-an-account-qr-code)
|
||||
:error-message (i18n/label :t/oops-this-qr-does-not-contain-an-address)
|
||||
:validate-fn #(contains-address? %)
|
||||
:validate-fn #(contains-supported-address? %)
|
||||
:on-success-scan (fn [result]
|
||||
(let [address (extract-address result)]
|
||||
(when on-result (on-result address))
|
||||
|
||||
@@ -15,16 +15,14 @@
|
||||
:right-icon :i/external})
|
||||
|
||||
(defn- action-send
|
||||
[token-data]
|
||||
[send-params]
|
||||
{:icon :i/send
|
||||
:accessibility-label :send
|
||||
:label (i18n/label :t/send)
|
||||
:on-press (fn []
|
||||
(rf/dispatch [:hide-bottom-sheet])
|
||||
(rf/dispatch [:wallet/clean-send-data])
|
||||
(rf/dispatch [:wallet/send-select-token
|
||||
{:token token-data
|
||||
:start-flow? true}]))})
|
||||
(rf/dispatch [:wallet/set-token-to-send send-params]))})
|
||||
|
||||
(defn- action-receive
|
||||
[]
|
||||
@@ -59,14 +57,21 @@
|
||||
|
||||
(defn token-value-drawer
|
||||
[token watch-only?]
|
||||
(let [token-data (first (rf/sub [:wallet/current-viewing-account-tokens-filtered (:token token)]))]
|
||||
(let [token-symbol (:token token)
|
||||
token-data (first (rf/sub [:wallet/current-viewing-account-tokens-filtered token-symbol]))
|
||||
selected-account? (rf/sub [:wallet/current-viewing-account-address])
|
||||
send-params (if selected-account?
|
||||
{:token token-data
|
||||
:start-flow? true}
|
||||
{:token-symbol token-symbol
|
||||
:start-flow? true})]
|
||||
[quo/action-drawer
|
||||
[(cond->> [(when (ff/enabled? ::ff/wallet.assets-modal-manage-tokens)
|
||||
(action-manage-tokens watch-only?))
|
||||
(when (ff/enabled? ::ff/wallet.assets-modal-hide)
|
||||
(action-hide))]
|
||||
(not watch-only?) (concat [(action-buy)
|
||||
(action-send token-data)
|
||||
(action-send send-params)
|
||||
(action-receive)
|
||||
(action-bridge token-data)]))]]))
|
||||
|
||||
|
||||
@@ -271,3 +271,10 @@
|
||||
(str (get-in collectible [:id :contract-id :address])
|
||||
":"
|
||||
(get-in collectible [:id :token-id]))))
|
||||
|
||||
(defn get-token-from-account
|
||||
[db token-symbol address]
|
||||
(let [address-tokens (-> db :wallet :accounts (get address) :tokens)]
|
||||
(some #(when (= token-symbol (:symbol %))
|
||||
%)
|
||||
address-tokens)))
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
(ns status-im.contexts.wallet.connected-dapps.style
|
||||
(:require [quo.foundations.colors :as colors]))
|
||||
|
||||
(def screen-padding 20)
|
||||
|
||||
(def header-container
|
||||
{:flex-direction :row
|
||||
:justify-content :space-between
|
||||
:padding-horizontal screen-padding
|
||||
:margin-vertical 12})
|
||||
|
||||
(defn header-text
|
||||
[bottom-padding?]
|
||||
{:padding-horizontal screen-padding
|
||||
:padding-top 12
|
||||
:padding-bottom (when bottom-padding? 8)
|
||||
:color colors/black})
|
||||
@@ -0,0 +1,29 @@
|
||||
(ns status-im.contexts.wallet.connected-dapps.view
|
||||
(:require
|
||||
[quo.core :as quo]
|
||||
[react-native.core :as rn]
|
||||
[status-im.contexts.wallet.connected-dapps.style :as style]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn- header
|
||||
[{:keys [title subtitle]}]
|
||||
[:<>
|
||||
[rn/view {:style style/header-container}
|
||||
[quo/button
|
||||
{:icon-only? true
|
||||
:type :grey
|
||||
:background :blur
|
||||
:size 32
|
||||
:accessibility-label :close-scan-qr-code
|
||||
:on-press #(rf/dispatch [:navigate-back])}
|
||||
:i/close]]
|
||||
[quo/text
|
||||
{:size :heading-1
|
||||
:weight :semi-bold
|
||||
:style (style/header-text (when subtitle true))}
|
||||
title]])
|
||||
|
||||
(defn view
|
||||
[]
|
||||
[rn/view {:style {:flex 1}}
|
||||
[header {:title "Connected dApps"}]])
|
||||
@@ -4,6 +4,7 @@
|
||||
[clojure.string :as string]
|
||||
[react-native.platform :as platform]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.contexts.settings.wallet.events]
|
||||
[status-im.contexts.wallet.common.utils.networks :as network-utils]
|
||||
[status-im.contexts.wallet.data-store :as data-store]
|
||||
[status-im.contexts.wallet.db :as db]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
(ns status-im.contexts.wallet.home.style
|
||||
(:require
|
||||
[quo.foundations.colors :as colors]
|
||||
[react-native.safe-area :as safe-area]))
|
||||
|
||||
(def tabs
|
||||
@@ -22,3 +23,7 @@
|
||||
[]
|
||||
{:margin-top (+ (safe-area/get-top) 8)
|
||||
:flex 1})
|
||||
|
||||
(defn header-container
|
||||
[theme]
|
||||
{:background-color (colors/theme-colors colors/white colors/neutral-95 theme)})
|
||||
|
||||
@@ -2,13 +2,10 @@
|
||||
(:require
|
||||
[quo.core :as quo]
|
||||
[react-native.core :as rn]
|
||||
[status-im.contexts.wallet.common.token-value.view :as token-value]
|
||||
[status-im.contexts.wallet.home.tabs.assets.style :as style]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn- token-value
|
||||
[item & _rest]
|
||||
[quo/token-value item])
|
||||
|
||||
(defn view
|
||||
[]
|
||||
(let [tokens-loading? (rf/sub [:wallet/tokens-loading?])
|
||||
@@ -19,6 +16,6 @@
|
||||
:parent-height 560
|
||||
:animated? false}]
|
||||
[rn/flat-list
|
||||
{:render-fn token-value
|
||||
{:render-fn token-value/view
|
||||
:data tokens
|
||||
:content-container-style style/list-container}])))
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
(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]
|
||||
@@ -37,6 +40,27 @@
|
||||
(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)))
|
||||
@@ -45,7 +69,9 @@
|
||||
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))
|
||||
{:keys [formatted-balance]} (rf/sub [:wallet/aggregated-token-values-and-balance])]
|
||||
[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)]
|
||||
(rn/use-effect (fn []
|
||||
(when (and @account-list-ref (pos? (count cards)))
|
||||
(.scrollToOffset ^js @account-list-ref
|
||||
@@ -53,33 +79,32 @@
|
||||
{: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]
|
||||
[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}]]))
|
||||
[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}]}]]))
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
[clojure.string :as string]
|
||||
[native-module.core :as native-module]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.contexts.wallet.collectible.utils :as collectible.utils]
|
||||
[status-im.contexts.wallet.common.utils :as utils]
|
||||
[status-im.contexts.wallet.common.utils.networks :as network-utils]
|
||||
[status-im.contexts.wallet.send.utils :as send-utils]
|
||||
@@ -136,13 +137,20 @@
|
||||
receiver-networks (network-utils/resolve-receiver-networks
|
||||
{:prefix prefix
|
||||
:testnet-enabled? testnet-enabled?
|
||||
:goerli-enabled? goerli-enabled?})]
|
||||
:goerli-enabled? goerli-enabled?})
|
||||
collectible-tx? (= (-> db :wallet :ui :send :tx-type) :collectible)
|
||||
collectible (when collectible-tx?
|
||||
(-> db :wallet :ui :send :collectible))
|
||||
one-collectible? (when collectible-tx?
|
||||
(= (collectible.utils/collectible-balance collectible) 1))]
|
||||
{:db (-> db
|
||||
(assoc-in [:wallet :ui :send :recipient] (or recipient address))
|
||||
(assoc-in [:wallet :ui :send :to-address] to-address)
|
||||
(assoc-in [:wallet :ui :send :address-prefix] prefix)
|
||||
(assoc-in [:wallet :ui :send :receiver-networks] receiver-networks))
|
||||
:fx [[:dispatch
|
||||
:fx [(when (and collectible-tx? one-collectible?)
|
||||
[:dispatch [:wallet/get-suggested-routes {:amount 1}]])
|
||||
[:dispatch
|
||||
[:wallet/wizard-navigate-forward
|
||||
{:current-screen stack-id
|
||||
:start-flow? start-flow?
|
||||
@@ -163,12 +171,16 @@
|
||||
:fx [[:dispatch [:wallet/get-suggested-routes {:amount amount}]]]})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/send-select-token
|
||||
(fn [{:keys [db]} [{:keys [token stack-id start-flow?]}]]
|
||||
{:db (-> db
|
||||
(update-in [:wallet :ui :send] dissoc :collectible)
|
||||
(assoc-in [:wallet :ui :send :token] token)
|
||||
(assoc-in [:wallet :ui :send :token-display-name] (:symbol token)))
|
||||
:wallet/set-token-to-send
|
||||
(fn [{:keys [db]} [{:keys [token-symbol token stack-id start-flow?]}]]
|
||||
;; `token` is a map extracted from the sender, but in the wallet home page we don't know the
|
||||
;; sender yet, so we only provide the `token-symbol`, later in
|
||||
;; `:wallet/select-from-account` the `token` key will be set.
|
||||
{:db (cond-> db
|
||||
:always (update-in [:wallet :ui :send] dissoc :collectible)
|
||||
:always (assoc-in [:wallet :ui :send :token-display-name] (:symbol token))
|
||||
token (assoc-in [:wallet :ui :send :token] token)
|
||||
token-symbol (assoc-in [:wallet :ui :send :token-symbol] token-symbol))
|
||||
:fx [[:dispatch [:wallet/clean-suggested-routes]]
|
||||
[:dispatch
|
||||
[:wallet/wizard-navigate-forward
|
||||
@@ -198,38 +210,49 @@
|
||||
:collectible
|
||||
:token-display-name
|
||||
:amount
|
||||
(when (= transaction-type :collecible) :tx-type))})))
|
||||
(when (= transaction-type :collectible) :tx-type))})))
|
||||
|
||||
(rf/reg-event-fx :wallet/send-collectibles-amount
|
||||
(fn [{:keys [db]} [{:keys [collectible stack-id amount]}]]
|
||||
(rf/reg-event-fx
|
||||
:wallet/set-collectible-to-send
|
||||
(fn [{db :db} [{:keys [collectible current-screen]}]]
|
||||
(let [collection-data (:collection-data collectible)
|
||||
collectible-data (:collectible-data collectible)
|
||||
collectible-id (get-in collectible [:id :token-id])
|
||||
one-collectible? (= (collectible.utils/collectible-balance collectible) 1)
|
||||
token-display-name (cond
|
||||
(and collectible
|
||||
(not (string/blank? (:name collectible-data))))
|
||||
(:name collectible-data)
|
||||
|
||||
collectible
|
||||
(str (:name collection-data) " #" collectible-id))]
|
||||
{:db (-> db
|
||||
(update-in [:wallet :ui :send] dissoc :token)
|
||||
(assoc-in [:wallet :ui :send :collectible] collectible)
|
||||
(assoc-in [:wallet :ui :send :token-display-name] token-display-name)
|
||||
(assoc-in [:wallet :ui :send :tx-type] :collectible)
|
||||
(assoc-in [:wallet :ui :send :amount] amount))
|
||||
:fx [[:dispatch [:wallet/get-suggested-routes {:amount amount}]]
|
||||
[:navigate-to-within-stack [:screen/wallet.transaction-confirmation stack-id]]]})))
|
||||
(str (:name collection-data) " #" collectible-id))
|
||||
collectible-tx (-> db
|
||||
(update-in [:wallet :ui :send] dissoc :token)
|
||||
(assoc-in [:wallet :ui :send :collectible] collectible)
|
||||
(assoc-in [:wallet :ui :send :token-display-name] token-display-name)
|
||||
(assoc-in [:wallet :ui :send :tx-type] :collectible))
|
||||
recipient-set? (-> db :wallet :ui :send :recipient)]
|
||||
{:db (cond-> collectible-tx
|
||||
one-collectible? (assoc-in [:wallet :ui :send :amount] 1))
|
||||
:fx [(when (and one-collectible? recipient-set?)
|
||||
[:dispatch [:wallet/get-suggested-routes {:amount 1}]])
|
||||
[:dispatch
|
||||
[:wallet/wizard-navigate-forward
|
||||
{:current-screen current-screen
|
||||
:flow-id :wallet-send-flow}]]]})))
|
||||
|
||||
(rf/reg-event-fx :wallet/select-collectibles-amount
|
||||
(fn [{:keys [db]} [{:keys [collectible stack-id]}]]
|
||||
{:db (-> db
|
||||
(update-in [:wallet :ui :send] dissoc :token)
|
||||
(assoc-in [:wallet :ui :send :collectible] collectible)
|
||||
(assoc-in [:wallet :ui :send :tx-type] :collectible))
|
||||
:fx [[:navigate-to-within-stack [:screen/wallet.select-collectible-amount stack-id]]]}))
|
||||
(rf/reg-event-fx
|
||||
:wallet/set-collectible-amount-to-send
|
||||
(fn [{db :db} [{:keys [stack-id amount]}]]
|
||||
{:db (assoc-in db [:wallet :ui :send :amount] amount)
|
||||
:fx [[:dispatch [:wallet/get-suggested-routes {:amount amount}]]
|
||||
[:dispatch
|
||||
[:wallet/wizard-navigate-forward
|
||||
{:current-screen stack-id
|
||||
:flow-id :wallet-send-flow}]]]}))
|
||||
|
||||
(rf/reg-event-fx :wallet/send-select-amount
|
||||
(rf/reg-event-fx
|
||||
:wallet/set-token-amount-to-send
|
||||
(fn [{:keys [db]} [{:keys [amount stack-id start-flow?]}]]
|
||||
{:db (assoc-in db [:wallet :ui :send :amount] amount)
|
||||
:fx [[:dispatch
|
||||
@@ -503,10 +526,21 @@
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/select-from-account
|
||||
(fn [_ [{:keys [address stack-id start-flow?]}]]
|
||||
{:fx [[:dispatch [:wallet/switch-current-viewing-account address]]
|
||||
[:dispatch
|
||||
[:wallet/wizard-navigate-forward
|
||||
{:current-screen stack-id
|
||||
:start-flow? start-flow?
|
||||
:flow-id :wallet-send-flow}]]]}))
|
||||
(fn [{db :db} [{:keys [address stack-id start-flow?]}]]
|
||||
(let [token-symbol (-> db :wallet :ui :send :token-symbol)
|
||||
token (when token-symbol
|
||||
;; When this flow has started in the wallet home page, we know the
|
||||
;; token or collectible to send, but we don't know from which
|
||||
;; account, so we extract the token data from the picked account.
|
||||
(utils/get-token-from-account db token-symbol address))]
|
||||
{:db (if token-symbol
|
||||
(-> db
|
||||
(assoc-in [:wallet :ui :send :token] token)
|
||||
(update-in [:wallet :ui :send] dissoc :token-symbol))
|
||||
db)
|
||||
:fx [[:dispatch [:wallet/switch-current-viewing-account address]]
|
||||
[:dispatch
|
||||
[:wallet/wizard-navigate-forward
|
||||
{:current-screen stack-id
|
||||
:start-flow? start-flow?
|
||||
:flow-id :wallet-send-flow}]]]})))
|
||||
|
||||
@@ -1,13 +1,30 @@
|
||||
(ns status-im.contexts.wallet.send.flow-config)
|
||||
|
||||
(defn- collectible-selected?
|
||||
[db]
|
||||
(let [collectible-stored (-> db :wallet :ui :send :collectible)
|
||||
tx-type (-> db :wallet :ui :send :tx-type)]
|
||||
(and (some? collectible-stored)
|
||||
(= tx-type :collectible))))
|
||||
|
||||
(defn- token-selected?
|
||||
[db]
|
||||
(-> db :wallet :ui :send :token some?))
|
||||
|
||||
(def steps
|
||||
[{:screen-id :screen/wallet.select-from
|
||||
:skip-step? (fn [db] (some? (get-in db [:wallet :current-viewing-account-address])))}
|
||||
{:screen-id :screen/wallet.select-address
|
||||
:skip-step? (fn [db] (some? (get-in db [:wallet :ui :send :recipient])))}
|
||||
{:screen-id :screen/wallet.select-asset
|
||||
:skip-step? (fn [db] (some? (get-in db [:wallet :ui :send :token])))}
|
||||
:skip-step? (fn [db] (or (token-selected? db) (collectible-selected? db)))}
|
||||
{:screen-id :screen/wallet.send-input-amount
|
||||
:skip-step? (fn [db] (some? (get-in db [:wallet :ui :send :amount])))}
|
||||
:skip-step? (fn [db]
|
||||
(or (not (token-selected? db))
|
||||
(some? (get-in db [:wallet :ui :send :amount]))))}
|
||||
{:screen-id :screen/wallet.select-collectible-amount
|
||||
:skip-step? (fn [db]
|
||||
(or (not (collectible-selected? db))
|
||||
(some? (get-in db [:wallet :ui :send :amount]))))}
|
||||
{:screen-id :screen/wallet.transaction-confirmation}
|
||||
{:screen-id :screen/wallet.transaction-progress}])
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
(let [[input-state set-input-state] (rn/use-state controlled-input/init-state)
|
||||
clear-input! #(set-input-state controlled-input/delete-all)
|
||||
handle-on-confirm (fn []
|
||||
(rf/dispatch [:wallet/send-select-amount
|
||||
(rf/dispatch [:wallet/set-token-amount-to-send
|
||||
{:amount (controlled-input/input-value
|
||||
input-state)
|
||||
:stack-id current-screen-id}]))
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
[quo.core :as quo]
|
||||
[react-native.core :as rn]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.contexts.wallet.collectible.utils :as utils]
|
||||
[status-im.contexts.wallet.common.account-switcher.view :as account-switcher]
|
||||
[status-im.contexts.wallet.common.asset-list.view :as asset-list]
|
||||
[status-im.contexts.wallet.common.collectibles-tab.view :as collectibles-tab]
|
||||
@@ -34,15 +33,10 @@
|
||||
{:collectibles collectibles
|
||||
:filtered? search-performed?
|
||||
:on-end-reached #(rf/dispatch [:wallet/request-collectibles-for-current-viewing-account])
|
||||
:on-collectible-press #(let [collectibles-count (utils/collectible-balance %)]
|
||||
(if (> collectibles-count 1)
|
||||
(rf/dispatch [:wallet/select-collectibles-amount
|
||||
{:collectible %
|
||||
:stack-id :screen/wallet.select-asset}])
|
||||
(rf/dispatch [:wallet/send-collectibles-amount
|
||||
{:collectible %
|
||||
:amount 1
|
||||
:stack-id :screen/wallet.select-asset}])))}]))
|
||||
:on-collectible-press (fn [collectible]
|
||||
(rf/dispatch [:wallet/set-collectible-to-send
|
||||
{:collectible collectible
|
||||
:current-screen :screen/wallet.select-asset}]))}]))
|
||||
|
||||
(defn- tab-view
|
||||
[search-text selected-tab on-change-text]
|
||||
@@ -51,7 +45,7 @@
|
||||
(and (= selected-tab :tab/collectibles)
|
||||
(seq unfiltered-collectibles)))
|
||||
on-token-press (fn [token]
|
||||
(rf/dispatch [:wallet/send-select-token
|
||||
(rf/dispatch [:wallet/set-token-to-send
|
||||
{:token token
|
||||
:stack-id :screen/wallet.select-asset}]))]
|
||||
[:<>
|
||||
|
||||
@@ -55,10 +55,10 @@
|
||||
:status (if incorrect-value? :error :default)}]
|
||||
[quo/bottom-actions
|
||||
{:actions :one-action
|
||||
:button-one-props {:on-press #(rf/dispatch [:wallet/send-collectibles-amount
|
||||
{:collectible collectible
|
||||
:amount value
|
||||
:stack-id :screen/wallet.select-asset}])
|
||||
:button-one-props {:on-press #(rf/dispatch
|
||||
[:wallet/set-collectible-amount-to-send
|
||||
{:stack-id :screen/wallet.select-collectible-amount
|
||||
:amount value}])
|
||||
:disabled? incorrect-value?}
|
||||
:button-one-label (i18n/label :t/confirm)}]
|
||||
[quo/numbered-keyboard
|
||||
|
||||
@@ -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,6 +63,9 @@
|
||||
(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))
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
(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]))
|
||||
|
||||
@@ -8,20 +9,25 @@
|
||||
[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
|
||||
{::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)}))
|
||||
(reagent/atom initial-flags))
|
||||
|
||||
(defn feature-flags [] @feature-flags-config)
|
||||
|
||||
@@ -37,7 +43,28 @@
|
||||
|
||||
(defn toggle
|
||||
[flag]
|
||||
(swap! feature-flags-config update flag not))
|
||||
(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))))
|
||||
|
||||
(defn alert
|
||||
[flag action]
|
||||
|
||||
@@ -205,7 +205,8 @@
|
||||
:options (merge (options/statusbar-and-navbar-options (:theme opts) nil nil)
|
||||
{:layout {:componentBackgroundColor :transparent
|
||||
:orientation ["portrait"]}
|
||||
:overlay {:interceptTouchOutside true}}
|
||||
:overlay {:interceptTouchOutside true
|
||||
:handleKeyboardEvents true}}
|
||||
opts)}})))
|
||||
|
||||
(rf/reg-fx :show-toasts
|
||||
|
||||
@@ -57,6 +57,8 @@
|
||||
[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.rename.view :as keypair-rename]
|
||||
[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]
|
||||
@@ -78,12 +80,12 @@
|
||||
wallet-edit-derivation-path]
|
||||
[status-im.contexts.wallet.add-account.create-account.import-private-key.view :as
|
||||
wallet-import-private-key]
|
||||
[status-im.contexts.wallet.add-account.create-account.key-pair-name.view :as
|
||||
wallet-key-pair-name]
|
||||
[status-im.contexts.wallet.add-account.create-account.new-keypair.backup-recovery-phrase.view :as
|
||||
wallet-backup-recovery-phrase]
|
||||
[status-im.contexts.wallet.add-account.create-account.new-keypair.check-your-backup.view :as
|
||||
wallet-check-your-backup]
|
||||
[status-im.contexts.wallet.add-account.create-account.new-keypair.keypair-name.view :as
|
||||
wallet-keypair-name]
|
||||
[status-im.contexts.wallet.add-account.create-account.select-keypair.view :as wallet-select-keypair]
|
||||
[status-im.contexts.wallet.add-account.create-account.view :as wallet-create-account]
|
||||
[status-im.contexts.wallet.bridge.bridge-to.view :as wallet-bridge-to]
|
||||
@@ -91,6 +93,7 @@
|
||||
[status-im.contexts.wallet.bridge.select-asset.view :as wallet-bridge-select-asset]
|
||||
[status-im.contexts.wallet.collectible.view :as wallet-collectible]
|
||||
[status-im.contexts.wallet.common.scan-account.view :as wallet-scan-address]
|
||||
[status-im.contexts.wallet.connected-dapps.view :as wallet-connected-dapps]
|
||||
[status-im.contexts.wallet.save-address.view :as wallet-save-address]
|
||||
[status-im.contexts.wallet.send.from.view :as wallet-select-from]
|
||||
[status-im.contexts.wallet.send.select-address.view :as wallet-select-address]
|
||||
@@ -376,6 +379,10 @@
|
||||
:options {:insets {:top? true}}
|
||||
:component wallet-accounts/view}
|
||||
|
||||
{:name :screen/wallet.connected-dapps
|
||||
:options {:insets {:top? true}}
|
||||
:component wallet-connected-dapps/view}
|
||||
|
||||
{:name :screen/wallet.edit-account
|
||||
:component wallet-edit-account/view}
|
||||
|
||||
@@ -427,8 +434,8 @@
|
||||
:component wallet-check-your-backup/view}
|
||||
|
||||
{:name :screen/wallet.keypair-name
|
||||
:options {:insets {:top? true :bottom? true}}
|
||||
:component wallet-keypair-name/view}
|
||||
:options {:insets {:top? true}}
|
||||
:component wallet-key-pair-name/view}
|
||||
|
||||
{:name :screen/wallet.enter-seed-phrase
|
||||
:component enter-seed-phrase/view}
|
||||
@@ -497,10 +504,20 @@
|
||||
:options options/transparent-modal-screen-options
|
||||
:component wallet-options/view}
|
||||
|
||||
{:name :screen/settings.rename-keypair
|
||||
:options (assoc options/dark-screen :sheet? true)
|
||||
:component keypair-rename/view}
|
||||
|
||||
{:name :screen/settings.saved-addresses
|
||||
: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}
|
||||
|
||||
@@ -90,19 +90,12 @@
|
||||
manually call `setup!`, otherwise you won't see any changes. It is safe and
|
||||
even expected you will call `setup!` multiple times in REPLs."
|
||||
[]
|
||||
(try
|
||||
(schema.registry/init-global-registry)
|
||||
(register-schemas)
|
||||
(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.")
|
||||
|
||||
;; 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}))))
|
||||
(malli.dev/start! {:report (schema/reporter)})
|
||||
(log/debug "Schemas initialized."))
|
||||
|
||||
@@ -279,7 +279,12 @@
|
||||
:<- [:initials-avatar-font-file]
|
||||
:<- [:theme]
|
||||
(fn [[profile ens-names port font-file theme] [_ avatar-opts]]
|
||||
(replace-multiaccount-image-uri profile ens-names port font-file avatar-opts theme)))
|
||||
;; 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))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:profile/image
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
(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]
|
||||
[utils.number]))
|
||||
[utils.number]
|
||||
[utils.security.core :as security]))
|
||||
|
||||
(defn- filter-networks
|
||||
[chain-ids network-details]
|
||||
@@ -158,6 +160,35 @@
|
||||
: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 key-uid]}]
|
||||
{:type (keyword type)
|
||||
:name name
|
||||
:key-uid key-uid
|
||||
:accounts (format-settings-keypair-accounts accounts format-options)})))))
|
||||
|
||||
(rf/reg-sub
|
||||
:wallet/derivation-path-state
|
||||
:<- [:wallet/create-account]
|
||||
@@ -392,3 +423,16 @@
|
||||
{:tokens tokens
|
||||
:currency currency
|
||||
:currency-symbol currency-symbol})))
|
||||
|
||||
(rf/reg-sub
|
||||
:wallet/import-private-key
|
||||
:<- [:wallet/create-account]
|
||||
(fn [create-account]
|
||||
(some-> create-account
|
||||
:private-key
|
||||
security/unmask)))
|
||||
|
||||
(rf/reg-sub
|
||||
:wallet/public-address
|
||||
:<- [:wallet/create-account]
|
||||
:-> :public-address)
|
||||
|
||||
@@ -554,6 +554,109 @@
|
||||
(= 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
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
[re-frame.core :as re-frame]
|
||||
[re-frame.interceptor :as interceptor]
|
||||
[re-frame.interop :as rf.interop]
|
||||
[reagent.core :as reagent]
|
||||
[taoensso.timbre :as log]
|
||||
[utils.datetime :as datetime])
|
||||
(:refer-clojure :exclude [merge reduce]))
|
||||
@@ -80,14 +79,6 @@
|
||||
(swap! handler-nesting-level dec)
|
||||
res))
|
||||
|
||||
(defn delay-render
|
||||
[_]
|
||||
(let [render? (reagent/atom false)]
|
||||
(js/setTimeout #(reset! render? true) 0)
|
||||
(fn [content]
|
||||
(when @render?
|
||||
content))))
|
||||
|
||||
(def sub (comp deref re-frame/subscribe))
|
||||
|
||||
(def dispatch re-frame/dispatch)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
|
||||
"owner": "status-im",
|
||||
"repo": "status-go",
|
||||
"version": "v0.179.15",
|
||||
"commit-sha1": "7ba78cd6e97ba1180e2cbab9ad8fc1e666b92a73",
|
||||
"src-sha256": "0gafxkha9mcdnl91w1f786ax0z3yqgl55qblw9xazhm7lpm44vgj"
|
||||
"version": "v0.179.16",
|
||||
"commit-sha1": "601c80fec2e6db76dd2f5d47fdc94492b5a618f5",
|
||||
"src-sha256": "0g8ryxz6klqfn1avp66zkj44yrbhnck14lfhpyqj92caakz35m84"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const WebSocket = require('ws');
|
||||
const { NativeModules } = require('react-native');
|
||||
|
||||
require('@react-native-async-storage/async-storage/jest/async-storage-mock');
|
||||
mockAsyncStorage = 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();
|
||||
|
||||
|
||||
@@ -1255,6 +1255,7 @@
|
||||
"remove-network": "Remove network",
|
||||
"remove-token": "Remove token",
|
||||
"removed": "removed",
|
||||
"rename-key-pair": "Rename key pair",
|
||||
"repeat-pin": "Repeat new 6-digit passcode",
|
||||
"repeat-puk": "Repeat new 12-digit PUK",
|
||||
"report-bug-email-template": "1. Issue Description\n{{description}}\n\n\n2. Steps to reproduce\n{{steps}}\n\n\n3. Attach screenshots that can demo the problem, please\n",
|
||||
@@ -2484,6 +2485,7 @@
|
||||
"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",
|
||||
@@ -2569,6 +2571,7 @@
|
||||
"keypair-name": "Key pair name",
|
||||
"keypair-name-description": "Name key pair for your own personal reference",
|
||||
"keypair-name-input-placeholder": "Collectibles account, Old vault....",
|
||||
"key-pair-name-updated": "Key pair name updated",
|
||||
"goerli-testnet-toggle-confirmation": "Are you sure you want to toggle Goerli? This will log you out and you will have to login again.",
|
||||
"bridged-to": "Bridged to {{network}}",
|
||||
"slide-to-bridge": "Slide to bridge",
|
||||
@@ -2589,9 +2592,12 @@
|
||||
"other": "{{count}} addresses"
|
||||
},
|
||||
"max": "Max: {{number}}",
|
||||
"your-key-pair-name-is-too-long": "Your key pair name is too long",
|
||||
"your-key-pair-name-is-too-short": "Your key pair name is too short",
|
||||
"key-name-error-length": "Key name too long",
|
||||
"key-name-error-emoji": "Emojis are not allowed",
|
||||
"key-name-error-special-char": "Special characters are not allowed",
|
||||
"key-name-error-too-short": "Key pair name must be at least {{count}} characters",
|
||||
"display": "Display",
|
||||
"testnet-mode-enabled": "Testnet mode enabled",
|
||||
"online-community-member": "Online",
|
||||
|
||||
Reference in New Issue
Block a user