Compare commits

..
25 Commits
Author SHA1 Message Date
ibrkhalil 7f08fc5e1f Add deletion of saved addresses 2024-05-11 14:04:06 +03:00
ibrkhalil ecf9806176 improvements 2024-05-11 12:27:21 +03:00
Ibrahem Khalil c21727228d Merge branch 'develop' into 19727 2024-05-11 12:26:41 +03:00
Omar Basem f50ca4606f fix: remove wallet graph (#19973)
fix: remove wallet graph (#19973)
2024-05-11 12:20:21 +04:00
ibrkhalil d762c954ca Bump go ver 2024-05-11 10:40:02 +03:00
Icaro Motta 22392464e0 Don't preload user & dev.user namespaces (#19985)
Reverts the preloading mechanism from PR
https://github.com/status-im/status-mobile/pull/19927, which introduced a
problem I couldn't find any satisfactory solution. The namespaces user and
dev.user were being preloaded by shadow-cljs, but the problem is that preloading
will fail if those namespaces don't exist in your file system.

I couldn't find any solution to conditionally preload namespaces via shadow-cljs
and ClojureScript unfortunately doesn't support conditional requires like
Clojure.

At least we got to keep the code to not lint them and the whole idea to start to
commit dev-only code inside src/dev/.
2024-05-10 15:42:04 -03:00
Icaro Motta 225e3b1c2f DX: Preload user and dev.user namespace (#19927)
Preload the user namespace (src/user.cljs and src/dev/user.cljs) for the mobile
target and for dev-only purposes. The files are git-ignored.

Just a reminder that you'll be responsible for making sure your user namespace
is correct. If it's broken in any way (e.g. calling non-existent code) the app
will crash at initialization (dev-only environment obviously).

Why? When the app initializes, it loads namespaces that were required at least
once. If you create a user namespace, it won't be automatically required for
you. And if you, like some Clojure devs, like to use the user namespace as
your safe heaven for experimentation and dev-only utilities, you'll need to
remember to evaluate the namespace at least once.

This is tedious and many times I forgot to do so and the app crashed because the
compiler didn't know where the symbols were coming from.
2024-05-10 13:17:26 -03:00
Icaro Motta 037e71bc03 Optimize opening of Settings screens (#19940)
This commit rewrites utils.re-frame/delay-render to use hooks. The new
implementation renders significantly better than what we have today, at least on
Android.

Why not hiccup instead of a function call to delay-render? The Settings screen
is rendered slightly faster if I use delay-render as a function call instead of
hiccup. My only guess is that this is just less work to be done by Reagent,
since the wrapper function is not creating a wrapper component with its own
lifecycle.

The full analysis can be found here, but it's copied for future reference:

--------------------------------------------------------------------------------
Based on my analysis of individual frames being rendered and having investigated
3 different scenarios:

1. Scenario 1: No delay whatsoever, i.e. not using `delay-render`.
2. Scenario 2: Using `delay-render` like in `develop`, that is, a form-2
   component with a local Reagent atom.
3. Scenario 3: Using `delay-render` as in this PR, using hooks.

All 3 scenarios open the Settings screen with all rendered views in the same
amount of time. In terms of raw performance, they are completely identical. The
absolute value doesn't matter, but in my recordings, on average, 10 frames of
video after the first press on the user's profile image.

So how can it be that on Android the new solution is visibly smoother? It's all
about latency and our brains are very picky about it.

Scenario 1 - Not using delay-render: the user notices a longer delay after
pressing on the profile image because all components in the Settings screen are
mounted in one go. This gives the impression to the user of being slower. In
slower Android devices, we've seen a user even press twice because the Settings
screen was taking longer to open. On newer Android devices this is not much of a
problem. There's another problem in `Scenario 1`, on Android, with too many
elements and/or too many heavy elements being mounted, the opening animation is
sometimes completely cut off or very clunky (a similar problem can happen while
opening the Activity Center).

Scenario 2 - Use delay-render with a form-2 component: The Settings items are
always rendered after the opening animation completes. Our brains perceive this
as a slight delay because we can see the empty gray background for 1-3 frames.
This is quite noticeable on my physical Android device, even with a prod build.

Scenario 3 - Use delay-render as a hook: the optimal solution from the user's
perspective, Settings items sometimes can be rendered before the animation
completes. I say sometimes because other times the items are rendered only 1
frame before or right when the animation completes, which would be almost the
same as Scenario 2.

What the hooks solution gave us is a little bit of the Scenario 1 and
Scenario 2 in one package, and because the Settings items can be sometimes
rendered before the opening animation completes, our brains see that as being
faster.

In future performance investigations, we might want to focus on manipulating
latency more aggressively to see where that leads us.
2024-05-10 12:43:08 -03:00
Siddarth Kumar cb9a620f40 fix: hack fix for contract tests on MacOS (#19965)
fixes #19802

Contract Tests are failing with missing symbols runtime error on `MacOS` after `golang` version was upgraded to 1.20
A simple hack fix such a case is to use `go 1.19` only to build the status-go library that is used specifically for these integration tests.
Its ugly but it works and unblocks devs from running tests locally.

- execute `make test-contract` on MacOS and it should not fail.

not needed since this impacts only the integration tests.

- macOS

status: ready
2024-05-10 17:58:49 +05:30
Icaro Motta a481a44c72 Fail fast during app initialization if an invalid schema is found (#19958)
Some devs reported invalid schemas in the develop branch during app
initialization. We knew this could happen when Malli was first
introduced, but we wanted to play safe in the beginning due to the
overall inexperience of the team with Malli.

This commit removes all guardrails on instrumented vars, i.e. during app
initialization the app will crash on any invalid schema. A reminder that
instrumentation only take effect when js/goog.DEBUG is true.
2024-05-10 09:12:31 -03:00
Siddarth Kumar a68b2f357d fix: node-pre-gyp warning (#19960)
## Summary

any `yarn` command calls `node-pre-gyp rebuild` which prints out this warning message :

```
make[1]: Entering directory '/Users/siddarthkumar/code/experiments/status-mobile/build'
  CXX(target) Release/obj.target/status_nodejs_addon/modules/react-native-status/nodejs/status.o
../modules/react-native-status/nodejs/status.cpp:1153:11: warning: ignoring return value of function
declared with 'warn_unused_result' attribute [-Wunused-result]
          func->Call(isolate->GetCurrentContext(), v8::Null(isolate), argc, argv);
          ^~~~ ~~~~~~~~~~~~~
1 warning generated.
```

This happens due to return value of `func->Call` here :
https://github.com/status-im/status-mobile/blob/52a6f5c17d3055a98a403505a354cde135b1966f/modules/react-native-status/nodejs/status.cpp#L1153
not being used.
Which is not a huge red flag but produces a warning which is not nice when looking at logs and can be sometimes misleading for other devs.

This commit fixes that warning by assigning return value of that function and checking if its empty or not.

## Testing notes
not needed since this impacts only the integration tests.

## Platforms
- macOS

status: ready
2024-05-10 17:06:45 +05:30
Sean Hagstrom 4f0a49f7bf Add screen for key-pairs and accounts inside wallet settings (#19912)
* chore: add "key pairs and accounts" label

* chore: feature flag wallet-settings

* tidy: extact navigate-back function into static defn

* wip: add initial keypairs and accounts list view to wallet settings

* tweak: wire-up initial action menu for key-pairs

* tidy: extract key-pair container styles into style namespace

* tweak: fix dark background for key-pair and account settings

* tidy: refactor on-press handler for key-pair options

* fix: move feature-flag usage to settings screen instead of settings items definition

* tidy: remove unneeded key props

* tidy: clean up de-structuring and passing of props

* tidy: use keep with when expressions instead of filter and map expressions

* tidy: rename the wallet-settings feature flag

* tweak: rename and add feature-flags for mobile wallet settings

* tweak: use scrollview for feature-flags and add spacing between feature-flag groups

* tweak: adjust the way feature-flags are displayed in groups

* tidy: remove unneeded prop

* tidy: use bottom-inset for padding key-pair and accounts list

* tidy: change `filterv` to `filter`

* tidy: use subscription for building account-props

* tidy: use subscription to build the entire keypair-account

* tweak: use key-pair type to determine default key-pair

* tidy: rename component to settings-category-view

* tidy: use assoc instead of merge

* tidy: extract function from subscription

* test: add tests for formatting key-pairs and accounts for wallet settings

* tweak: use `match?` instead of `=`

* tidy: use `swap!` without anonymous functions
2024-05-10 10:53:35 +01:00
Omar Basem c40853456b Fix: manage members gesture (#19949)
Fix: manage members gesture (#19949)
2024-05-10 09:16:57 +04:00
Icaro Motta 52a6f5c17d Upgrade clj-kondo to 2024.03.13 (#19930)
This PR upgrades clj-kondo (our Clojure linter) from v2023-09-07 to
v2024-03-13, so ~6 months of development updates.

You can check out the changes starting at
https://github.com/clj-kondo/clj-kondo/blob/master/CHANGELOG.md#20231020.
Nothing terribly useful to us this time, but as usual, clj-kondo can catch
more problems and more reliably than before.
2024-05-09 12:04:31 -03:00
mmilad75 14aa9e1c20 Refresh control test (#19831) 2024-05-09 17:42:52 +03:30
mmilad75 2c5cc6cd08 'Send' button is shown for watch-only collectibles and can navigate to the 'send' flow #19743 (#19918) 2024-05-09 17:10:41 +03:30
Icaro Motta 8ad58bb364 Persist in-app feature flags (dev-only feature) (#19619)
This commit improves in-app feature flags to persist what is currently only
stored in a Reagent atom by using RN Async Storage
https://reactnative.dev/docs/asyncstorage. This should make them more convenient
to use, which is a good thing overall for developers.

Additionally, there's now a top-right button in screen Settings > Feature Flags
that will reset the flags to the initial values obtained from environment
variables.

These in-app feature flags are exclusively available in debug builds in
Settings > Feature Flags, and only visible when flag ENABLE_QUO_PREVIEW is
enabled. There's no impact whatsoever in prod builds. A reminder that they are
not meant to be used by users (yet).

It's worth noting that RN has deprecated Async Storage and now recommends other
community solutions, but for a dev-only feature, I think it's fine.
2024-05-09 09:42:38 -03:00
Icaro Motta ab191407ed Fix schema error after logout (#19933)
Detailed explanation:

The schema failure is due to utils.image-server/get-initials-avatar-uri being
called with a nil profile customization color right after the user confirms
logout.

Right after logging out, the subscription :profile/profile-with-image is
recomputed. One of its signal inputs is :profile/profile. Right after logout,
the output of sub :profile/profile is always nil (this is correct, nobody is
logged in). This means that the sub :profile/profile-with-image will try to
calculate the multiaccount URI by passing a nil profile. This is wasteful
computation and is also the cause of the schema for
utils.image-server/get-initials-avatar-uri to fail, because it expects the
profile's customization-color to be present.
2024-05-09 08:52:27 -03:00
ibrkhalil 217f9ba871 clean 2024-05-07 20:48:02 +03:00
ibrkhalil fc433a2c49 Refactors 2024-05-07 20:46:23 +03:00
ibrkhalil c4f3b30fff Add colored chain text 2024-05-07 20:13:23 +03:00
Ibrahem Khalil 44bd6162d0 Merge branch 'develop' into 19727 2024-05-07 19:32:12 +03:00
ibrkhalil 628245a2eb Bump go 2024-05-05 16:08:38 +03:00
ibrkhalil eb7c1f35fb Improvements 2024-05-05 15:37:31 +03:00
ibrkhalil 36750561b8 Show a list of saved addresses and details 2024-05-05 12:59:21 +03:00
47 changed files with 956 additions and 281 deletions
+7
View File
@@ -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}
+2
View File
@@ -127,6 +127,8 @@ fastlane/README.md
# Clj
.cpcache/
src/user.cljs
src/dev/user.cljs
# emacs
.dir-locals.el
+13 -6
View File
@@ -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();
}
}
+120 -102
View File
@@ -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",
@@ -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",
@@ -971,6 +998,15 @@
}
},
{
"path": "refactor-nrepl/refactor-nrepl/3.9.1/refactor-nrepl-3.9.1",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "f949af92dd1d6fef59d7447bd0cb62118e34eca1",
"sha256": "0dml9yvjmji6xk2sk3cdmkvvnh13rw29szxxl363hap8yg28xcs1"
}
},
{
"path": "re-frame/re-frame/1.3.0/re-frame-1.3.0",
"host": "https://repo.clojars.org",
@@ -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",
+16 -14
View File
@@ -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,13 +83,13 @@ org/clojure/core.rrb-vector/0.1.2/core.rrb-vector-0.1.2.jar
org/clojure/core.specs.alpha/0.2.62/core.specs.alpha-0.2.62.jar
org/clojure/data.json/2.4.0/data.json-2.4.0.jar
org/clojure/data.priority-map/1.1.0/data.priority-map-1.1.0.jar
org/clojure/google-closure-library-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.macro/0.1.5/tools.macro-0.1.5.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
refactor-nrepl/refactor-nrepl/3.9.1/refactor-nrepl-3.9.1.jar
re-frame/re-frame/1.3.0/re-frame-1.3.0.jar
re-frisk-remote/re-frisk-remote/1.6.0/re-frisk-remote-1.6.0.jar
re-frisk/sente/1.15.0/sente-1.15.0.jar
reagent/reagent/1.2.0/reagent-1.2.0.jar
refactor-nrepl/refactor-nrepl/3.9.1/refactor-nrepl-3.9.1.jar
ring-cors/ring-cors/0.1.8/ring-cors-0.1.8.jar
ring/ring-codec/1.2.0/ring-codec-1.2.0.jar
ring/ring-core/1.9.6/ring-core-1.9.6.jar
+6 -5
View File
@@ -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}";
+1 -1
View File
@@ -21,7 +21,7 @@
[nubank/matcher-combinators "3.8.8"]
;; Use the same version specified in the Nix dependency.
[clj-kondo/clj-kondo "2023.09.07"]
[clj-kondo/clj-kondo "2024.03.13"]
;; Routing
[bidi "2.1.6"]
+23
View File
@@ -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.
@@ -1,5 +1,6 @@
(ns quo.components.list-items.saved-address.view
(:require
[clojure.string :as string]
[quo.components.avatars.wallet-user-avatar.view :as wallet-user-avatar]
[quo.components.icon :as icon]
[quo.components.list-items.saved-address.style :as style]
@@ -9,32 +10,51 @@
[react-native.core :as rn]
[utils.address :as address]))
(def ^:private chains-map
{:eth :ethereum
:arb :arbitrum
:opt :optimism})
(defn- left-container
[{:keys [blur? name ens address customization-color]}]
[{:keys [blur? ens address customization-color chain-color-map] address-name :name}]
(let [theme (quo.theme/use-theme)]
[rn/view {:style style/left-container}
[wallet-user-avatar/wallet-user-avatar
{:size :size-32
:full-name name
:full-name address-name
:customization-color customization-color}]
[rn/view {:style style/account-container}
[text/text
{:weight :semi-bold
:size :paragraph-1
:style style/name-text}
name]
address-name]
[text/text {:size :paragraph-2}
[text/text
{:size :paragraph-2
:weight :monospace
:style (style/account-address blur? theme)}
(map (fn [[chain color]]
^{:key chain}
[text/text
{:size :paragraph-2
:weight :monospace
:style {:color color}} (str (name chain) ":")])
chain-color-map)
(or ens (address/get-shortened-key address))]]]]))
(defn view
[{:keys [blur? user-props active-state? customization-color on-press on-options-press]
[{:keys [blur? user-props active-state? customization-color on-press on-options-press chains]
:or {customization-color :blue
blur? false}}]
(let [theme (quo.theme/use-theme)
chains-vector (map keyword (string/split chains #":"))
chain-color-map (->> chains-vector
(map (fn [chain-short-keyword]
(let [chain-full-name (get chains-map chain-short-keyword)]
{chain-short-keyword (colors/resolve-color chain-full-name
theme)})))
(into {}))
[state set-state] (rn/use-state :default)
active? (rn/use-ref-atom false)
timer (rn/use-ref-atom nil)
@@ -64,7 +84,8 @@
:name (:name user-props)
:ens (:ens user-props)
:address (:address user-props)
:customization-color (or (:customization-color user-props) :blue)}]
:customization-color (or (:customization-color user-props) :blue)
:chain-color-map (when chains chain-color-map)}]
(when on-options-press
[rn/pressable
{:accessibility-label :options-button
@@ -12,8 +12,8 @@
[:lower-case? :boolean]
[:upper-case? :boolean]
[:numbers? :boolean]
[:symbols? :boolean]]
[:any]]])
[:symbols? :boolean]]]
:any])
(defn- view-internal
[{:keys [lower-case? upper-case? numbers? symbols?]}]
+9
View File
@@ -199,6 +199,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))
+1 -1
View File
@@ -19,5 +19,5 @@
(catch js/Error e#
(taoensso.timbre/error "Failed to instrument function"
{:symbol ~sym :error e#})
~sym))
(throw e#)))
~sym))
+1 -1
View File
@@ -91,5 +91,5 @@
{:schema-id schema-id
:error e
:function f})
f))
(throw e)))
f)))
@@ -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))])
@@ -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
@@ -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) "."))]]))]))]])
@@ -8,7 +8,8 @@
[(preview/customization-color-option {:key :account-color})
{:key :blur? :type :boolean}
{:key :title :type :text}
(preview/customization-color-option)])
(preview/customization-color-option)
{:key :chains :type :text}])
(defn view
[]
@@ -17,7 +18,8 @@
:account-color :flamingo
:title "Alisher Yakupov"
:address "0x21a...49e"
:on-options-press #(js/alert "Options button pressed!")})]
:on-options-press #(js/alert "Options button pressed!")
:chains "eth:opt:arb:"})]
(fn []
[preview/preview-container
{:state state
@@ -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,6 @@
(ns status-im.contexts.settings.wallet.keypairs-and-accounts.actions.view
(:require [quo.core :as quo]))
(defn view
[props]
[quo/drawer-top props])
@@ -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,89 @@
(ns status-im.contexts.settings.wallet.keypairs-and-accounts.view
(:require [quo.core :as quo]
[quo.theme]
[react-native.core :as rn]
[react-native.safe-area :as safe-area]
[status-im.contexts.settings.wallet.keypairs-and-accounts.actions.view :as actions]
[status-im.contexts.settings.wallet.keypairs-and-accounts.style :as style]
[utils.address :as utils]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn navigate-back
[]
(rf/dispatch [:navigate-back]))
(defn on-options-press
[{:keys [theme]
:as props}]
(rf/dispatch [:show-bottom-sheet
{:content (fn [] [actions/view props])
:theme theme}]))
(defn- keypair
[{keypair-type :type
:keys [accounts name]}
_ _
{:keys [profile-picture compressed-key customization-color]}]
(let [theme (quo.theme/use-theme)
default-keypair? (= keypair-type :profile)
shortened-key (when default-keypair?
(utils/get-shortened-compressed-key compressed-key))
on-press (rn/use-callback
(fn []
(on-options-press
(cond-> {:theme theme
:blur? true
:title name}
default-keypair?
(assoc :type :default-keypair
:description shortened-key
:customization-color customization-color
:profile-picture profile-picture)
(not default-keypair?)
(assoc :type :keypair
:icon-avatar :i/seed))))
[customization-color default-keypair? name
profile-picture shortened-key theme])]
[quo/keypair
{:blur? false
:status-indicator false
:stored :on-device
:action :options
:accounts accounts
:customization-color customization-color
:container-style style/keypair-container-style
:profile-picture (when default-keypair? profile-picture)
:type (if default-keypair? :default-keypair :other)
:on-options-press on-press
:details {:full-name name
:address shortened-key}}]))
(defn view
[]
(let [insets (safe-area/get-insets)
compressed-key (rf/sub [:profile/compressed-key])
profile-picture (rf/sub [:profile/image])
customization-color (rf/sub [:profile/customization-color])
quo-keypairs-accounts (rf/sub [:wallet/settings-keypairs-accounts])]
[quo/overlay
{:type :shell
:container-style (style/page-wrapper (:top insets))}
[quo/page-nav
{:key :header
:background :blur
:icon-name :i/arrow-left
:on-press navigate-back}]
[rn/view {:style style/title-container}
[quo/standard-title
{:title (i18n/label :t/keypairs-and-accounts)
:accessibility-label :keypairs-and-accounts-header
:customization-color customization-color}]]
[rn/view {:style {:flex 1}}
[rn/flat-list
{:data quo-keypairs-accounts
:render-fn keypair
:render-data {:profile-picture profile-picture
:compressed-key compressed-key
:customization-color customization-color}
:content-container-style (style/list-container (:bottom insets))}]]]))
@@ -0,0 +1,20 @@
(ns status-im.contexts.settings.wallet.saved-addresses.events
(:require [taoensso.timbre :as log]
[utils.re-frame :as rf]))
(rf/reg-event-fx
:wallet/remove-account-success
(fn [_ [toast-message _]]
{:fx [[:dispatch [:wallet/get-saved-addresses]]
[:dispatch-later
{:ms 100
:dispatch [:wallet/show-account-deleted-toast toast-message]}]]}))
(rf/defn delete-saved-address
{:events [:wallet/delete-saved-address]}
[_ {:keys [address test? toast-message]}]
{:json-rpc/call
[{:method "wakuext_deleteSavedAddress"
:params [address test?]
:on-success [:wallet/remove-account-success toast-message]
:on-error #(log/error "Failed to delete saved address" %)}]})
@@ -2,7 +2,8 @@
(def title-container
{:padding-horizontal 20
:margin-top 12})
:margin-top 12
:margin-bottom 16})
(defn page-wrapper
[inset-top]
@@ -1,14 +1,18 @@
(ns status-im.contexts.settings.wallet.saved-addresses.view
(:require [quo.core :as quo]
[quo.foundations.colors :as colors]
[quo.theme :as quo.theme]
[react-native.core :as rn]
[react-native.platform :as platform]
[react-native.safe-area :as safe-area]
[status-im.common.not-implemented :as not-implemented]
[status-im.common.resources :as resources]
[status-im.config :as config]
[status-im.contexts.settings.wallet.saved-addresses.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn empty-state
(defn- empty-state
[]
(let [theme (quo.theme/use-theme)]
[quo/empty-state
@@ -17,12 +21,169 @@
:image (resources/get-themed-image :sweating-man theme)
:container-style style/empty-container-style}]))
(defn view
(defn- option
[{:keys [icon label on-press danger? sub-label add-divider? accessibility-label right-icon] :as opt}]
(when opt
^{:key label}
{:icon icon
:label label
:on-press on-press
:danger? danger?
:sub-label sub-label
:right-icon right-icon
:add-divider? add-divider?
:accessibility-label accessibility-label}))
(defn- remove-account
[address account-name customization-color]
(rf/dispatch [:hide-bottom-sheet])
(rf/dispatch
[:show-bottom-sheet
{:theme :dark
:content (fn []
[:<>
[quo/drawer-top
{:title (i18n/label :t/remove-saved-address)
:customization-color customization-color}]
[quo/context-tag
{:type :default
:customization-color customization-color
:size 24
:full-name account-name
:container-style {:padding-horizontal 20
:margin-bottom 16}}]
[quo/text
{:style {:padding-horizontal 20
:margin-bottom 8}}
(i18n/label :t/remove-saved-address-description {:name account-name})]
[quo/bottom-actions
{:actions :two-actions
:button-one-label (i18n/label :t/remove)
:button-one-props {:on-press (fn []
(rf/dispatch [:wallet/delete-saved-address
{:address address
:toast-message
(i18n/label :t/saved-address-removed)
:test? false}]))
:type :danger}
:button-two-label (i18n/label :t/cancel)
:button-two-props {:on-press #(rf/dispatch [:hide-bottom-sheet])
:type :grey}}]])}]))
(defn- options
[account-name address customization-color]
[(when config/show-not-implemented-features?
{:icon :i/arrow-up
:label (i18n/label :t/send-to-user {:user account-name})
:on-press not-implemented/alert
:accessibility-label :send-to-user})
(when config/show-not-implemented-features?
{:icon :i/link
:right-icon :i/external
:label (i18n/label :t/view-address-on-website {:website "Etherscan"})
:on-press not-implemented/alert
:accessibility-label :view-address-on-etherscan})
(when config/show-not-implemented-features?
{:icon :i/link
:right-icon :i/external
:label (i18n/label :t/view-address-on-website {:website "Optimistic"})
:on-press not-implemented/alert
:accessibility-label :view-address-on-optimistic})
{:icon :i/share
:on-press #(rf/dispatch
[:open-share
{:options (if platform/ios?
{:activityItemSources [{:placeholderItem {:type :text
:content address}
:item {:default {:type :text
:content
address}}
:linkMetadata {:title address}}]}
{:title address
:subject address
:message address
:isNewTask true})}])
:label (i18n/label :t/share-address)
:accessibility-label :share-saved-address}
{:icon :i/qr-code
:label (i18n/label :t/show-address-qr)
:on-press (fn []
(rf/dispatch [:wallet/set-current-viewing-account address])
(rf/dispatch [:open-modal :screen/wallet.share-address {:status :share}]))
:accessibility-label :show-address-qr-code}
(when config/show-not-implemented-features?
{:icon :i/edit
:label (i18n/label :t/edit-account)
:on-press #(rf/dispatch [:navigate-to :screen/wallet.edit-account])
:accessibility-label :edit-saved-address})
(when config/show-not-implemented-features?
{:icon :i/delete
:label (i18n/label :t/remove-address)
:on-press #(remove-account address account-name customization-color)
:danger? true
:accessibility-label :remove-saved-address
:add-divider? true})])
(defn- sample-options
[account-name address customization-color]
(keep option (options account-name address customization-color)))
(defn- account-sheet
[address account-name customization-color]
[quo/action-drawer
[(sample-options account-name address customization-color)]])
(defn- on-press-saved-address
[{:keys [address account-name ens-name customization-color]}]
(rf/dispatch
[:show-bottom-sheet
{:theme :dark
:selected-item (fn []
[quo/saved-address
{:active-state? false
:user-props {:name account-name
:address address
:ens ens-name
:customization-color customization-color}}])
:content (fn []
[account-sheet
address account-name customization-color])}]))
(defn- saved-address
[{:keys [address colorId _chain-short-names _test? ens?]
account-name :name}]
[quo/saved-address
{:on-press #(on-press-saved-address
{:account-name account-name
:address address
:ens-name (when ens? address)
:customization-color (keyword colorId)})
:user-props {:name account-name
:address address
:customization-color (keyword colorId)}}])
(defn- header
[{:keys [title]}]
[quo/divider-label
{:container-style {:border-top-color colors/white-opa-5}}
title])
(defn- footer
[]
[rn/view {:height 8}])
(defn- navigate-back
[]
(rf/dispatch [:navigate-back]))
(defn- view
[]
(let [inset-top (safe-area/get-top)
customization-color (rf/sub [:profile/customization-color])
saved-addresses []
navigate-back (rn/use-callback #(rf/dispatch [:navigate-back]))]
saved-addresses (rf/sub [:wallet/grouped-saved-addresses])]
(rn/use-effect
(fn []
(rf/dispatch [:wallet/get-saved-addresses])))
[quo/overlay
{:type :shell
:container-style (style/page-wrapper inset-top)}
@@ -38,5 +199,13 @@
:right :action
:customization-color customization-color
:icon :i/add}]]
[rn/section-list
{:key-fn :title
:sticky-section-headers-enabled false
:render-section-header-fn header
:render-section-footer-fn footer
:sections saved-addresses
:render-fn saved-address
:separator [rn/view {:style {:height 4}}]}]
(when-not (seq saved-addresses)
[empty-state])]))
@@ -1,8 +1,8 @@
(ns status-im.contexts.settings.wallet.wallet-options.view
(:require [quo.core :as quo]
[react-native.core :as rn]
[react-native.safe-area :as safe-area]
[status-im.contexts.settings.wallet.wallet-options.style :as style]
[status-im.feature-flags :as ff]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
@@ -10,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
@@ -28,15 +28,16 @@
collection-name]]])
(defn cta-buttons
[chain-id token-id contract-address]
[{:keys [chain-id token-id contract-address 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}
(i18n/label :t/send)])
[quo/button
{:container-style style/opensea-button
:type :outline
@@ -66,7 +67,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 +91,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
@@ -128,7 +129,11 @@
{: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? (:watch-only? collectible-owner)}]
[quo/tabs
{:size 32
:style style/tabs
+9 -3
View File
@@ -27,10 +27,16 @@
:type :positive
:text (i18n/label :t/account-created {:name (:name account)})}]]]})))
(defn set-current-viewing-account
[{:keys [db]} [address]]
{:db (assoc-in db [:wallet :current-viewing-account-address] address)})
(rf/reg-event-fx :wallet/set-current-viewing-account set-current-viewing-account)
(rf/reg-event-fx :wallet/navigate-to-account
(fn [{:keys [db]} [address]]
{:db (assoc-in db [:wallet :current-viewing-account-address] address)
:fx [[:dispatch [:navigate-to :screen/wallet.accounts address]]]}))
(fn [_cofx [address]]
{:fx [[:dispatch [:wallet/set-current-viewing-account address]]
[:dispatch [:navigate-to :screen/wallet.accounts address]]]}))
(rf/reg-event-fx :wallet/navigate-to-new-account
(fn [{:keys [db]} [address]]
@@ -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)})
+54 -29
View File
@@ -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}]}]]))
@@ -29,7 +29,7 @@
(rf/reg-event-fx
:wallet/get-saved-addresses-success
(fn [{:keys [db]} [saved-addresses]]
{:db (assoc-in db [:wallet :saved-addresses] saved-addresses)}))
{:db (assoc-in db [:wallet :saved-addresses] (group-by :address saved-addresses))}))
(rf/reg-event-fx
:wallet/get-saved-addresses-error
+4 -1
View File
@@ -21,10 +21,10 @@
[status-im.contexts.profile.push-notifications.events :as notifications]
[status-im.contexts.shell.jump-to.state :as shell.state]
[status-im.contexts.shell.jump-to.utils :as shell.utils]
[status-im.feature-flags :as ff]
[status-im.navigation.core :as navigation]
status-im.contexts.wallet.signals
status-im.events
status-im.navigation.core
[status-im.setup.dev :as dev]
[status-im.setup.global-error :as global-error]
[status-im.setup.interceptors :as interceptors]
@@ -63,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))
+2
View File
@@ -28,6 +28,7 @@
status-im.contexts.onboarding.events
status-im.contexts.profile.events
status-im.contexts.profile.settings.events
status-im.contexts.settings.wallet.saved-addresses.events
status-im.contexts.shell.qr-reader.events
status-im.contexts.shell.share.events
status-im.contexts.syncing.events
@@ -37,6 +38,7 @@
status-im.contexts.wallet.common.wizard.events
status-im.contexts.wallet.effects
status-im.contexts.wallet.events
status-im.contexts.wallet.save-address.events
status-im.contexts.wallet.send.events
status-im.contexts.wallet.signals
status-im.contexts.wallet.swap.events
+41 -14
View File
@@ -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]
+7
View File
@@ -57,6 +57,7 @@
[status-im.contexts.profile.settings.screens.password.change-password.view :as change-password]
[status-im.contexts.profile.settings.screens.password.view :as settings-password]
[status-im.contexts.profile.settings.view :as settings]
[status-im.contexts.settings.wallet.keypairs-and-accounts.view :as keypairs-and-accounts]
[status-im.contexts.settings.wallet.saved-addresses.view :as saved-addresses-settings]
[status-im.contexts.settings.wallet.wallet-options.view :as wallet-options]
[status-im.contexts.shell.activity-center.view :as activity-center]
@@ -501,6 +502,12 @@
: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}
+7 -14
View File
@@ -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."))
+6 -1
View File
@@ -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,5 +1,6 @@
(ns status-im.subs.wallet.saved-addresses
(:require
[clojure.string :as string]
[re-frame.core :as rf]))
(rf/reg-sub
@@ -13,3 +14,16 @@
(fn [wallet [address]]
(some #(= address (:address %))
(:saved-addresses wallet))))
(rf/reg-sub
:wallet/grouped-saved-addresses
:<- [:wallet/saved-addresses]
(fn [saved-addresses]
(->> saved-addresses
vals
flatten
(sort-by :name)
(group-by #(string/upper-case (first (:name %))))
(map (fn [[k v]]
{:title k
:data v})))))
@@ -0,0 +1,25 @@
(ns status-im.subs.wallet.saved-addresses-test
(:require [clojure.test :refer [is testing]]
[re-frame.db :as rf-db]
[test-helpers.unit :as h]
[utils.re-frame :as rf]))
(def saved-addresses-data
[{:address "0x0" :colorId "blue" :chainShortNames "eth:" :isTest false :name "Alice's address"}
{:address "0x1" :colorId "purple" :chainShortNames "eth:" :isTest false :name "Bob's address"}])
(def grouped-saved-addresses-data
[{:title "A"
:data
[{:address "0x0" :colorId "blue" :chainShortNames "eth:" :isTest false :name "Alice's address"}]}
{:title "B"
:data
[{:address "0x1" :colorId "purple" :chainShortNames "eth:" :isTest false :name "Bob's address"}]}])
(h/deftest-sub :wallet/grouped-saved-addresses
[sub-name]
(testing "returns data with prod"
(swap! rf-db/app-db assoc-in [:wallet :saved-addresses] saved-addresses-data)
(is
(= grouped-saved-addresses-data
(rf/sub [sub-name])))))
+29
View File
@@ -1,6 +1,7 @@
(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]
@@ -158,6 +159,34 @@
:goerli-enabled? goerli-enabled?})
selected-networks))))
(defn- format-settings-keypair-accounts
[accounts
{:keys [networks size]
:or {networks []
size 32}}]
(->> accounts
(keep (fn [{:keys [path customization-color emoji name address]}]
(when-not (string/starts-with? path constants/path-eip1581)
{:account-props {:customization-color customization-color
:size size
:emoji emoji
:type :default
:name name
:address address}
:networks networks
:state :default
:action :none})))))
(rf/reg-sub
:wallet/settings-keypairs-accounts
:<- [:wallet/keypairs]
(fn [keypairs [_ format-options]]
(->> keypairs
(map (fn [{:keys [accounts name type]}]
{:type (keyword type)
:name name
:accounts (format-settings-keypair-accounts accounts format-options)})))))
(rf/reg-sub
:wallet/derivation-path-state
:<- [:wallet/create-account]
+103
View File
@@ -554,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
-9
View File
@@ -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 -3
View File
@@ -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": "add-emoji-to-saved-addresses",
"commit-sha1": "5c1ae90fa682ffb236f35b71c4d2911455bea8ce",
"src-sha256": "12xfsxdyclz8mx4qm6lywcbzqkxmrspni44450cqsa5qspdhdrxq"
}
+1 -1
View File
@@ -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();
+8 -1
View File
@@ -2484,6 +2484,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",
@@ -2612,5 +2613,11 @@
"scanning-for-activity": "Scanning for activity...",
"send-community-link": "Send community link",
"at-least-one-network-must-be-activated": "At least 1 network must be activated",
"status-is-a-secure-messaging-app": "Status is a secure messaging app, crypto wallet and web3 browser built with the state of the art technology"
"status-is-a-secure-messaging-app": "Status is a secure messaging app, crypto wallet and web3 browser built with the state of the art technology",
"send-to-user": "Send to {{user}}",
"view-address-on-website": "View address on {{website}}",
"saved-address-removed": "Saved address removed",
"remove-address": "Remove address",
"remove-saved-address-description": "Transaction history relating to this address will no longer be labelled {{name}}.",
"remove-saved-address": "Remove saved address"
}