Compare commits

..
Author SHA1 Message Date
Sean Hagstrom c777771524 tweak: utilise use-layout-effect to safely update atom 2024-05-14 09:45:43 +01:00
Sean Hagstrom e6623ef370 tidy: refactor from use-callback to use-memo 2024-05-14 09:45:43 +01:00
Sean Hagstrom 91a592a65b chore: add use-layout-effect 2024-05-14 09:45:43 +01:00
Sean Hagstrom e377064ca9 tidy: remove extra debug labels 2024-05-14 09:45:43 +01:00
Sean Hagstrom 109647c3be wip: refactor to use custom memo implementation and display demo of different behaviors 2024-05-14 09:45:42 +01:00
Sean Hagstrom 01e1ff2b1b tweak: test sharing a state-sub 2024-05-14 09:45:42 +01:00
Sean Hagstrom b69a9933d3 tidy: remove unused button stuff 2024-05-14 09:45:42 +01:00
Sean Hagstrom b61a8c8a5f tweak: update demo with a variety of helper functions 2024-05-14 09:45:42 +01:00
Sean Hagstrom 00c726b7ba tweak: use debug labels for buttons 2024-05-14 09:45:42 +01:00
Sean Hagstrom 2bf0fa845e tweak: only debug buttons with string children 2024-05-14 09:45:41 +01:00
Sean Hagstrom a1a71489e8 tidy: rename functions to be more descriptive 2024-05-14 09:45:41 +01:00
Sean Hagstrom 8b45ddce6f fix: subscription leak during hot reload by using use-memo 2024-05-14 09:45:41 +01:00
Sean Hagstrom 90251249b0 tweak: log when button component renders 2024-05-14 09:45:41 +01:00
Sean Hagstrom be0e14aea4 tweak: refactor example to use reagent.ratom/track and reagent.ratom/track! functions with message state 2024-05-14 09:45:41 +01:00
Sean Hagstrom 1e3d90fef6 wip: add small experiment for ui callback with state and memoization 2024-05-14 09:45:41 +01:00
Sean Hagstrom fc318b6e92 tweak: forward on-press events 2024-05-14 09:45:40 +01:00
131 changed files with 1682 additions and 2564 deletions
+4 -2
View File
@@ -353,11 +353,13 @@ test: export SHADOW_NS_REGEXP := .*-test$$
test: ##@test Run all Clojure tests
test: _test-clojure
test-watch-for-repl: export TARGET := default
test-watch-for-repl: export SHADOW_OUTPUT_TO := target/test/test.js
test-watch-for-repl: export SHADOW_NS_REGEXP := .*-test$$
test-watch-for-repl: status-go-library
test-watch-for-repl: ##@test Watch all Clojure tests and support REPL connections
yarn install && shadow-cljs compile mocks && \
yarn node-pre-gyp rebuild
rm -f target/test/test.js
yarn shadow-cljs compile mocks && \
concurrently --kill-others --prefix-colors 'auto' --names 'build,repl' \
'yarn shadow-cljs watch test --verbose' \
"until [ -f $$SHADOW_OUTPUT_TO ] ; do sleep 1 ; done ; node --require ./test-resources/override.js $$SHADOW_OUTPUT_TO --repl"
+1 -1
View File
@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools">
<!-- These are added by React Native for debug mode, but actually aren't needed in release mode -->
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission tools:node="remove" android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<!-- Remove licensing permission since we don't license our app and it blocks F-Droid submissions. -->
<uses-permission tools:node="remove" android:name="com.android.vending.CHECK_LICENSE"/>
+6
View File
@@ -946,6 +946,8 @@ PODS:
- react-native-status-keycard (2.5.39):
- Keycard
- React
- react-native-transparent-video (0.1.0):
- React-Core
- react-native-webview (13.6.3):
- React-Core
- React-nativeconfig (0.73.5)
@@ -1236,6 +1238,7 @@ DEPENDENCIES:
- "react-native-slider (from `../node_modules/@react-native-community/slider`)"
- react-native-status (from `../modules/react-native-status`)
- react-native-status-keycard (from `../node_modules/react-native-status-keycard`)
- react-native-transparent-video (from `../node_modules/react-native-transparent-video`)
- react-native-webview (from `../node_modules/react-native-webview`)
- React-nativeconfig (from `../node_modules/react-native/ReactCommon`)
- React-NativeModulesApple (from `../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`)
@@ -1385,6 +1388,8 @@ EXTERNAL SOURCES:
:path: "../modules/react-native-status"
react-native-status-keycard:
:path: "../node_modules/react-native-status-keycard"
react-native-transparent-video:
:path: "../node_modules/react-native-transparent-video"
react-native-webview:
:path: "../node_modules/react-native-webview"
React-nativeconfig:
@@ -1528,6 +1533,7 @@ SPEC CHECKSUMS:
react-native-slider: 12bd76d3d568c9c5500825db54123d44b48e4ad4
react-native-status: 21f75d492fd311dc111303da38a7a2b23a8a8466
react-native-status-keycard: f1c1227b2d5984c10fb44db68e4bfd2937f31e98
react-native-transparent-video: e484ad11ace8e5f62516e2c5e15efd3cb4df24b0
react-native-webview: 88293a0f23eca8465c0433c023ec632930e644d0
React-nativeconfig: 1166714a4f7ea57a0df5c2cb44fbc70f98d580f9
React-NativeModulesApple: 726664e9829eb5eed8170241000e46ead269a05f
+158 -132
View File
@@ -10306,20 +10306,20 @@
},
{
"path": "com/fasterxml/jackson/core/jackson-annotations/2.17.1",
"path": "com/fasterxml/jackson/core/jackson-annotations/2.17.0",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"jackson-annotations-2.17.1.pom": {
"sha1": "186c3704ed2d09c8870722223a44e7b221da9a5a",
"sha256": "sha256-c1XzdEX12vUPUMdfLrzXG6LE+86ktiVBSAWexjVkTnc="
"jackson-annotations-2.17.0.pom": {
"sha1": "912bf318b1a41adbc921505aef325182cbf71869",
"sha256": "sha256-yHz4sMhDRDpM7E5pp4kTM10OR7FqGdI8IcI4JuCS+Mk="
},
"jackson-annotations-2.17.1.jar": {
"sha1": "fca7ef6192c9ad05d07bc50da991bf937a84af3a",
"sha256": "sha256-/MrYLhMXLA5DhNtxV3IZybhjHAgg9LGNqqVwFvtmHHY="
"jackson-annotations-2.17.0.jar": {
"sha1": "880a742337010da4c851f843d8cac150e22dff9f",
"sha256": "sha256-hWJWmgAdRuhOojgCJX4zyPaLJOtHweDv0TOgNyxRKVk="
},
"jackson-annotations-2.17.1.module": {
"sha1": "3822431bbca9acce12e554dff0d82de1c802a13e",
"sha256": "sha256-VNTVHaATppa+CeH0gDH39At3cYB4qpNuZMAjpP2blZM="
"jackson-annotations-2.17.0.module": {
"sha1": "c3f7565e70f082a678c6c0bedd479df9a771cfe6",
"sha256": "sha256-RkPjPFKL6kG0/F7A4vivbBzVlQAr4voTzE+pF2JXf7w="
}
}
},
@@ -10340,20 +10340,20 @@
},
{
"path": "com/fasterxml/jackson/core/jackson-core/2.17.1",
"path": "com/fasterxml/jackson/core/jackson-core/2.17.0",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"jackson-core-2.17.1.pom": {
"sha1": "22a579663e24a696b98a352eb423ca393dc1a4bd",
"sha256": "sha256-2UiDEgmgTAE5G5Oq7nrTShyelIY/nnaFwvW2FJoqs50="
"jackson-core-2.17.0.pom": {
"sha1": "ff0f34af82de11f065364a11d993ab2769b7ec07",
"sha256": "sha256-lR2zV/nEmlyId8CJYMSoroa9jJqohwYmZL0E96/+6pU="
},
"jackson-core-2.17.1.jar": {
"sha1": "5e52a11644cd59a28ef79f02bddc2cc3bab45edb",
"sha256": "sha256-3bJsih8ahFNeghPEizWyUzcENOMoezzxV3eFb8TljOY="
"jackson-core-2.17.0.jar": {
"sha1": "a6e5058ef9720623c517252d17162f845306ff3a",
"sha256": "sha256-Vb4TD2poA4CIomGFbE44POeZV6D8GinsshOp79bvQ4k="
},
"jackson-core-2.17.1.module": {
"sha1": "ff7615f1ccc2a9c1c8a5a404ab29e53f5abe29a7",
"sha256": "sha256-iowJZP38Js7bso2CXfRiGBf7jNIrnnpZ2cdKOl8b3R0="
"jackson-core-2.17.0.module": {
"sha1": "4a7ed6d155ffc200c55da5827a1ea9db10dcbdc6",
"sha256": "sha256-PSDo4ew+imyoB/J3vL2UM//DSs27X9PcJIWs8lKXlIc="
}
}
},
@@ -10374,20 +10374,20 @@
},
{
"path": "com/fasterxml/jackson/core/jackson-databind/2.17.1",
"path": "com/fasterxml/jackson/core/jackson-databind/2.17.0",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"jackson-databind-2.17.1.pom": {
"sha1": "6948da5a23ce75d431982d8228b67299b57be315",
"sha256": "sha256-YKCKmGrDE60+MmiKTjJ6YSg6ioAa1vphV5+MS+bcj2w="
"jackson-databind-2.17.0.pom": {
"sha1": "16301a5fdcdd9b6e453dff2307808730b82dda97",
"sha256": "sha256-itZM7RCQyt5O90sVYbmWOkUeM/Sc8/oCp4y7LaCvzxc="
},
"jackson-databind-2.17.1.jar": {
"sha1": "0524dcbcccdde7d45a679dfc333e4763feb09079",
"sha256": "sha256-tsovfVsaskXOxUlewzl3PS2QVUxIWSWQZz+xj0QAqUg="
"jackson-databind-2.17.0.jar": {
"sha1": "7173e9e1d4bc6d7ca03bc4eeedcd548b8b580b34",
"sha256": "sha256-0O1bVMsbC7sIKOJM51KkOgBtwYizTjpK4yOKzHtjdBg="
},
"jackson-databind-2.17.1.module": {
"sha1": "9dff3c7bfd8d46e05335d0b5dea8f12d5a4f5a20",
"sha256": "sha256-C6vGRqBi8NnTWEQCpQJxiE7cPhekGULB4x4OENcdvuY="
"jackson-databind-2.17.0.module": {
"sha1": "8e40a003945d3481158e7396b5926d09488b83d3",
"sha256": "sha256-fHs6Ikpqvls4uhoi/kVMCyVh80uyfnI8FwkluK0Akhs="
}
}
},
@@ -10419,12 +10419,12 @@
},
{
"path": "com/fasterxml/jackson/jackson-base/2.17.1",
"path": "com/fasterxml/jackson/jackson-base/2.17.0",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"jackson-base-2.17.1.pom": {
"sha1": "f5b8cfce0e5562b14ac36020b46ec3bcd8f2d990",
"sha256": "sha256-4K78YdOPzd2VX/7sAbt1EE8bv/+jpuy1jb50r7cV4yI="
"jackson-base-2.17.0.pom": {
"sha1": "fb0c3dd80f76b467d6afa2569bbfc10afe5df73f",
"sha256": "sha256-w9lEq1Kiy2/0VJ3O6wTUIajeYyo8yl3UVPq8f1KsMeI="
}
}
},
@@ -10441,12 +10441,12 @@
},
{
"path": "com/fasterxml/jackson/jackson-bom/2.17.1",
"path": "com/fasterxml/jackson/jackson-bom/2.17.0",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"jackson-bom-2.17.1.pom": {
"sha1": "3bd0a8fe4faa6434ff0109e330349fd8cff0967f",
"sha256": "sha256-n0RhIo4SkQPu16MC3BABqy5Mgt086pFcKn27jMYe/SU="
"jackson-bom-2.17.0.pom": {
"sha1": "b07eaa72b4c5113b038c749723ead41ba2fc9b5e",
"sha256": "sha256-SWSsYtWw5Ne/Vuz4sscC+pkUGCpfwtLnZvTPdoZP0qU="
}
}
},
@@ -10485,12 +10485,12 @@
},
{
"path": "com/fasterxml/jackson/module/jackson-modules-base/2.17.1",
"path": "com/fasterxml/jackson/module/jackson-modules-base/2.17.0",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"jackson-modules-base-2.17.1.pom": {
"sha1": "a19b31429808678e13cc068c37384e316bc9dd75",
"sha256": "sha256-fzPKJF1DhO+gTVBoQIYumA1QMYwGkg+aOt8F1I8LeUM="
"jackson-modules-base-2.17.0.pom": {
"sha1": "b2d172695b8e6137df2fe53e8e90e3d6ee511268",
"sha256": "sha256-tv/miBI+l3tsL99BKBcdSBSBd449w6QT6N4k88k/QAU="
}
}
},
@@ -10511,20 +10511,20 @@
},
{
"path": "com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.17.1",
"path": "com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.17.0",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"jackson-module-jaxb-annotations-2.17.1.pom": {
"sha1": "7e73e3750a612c5d176f24245cc6aedc49f41c0a",
"sha256": "sha256-HdSa8i8aVUOzkvwAuXjJywz6bijcHLASxuhYlQs4F+E="
"jackson-module-jaxb-annotations-2.17.0.pom": {
"sha1": "f1bd4e7f9af710bf265ba21394185a5b37051ef2",
"sha256": "sha256-VrsjZo/bGjZsQTOWBPuStlf75ARtSMMvlZ0h4EbEXO8="
},
"jackson-module-jaxb-annotations-2.17.1.jar": {
"sha1": "f77e7bf0e64dfcf53bfdcf2764ad7ab92b78a4da",
"sha256": "sha256-lD9YVAwZtRcnRl7PTQehHQiLMDOXhIJCmdV+Wv6e7p0="
"jackson-module-jaxb-annotations-2.17.0.jar": {
"sha1": "e07032ce170277213ac4835169ca79fa0340c7b5",
"sha256": "sha256-mTJZetw8/maj37eCxGgJ1B1mtvjo6Y2GSjGKB38XEig="
},
"jackson-module-jaxb-annotations-2.17.1.module": {
"sha1": "feb6451e95bb55db0dc98d26ed4e7968f9ce0267",
"sha256": "sha256-EQtHVfGAVgQ9XtnpeQDOQiU/0lbz7EdaPwUMsAhNze4="
"jackson-module-jaxb-annotations-2.17.0.module": {
"sha1": "d7b4ed7f26b3f096d301ee076120d8a9c89ad387",
"sha256": "sha256-2FGXX3oXYyDBfUOnjM4UjGmVLSykOwhdgKwIluHyBBA="
}
}
},
@@ -11846,27 +11846,27 @@
},
{
"path": "com/google/guava/guava-parent/33.2.0-jre",
"path": "com/google/guava/guava-parent/33.1.0-jre",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"guava-parent-33.2.0-jre.pom": {
"sha1": "f5bfac48964350d7ad36aa378acff0ed379f816b",
"sha256": "sha256-Ng5j7DRbu9j6pK3YluMlAt//9U6DQJhFyzPB+tN7WYU="
"guava-parent-33.1.0-jre.pom": {
"sha1": "07ac341ceab9c132ddc00771ca187bac04681eeb",
"sha256": "sha256-D73wcsyo4Fa6MVQrt18MFJCRRABYbUukIuz8fR38ecY="
}
}
},
{
"path": "com/google/guava/guava-testlib/33.2.0-jre",
"path": "com/google/guava/guava-testlib/33.1.0-jre",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"guava-testlib-33.2.0-jre.pom": {
"sha1": "1d0c542e891776dcb545a86de861afb18bc79540",
"sha256": "sha256-HQFL2lY+v0p64DOKef0JPulhIctiQz0g61uejCvIroo="
"guava-testlib-33.1.0-jre.pom": {
"sha1": "f25d7efd40db1ad39cc7222a89bee9150b1835ad",
"sha256": "sha256-5spqGrW/Ajzn7xgo3vmKiQP/aXt4kVlBK//JCceU1Gs="
},
"guava-testlib-33.2.0-jre.jar": {
"sha1": "4678a8fd0e7fba71a4283154fd4979f51ba294d5",
"sha256": "sha256-HK2mwu+stz+eoRk7sMeKr/qT2DjtAGrIBtDXoeYMQlo="
"guava-testlib-33.1.0-jre.jar": {
"sha1": "55c1c7a9df8d7293bd67d0209320d678f04c5fee",
"sha256": "sha256-xttkB1YEm8dLDaYhaH2k6XfUeiCuN4FGaMW/jGpQogM="
}
}
},
@@ -12052,20 +12052,20 @@
},
{
"path": "com/google/guava/guava/33.2.0-jre",
"path": "com/google/guava/guava/33.1.0-jre",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"guava-33.2.0-jre.pom": {
"sha1": "e78e6bc096ac140596ce47c2cd6e90f12a417779",
"sha256": "sha256-7YMRSBtY5QTb/BtfR3C/B13BL2yshV3X1/NqUNTEGRA="
"guava-33.1.0-jre.pom": {
"sha1": "ff9e5899929c5ff0de96f6d9a49359ecc088f756",
"sha256": "sha256-VXQa0W+Yzubm3Ard3UOAacxeP/KaJuMXXU/qKHaSVLc="
},
"guava-33.2.0-jre.jar": {
"sha1": "e264781dadc4967e5292f3c4d05f1d153631f7b4",
"sha256": "sha256-mfSR6GJizjjROzWB1A93rNtGlqlQVEfDFUR0wxkpCN0="
"guava-33.1.0-jre.jar": {
"sha1": "9b7ed39143d59e8eabcc6f91ffe4d23db2efe558",
"sha256": "sha256-NGrsDrjImHNgyKJk5w/xDC+6dgRG6yfoqwfnjnh6df4="
},
"guava-33.2.0-jre.module": {
"sha1": "5ee9e7ff047a61986890f7ea80a2695c7239169c",
"sha256": "sha256-eSlFEwC6UJb1M6LiPOqpManfGBIy21emmK1+PB4TD/g="
"guava-33.1.0-jre.module": {
"sha1": "603d87c0a1f8da8a608eb1c48ee6200ccba29c13",
"sha256": "sha256-6qUNmCgORsANUYq/FUgp3pm1lm0bb+KLffHVvZB+dKg="
}
}
},
@@ -12238,12 +12238,12 @@
},
{
"path": "com/google/protobuf/protobuf-bom/4.27.0-RC3",
"path": "com/google/protobuf/protobuf-bom/4.27.0-RC1",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"protobuf-bom-4.27.0-RC3.pom": {
"sha1": "bd9f15b87d06e839222b2dadcd90272013557048",
"sha256": "sha256-S1fPaw/YOC7Ntmsg4yYX+nDJh3kcIsYiOw9GMFhCogI="
"protobuf-bom-4.27.0-RC1.pom": {
"sha1": "27a037f37e7e95b5e28ec5cd410ed99d34eb0a29",
"sha256": "sha256-ilnU8jEpEPRz7kIC0n8QQBt1nSyGY6xr/dQP299Bfy4="
}
}
},
@@ -12489,16 +12489,16 @@
},
{
"path": "com/google/protobuf/protobuf-java/4.27.0-RC3",
"path": "com/google/protobuf/protobuf-java/4.27.0-RC1",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"protobuf-java-4.27.0-RC3.pom": {
"sha1": "eb6c9cf9ce563effc186f0a8bbc35aa53bbcf74e",
"sha256": "sha256-tYj2q0siUF4fcX4dwZ/NhbsHbICJkDDlOE0fX0+lb1s="
"protobuf-java-4.27.0-RC1.pom": {
"sha1": "8c2f747548d2fafc3e9b057cee34c343dc47e78e",
"sha256": "sha256-n9A6OYpEYg/F4Um5bKFXFb/1zQkxiNk7nGaSmmj087w="
},
"protobuf-java-4.27.0-RC3.jar": {
"sha1": "b8abf4eca2730bf6de63f187eb1c15dd512cbe83",
"sha256": "sha256-BTKtECTWI2FWGsrtuXTX0WiJ52cLNuI+kyHda50zTvk="
"protobuf-java-4.27.0-RC1.jar": {
"sha1": "f37d7fb8ab06eee5ae3dd11c121f63a8b209e74f",
"sha256": "sha256-MW6bDi8Ee6d42j4PgT+0lqqzysiu/qRTRiIAi2bAcyk="
}
}
},
@@ -12618,12 +12618,12 @@
},
{
"path": "com/google/protobuf/protobuf-parent/4.27.0-RC3",
"path": "com/google/protobuf/protobuf-parent/4.27.0-RC1",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"protobuf-parent-4.27.0-RC3.pom": {
"sha1": "896b7ebb6bf6d26d64bf7b92e41d5e4f6c097a8b",
"sha256": "sha256-i7Fdb53i0Q8PlqmPKfkl+9T/oA/VEOyse5X3QjIYhvc="
"protobuf-parent-4.27.0-RC1.pom": {
"sha1": "59b00c8642d1166a189ebdcc529d3de170c8c56c",
"sha256": "sha256-mdkAVgkc3DOMTzc5ghqX3ICl1+ajWVFVWdw//1f73+E="
}
}
},
@@ -14999,16 +14999,16 @@
},
{
"path": "net/bytebuddy/byte-buddy-agent/1.14.15",
"path": "net/bytebuddy/byte-buddy-agent/1.14.12",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"byte-buddy-agent-1.14.15.pom": {
"sha1": "38dc80ceffcc2eb5a333a91178e2b604d79acc4c",
"sha256": "sha256-bSndpffrUMo7o7ChKu9RjMVtgjSjNEKl+pgrS0SAJl4="
"byte-buddy-agent-1.14.12.pom": {
"sha1": "2e7579d9fc7635fac3b777222bfe7ed0c6180370",
"sha256": "sha256-ZpifcNNV1gD9TZJtiDXke30b7/Z47r7FnRljY7XNTCw="
},
"byte-buddy-agent-1.14.15.jar": {
"sha1": "0b4cc9d88d5de562bf75b3a54ab436ad01b3f72d",
"sha256": "sha256-PvbscXWAE2EXAGfMaQKWn5ZtN8cr+TU9nNKCJjsYQGQ="
"byte-buddy-agent-1.14.12.jar": {
"sha1": "be4984cb6fd1ef1d11f218a648889dfda44b8a15",
"sha256": "sha256-KzCakwAJLgtpb3xHH9UdmWkAHfeEyKufB5l0N9dXrW0="
}
}
},
@@ -15036,12 +15036,23 @@
},
{
"path": "net/bytebuddy/byte-buddy-parent/1.14.15",
"path": "net/bytebuddy/byte-buddy-parent/1.14.9",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"byte-buddy-parent-1.14.15.pom": {
"sha1": "41a33be695a3bbf89c995e2d53433f4cbaa3ac81",
"sha256": "sha256-JurvCGUf+li6KQCSzjKBeC4pwGKKG3n6WjeE+Qi0GKw="
"byte-buddy-parent-1.14.9.pom": {
"sha1": "da031e5ce56cd47e73b9793bf85525d5bf016071",
"sha256": "sha256-Zrg0IlHTXyBj5pMW9juvywVjQv516SHA9GXC2WWTU14="
}
}
},
{
"path": "net/bytebuddy/byte-buddy-parent/1.14.12",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"byte-buddy-parent-1.14.12.pom": {
"sha1": "b9c86a9d0a445f6a6374f092377a570cfc363426",
"sha256": "sha256-m3/SvyklMayw6XTZVeSjbKQTMt0Nr+icJNj+Q5uuV7A="
}
}
},
@@ -15077,16 +15088,31 @@
},
{
"path": "net/bytebuddy/byte-buddy/1.14.15",
"path": "net/bytebuddy/byte-buddy/1.14.9",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"byte-buddy-1.14.15.pom": {
"sha1": "95fc2fd8a131fad0706f51d6b573ece01763572c",
"sha256": "sha256-1WOfj+J86tM+akx4n62OZfMo9iu3na0r3XrmzJO5RUw="
"byte-buddy-1.14.9.pom": {
"sha1": "fb912d2860bd618655759750893db27c3f12db66",
"sha256": "sha256-LWdykQ0WFpvUySKeijZc9U4ZK8Ygy8+n+EJx9dEV6BU="
},
"byte-buddy-1.14.15.jar": {
"sha1": "11c9440bc7f9468761e5a82778a05205169d49a9",
"sha256": "sha256-dHLjlhmSwSqf1PbWfCHeQoCr4Y8pJwTdSdczgon4rPU="
"byte-buddy-1.14.9.jar": {
"sha1": "b69e7fff6c473d3ed2b489cdfd673a091fd94226",
"sha256": "sha256-N3NS4lMoK/hvcxrJDtiDSOj0CmPOAzwAqFmC3n55Dm8="
}
}
},
{
"path": "net/bytebuddy/byte-buddy/1.14.12",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"byte-buddy-1.14.12.pom": {
"sha1": "95857e045a1878f95b696844f78d03b94ec25964",
"sha256": "sha256-XamVxw3nt/SoSKhUN8fd7oA9GrfKwtfY33GUw9XicU0="
},
"byte-buddy-1.14.12.jar": {
"sha1": "6e37f743dc15a8d7a4feb3eb0025cbc612d5b9e1",
"sha256": "sha256-lwY2E01hwYOxn49Y+mMeMNLyq8o0SzeEijk8rHhj3XA="
}
}
},
@@ -19201,16 +19227,16 @@
},
{
"path": "org/jetbrains/kotlin/kotlin-reflect/2.0.0-RC3",
"path": "org/jetbrains/kotlin/kotlin-reflect/2.0.0-RC2",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"kotlin-reflect-2.0.0-RC3.pom": {
"sha1": "a7730291ea955a34868c94a9409c048c15107d94",
"sha256": "sha256-9aeMqntbuaejEkPzeT4Nj+3/q1d6KNW7pXlyMFkU5nU="
"kotlin-reflect-2.0.0-RC2.pom": {
"sha1": "f59f0775b6c4874de09c44d692037fd8f3132bfd",
"sha256": "sha256-1aOhZnjByMuCwt0x6SO2i+pd0ka/rEv8T+nO3nUo6gM="
},
"kotlin-reflect-2.0.0-RC3.jar": {
"sha1": "2de9acd396986f0130a7015ca18caa593915b077",
"sha256": "sha256-bFXdlUw7yRgPPDvM+D9PAf+ifqvMVlWdLKw2Z6FbjMo="
"kotlin-reflect-2.0.0-RC2.jar": {
"sha1": "a416a6e9f3c00ba5f0c58091bbe20128117720ff",
"sha256": "sha256-VSmq3nuZWEmDRvXHvnD+3VIrYmg0FlJmaIJ9j3mNbaE="
}
}
},
@@ -20743,28 +20769,28 @@
},
{
"path": "org/jetbrains/kotlin/kotlin-stdlib/2.0.0-RC3",
"path": "org/jetbrains/kotlin/kotlin-stdlib/2.0.0-RC2",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"kotlin-stdlib-2.0.0-RC3.pom": {
"sha1": "7fb5dbef4bdc345da221fecbd12ddbcf6bbe3160",
"sha256": "sha256-zUpUNgRDkBPpPf5Czq/zFbV0Fy6PWdc4u7Ast9mrP38="
"kotlin-stdlib-2.0.0-RC2.pom": {
"sha1": "a0173de9669d2b669a0a9331abc10eed854c7578",
"sha256": "sha256-P5+BoFtN2UXxa5nt5GUj/36Ts2zN2qRIKsbvj519M2g="
},
"kotlin-stdlib-2.0.0-RC3-all.jar": {
"kotlin-stdlib-2.0.0-RC2-all.jar": {
"sha1": "e6142a28b5fa6722cd811dd86278ad056784fa40",
"sha256": "sha256-MOBSIrwGf/+4lqMna18ePylFC/HZRh0noZzg78eTtc0="
},
"kotlin-stdlib-2.0.0-RC3-common.jar": {
"kotlin-stdlib-2.0.0-RC2-common.jar": {
"sha1": "281e03983850e590dcc0d2474758f2fa8dd0e96a",
"sha256": "sha256-EsHDu0lApPmVlUD/tc8uLl6brNtoywDEvSidFjm9HSc="
},
"kotlin-stdlib-2.0.0-RC3.jar": {
"sha1": "37bea4f33a0d1823317f1210048928030077ec38",
"sha256": "sha256-B2a3hUy+BDpaysUyZ3CUvh9ua0iT54/a2SXC64Mks3Y="
"kotlin-stdlib-2.0.0-RC2.jar": {
"sha1": "504eb64ad16be7612c962dd198a511a809800d80",
"sha256": "sha256-nFMX9JplxBB9EJM5WG+LfW95ehOyI0zMR5CGQZDpQVo="
},
"kotlin-stdlib-2.0.0-RC3.module": {
"sha1": "83a7913d9fd48986a323feb3fccc2b1049182fab",
"sha256": "sha256-vpppwKPQSAwqZ2ff0DPELmM87yPovzFuqKy8Osz9piE="
"kotlin-stdlib-2.0.0-RC2.module": {
"sha1": "ec60b751c2b289581aed1cf553d477048a890cc4",
"sha256": "sha256-18U/l65G+3O8wy1oZbKJ+MSv8fv3yvfaXIllxukU+wg="
}
}
},
@@ -21149,16 +21175,16 @@
},
{
"path": "org/mockito/mockito-core/5.12.0",
"path": "org/mockito/mockito-core/5.11.0",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"mockito-core-5.12.0.pom": {
"sha1": "63bde3dc82d8ee626ecf765f61a1ce7b8c68cb96",
"sha256": "sha256-bccvwKe1NHdVVfgzB0hiqcUwE6ZzOD4hMStYHKI7dhI="
"mockito-core-5.11.0.pom": {
"sha1": "456cc29c4ed1d6e11efe7a92bdaae1ea5999a49d",
"sha256": "sha256-ugsbXXA1CUlPmo5EWCIjh54zSKTElmfwx35odG5IHHg="
},
"mockito-core-5.12.0.jar": {
"sha1": "22f8bbaf478e6789164787fa411a3b5ed986e110",
"sha256": "sha256-Si6ykjcFDadJ6QpG+Ui85+JuwitnHkH1mxrG9LZAgik="
"mockito-core-5.11.0.jar": {
"sha1": "e4069fa4f4ff2c94322cfec5f2e45341c6c70aff",
"sha256": "sha256-8HbJax9JuNm8QuRrCWmq9WhMQMi1tnnUAOXYgAc6DgA="
}
}
},
+1
View File
@@ -774,6 +774,7 @@ org.jetbrains.kotlinx:atomicfu:0.16.3
org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2
org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1
org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.1
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.4.1
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.0
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.1
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1
+21 -19
View File
@@ -628,22 +628,22 @@ https://repo.maven.apache.org/maven2/com/facebook/soloader/soloader/0.10.1/soloa
https://repo.maven.apache.org/maven2/com/facebook/soloader/soloader/0.10.5/soloader-0.10.5.pom
https://repo.maven.apache.org/maven2/com/facebook/yoga/proguard-annotations/1.19.0/proguard-annotations-1.19.0.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.11.1/jackson-annotations-2.11.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.17.1/jackson-annotations-2.17.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.17.0/jackson-annotations-2.17.0.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-core/2.11.1/jackson-core-2.11.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-core/2.17.1/jackson-core-2.17.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-core/2.17.0/jackson-core-2.17.0.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.11.1/jackson-databind-2.11.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.17.1/jackson-databind-2.17.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.17.0/jackson-databind-2.17.0.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/dataformat/jackson-dataformat-xml/2.11.1/jackson-dataformat-xml-2.11.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-base/2.11.1/jackson-base-2.11.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-base/2.17.1/jackson-base-2.17.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-base/2.17.0/jackson-base-2.17.0.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-bom/2.11.1/jackson-bom-2.11.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-bom/2.17.1/jackson-bom-2.17.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-bom/2.17.0/jackson-bom-2.17.0.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-parent/2.11/jackson-parent-2.11.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-parent/2.17/jackson-parent-2.17.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/module/jackson-modules-base/2.11.1/jackson-modules-base-2.11.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/module/jackson-modules-base/2.17.1/jackson-modules-base-2.17.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/module/jackson-modules-base/2.17.0/jackson-modules-base-2.17.0.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.11.1/jackson-module-jaxb-annotations-2.11.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.17.1/jackson-module-jaxb-annotations-2.17.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.17.0/jackson-module-jaxb-annotations-2.17.0.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/module/jackson-module-kotlin/2.11.1/jackson-module-kotlin-2.11.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/oss-parent/38/oss-parent-38.pom
https://repo.maven.apache.org/maven2/com/fasterxml/oss-parent/58/oss-parent-58.pom
@@ -740,8 +740,8 @@ https://repo.maven.apache.org/maven2/com/google/guava/guava-parent/30.1-jre/guav
https://repo.maven.apache.org/maven2/com/google/guava/guava-parent/31.0.1-android/guava-parent-31.0.1-android.pom
https://repo.maven.apache.org/maven2/com/google/guava/guava-parent/31.0.1-jre/guava-parent-31.0.1-jre.pom
https://repo.maven.apache.org/maven2/com/google/guava/guava-parent/31.1-jre/guava-parent-31.1-jre.pom
https://repo.maven.apache.org/maven2/com/google/guava/guava-parent/33.2.0-jre/guava-parent-33.2.0-jre.pom
https://repo.maven.apache.org/maven2/com/google/guava/guava-testlib/33.2.0-jre/guava-testlib-33.2.0-jre.pom
https://repo.maven.apache.org/maven2/com/google/guava/guava-parent/33.1.0-jre/guava-parent-33.1.0-jre.pom
https://repo.maven.apache.org/maven2/com/google/guava/guava-testlib/33.1.0-jre/guava-testlib-33.1.0-jre.pom
https://repo.maven.apache.org/maven2/com/google/guava/guava/17.0/guava-17.0.pom
https://repo.maven.apache.org/maven2/com/google/guava/guava/22.0/guava-22.0.pom
https://repo.maven.apache.org/maven2/com/google/guava/guava/23.0/guava-23.0.pom
@@ -754,7 +754,7 @@ https://repo.maven.apache.org/maven2/com/google/guava/guava/30.1-jre/guava-30.1-
https://repo.maven.apache.org/maven2/com/google/guava/guava/31.0.1-android/guava-31.0.1-android.pom
https://repo.maven.apache.org/maven2/com/google/guava/guava/31.0.1-jre/guava-31.0.1-jre.pom
https://repo.maven.apache.org/maven2/com/google/guava/guava/31.1-jre/guava-31.1-jre.pom
https://repo.maven.apache.org/maven2/com/google/guava/guava/33.2.0-jre/guava-33.2.0-jre.pom
https://repo.maven.apache.org/maven2/com/google/guava/guava/33.1.0-jre/guava-33.1.0-jre.pom
https://repo.maven.apache.org/maven2/com/google/guava/listenablefuture/1.0/listenablefuture-1.0.pom
https://repo.maven.apache.org/maven2/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.pom
https://repo.maven.apache.org/maven2/com/google/j2objc/j2objc-annotations/1.1/j2objc-annotations-1.1.pom
@@ -768,7 +768,7 @@ https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-bom/3.13.0/pro
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-bom/3.17.2/protobuf-bom-3.17.2.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-bom/3.19.2/protobuf-bom-3.19.2.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-bom/3.19.3/protobuf-bom-3.19.3.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-bom/4.27.0-RC3/protobuf-bom-4.27.0-RC3.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-bom/4.27.0-RC1/protobuf-bom-4.27.0-RC1.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-javalite/3.17.2/protobuf-javalite-3.17.2.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-javalite/3.19.2/protobuf-javalite-3.19.2.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-java-util/3.4.0/protobuf-java-util-3.4.0.pom
@@ -785,7 +785,7 @@ https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-java/3.13.0/pr
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-java/3.17.2/protobuf-java-3.17.2.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-java/3.19.2/protobuf-java-3.19.2.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-java/3.19.3/protobuf-java-3.19.3.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-java/4.27.0-RC3/protobuf-java-4.27.0-RC3.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-java/4.27.0-RC1/protobuf-java-4.27.0-RC1.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-lite/3.0.1/protobuf-lite-3.0.1.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-parent/3.0.0/protobuf-parent-3.0.0.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-parent/3.4.0/protobuf-parent-3.4.0.pom
@@ -796,7 +796,7 @@ https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-parent/3.13.0/
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-parent/3.17.2/protobuf-parent-3.17.2.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-parent/3.19.2/protobuf-parent-3.19.2.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-parent/3.19.3/protobuf-parent-3.19.3.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-parent/4.27.0-RC3/protobuf-parent-4.27.0-RC3.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-parent/4.27.0-RC1/protobuf-parent-4.27.0-RC1.pom
https://repo.maven.apache.org/maven2/com/google/truth/truth-parent/1.4.2/truth-parent-1.4.2.pom
https://repo.maven.apache.org/maven2/com/google/truth/truth/1.4.2/truth-1.4.2.pom
https://repo.maven.apache.org/maven2/com/ibm/icu/icu4j/53.1/icu4j-53.1.pom
@@ -963,13 +963,15 @@ https://repo.maven.apache.org/maven2/junit/junit/4.13.2/junit-4.13.2.pom
https://repo.maven.apache.org/maven2/me/zhanghai/android/materialprogressbar/library/1.4.2/library-1.4.2.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy-agent/1.11.13/byte-buddy-agent-1.11.13.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy-agent/1.11.19/byte-buddy-agent-1.11.19.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy-agent/1.14.15/byte-buddy-agent-1.14.15.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy-agent/1.14.12/byte-buddy-agent-1.14.12.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy-parent/1.11.13/byte-buddy-parent-1.11.13.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy-parent/1.11.19/byte-buddy-parent-1.11.19.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy-parent/1.14.15/byte-buddy-parent-1.14.15.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy-parent/1.14.9/byte-buddy-parent-1.14.9.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy-parent/1.14.12/byte-buddy-parent-1.14.12.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy/1.11.13/byte-buddy-1.11.13.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy/1.11.19/byte-buddy-1.11.19.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy/1.14.15/byte-buddy-1.14.15.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy/1.14.9/byte-buddy-1.14.9.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy/1.14.12/byte-buddy-1.14.12.pom
https://repo.maven.apache.org/maven2/net/java/dev/jna/jna-platform/5.6.0/jna-platform-5.6.0.pom
https://repo.maven.apache.org/maven2/net/java/dev/jna/jna/5.6.0/jna-5.6.0.pom
https://repo.maven.apache.org/maven2/net/java/jvnet-parent/1/jvnet-parent-1.pom
@@ -1245,7 +1247,7 @@ https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-reflect/1.6.10/
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-reflect/1.6.20/kotlin-reflect-1.6.20.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-reflect/1.7.22/kotlin-reflect-1.7.22.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-reflect/1.8.20-RC2/kotlin-reflect-1.8.20-RC2.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-reflect/2.0.0-RC3/kotlin-reflect-2.0.0-RC3.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-reflect/2.0.0-RC2/kotlin-reflect-2.0.0-RC2.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-scripting-common/1.6.20/kotlin-scripting-common-1.6.20.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-scripting-common/1.7.22/kotlin-scripting-common-1.7.22.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-scripting-common/1.8.0/kotlin-scripting-common-1.8.0.pom
@@ -1347,7 +1349,7 @@ https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.8.20-R
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.8.21/kotlin-stdlib-1.8.21.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.9.0/kotlin-stdlib-1.9.0.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.9.21/kotlin-stdlib-1.9.21.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/2.0.0-RC3/kotlin-stdlib-2.0.0-RC3.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/2.0.0-RC2/kotlin-stdlib-2.0.0-RC2.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-tooling-core/1.7.22/kotlin-tooling-core-1.7.22.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-tooling-core/1.8.0/kotlin-tooling-core-1.8.0.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-tooling-core/1.9.0/kotlin-tooling-core-1.9.0.pom
@@ -1373,7 +1375,7 @@ https://repo.maven.apache.org/maven2/org/jvnet/staxex/stax-ex/1.8/stax-ex-1.8.po
https://repo.maven.apache.org/maven2/org/jvnet/staxex/stax-ex/2.1.0/stax-ex-2.1.0.pom
https://repo.maven.apache.org/maven2/org/mockito/mockito-core/3.12.4/mockito-core-3.12.4.pom
https://repo.maven.apache.org/maven2/org/mockito/mockito-core/4.0.0/mockito-core-4.0.0.pom
https://repo.maven.apache.org/maven2/org/mockito/mockito-core/5.12.0/mockito-core-5.12.0.pom
https://repo.maven.apache.org/maven2/org/mockito/mockito-core/5.11.0/mockito-core-5.11.0.pom
https://repo.maven.apache.org/maven2/org/mockito/mockito-inline/4.0.0/mockito-inline-4.0.0.pom
https://repo.maven.apache.org/maven2/org/objenesis/objenesis-parent/3.2/objenesis-parent-3.2.pom
https://repo.maven.apache.org/maven2/org/objenesis/objenesis-parent/3.3/objenesis-parent-3.3.pom
+1
View File
@@ -34,5 +34,6 @@ react-native-static-safe-area-insets
react-native-status
react-native-status-keycard
react-native-svg
react-native-transparent-video
react-native-webview
walletconnect_react-native-compat
+1 -1
View File
@@ -57,7 +57,7 @@ in {
yarn = super.yarn.override { nodejs = super.nodejs-18_x; };
openjdk = super.openjdk11_headless;
xcodeWrapper = callPackage ./pkgs/xcodeenv/compose-xcodewrapper.nix { } {
versions = ["15.1" "15.2"];
versions = ["15.1"];
};
go = super.go_1_20;
clang = super.clang_15;
+1
View File
@@ -66,6 +66,7 @@
"react-native-static-safe-area-insets": "^2.2.0",
"react-native-status-keycard": "git+https://github.com/status-im/react-native-status-keycard.git#refs/tags/v2.5.39",
"react-native-svg": "13.10.0",
"react-native-transparent-video": "git+https://github.com/status-im/react-native-transparent-video.git#refs/tags/0.1.1",
"react-native-webview": "13.6.3",
"react-syntax-highlighter": "^15.5.0"
},
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-25
View File
@@ -1,25 +0,0 @@
import {
useDerivedValue,
interpolate,
interpolateColor,
Extrapolation,
useAnimatedStyle,
} from 'react-native-reanimated';
const CLAMP_MIN = 0;
const CLAMP_MAX = 60;
const BLUR_MIN = 1;
const BLUR_MAX = 15;
export const useBlurAmount = (sharedValue) =>
useDerivedValue(() =>
parseInt(interpolate(sharedValue.value, [CLAMP_MIN, CLAMP_MAX], [BLUR_MIN, BLUR_MAX], Extrapolation.CLAMP)),
);
export function useLayerOpacity(sharedValue, from, to) {
return useAnimatedStyle(() => ({
flex: 1,
justifyContent: 'flex-end',
backgroundColor: interpolateColor(sharedValue.value, [0, 60], [from, to], 'RGB'),
}));
}
+46
View File
@@ -0,0 +1,46 @@
import { useAnimatedStyle, useAnimatedSensor, withTiming, interpolate, SensorType } from 'react-native-reanimated';
import { Platform } from 'react-native';
const PI = Math.PI;
/*
sensorAnimatedImage uses the pitch and roll of a device to move the content on screen in the respective direction.
This approach mostly follows the example here:
https://github.com/notJust-dev/iOSLockScreen/blob/main/src/components/SensorAnimatedImage.js
which is explained in better detail in this video
https://www.youtube.com/watch?v=iEBoZDHCN5Y&t=2205s
there is a bug with the pitch and roll calculations provided directly from the sensor data so the calculation had to
be done using the quaternions directly.
This link is useful to understand this: https://engineering.stackexchange.com/questions/3348/calculating-pitch-yaw-and-roll-from-mag-acc-and-gyro-data
*/
export function sensorAnimatedImage(zIndex, offset, stretch) {
'worklet';
const rotationSensor = useAnimatedSensor(SensorType.ROTATION, { interval: 30 });
return useAnimatedStyle(function () {
const { qx, qz, qw, qy, pitch } = rotationSensor.sensor.value;
const roll = Math.asin(-2.0 * (qx * qz - qw * qy));
const translateY = withTiming(
interpolate(pitch, Platform.OS === 'ios' ? [-PI, PI] : [PI, -PI], [
(-offset * 3) / zIndex - offset + (offset - stretch),
(offset * 3) / zIndex - offset + (offset - stretch),
]),
{ duration: 10 },
);
const translateX = withTiming(
interpolate(
roll,
[1, -1],
[(-offset * 2) / zIndex - offset + (offset - stretch), (offset * 2) / zIndex - offset + (offset - stretch)],
),
{ duration: 10 },
);
return {
transform: [{ translateX }, { translateY }],
};
});
}
-2
View File
@@ -418,7 +418,6 @@
"react-native-transparent-video" react-native-transparent-video
"react-native-orientation-locker" react-native-orientation-locker
"react-native-gifted-charts" react-native-gifted-charts
"@walletconnect/react-native-compat" #js {}
"../resources/data/emojis/en.json" (js/JSON.parse
(slurp
"./resources/data/emojis/en.json"))
@@ -438,7 +437,6 @@
"../src/js/worklets/parallax.js" #js {}
"../src/js/worklets/profile_header.js" #js {}
"../src/js/worklets/identifiers_highlighting.js" #js {}
"../src/js/worklets/header_animations.js" #js {}
"./fleets.js" default-fleets
"../translations/ar.json" (js/JSON.parse (slurp "./translations/ar.json"))
"../translations/de.json" (js/JSON.parse (slurp "./translations/de.json"))
@@ -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
@@ -1,61 +0,0 @@
(ns quo.components.community.community-token-gating.component-spec
(:require
[quo.core :as quo]
[test-helpers.component :as h]))
(h/describe "Community Detail Token Gating Component"
(h/test "render with satisfied permissions"
(let [mock-on-press-fn (h/mock-fn)
mock-on-press-info-fn (h/mock-fn)]
(h/render
[quo/community-token-gating
{:tokens [[{:symbol "ETH"
:sufficient? true
:collectible? false
:amount "0.8"
:img-src nil}]
[{:symbol "ETH"
:sufficient? false
:collectible? false
:amount "1"
:img-src nil}
{:symbol "STT"
:sufficient? false
:collectible? false
:amount "10"
:img-src nil}]]
:community-color "#FF0000"
:role "Member"
:satisfied? true
:on-press mock-on-press-fn
:on-press-info mock-on-press-info-fn}])
(h/is-truthy (h/get-by-translation-text :t/you-eligible-to-join-as {:role "Member"}))
(h/is-truthy (h/get-by-text "0.8 ETH"))
(h/is-truthy (h/get-by-text "1 ETH"))
(h/is-truthy (h/get-by-text "10 STT"))
(h/fire-event :press (h/get-by-translation-text :t/request-to-join))
(h/was-called mock-on-press-fn)
(h/fire-event :press (h/get-by-label-text :community-token-gating-info))
(h/was-called mock-on-press-info-fn)))
(h/test "render with unsatisfied permissions"
(let [mock-on-press-fn (h/mock-fn)
mock-on-press-info-fn (h/mock-fn)]
(h/render
[quo/community-token-gating
{:tokens [[{:symbol "ETH"
:sufficient? false
:collectible? false
:amount "0.8"
:img-src nil}]]
:community-color "#FF0000"
:role "Member"
:satisfied? false
:on-press mock-on-press-fn
:on-press-info mock-on-press-info-fn}])
(h/is-truthy (h/get-by-translation-text :t/you-not-eligible-to-join))
(h/is-truthy (h/get-by-text "0.8 ETH"))
(h/fire-event :press (h/get-by-translation-text :t/request-to-join))
(h/was-not-called mock-on-press-fn)
(h/fire-event :press (h/get-by-label-text :community-token-gating-info))
(h/was-called mock-on-press-info-fn))))
@@ -1,22 +0,0 @@
(ns quo.components.community.community-token-gating.schema)
(def ^:private ?token-schema
[:map
[:symbol :string]
[:sufficient? :boolean]
[:collectible? :boolean]
[:amount {:optional true} [:maybe :string]]
[:img-src {:optional true} [:maybe :schema.common/image-source]]])
(def ?schema
[:=>
[:catn
[:props
[:map
[:tokens [:sequential [:sequential ?token-schema]]]
[:community-color [:or :string :schema.common/customization-color]]
[:role {:optional true} [:maybe :string]]
[:satisfied? :boolean]
[:on-press fn?]
[:on-press-info fn?]]]]
:any])
@@ -1,47 +0,0 @@
(ns quo.components.community.community-token-gating.style
(:require [quo.foundations.colors :as colors]))
(defn container
[theme]
{:padding-bottom 12
:padding-top 10
:border-width 1
:border-color (colors/theme-colors colors/neutral-20 colors/neutral-80 theme)
:border-radius 16
:margin-vertical -4})
(def eligibility-row
{:flex-direction :row
:padding-horizontal 12
:align-items :center})
(def divider
{:height 27
:padding-left 12
:padding-top 0
:align-items :flex-start})
(def eligibility-label
{:flex 1})
(def you-hodl
{:padding-horizontal 12
:margin-bottom 15})
(def join-button
{:padding-horizontal 12
:margin-top 8})
(def token-row
{:flex-direction :row
:padding-horizontal 12
:row-gap 10
:column-gap 8
:flex-wrap :wrap
:margin-bottom 11})
;; This wrapper prevents layout shifts caused by border effects on
;; the view's height when the token has a border.
(def token-wrapper
{:height 26
:justify-content :center})
@@ -1,89 +0,0 @@
(ns quo.components.community.community-token-gating.view
(:require [clojure.string :as string]
[quo.components.buttons.button.view :as button]
[quo.components.community.community-token-gating.schema :as component-schema]
[quo.components.community.community-token-gating.style :as style]
[quo.components.dividers.divider-label.view :as divider-label]
[quo.components.icon :as icon]
[quo.components.markdown.text :as text]
[quo.components.tags.collectible-tag.view :as collectible-tag]
[quo.components.tags.token-tag.view :as token-tag]
[quo.foundations.colors :as colors]
[quo.theme :as theme]
[react-native.core :as rn]
[schema.core :as schema]
[utils.i18n :as i18n]))
(defn- token-view
[{:keys [collectible? img-src amount sufficient?] :as token}]
(let [token-symbol (:symbol token)]
[rn/view {:style style/token-wrapper}
(if collectible?
[collectible-tag/view
{:collectible-name token-symbol
:size :size-24
:collectible-img-src img-src
:options (when sufficient?
:hold)}]
[token-tag/view
{:token-symbol token-symbol
:size :size-24
:token-value amount
:token-img-src img-src
:options (when sufficient? :hold)}])]))
(defn- tokens-row
[{:keys [theme tokens divider?]}]
[:<>
[rn/view
{:style style/token-row}
(map-indexed (fn [token-index token]
^{:key (str "token-" token-index)}
[token-view token])
tokens)]
(when-not divider?
[divider-label/view
{:container-style style/divider}
[text/text
{:size :label
:style {:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)}}
(string/lower-case (i18n/label :t/or))]])])
(defn- view-internal
[{:keys [tokens community-color role satisfied? on-press on-press-info]}]
(let [theme (theme/use-theme)
last-token-index (dec (count tokens))]
[rn/view {:style (style/container theme)}
[rn/view {:style style/eligibility-row}
[text/text
{:size :paragraph-1
:weight :medium
:style style/eligibility-label}
(if satisfied?
(i18n/label :t/you-eligible-to-join-as {:role role})
(i18n/label :t/you-not-eligible-to-join))]
[rn/pressable {:on-press on-press-info}
[icon/icon :i/info
{:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)
:accessibility-label :community-token-gating-info}]]]
[text/text
{:size :paragraph-2
:style style/you-hodl}
(i18n/label (if satisfied? :t/you-hodl :t/you-must-hold))]
(map-indexed (fn [index tokens-item]
^{:key (str role "-tokens-" index)}
[tokens-row
{:tokens tokens-item
:theme theme
:divider? (= index last-token-index)}])
tokens)
[button/button
{:on-press on-press
:container-style style/join-button
:accessibility-label :join-community-button
:customization-color community-color
:disabled? (not satisfied?)
:icon-left (if satisfied? :i/unlocked :i/locked)}
(i18n/label :t/request-to-join)]]))
(def view (schema/instrument #'view-internal component-schema/?schema))
+33
View File
@@ -101,6 +101,39 @@
:top 8
:right 8})
(def token-tag-spacing
{:padding-top 10
:margin-right 8})
(defn token-row
[padding?]
(merge
{:flex-direction :row
:flex-wrap :wrap
:align-items :center}
(when padding?
{:padding-horizontal 12})))
(defn token-row-or-text
[padding? theme]
(merge
{:padding-top 4
:margin-bottom -2
:color (colors/theme-colors
colors/neutral-50
colors/neutral-40
theme)}
(when padding?
{:padding-left 12})))
(defn token-row-or-border
[theme]
{:height 1
:background-color (colors/theme-colors
colors/neutral-20
colors/neutral-80
theme)})
(defn loading-card
[width theme]
(merge
@@ -0,0 +1,44 @@
(ns quo.components.community.token-gating
(:require
[clojure.string :as string]
[quo.components.community.style :as style]
[quo.components.markdown.text :as text]
[quo.components.tags.token-tag.view :as token-tag]
[quo.theme :as quo.theme]
[react-native.core :as rn]
[utils.i18n :as i18n]))
(defn token-requirement-list-row
[tokens padding?]
[rn/view {:style (style/token-row padding?)}
(map-indexed (fn [token-index {:keys [img-src amount sufficient? purchasable?] :as token}]
^{:key token-index}
[rn/view {:style style/token-tag-spacing}
[token-tag/view
{:token-symbol (:symbol token)
:token-img-src img-src
:token-value amount
:size :size-24
:options (cond
sufficient? :hold
purchasable? :add)}]])
tokens)])
(defn token-requirement-list
[{:keys [tokens padding?]}]
(let [theme (quo.theme/use-theme)]
[:<>
(if (> (count tokens) 1)
(map-indexed
(fn [token-requirement-index tokens]
^{:key token-requirement-index}
[rn/view {:margin-bottom 12}
(when-not (= token-requirement-index 0)
[rn/view {:style (style/token-row-or-border theme)}])
(when-not (= token-requirement-index 0)
[text/text
{:style (style/token-row-or-text padding? theme)
:size :label} (string/lower-case (i18n/label :t/or))])
[token-requirement-list-row tokens padding?]])
tokens)
[token-requirement-list-row (first tokens) padding?])]))
@@ -9,18 +9,20 @@
(merge {:padding-horizontal 20
:padding-top 8
:padding-bottom 16
:height 48
:flex-direction :row
:align-items :flex-start}
container-style))
(def buttons-container
{:flex-direction :row
:align-items :flex-start})
:align-items :center
:padding-top (when platform/android? 2)})
(def clear-icon-container
{:justify-content :flex-start
{:justify-content :center
:align-items :center
:padding-top (when platform/ios? 4)
:padding-top (if platform/ios? 6 2)
:height 24
:width 20})
@@ -31,10 +33,9 @@
nil)
:flex 1
:color (colors/theme-colors colors/neutral-100 colors/white theme)
:margin-top -4
:margin-top (if platform/ios? 0 -4)
:margin-right 8
:max-height 50
:padding 0))
:height (if platform/ios? 24 40)))
(defn accessory-button
[blur? theme]
@@ -128,7 +128,6 @@
:auto-capitalize :none
:auto-correct false
:spell-check false
:multiline true
:keyboard-appearance theme
:on-focus on-focus
:on-blur on-blur
@@ -13,12 +13,13 @@
:align-items :center})
(defn center-content-container
[centered?]
[centered? center-opacity]
{:flex 1
:margin-horizontal 12
:flex-direction :row
:align-items :center
:justify-content (if centered? :center :flex-start)})
:justify-content (if centered? :center :flex-start)
:opacity center-opacity})
(def right-actions-container
{:flex-direction :row})
@@ -99,13 +99,14 @@
(def threshold (- header-height page-nav-height))
(defn- title-center
[{:keys [title scroll-y center-content-container-style]}]
[{:keys [centered? title center-opacity scroll-y]}]
(let [animated-style (when scroll-y
(header-worklet/profile-header-animation scroll-y
threshold
page-nav-height))]
[reanimated/view
{:style [center-content-container-style animated-style]}
{:style [(style/center-content-container centered? center-opacity)
animated-style]}
[text/text
{:weight :medium
:size :paragraph-1
@@ -113,15 +114,14 @@
title]]))
(defn- dropdown-center
[{:keys [background dropdown-on-press dropdown-selected? dropdown-text
center-content-container-style]}]
[{:keys [background dropdown-on-press dropdown-selected? dropdown-text center-opacity]}]
(let [theme (quo.theme/use-theme)
dropdown-type (cond
(= background :photo) :grey
(and (= theme :dark) (= background :blur)) :grey
:else :ghost)
dropdown-state (if dropdown-selected? :active :default)]
[reanimated/view {:style center-content-container-style}
[reanimated/view {:style (style/center-content-container true center-opacity)}
[dropdown/view
{:type dropdown-type
:state dropdown-state
@@ -131,9 +131,9 @@
dropdown-text]]))
(defn- token-center
[{:keys [background token-logo token-name token-abbreviation center-content-container-style]}]
[{:keys [background token-logo token-name token-abbreviation center-opacity]}]
(let [theme (quo.theme/use-theme)]
[reanimated/view {:style center-content-container-style}
[reanimated/view {:style (style/center-content-container false center-opacity)}
[rn/image {:style style/token-logo :source token-logo}]
[text/text
{:style style/token-name
@@ -149,9 +149,9 @@
token-abbreviation]]))
(defn- channel-center
[{:keys [background channel-emoji channel-name channel-icon center-content-container-style]}]
[{:keys [background channel-emoji channel-name channel-icon center-opacity]}]
(let [theme (quo.theme/use-theme)]
[reanimated/view {:style center-content-container-style}
[reanimated/view {:style (style/center-content-container false center-opacity)}
[rn/text {:style style/channel-emoji}
channel-emoji]
[text/text
@@ -163,9 +163,9 @@
[icons/icon channel-icon {:size 16 :color (style/channel-icon-color theme background)}]]))
(defn- title-description-center
[{:keys [background picture title description center-content-container-style]}]
[{:keys [background picture title description center-opacity]}]
(let [theme (quo.theme/use-theme)]
[reanimated/view {:style center-content-container-style}
[reanimated/view {:style (style/center-content-container false center-opacity)}
(when picture
[rn/view {:style style/group-avatar-picture}
[group-avatar/view {:picture picture :size :size-28}]])
@@ -184,11 +184,11 @@
description]]]))
(defn- community-network-center
[{:keys [type community-logo network-logo community-name network-name center-content-container-style]}]
[{:keys [type community-logo network-logo community-name network-name center-opacity]}]
(let [community? (= type :community)
shown-logo (if community? community-logo network-logo)
shown-name (if community? community-name network-name)]
[reanimated/view {:style center-content-container-style}
[reanimated/view {:style (style/center-content-container false center-opacity)}
[rn/image
{:style style/community-network-logo
:source shown-logo}]
@@ -199,8 +199,8 @@
shown-name]]))
(defn- wallet-networks-center
[{:keys [networks networks-on-press background center-content-container-style]}]
[reanimated/view {:style center-content-container-style}
[{:keys [networks networks-on-press background center-opacity]}]
[reanimated/view {:style (style/center-content-container true center-opacity)}
[network-dropdown/view
{:state :default
:on-press networks-on-press
@@ -250,91 +250,82 @@
`:network`
- network-name
- network-logo a valid rn/image `:source` value"
[{:keys [type right-side background text-align behind-overlay? center-opacity]
[{:keys [type right-side background text-align behind-overlay?]
:or {type :no-title
text-align :center
right-side :none
background :white}
:as props}]
(let [center-content-container-style (reanimated/apply-animations-to-style
(if center-opacity
{:opacity center-opacity}
nil)
(style/center-content-container
(and (= type :title) (= text-align :center))))
props-with-style (assoc props
:center-content-container-style
center-content-container-style)]
(case type
:no-title
[page-nav-base props
[right-content
{:background background
:content right-side
:max-actions 3
:behind-overlay? behind-overlay?}]]
(case type
:no-title
[page-nav-base props
[right-content
{:background background
:content right-side
:max-actions 3
:behind-overlay? behind-overlay?}]]
:title
(let [centered? (= text-align :center)]
[page-nav-base props
[title-center props-with-style]
[right-content
{:background background
:content right-side
:max-actions (if centered? 1 3)
:min-size? centered?}]])
:dropdown
:title
(let [centered? (= text-align :center)]
[page-nav-base props
[dropdown-center props-with-style]
[right-content
{:background background
:content right-side
:max-actions 1
:support-account-switcher? false}]]
:token
[page-nav-base props
[token-center props-with-style]
[title-center (assoc props :centered? centered?)]
[right-content
{:background background
:content right-side
:max-actions 3}]]
:max-actions (if centered? 1 3)
:min-size? centered?}]])
:channel
[page-nav-base props
[channel-center props-with-style]
[right-content
{:background background
:content right-side
:max-actions 3
:support-account-switcher? false}]]
:dropdown
[page-nav-base props
[dropdown-center props]
[right-content
{:background background
:content right-side
:max-actions 1
:support-account-switcher? false}]]
:title-description
[page-nav-base props
[title-description-center props-with-style]
[right-content
{:background background
:content right-side
:max-actions 2
:support-account-switcher? false}]]
:token
[page-nav-base props
[token-center props]
[right-content
{:background background
:content right-side
:max-actions 3}]]
:wallet-networks
[page-nav-base props
[wallet-networks-center props-with-style]
[right-content
{:background background
:content right-side
:max-actions 3
:min-size? true}]]
:channel
[page-nav-base props
[channel-center props]
[right-content
{:background background
:content right-side
:max-actions 3
:support-account-switcher? false}]]
(:community :network)
[page-nav-base props
[community-network-center props-with-style]
[right-content
{:background background
:content right-side
:max-actions 3
:support-account-switcher? false}]]
:title-description
[page-nav-base props
[title-description-center props]
[right-content
{:background background
:content right-side
:max-actions 2
:support-account-switcher? false}]]
nil)))
:wallet-networks
[page-nav-base props
[wallet-networks-center props]
[right-content
{:background background
:content right-side
:max-actions 3
:min-size? true}]]
(:community :network)
[page-nav-base props
[community-network-center props]
[right-content
{:background background
:content right-side
:max-actions 3
:support-account-switcher? false}]]
nil))
@@ -1,10 +1,13 @@
(ns quo.components.profile.expanded-collectible.style
(:require [quo.foundations.colors :as colors]))
(:require [quo.foundations.colors :as colors]
[quo.foundations.shadows :as shadows]))
(def container
{:align-items :center
:justify-content :center
:border-radius 16})
(defn container
[theme]
(merge (shadows/get 2 theme)
{:align-items :center
:justify-content :center
:border-radius 16}))
(defn image
[square? aspect-ratio]
@@ -34,8 +34,7 @@
label]])
(defn view-internal
[{:keys [container-style square? on-press counter image-src native-ID supported-file?
on-collectible-load]}]
[{:keys [container-style square? on-press counter image-src native-ID supported-file?]}]
(let [theme (quo.theme/use-theme)
[image-size set-image-size] (rn/use-state {})
[image-error? set-image-error] (rn/use-state false)]
@@ -49,7 +48,7 @@
[rn/pressable
{:on-press (when (and (not image-error?) supported-file?) on-press)
:accessibility-label :expanded-collectible
:style (merge container-style style/container)}
:style (merge container-style (style/container theme))}
(cond
(not supported-file?)
[fallback-view
@@ -69,8 +68,7 @@
{:style (style/image square? (:aspect-ratio image-size))
:source image-src
:native-ID native-ID
:on-error #(set-image-error true)
:on-load on-collectible-load}]
:on-error #(set-image-error true)}]
[counter-view counter]])]))
(def ?schema
@@ -84,8 +82,7 @@
[:native-ID {:optional true} [:maybe [:or string? keyword?]]]
[:square? {:optional true} [:maybe boolean?]]
[:counter {:optional true} [:maybe string?]]
[:on-press {:optional true} [:maybe fn?]]
[:on-collectible-load {:optional true} [:maybe fn?]]]]]
[:on-press {:optional true} [:maybe fn?]]]]]
:any])
(def view (schema/instrument #'view-internal ?schema))
+2 -2
View File
@@ -35,9 +35,9 @@
quo.components.community.community-detail-token-gating.view
quo.components.community.community-list-view
quo.components.community.community-stat.view
quo.components.community.community-token-gating.view
quo.components.community.community-view
quo.components.community.icon
quo.components.community.token-gating
quo.components.counter.collectible-counter.view
quo.components.counter.counter.view
quo.components.counter.step.view
@@ -227,7 +227,6 @@
;;;; Community
(def community-card-view-item quo.components.community.community-card-view/view)
(def community-detail-token-gating quo.components.community.community-detail-token-gating.view/view)
(def community-token-gating quo.components.community.community-token-gating.view/view)
(def communities-membership-list-item
quo.components.community.community-list-view/communities-membership-list-item)
(def community-stats-column quo.components.community.community-view/community-stats-column)
@@ -237,6 +236,7 @@
(def permission-tag-container quo.components.community.community-view/permission-tag-container)
(def discover-card quo.components.community.banner.view/view)
(def community-icon quo.components.community.icon/community-icon)
(def token-requirement-list quo.components.community.token-gating/token-requirement-list)
(def channel-action quo.components.community.channel-action.view/view)
(def channel-actions quo.components.community.channel-actions.view/view)
-1
View File
@@ -18,7 +18,6 @@
quo.components.colors.color-picker.component-spec
quo.components.community.community-detail-token-gating.component-spec
quo.components.community.community-stat.component-spec
quo.components.community.community-token-gating.component-spec
quo.components.counter.collectible-counter.component-spec
quo.components.counter.counter.component-spec
quo.components.counter.step.component-spec
+8
View File
@@ -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 []))
+2 -2
View File
@@ -15,7 +15,7 @@
[_]
(let [loaded? (reagent/atom false)
error? (reagent/atom false)]
(fn [{:keys [source fallback-content] :as props}]
(fn [{:keys [source] :as props}]
[fast-image-class
(merge
props
@@ -35,6 +35,6 @@
(when (or @error? (not @loaded?))
[placeholder (:style props)
(if @error?
(or fallback-content [rn/text "X"])
[rn/text "X"]
(when-not @loaded?
[rn/activity-indicator {:animating true}]))])])))
+6
View File
@@ -0,0 +1,6 @@
(ns react-native.transparent-video
(:require
["react-native-transparent-video" :default TV]
[reagent.core :as reagent]))
(def view (reagent/adapt-react-class TV))
+2 -2
View File
@@ -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)))))))
-22
View File
@@ -1,22 +0,0 @@
(ns react-native.wallet-connect
(:require
["@walletconnect/core" :refer [Core]]
["@walletconnect/utils" :refer [buildApprovedNamespaces]]
["@walletconnect/web3wallet" :refer [Web3Wallet]]))
(defn- wallet-connect-core
[project-id]
(Core. #js {:projectId project-id}))
(defn init
[project-id metadata]
(let [core (wallet-connect-core project-id)]
(Web3Wallet.init
(clj->js {:core core
:metadata metadata}))))
(defn build-approved-namespaces
[proposal supported-namespaces]
(buildApprovedNamespaces
(clj->js {:proposal proposal
:supportedNamespaces supported-namespaces})))
@@ -0,0 +1,18 @@
(ns status-im.common.parallax.blacklist
(:require
[native-module.core :as native-module]))
(def ^:private device-id (:device-id (native-module/get-device-model-info)))
(defn- get-model-code
[model]
(if-let [[_ code] (and model (re-find #"iPhone(\d+)" model))]
(js/parseInt code 10)
0))
(def ^:private minimum-device-code 11)
(def blacklisted?
(-> device-id
get-model-code
(< minimum-device-code)))
+26
View File
@@ -0,0 +1,26 @@
(ns status-im.common.parallax.style
(:require
[react-native.core :as rn]
[react-native.safe-area :as safe-area]))
(defn outer-container
[container-style]
(merge {:position :absolute
:top (if rn/small-screen? (safe-area/get-top) 0)
:left 0
:right 0
:bottom 0}
container-style))
(def video
{:position :absolute
:top 0
:left 0
:right 0
:bottom 0})
(defn container-view
[width height]
{:position :absolute
:width width
:height height})
+54
View File
@@ -0,0 +1,54 @@
(ns status-im.common.parallax.view
(:require
[react-native.core :as rn]
[react-native.reanimated :as reanimated]
[react-native.transparent-video :as transparent-video]
[status-im.common.parallax.style :as style]
[utils.worklets.parallax :as worklets.parallax]))
(defn f-sensor-animated-video
[{:keys [offset stretch order source disable-parallax? enable-looping?]}]
(let [double-stretch (* 2 stretch)
{window-width :width
window-height :height} (rn/get-window)
image-style (if (not disable-parallax?)
(worklets.parallax/sensor-animated-image order offset stretch)
{:top 0
:right 0
:bottom 0
:left 0})]
(fn []
[reanimated/view
{:needsOffscreenAlphaCompositing true
:style [(style/container-view
(+ window-width double-stretch)
(+ window-height double-stretch))
image-style]}
[transparent-video/view
{:source source
:style style/video
:loop enable-looping?}]])))
(defn sensor-animated-video
[props]
[:f> f-sensor-animated-video props])
(defn f-video
[{:keys [layers disable-parallax? offset stretch container-style enable-looping?]
:or {offset 50 stretch 0}}]
[rn/view
{:style (style/outer-container container-style)}
(map-indexed (fn [idx layer]
[sensor-animated-video
{:key (str layer idx)
:source layer
:offset offset
:stretch stretch
:order (inc idx)
:disable-parallax? disable-parallax?
:enable-looping? enable-looping?}])
layers)])
(defn video
[props]
[:f> f-video props])
+13
View File
@@ -128,6 +128,19 @@
:user-picture-male4 (js/require "../resources/images/mock2/user_picture_male4.png")
:user-picture-male5 (js/require "../resources/images/mock2/user_picture_male5.png")})
(def parallax-video
{:biometrics [(js/require "../resources/videos2/biometrics_01.mp4")
(js/require "../resources/videos2/biometrics_02.mp4")
(js/require "../resources/videos2/biometrics_03.mp4")
(js/require "../resources/videos2/biometrics_04.mp4")]
:generate-keys [(js/require "../resources/videos2/generating_keys_01.mp4")
(js/require "../resources/videos2/generating_keys_02.mp4")
(js/require "../resources/videos2/generating_keys_03.mp4")]
:notifications [(js/require "../resources/videos2/notifications_01.mp4")
(js/require "../resources/videos2/notifications_02.mp4")
(js/require "../resources/videos2/notifications_03.mp4")
(js/require "../resources/videos2/notifications_04.mp4")]})
(def services
{:latamex (js/require "../resources/images/services/Latamex.png")
:moonpay (js/require "../resources/images/services/Moonpay.png")
+1 -1
View File
@@ -22,7 +22,7 @@
:height height
:right 0
:left 0
:background-color (if platform/android?
:background-color (if platform/ios?
(colors/theme-colors
colors/white-opa-70
colors/neutral-95-opa-70
+3 -4
View File
@@ -49,7 +49,7 @@
[:<>
[reanimated/blur-view
{:blur-amount 20
:blur-type :ultraThinMaterial
:blur-type :transparent
:overlay-color :transparent
:style (style/blur-slider translate-animation height theme)}]
[rn/view
@@ -108,7 +108,7 @@
children]
(let [theme (quo.theme/use-theme)]
[:<>
[f-scroll-page-header
[:f> f-scroll-page-header
{:scroll-height @scroll-height
:height height
:sticky-header sticky-header
@@ -119,8 +119,7 @@
:page-nav-props page-nav-props
:overlay-shown? overlay-shown?}]
[rn/scroll-view
{:bounces false
:content-container-style {:flex-grow 1}
{:content-container-style {:flex-grow 1}
:content-inset-adjustment-behavior :never
:shows-vertical-scroll-indicator false
:scroll-event-throttle 16
-11
View File
@@ -257,15 +257,6 @@
(def regx-starts-with-uuid #"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}")
(def regx-full-or-partial-address #"^0x[a-fA-F0-9]{1,40}$")
;; Wallet Connect
(def ^:const wallet-connect-metadata-icon
"https://res.cloudinary.com/dhgck7ebz/image/upload/f_auto,c_limit,w_1080,q_auto/Brand/Logo%20Section/Mark/Mark_01")
(def ^:const wallet-connect-metadata-url "https://status.app")
(def ^:const optimism-crosschain-id "eip155:10")
(def ^:const wallet-connect-supported-methods ["eth_sendTransaction" "personal_sign"])
(def ^:const wallet-connect-supported-events ["accountsChanged" "chainChanged"])
(def ^:const wallet-connect-session-proposal-event "session_proposal")
(def ^:const dapp-permission-contact-code "contact-code")
(def ^:const dapp-permission-web3 "web3")
(def ^:const dapp-permission-qr-code "qr-code")
@@ -467,7 +458,6 @@
#{ethereum-sepolia-chain-id arbitrum-sepolia-chain-id optimism-sepolia-chain-id})
(def ^:const mainnet-short-name "eth")
(def ^:const ethereum-short-name "eth")
(def ^:const optimism-short-name "opt")
(def ^:const arbitrum-short-name "arb1")
@@ -478,7 +468,6 @@
(def ^:const arbitrum-abbreviated-name "Arb1.")
(def ^:const mainnet-network-name :mainnet)
(def ^:const ethereum-network-name :ethereum)
(def ^:const optimism-network-name :optimism)
(def ^:const arbitrum-network-name :arbitrum)
@@ -126,32 +126,25 @@
(-> user-name
(string/replace "<b>" "")
(string/replace "</b>" "")))]
(when (and user-name content)
[rn/view
{:style {:flex-direction :row
:padding-horizontal 12
:padding-top 4}}
[fast-image/fast-image
{:source {:uri user-avatar}
:fallback-content [quo/user-avatar
{:full-name user-name
:ring? false
:online? false
:status-indicator? false
:size :small}]
:style {:width 32
:margin-top 4
:border-radius 16
:height 32}}]
[rn/view {:margin-left 8 :flex 1}
[quo/author
{:primary-name (str user-name)
:short-chat-key (str "Bridged from " bridge-name)
:time-str (datetime/timestamp->time timestamp)}]
[quo/text
{:size :paragraph-1
:style {:line-height 22.75}}
content]]])))
[rn/view
{:style {:flex-direction :row
:padding-horizontal 12
:padding-top 4}}
[fast-image/fast-image
{:source {:uri user-avatar}
:style {:width 32
:margin-top 4
:border-radius 16
:height 32}}]
[rn/view {:margin-left 8 :flex 1}
[quo/author
{:primary-name (str user-name)
:short-chat-key (str "Bridged from " bridge-name)
:time-str (datetime/timestamp->time timestamp)}]
[quo/text
{:size :paragraph-1
:style {:line-height 22.75}}
content]]]))
(declare on-long-press)
@@ -23,21 +23,17 @@
(defn lazy-chat-screen
[chat-screen-layout-calculations-complete?]
(let [screen-loaded? (rf/sub [:shell/chat-screen-loaded?])
distance-from-list-top (reanimated/use-shared-value 0)
chat-list-scroll-y (reanimated/use-shared-value 0)
props {:insets (safe-area/get-insets)
:content-height (atom 0)
:layout-height (atom 0)
:distance-atom (atom 0)
:distance-from-list-top distance-from-list-top
:chat-list-scroll-y chat-list-scroll-y
:chat-screen-layout-calculations-complete?
chat-screen-layout-calculations-complete?}]
(let [screen-loaded? (rf/sub [:shell/chat-screen-loaded?])
props {:insets (safe-area/get-insets)
:content-height (atom 0)
:layout-height (atom 0)
:distance-atom (atom 0)
:distance-from-list-top (reanimated/use-shared-value 0)
:chat-list-scroll-y (reanimated/use-shared-value 0)
:chat-screen-layout-calculations-complete?
chat-screen-layout-calculations-complete?}]
(when-not screen-loaded?
(reanimated/set-shared-value chat-screen-layout-calculations-complete? false)
(reanimated/set-shared-value distance-from-list-top 0)
(reanimated/set-shared-value chat-list-scroll-y 0))
(reanimated/set-shared-value chat-screen-layout-calculations-complete? false))
(when screen-loaded?
[chat-screen props])))
@@ -5,8 +5,8 @@
[status-im.common.muting.helpers :refer [format-mute-till]]
[status-im.constants :as constants]
[status-im.contexts.communities.actions.leave.view :as leave-menu]
[status-im.contexts.communities.actions.permissions-sheet.view :as permissions-sheet]
[status-im.contexts.communities.actions.see-rules.view :as see-rules]
[status-im.contexts.communities.actions.token-gating.view :as token-gating]
[status-im.feature-flags :as ff]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
@@ -39,7 +39,8 @@
:right-icon :i/chevron-right
:accessibility-label :view-token-gating
:on-press #(rf/dispatch [:show-bottom-sheet
{:content (fn [] [permissions-sheet/view id])
{:content (fn [] [token-gating/token-requirements
id])
:padding-bottom-override 16}])
:label (i18n/label :t/view-token-gating)})
@@ -8,4 +8,5 @@
[id]
(let [permissions (rf/sub [:community/token-permissions id])]
[gesture/scroll-view
[quo/community-detail-token-gating {:permissions permissions}]]))
[quo/community-detail-token-gating {:permissions permissions}]
]))
@@ -0,0 +1,21 @@
(ns status-im.contexts.communities.actions.token-gating.view
(:require
[quo.core :as quo]
[react-native.core :as rn]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn token-requirements
[]
(fn [id]
(let [{:keys [can-request-access? tokens]} (rf/sub [:community/token-gated-overview id])]
[rn/view {:style {:padding-horizontal 20}}
[quo/text {:weight :medium}
(if can-request-access?
(i18n/label :t/you-eligible-to-join)
(i18n/label :t/you-not-eligible-to-join))]
[quo/text {:style {:padding-bottom 8} :size :paragraph-2}
(if can-request-access?
(i18n/label :t/you-hodl)
(i18n/label :t/you-must-hold))]
[quo/token-requirement-list {:tokens tokens}]])))
@@ -1,5 +1,6 @@
(ns status-im.contexts.communities.overview.style
(:require
[quo.foundations.colors :as colors]
[status-im.contexts.shell.jump-to.constants :as jump-to.constants]))
(def screen-horizontal-padding 20)
@@ -15,6 +16,11 @@
(def community-content-container
{:padding-horizontal screen-horizontal-padding})
(def preview-user
{:flex-direction :row
:align-items :center
:margin-top 20})
(defn fetching-placeholder
[top-inset]
{:flex 1
@@ -28,6 +34,12 @@
:left 0
:flex 1})
(def review-notice
{:color colors/neutral-50
:margin-top 12
:margin-left :auto
:margin-right :auto})
(def community-overview-container
{:position :absolute
:top 0
@@ -44,3 +56,11 @@
{:margin-top 8
:margin-bottom (+ 21 jump-to.constants/floating-shell-button-height)
:flex 1})
(defn token-gated-container
[theme]
{:border-radius 16
:border-color (colors/theme-colors colors/neutral-20 colors/neutral-80 theme)
:border-width 1
:padding-top 10
:margin-bottom 106})
@@ -73,26 +73,25 @@
(into #{} (map (comp :name second) channels-list)))
:style (style/channel-list-component)}
(for [[category-id {:keys [chats name collapsed?]}] channels-list]
(when (seq chats)
[rn/view
{:key category-id
;; on-layout fires only when the component re-renders, so
;; in case the category hasn't changed, it will not be fired
:on-layout #(on-category-layout name category-id (int (layout-y %)))}
(when-not (= constants/empty-category-id category-id)
[quo/divider-label
{:on-press #(collapse-category community-id category-id collapsed?)
:chevron-icon (if collapsed? :i/chevron-right :i/chevron-down)
:chevron :left}
name])
(when-not collapsed?
[rn/view {:style {:padding-horizontal 8}}
(let [last-item-index (dec (count chats))]
(map-indexed
(fn [index chat]
^{:key (:id chat)}
[channel-chat-item community-id chat (= index last-item-index)])
chats))])]))])
[rn/view
{:key category-id
;; on-layout fires only when the component re-renders, so
;; in case the category hasn't changed, it will not be fired
:on-layout #(on-category-layout name category-id (int (layout-y %)))}
(when-not (= constants/empty-category-id category-id)
[quo/divider-label
{:on-press #(collapse-category community-id category-id collapsed?)
:chevron-icon (if collapsed? :i/chevron-right :i/chevron-down)
:chevron :left}
name])
(when-not collapsed?
[rn/view {:style {:padding-horizontal 8}}
(let [last-item-index (dec (count chats))]
(map-indexed
(fn [index chat]
^{:key (:id chat)}
[channel-chat-item community-id chat (= index last-item-index)])
chats))])])])
(defn- get-access-type
[access]
@@ -102,6 +101,24 @@
constants/community-on-request-access :request-access
:unknown-access))
(defn- info-button
[]
(let [theme (quo.theme/use-theme)]
[rn/pressable
{:on-press
#(rf/dispatch
[:show-bottom-sheet
{:content
(fn []
[quo/documentation-drawers
{:title (i18n/label :t/token-gated-communities)
:show-button? true
:button-label (i18n/label :t/read-more)
:button-icon :info}
[quo/text {:size :paragraph-2} (i18n/label :t/token-gated-communities-info)]])}])}
[rn/view
[quo/icon :i/info {:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)}]]]))
(defn- network-not-supported
[]
[quo/text (i18n/label :t/network-not-supported)])
@@ -119,39 +136,19 @@
:icon-left :i/communities}
(i18n/label :t/request-to-join)])
(defn- info-button-handler
[]
(rf/dispatch
[:show-bottom-sheet
{:content
(fn []
[quo/documentation-drawers
{:title (i18n/label :t/token-gated-communities)
:show-button? true
:button-label (i18n/label :t/read-more)
:button-icon :info}
[quo/text {:size :paragraph-2}
(i18n/label :t/token-gated-communities-info)]])}]))
(defn- token-requirements
[{:keys [id color role-permissions?]}]
(let [{:keys [can-request-access?
(let [theme (quo.theme/use-theme)
{:keys [can-request-access?
no-member-permission?
tokens
networks-not-supported?
highest-permission-role]} (rf/sub [:community/token-gated-overview id])
highest-role-text
(i18n/label
(communities.utils/role->translation-key highest-permission-role :t/member))
on-press (rn/use-callback (fn []
(if config/community-accounts-selection-enabled?
(rf/dispatch [:open-modal :community-account-selection-sheet
{:community-id id}])
(rf/dispatch [:open-modal :community-requests-to-join
{:id
id}])))
[id])]
(communities.utils/role->translation-key highest-permission-role :t/member))]
(cond
networks-not-supported?
[network-not-supported]
@@ -159,14 +156,36 @@
[request-access-button id color]
:else
[quo/community-token-gating
{:role highest-role-text
:tokens tokens
:community-color color
:satisfied? can-request-access?
:on-press on-press
:on-press-info
info-button-handler}])))
[rn/view {:style (style/token-gated-container theme)}
[rn/view
{:style {:padding-horizontal 12
:flex-direction :row
:align-items :center
:justify-content :space-between
:flex 1}}
[quo/text {:weight :medium}
(if (and can-request-access? highest-permission-role)
(i18n/label :t/you-eligible-to-join-as {:role highest-role-text})
(i18n/label :t/you-not-eligible-to-join))]
[info-button]]
[quo/text {:style {:padding-horizontal 12 :padding-bottom 6} :size :paragraph-2}
(if can-request-access?
(i18n/label :t/you-hodl)
(i18n/label :t/you-must-hold))]
[quo/token-requirement-list
{:tokens tokens
:padding? true}]
[quo/button
{:on-press (if config/community-accounts-selection-enabled?
#(rf/dispatch [:open-modal :community-account-selection-sheet
{:community-id id}])
#(rf/dispatch [:open-modal :community-requests-to-join {:id id}]))
:accessibility-label :join-community-button
:customization-color color
:container-style {:margin-horizontal 12 :margin-top 8 :margin-bottom 12}
:disabled? (not can-request-access?)
:icon-left (if can-request-access? :i/unlocked :i/locked)}
(i18n/label :t/request-to-join)]])))
(defn- join-community
[{:keys [id joined permissions] :as community}]
@@ -360,7 +379,7 @@
:fetching-community-overview
:failed-to-fetch-community-overview)}
[quo/page-nav
{:title (i18n/label :t/community-overview)
{:title "Community Overview"
:type :title
:text-align :left
:icon-name :i/close
@@ -368,9 +387,7 @@
[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?
(i18n/label :t/fetching-community)
(i18n/label :t/failed-to-fetch-community))
:title (if fetching? "Fetching community..." "Failed to fetch community")
:container-style {:flex 1 :justify-content :center}}]]))
(defn- community-card-page-view
@@ -4,6 +4,8 @@
[react-native.core :as rn]
[react-native.safe-area :as safe-area]
[status-im.common.biometric.utils :as biometric]
[status-im.common.parallax.blacklist :as blacklist]
[status-im.common.parallax.view :as parallax]
[status-im.common.resources :as resources]
[status-im.contexts.onboarding.enable-biometrics.style :as style]
[status-im.navigation.state :as state]
@@ -47,6 +49,16 @@
:container-style {:margin-top 12}}
(i18n/label :t/maybe-later)]]))
(defn enable-biometrics-parallax
[]
(let [stretch (if rn/small-screen? 25 40)]
[rn/view
{:position :absolute
:top 12}
[parallax/video
{:layers (:biometrics resources/parallax-video)
:stretch stretch}]]))
(defn enable-biometrics-simple
[]
(let [width (:width (rn/get-window))]
@@ -55,10 +67,17 @@
:style (style/page-illustration width)
:source (resources/get-image :biometrics)}]))
(defn view
(defn f-enable-biometrics
[]
(let [insets (safe-area/get-insets)]
[rn/view {:style (style/page-container insets)}
[page-title]
[enable-biometrics-simple]
(if blacklist/blacklisted?
[enable-biometrics-simple]
[enable-biometrics-parallax])
[enable-biometrics-buttons insets]]))
(defn view
[]
[:f> f-enable-biometrics])
@@ -4,6 +4,8 @@
[react-native.core :as rn]
[react-native.platform :as platform]
[react-native.safe-area :as safe-area]
[status-im.common.parallax.blacklist :as blacklist]
[status-im.common.parallax.view :as parallax]
[status-im.common.resources :as resources]
[status-im.contexts.onboarding.enable-notifications.style :as style]
[status-im.contexts.shell.jump-to.utils :as shell.utils]
@@ -53,6 +55,13 @@
:container-style {:margin-top 12}}
(i18n/label :t/maybe-later)]]))
(defn enable-notifications-parallax
[]
(let [stretch (if rn/small-screen? -40 -25)]
[parallax/video
{:layers (:notifications resources/parallax-video)
:stretch stretch}]))
(defn enable-notifications-simple
[]
(let [width (:width (rn/get-window))]
@@ -61,7 +70,7 @@
:style (style/page-illustration width)
:source (resources/get-image :notifications)}]))
(defn view
(defn f-enable-notifications
[]
(let [insets (safe-area/get-insets)]
[rn/view {:style (style/page-container insets)}
@@ -71,5 +80,11 @@
:icon-name :i/arrow-left
:on-press #(rf/dispatch [:navigate-back])}]
[page-title]]
[enable-notifications-simple]
(if blacklist/blacklisted?
[enable-notifications-simple]
[enable-notifications-parallax])
[enable-notification-buttons {:insets insets}]]))
(defn view
[]
[:f> f-enable-notifications])
@@ -4,6 +4,8 @@
[react-native.core :as rn]
[react-native.reanimated :as reanimated]
[react-native.safe-area :as safe-area]
[status-im.common.parallax.blacklist :as blacklist]
[status-im.common.parallax.view :as parallax]
[status-im.common.resources :as resources]
[status-im.contexts.onboarding.generating-keys.style :as style]
[utils.i18n :as i18n]))
@@ -60,7 +62,7 @@
"easing" (:linear
reanimated/easings))))))
(defn title
(defn f-title
[insets generate-keys-opacity saving-keys-opacity keys-saved-opacity]
(let [top-insets (+ (if rn/small-screen? 62 112) (:insets insets))]
[rn/view
@@ -82,7 +84,15 @@
{:position :absolute})}
[keys-saved-title]]]))
(defn content
(defn f-page-title
[insets]
(let [generate-keys-opacity (reanimated/use-shared-value 1)
saving-keys-opacity (reanimated/use-shared-value 0)
keys-saved-opacity (reanimated/use-shared-value 0)]
(sequence-animation generate-keys-opacity saving-keys-opacity keys-saved-opacity)
[:f> f-title insets generate-keys-opacity saving-keys-opacity keys-saved-opacity]))
(defn f-simple-page-content
[generate-keys-opacity saving-keys-opacity keys-saved-opacity]
(let [width (:width (rn/get-window))]
[rn/view
@@ -113,14 +123,36 @@
:style (style/page-illustration width)
:source (resources/get-image :generate-keys3)}]]]))
(defn view
[]
(let [insets (safe-area/get-insets)
generate-keys-opacity (reanimated/use-shared-value 1)
(defn parallax-page
[insets]
[:<>
[parallax/video
{:stretch -20
:container-style {:top 40
:left 20}
:layers (:generate-keys resources/parallax-video)
:disable-parallax? true
:enable-looping? false}]
[:f> f-page-title insets]])
(defn f-simple-page
[insets]
(let [generate-keys-opacity (reanimated/use-shared-value 1)
saving-keys-opacity (reanimated/use-shared-value 0)
keys-saved-opacity (reanimated/use-shared-value 0)]
(sequence-animation generate-keys-opacity saving-keys-opacity keys-saved-opacity)
[:<>
[:f> f-title insets generate-keys-opacity saving-keys-opacity keys-saved-opacity]
[:f> f-simple-page-content generate-keys-opacity saving-keys-opacity keys-saved-opacity]]))
(defn f-generating-keys
[]
(let [insets (safe-area/get-insets)]
[rn/view {:style (style/page-container insets)}
(sequence-animation generate-keys-opacity saving-keys-opacity keys-saved-opacity)
[:<>
[title insets generate-keys-opacity saving-keys-opacity keys-saved-opacity]
[content generate-keys-opacity saving-keys-opacity keys-saved-opacity]]]))
(if blacklist/blacklisted?
[:f> f-simple-page insets]
[parallax-page insets])]))
(defn generating-keys
[]
[:f> f-generating-keys])
@@ -1,61 +0,0 @@
(ns status-im.contexts.preview.quo.community.community-token-gating
(:require [quo.core :as quo]
[reagent.core :as reagent]
[status-im.common.resources :as resources]
[status-im.contexts.preview.quo.preview :as preview]
[utils.i18n :as i18n]))
(def descriptor
[{:key :role
:type :select
:options [{:key :member}
{:key :admin}
{:key :token-master}
{:key :token-owner}]}
{:key :satisfied?
:type :boolean}
(preview/customization-color-option {:key :community-color})])
(def tokens
{:member
[[{:symbol "ETH" :sufficient? true :collectible? false :amount "0.8" :img-src nil}]
[{:symbol "ETH" :sufficient? false :collectible? false :amount "1" :img-src nil}
{:symbol "STT" :sufficient? false :collectible? false :amount "10" :img-src nil}]]
:admin
[[{:symbol "ETH" :sufficient? true :collectible? false :amount "2" :img-src nil}]]
:token-master
[[{:symbol "TMANI"
:sufficient? true
:collectible? true
:amount nil
:img-src (resources/mock-images :collectible1)}]]
:token-owner
[[{:symbol "TOANI"
:sufficient? true
:collectible? true
:amount nil
:img-src (resources/mock-images :collectible)}]]})
(def role
{:member (i18n/label :t/member)
:admin (i18n/label :t/admin)
:token-master (i18n/label :t/token-master)
:token-owner (i18n/label :t/token-owner)})
(defn view
[]
(let [state (reagent/atom {:role :member
:satisfied? true
:community-color :blue})]
(fn []
[preview/preview-container
{:state state
:descriptor descriptor
:show-blur-background? false}
[quo/community-token-gating
{:community-color (:community-color @state)
:role ((:role @state) role)
:satisfied? (:satisfied? @state)
:on-press #(js/alert "On press 'Request to join'")
:on-press-info #(js/alert "On press info")
:tokens ((:role @state) tokens)}]])))
@@ -0,0 +1,73 @@
(ns status-im.contexts.preview.quo.community.token-gating
(:require
[quo.core :as quo]
[reagent.core :as reagent]
[status-im.contexts.preview.quo.preview :as preview]))
(def descriptor
[{:label "Tokens sufficient?"
:key :sufficient?
:type :boolean}
{:key :many-tokens?
:type :boolean}
{:key :loading?
:type :boolean}
{:key :condition?
:type :boolean}
{:key :padding?
:type :boolean}])
(defn join-gate-options-base
[sufficient? many-tokens? loading?]
(into
[{:symbol "KNC"
:amount 200
:sufficient? true
:loading? loading?}
{:symbol "MANA"
:amount 10
:sufficient? sufficient?
:purchasable? true
:loading? loading?}
{:symbol "RARE"
:amount 10
:sufficient? sufficient?
:loading? loading?}]
(when many-tokens?
[{:symbol "FXC"
:amount 20
:sufficient? true
:loading? loading?}
{:symbol "SNT"
:amount 10000
:sufficient? sufficient?
:loading? loading?}])))
(defn get-mocked-props
[props]
(let [{:keys [sufficient? condition? many-tokens? padding? loading?]} props]
{:tokens
(if condition?
[(join-gate-options-base sufficient?
many-tokens?
loading?)
[{:symbol "FXC"
:amount 20
:sufficient? true}
{:symbol "USDT"
:amount 20
:sufficient? false}]]
[(join-gate-options-base sufficient?
many-tokens?
loading?)])
:padding? padding?}))
(defn view
[]
(let [state (reagent/atom {:sufficient? false
:many-tokens? false
:condition? false
:padding? false})]
(fn []
[preview/preview-container {:state state :descriptor descriptor}
[quo/token-requirement-list (get-mocked-props @state)]])))
+4 -3
View File
@@ -45,9 +45,9 @@
[status-im.contexts.preview.quo.community.community-membership-list-view
:as community-membership-list-view]
[status-im.contexts.preview.quo.community.community-stat :as community-stat]
[status-im.contexts.preview.quo.community.community-token-gating :as community-token-gating]
[status-im.contexts.preview.quo.community.discover-card :as discover-card]
[status-im.contexts.preview.quo.community.list-item :as community-list-item]
[status-im.contexts.preview.quo.community.token-gating :as token-gating]
[status-im.contexts.preview.quo.counter.collectible-counter :as collectible-counter]
[status-im.contexts.preview.quo.counter.counter :as counter]
[status-im.contexts.preview.quo.counter.step :as step]
@@ -266,14 +266,15 @@
:component community-card/view}
{:name :community-detail-token-gating
:component community-detail-token-gating/view}
{:name :community-token-gating
:component community-token-gating/view}
{:name :community-membership-list-view
:component community-membership-list-view/view}
{:name :community-stat
:component community-stat/view}
{:name :discover-card
:component discover-card/view}
{:name :token-gating
:options {:insets {:bottom? true}}
:component token-gating/view}
{:name :channel-action
:options {:insets {:bottom? true}}
:component channel-action/view}
@@ -52,7 +52,7 @@
field-value (reagent/cursor state [(:key args)])
active? @field-value]
[rn/view {:style style/field-row}
[label-view state label theme]
[label-view state label]
[rn/view {:style (style/boolean-container)}
[rn/pressable
{:style (style/boolean-button {:active? active? :left? true} theme)
@@ -70,7 +70,7 @@
(let [label (or label (key->text-label (:key args)))
field-value (reagent/cursor state [(:key args)])]
[rn/view {:style style/field-row}
[label-view state label theme]
[label-view state label]
[rn/view {:style style/field-column}
[rn/text-input
(merge
@@ -92,7 +92,7 @@
(let [label (or label (key->text-label (:key args)))
field-value (reagent/cursor state [(:key args)])]
[rn/view {:style style/field-row}
[label-view state label theme]
[label-view state label]
[rn/view {:style style/field-column}
[rn/text-input
(merge
@@ -169,7 +169,7 @@
field-value (reagent/cursor state [(:key args)])
selected-option (find-selected-option @field-value options)]
[rn/view {:style style/field-row}
[label-view state label theme]
[label-view state label]
[rn/view {:style style/field-column}
[customizer-select-modal
{:open open
@@ -252,7 +252,7 @@
selected-keys (reagent/cursor state [(:key args)])
selected-options (filter-by-keys options @selected-keys)]
[rn/view {:style style/field-row}
[label-view state label theme]
[label-view state label]
[rn/view {:style style/field-column}
[customizer-multi-select-modal
{:open-atom open
@@ -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"}]]))
@@ -8,7 +8,6 @@
[status-im.constants :as constants]
status-im.contexts.profile.login.effects
[status-im.contexts.profile.rpc :as profile.rpc]
[status-im.feature-flags :as ff]
[taoensso.timbre :as log]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
@@ -105,8 +104,6 @@
[:chat.ui/request-link-preview-whitelist]
[:visibility-status-updates/fetch]
[:switcher-cards/fetch]
(when (ff/enabled? ::ff/wallet.wallet-connect)
[:dispatch [:wallet-connect/init]])
(when-not (:universal-links/handling db)
[:effects.chat/open-last-chat key-uid])
(when notifications-enabled?
@@ -26,7 +26,7 @@
{:list-type :settings
:container-style {:padding-bottom 12}
:blur? true
:data (doall (filter show-settings-item? data))}]))
:data (filter show-settings-item? data)}]))
(defn scroll-handler
[event scroll-y]
@@ -1,25 +0,0 @@
(ns status-im.contexts.settings.wallet.network-settings.style
(:require [quo.foundations.colors :as colors]))
(def title-container
{:padding-horizontal 20
:margin-vertical 12})
(defn page-wrapper
[inset-top]
{:padding-top inset-top
:flex 1})
(defn settings-container
[inset-bottom]
{:flex 1
:padding-bottom inset-bottom})
(def networks-container
{:flex 1})
(def advanced-settings-container
{:flex-shrink 0})
(def testnet-not-available
{:color colors/danger-60})
@@ -1,17 +0,0 @@
(ns status-im.contexts.settings.wallet.network-settings.testnet-mode.style)
(def description
{:padding-top 4
:padding-bottom 8
:padding-horizontal 20})
(def info-box-container
{:padding-top 4
:padding-bottom 12
:padding-horizontal 20})
(def drawer-top
{:padding-bottom 4})
(def bottom-actions-container
{:flex 1})
@@ -1,62 +0,0 @@
(ns status-im.contexts.settings.wallet.network-settings.testnet-mode.view
(:require [quo.core :as quo]
[react-native.core :as rn]
[status-im.contexts.settings.wallet.network-settings.testnet-mode.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn hide-bottom-sheet
[]
(rf/dispatch [:hide-bottom-sheet]))
(defn logout
[]
(rf/dispatch [:logout]))
(defn on-confirm-change
[enable?]
(hide-bottom-sheet)
(rf/dispatch [:profile.settings/profile-update :test-networks-enabled? enable? {:on-success logout}]))
(defn testnet-mode-confirm-change-sheet
[{:keys [title description on-confirm on-cancel]}]
(let [customization-color (rf/sub [:profile/customization-color])]
[:<>
[quo/drawer-top
{:title title
:container-style style/drawer-top}]
[quo/text {:style style/description} description]
[rn/view {:style style/info-box-container}
[quo/information-box
{:type :default
:icon :i/info}
(i18n/label :t/change-testnet-mode-logout-info)]]
[quo/bottom-actions
{:container-style {:style style/bottom-actions-container}
:actions :two-actions
:button-one-label (i18n/label :t/confirm)
:button-one-props {:accessibility-label :confirm-testnet-mode-change
:on-press on-confirm
:type :primary
:customization-color customization-color}
:button-two-label (i18n/label :t/cancel)
:button-two-props {:accessibility-label :cancel-testnet-mode-change
:type :dark-grey
:on-press on-cancel}}]]))
(defn view
[{:keys [enable?]}]
(let [on-confirm (rn/use-callback
#(on-confirm-change enable?)
[enable?])]
(if enable?
[testnet-mode-confirm-change-sheet
{:title (i18n/label :t/turn-on-testnet-mode)
:description (i18n/label :t/testnet-mode-enable-description)
:on-confirm on-confirm
:on-cancel hide-bottom-sheet}]
[testnet-mode-confirm-change-sheet
{:title (i18n/label :t/turn-off-testnet-mode)
:description (i18n/label :t/testnet-mode-disable-description)
:on-confirm on-confirm
:on-cancel hide-bottom-sheet}])))
@@ -1,128 +0,0 @@
(ns status-im.contexts.settings.wallet.network-settings.view
(:require [quo.core :as quo]
[quo.foundations.resources :as resources]
[quo.theme]
[react-native.core :as rn]
[react-native.safe-area :as safe-area]
[status-im.contexts.settings.wallet.network-settings.style :as style]
[status-im.contexts.settings.wallet.network-settings.testnet-mode.view :as testnet]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn navigate-back
[]
(rf/dispatch [:navigate-back]))
(defn make-network-settings-item
[{:keys [details testnet-label testnet-mode?]}]
(let [{:keys [network-name]} details]
(cond-> {:blur? true
:title (i18n/label network-name)
:image :icon-avatar
:image-props {:icon (resources/get-network network-name)
:size :size-20}}
testnet-mode? (assoc
:label :text
:label-props testnet-label))))
(defn mainnet-settings
[{:keys [networks testnet-mode?]}]
[quo/category
{:key :mainnet-settings
:data [(make-network-settings-item
{:details (:mainnet networks)
:testnet-mode? testnet-mode?
:testnet-label (i18n/label :t/sepolia-active)})]
:blur? true
:list-type :settings}])
(defn layer-2-settings
[{:keys [networks testnet-mode?]}]
[quo/category
{:key :layer-2-settings
:label (i18n/label :t/layer-2)
:data (map make-network-settings-item
[{:details (:optimism networks)
:testnet-mode? testnet-mode?
:testnet-label [quo/text
{:style style/testnet-not-available}
(i18n/label :t/testnet-not-available)]}
{:details (:arbitrum networks)
:testnet-mode? testnet-mode?
:testnet-label (i18n/label :t/sepolia-active)}])
:blur? true
:list-type :settings}])
(defn testnet-mode-setting
[{:keys [testnet-mode? on-enable on-disable]}]
(let [on-change-testnet (rn/use-callback
(fn [active?]
(if active? (on-enable) (on-disable)))
[on-enable on-disable])]
{:blur? true
:title (i18n/label :t/testnet-mode)
:action :selector
:image :icon
:image-props :i/settings
:action-props {:on-change on-change-testnet
:checked? (boolean testnet-mode?)}}))
(defn advanced-settings
[{:keys [testnet-mode? enable-testnet disable-testnet]}]
[quo/category
{:key :advanced-settings
:label (i18n/label :t/advanced)
:data [(testnet-mode-setting {:testnet-mode? testnet-mode?
:on-enable enable-testnet
:on-disable disable-testnet})]
:blur? true
:list-type :settings}])
(defn on-change-testnet
[{:keys [enable? theme]}]
(rf/dispatch [:show-bottom-sheet
{:content (fn [] [testnet/view {:enable? enable?}])
:theme theme}]))
(defn view
[]
(let [insets (safe-area/get-insets)
theme (quo.theme/use-theme)
networks-by-name (rf/sub [:wallet/network-details-by-network-name])
testnet-mode? (rf/sub [:profile/test-networks-enabled?])
enable-testnet (rn/use-callback
(fn []
(on-change-testnet {:theme theme
:enable? true}))
[theme])
disable-testnet (rn/use-callback
(fn []
(on-change-testnet {:theme theme
:enable? false}))
[theme])]
[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/network-settings)
:accessibility-label :network-settings-header}]]
[rn/view {:style (style/settings-container (:bottom insets))}
(when networks-by-name
[rn/view {:style style/networks-container}
[mainnet-settings
{:networks networks-by-name
:testnet-mode? testnet-mode?}]
[layer-2-settings
{:networks networks-by-name
:testnet-mode? testnet-mode?}]])
[rn/view {:style style/advanced-settings-container}
[advanced-settings
{:testnet-mode? testnet-mode?
:enable-testnet enable-testnet
:disable-testnet disable-testnet}]]]]))
@@ -14,7 +14,7 @@
[]
(rf/dispatch [:open-modal :screen/settings.keypairs-and-accounts]))
(defn basic-settings-options
(defn gen-basic-settings-options
[]
[(when (ff/enabled? ::ff/settings.keypairs-and-accounts)
{:title (i18n/label :t/keypairs-and-accounts)
@@ -31,31 +31,10 @@
[quo/category
{:key :basic-wallet-settings
:label (i18n/label :t/keypairs-accounts-and-addresses)
:data (basic-settings-options)
:data (gen-basic-settings-options)
:blur? true
:list-type :settings}])
(defn open-network-settings-modal
[]
(rf/dispatch [:open-modal :screen/settings.network-settings]))
(defn advanced-settings-options
[]
[{:title (i18n/label :t/network-settings)
:blur? true
:on-press open-network-settings-modal
:action :arrow}])
(defn advanced-settings
[]
(when (ff/enabled? ::ff/settings.network-settings)
[quo/category
{:key :advanced-wallet-settings
:label (i18n/label :t/advanced)
:data (advanced-settings-options)
:blur? true
:list-type :settings}]))
(defn navigate-back
[]
(rf/dispatch [:navigate-back]))
@@ -74,5 +53,4 @@
[quo/page-top
{:title (i18n/label :t/wallet)
:title-accessibility-label :wallet-settings-header}]
[basic-settings]
[advanced-settings]]))
[basic-settings]]))
@@ -13,7 +13,3 @@
{:padding-top 60
:margin-bottom 12
:padding-horizontal 20})
(def shell-button
{:position :absolute
:bottom 12})
@@ -33,7 +33,7 @@
[options-drawer/view
{:name (:name collectible-details)
:image (:uri preview-url)}])}]))}]
:activity [activity/view]
:activity [activity/view {:activities []}]
:permissions [empty-tab/view
{:title (i18n/label :t/no-permissions)
:description (i18n/label :t/no-collectibles-description)
@@ -63,7 +63,11 @@
:size 32
:default-active @selected-tab
:data (tabs-data watch-only?)
:on-change (rn/use-callback (fn [tab] (reset! selected-tab tab)))
:on-change (rn/use-callback (fn [tab]
(when (and (= :activity tab)
(ff/enabled? :FLAG_WALLET_ACTIVITY_ENABLED))
(rf/dispatch [:wallet/fetch-activities]))
(reset! selected-tab tab)))
:scrollable? true
:scroll-on-press? true}]
[tabs/view {:selected-tab @selected-tab}]
@@ -72,4 +76,5 @@
{:on-press #(rf/dispatch [:shell/navigate-to-jump-to])
:customization-color customization-color
:label (i18n/label :t/jump-to)}}
style/shell-button]]))))
{:position :absolute
:bottom 0}]]))))
@@ -7,4 +7,5 @@
:skip-step? (fn [db] (some? (get-in db [:wallet :ui :send :bridge-to-chain-id])))}
{:screen-id :screen/wallet.bridge-input-amount
:skip-step? (fn [db] (some? (get-in db [:wallet :ui :send :amount])))}
{:screen-id :screen/wallet.transaction-confirmation}])
{:screen-id :screen/wallet.transaction-confirmation}
{:screen-id :screen/wallet.transaction-progress}])
@@ -1,15 +1,17 @@
(ns status-im.contexts.wallet.collectible.style
(:require [quo.foundations.colors :as colors]
[react-native.core :as rn]
[react-native.platform :as platform]))
(ns status-im.contexts.wallet.collectible.style)
(def container
{:margin-bottom 34})
{:margin-top 100
:margin-bottom 34})
(def preview-container
{:margin-horizontal 8
:margin-top 12
:padding-top 100})
:margin-top 12})
(def preview
{:width "100%"
:aspect-ratio 1
:border-radius 16})
(def header
{:margin-horizontal 20
@@ -41,43 +43,3 @@
(def opensea-button
{:flex 1
:margin-left 6})
(def animated-header
{:position :absolute
:top 0
:left 0
:right 0
:height 100
:z-index 1
:overflow :hidden})
(defn scroll-view
[safe-area-top]
{:flex 1
:margin-top (when platform/ios? (- safe-area-top))})
(def gradient-layer
{:position :absolute
:top 0
:left 0
:right 0
:bottom 0
:flex 1
:align-items :center
:overflow :hidden})
(def image-background
{:height (:height (rn/get-window))
:aspect-ratio 1})
(def gradient
{:position :absolute
:top 0
:left 0
:right 0
:bottom 0})
(defn background-color
[theme]
{:flex 1
:background-color (colors/theme-colors colors/white colors/neutral-95 theme)})
@@ -1,29 +1,21 @@
(ns status-im.contexts.wallet.collectible.view
(:require
[oops.core :as oops]
[quo.core :as quo]
[quo.foundations.colors :as colors]
[quo.theme :as quo.theme]
[react-native.core :as rn]
[react-native.linear-gradient :as linear-gradient]
[react-native.platform :as platform]
[react-native.reanimated :as reanimated]
[react-native.safe-area :as safe-area]
[reagent.core :as reagent]
[status-im.common.scroll-page.view :as scroll-page]
[status-im.contexts.wallet.collectible.options.view :as options-drawer]
[status-im.contexts.wallet.collectible.style :as style]
[status-im.contexts.wallet.collectible.tabs.view :as tabs]
[status-im.contexts.wallet.collectible.utils :as utils]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
[utils.worklets.header-animations :as header-animations]))
[utils.re-frame :as rf]))
(defn header
[collectible-name collection-name collection-image-url set-title-ref]
[rn/view
{:style style/header
:ref set-title-ref
:collapsable false}
[collectible-name collection-name collection-image-url]
[rn/view {:style style/header}
[quo/text
{:weight :semi-bold
:size :heading-1}
@@ -72,74 +64,13 @@
:label (i18n/label :t/about)
:accessibility-label :about-tab}])
(def navigate-back #(rf/dispatch [:navigate-back]))
(defn animated-header
[{:keys [scroll-amount title-opacity page-nav-type picture title description theme]}]
(let [blur-amount (header-animations/use-blur-amount scroll-amount)
layer-opacity (header-animations/use-layer-opacity
scroll-amount
"transparent"
(colors/theme-colors colors/white-opa-50 colors/neutral-95-opa-70-blur theme))]
[rn/view {:style style/animated-header}
[reanimated/blur-view
{:style {:flex 1}
:blur-type :transparent
:overlay-color :transparent
:blur-amount blur-amount
:blur-radius blur-amount}
[reanimated/view {:style layer-opacity}
[quo/page-nav
{:type page-nav-type
:picture picture
:title title
:description description
:background :blur
:icon-name :i/close
:accessibility-label :back-button
:on-press navigate-back
:right-side [{:icon-name :i/options
:on-press #(rf/dispatch
[:show-bottom-sheet
{:content (fn []
[options-drawer/view
{:name title
:image picture}])
:theme theme}])}]
:center-opacity title-opacity}]]]]))
(defn on-scroll
[e scroll-amount title-opacity title-bottom-coord]
(let [scroll-y (oops/oget e "nativeEvent.contentOffset.y")
new-opacity (if (>= scroll-y @title-bottom-coord) 1 0)]
(reanimated/set-shared-value scroll-amount scroll-y)
(reanimated/set-shared-value title-opacity
(reanimated/with-timing new-opacity #js {:duration 300}))))
(defn- gradient-layer
[image-uri]
(let [theme (quo.theme/use-theme)]
[rn/view {:style style/gradient-layer}
[rn/image
{:style style/image-background
:source {:uri image-uri}
:blur-radius 14}]
[rn/view {:style style/gradient}
[linear-gradient/linear-gradient
{:style {:flex 1}
:colors (colors/theme-colors
[colors/white-opa-70 colors/white colors/white]
[colors/neutral-95-opa-70 colors/neutral-95 colors/neutral-95]
theme)
:locations [0 0.9 1]}]]]))
(defn collectible-details
(defn view
[_]
(let [selected-tab (reagent/atom :overview)
on-tab-change #(reset! selected-tab %)]
(fn [{:keys [collectible set-title-bottom theme]}]
(let [title-ref (rn/use-ref-atom nil)
set-title-ref (rn/use-callback #(reset! title-ref %))
(fn []
(let [theme (quo.theme/use-theme)
collectible (rf/sub [:wallet/last-collectible-details])
animation-shared-element-id (rf/sub [:animation-shared-element-id])
collectible-owner (rf/sub [:wallet/last-collectible-details-owner])
{:keys [id
@@ -164,47 +95,51 @@
:id token-id
:header collectible-name
:description collection-name}
total-owned (utils/total-owned-collectible
(:ownership collectible)
(:address collectible-owner))]
[rn/view {:style style/container}
[rn/view
[gradient-layer preview-uri]
total-owned (utils/total-owned-collectible (:ownership collectible)
(:address collectible-owner))]
(rn/use-unmount #(rf/dispatch [:wallet/clear-last-collectible-details]))
[scroll-page/scroll-page
{:navigate-back? true
:height 148
:page-nav-props {:type :title-description
:title collectible-name
:description collection-name
:right-side [{:icon-name :i/options
:on-press #(rf/dispatch
[:show-bottom-sheet
{:content (fn [] [options-drawer/view
{:name collectible-name
:image preview-uri}])
:theme theme}])}]
:picture preview-uri
:blur? true}}
[rn/view {:style style/container}
[quo/expanded-collectible
{:image-src preview-uri
:container-style style/preview-container
:counter (utils/collectible-owned-counter total-owned)
:native-ID (when (= animation-shared-element-id token-id) :shared-element)
:supported-file? (utils/supported-file? (:animation-media-type collectible-data))
:on-press (fn []
(if svg?
(js/alert "Can't visualize SVG images in lightbox")
(rf/dispatch
[:lightbox/navigate-to-lightbox
token-id
{:images [collectible-image]
:index 0
:on-options-press #(rf/dispatch [:show-bottom-sheet
{:content
(fn []
[options-drawer/view
{:name collectible-name
:image
preview-uri}])}])}])))
:on-collectible-load (fn []
;; We need to delay the measurement because the
;; navigation has an animation
(js/setTimeout
#(some-> @title-ref
(oops/ocall "measureInWindow" set-title-bottom))
300))}]]
[rn/view {:style (style/background-color theme)}
[header collectible-name collection-name collection-image set-title-ref]
{:image-src preview-uri
:container-style style/preview-container
:counter (utils/collectible-owned-counter total-owned)
:native-ID (when (= animation-shared-element-id token-id) :shared-element)
:supported-file? (utils/supported-file? (:animation-media-type collectible-data))
:on-press (fn []
(if svg?
(js/alert "Can't visualize SVG images in lightbox")
(rf/dispatch
[:lightbox/navigate-to-lightbox
token-id
{:images [collectible-image]
:index 0
:on-options-press #(rf/dispatch [:show-bottom-sheet
{:content
(fn []
[options-drawer/view
{:name collectible-name
:image preview-uri}])}])}])))}]
[header collectible-name collection-name collection-image]
[cta-buttons
{:chain-id chain-id
:token-id token-id
:contract-address contract-address
:watch-only? (:watch-only? collectible-owner)
:watch-only? false ;(:watch-only? collectible-owner)
:collectible collectible}]
[quo/tabs
{:size 32
@@ -214,41 +149,3 @@
:on-change on-tab-change
:data tabs-data}]
[tabs/view {:selected-tab @selected-tab}]]]))))
(defn view
[_]
(let [{:keys [top]} (safe-area/get-insets)
theme (quo.theme/use-theme)
title-bottom-coord (rn/use-ref-atom 0)
set-title-bottom (rn/use-callback
(fn [_ y _ height]
(reset! title-bottom-coord
(+ y height -100 (if platform/ios? (- top) top)))))
scroll-amount (reanimated/use-shared-value 0)
title-opacity (reanimated/use-shared-value 0)
collectible (rf/sub [:wallet/last-collectible-details])
{:keys [preview-url
collection-data
collectible-data]} collectible
{preview-uri :uri} preview-url
{collectible-name :name} collectible-data
{collection-name :name} collection-data]
(rn/use-unmount #(rf/dispatch [:wallet/clear-last-collectible-details]))
[rn/view {:style (style/background-color theme)}
[animated-header
{:scroll-amount scroll-amount
:title-opacity title-opacity
:page-nav-type :title-description
:picture preview-uri
:title collectible-name
:description collection-name
:theme theme}]
[reanimated/scroll-view
{:style (style/scroll-view top)
:on-scroll #(on-scroll % scroll-amount title-opacity title-bottom-coord)}
[collectible-details
{:collectible collectible
:set-title-bottom set-title-bottom
:theme theme}]]]))
@@ -66,10 +66,8 @@
{:title (i18n/label :t/no-activity)
:description (i18n/label :t/empty-tab-description)
:image (resources/get-themed-image :no-activity theme)}]
[rn/section-list
{:sections activity-list
:sticky-section-headers-enabled false
:style {:flex 1}
:content-container-style {:padding-bottom jump-to.constants/floating-shell-button-height}
:render-fn activity-item
:render-section-header-fn (fn [{:keys [title]}] [quo/divider-date title])}])))
[rn/flat-list
{:data activity-list
:style {:flex 1}
:content-container-style {:padding-bottom jump-to.constants/floating-shell-button-height}
:render-fn activity-item}])))
@@ -4,6 +4,8 @@
[status-im.common.resources :as status.resources]
[utils.i18n :as i18n]))
(def address "0x39cf6E0Ba4C4530735616e1Ee7ff5FbCB726fBd4")
(def buy-tokens-list
[{:title "Ramp"
:description :text
@@ -1,6 +1,5 @@
(ns status-im.contexts.wallet.common.token-value.view
(:require [quo.core :as quo]
[status-im.common.not-implemented :as not-implemented]
[status-im.contexts.wallet.sheets.buy-token.view :as buy-token]
[status-im.feature-flags :as ff]
[utils.i18n :as i18n]
@@ -41,13 +40,6 @@
(rf/dispatch [:hide-bottom-sheet])
(rf/dispatch [:wallet/bridge-select-token {:token token-data}]))})
(defn- action-swap
[]
{:icon :i/swap
:accessibility-label :swap
:label (i18n/label :t/swap)
:on-press #(not-implemented/alert)})
(defn- action-manage-tokens
[watch-only?]
{:icon :i/settings
@@ -81,7 +73,6 @@
(not watch-only?) (concat [(action-buy)
(action-send send-params)
(action-receive)
(when (ff/enabled? ::ff/wallet.swap) (action-swap))
(action-bridge token-data)]))]]))
(defn view
@@ -229,16 +229,15 @@
(defn make-network-item
"This function generates props for quo/category component item"
[{:keys [network-name color on-change networks state label-props type]}]
[{:keys [network-name color on-change networks state label-props]}]
(cond-> {:title (string/capitalize (name network-name))
:image :icon-avatar
:image-props {:icon (resources/get-network network-name)
:size :size-20}
:action :selector
:action-props {:type (or type
(if (= :default state)
:filled-checkbox
:checkbox))
:action-props {:type (if (= :default state)
:filled-checkbox
:checkbox)
:customization-color color
:checked? (contains? networks network-name)
:on-change on-change}}
@@ -3,8 +3,6 @@
[status-im.constants :as constants]
[utils.number]))
(def ^:private last-comma-followed-by-text-to-end-regex #",\s(?=[^,]+$)")
(def id->network
{constants/ethereum-mainnet-chain-id constants/mainnet-network-name
constants/ethereum-goerli-chain-id constants/mainnet-network-name
@@ -94,34 +92,3 @@
{:network %
:testnet-enabled? testnet-enabled?
:goerli-enabled? goerli-enabled?})))))
(def network->short-name
{constants/mainnet-network-name constants/mainnet-short-name
constants/optimism-network-name constants/optimism-short-name
constants/arbitrum-network-name constants/arbitrum-short-name
constants/ethereum-network-name constants/ethereum-short-name})
(def short-name->network
{constants/mainnet-short-name constants/mainnet-network-name
constants/optimism-short-name constants/optimism-network-name
constants/arbitrum-short-name constants/arbitrum-network-name})
(defn short-names->network-preference-prefix
[short-names]
(str (string/join ":" short-names) ":"))
(defn network-preference-prefix->network-names
[prefix]
(as-> prefix $
(string/split $ ":")
(map short-name->network $)))
(defn network-ids->formatted-text
[network-ids]
(let [network-names (->> network-ids
(map id->network)
(map name)
(map string/capitalize)
(string/join ", "))
formatted-text (string/replace network-names last-comma-followed-by-text-to-end-regex " and ")]
formatted-text))
@@ -1,6 +1,6 @@
(ns status-im.contexts.wallet.common.utils.networks-test
(:require
[cljs.test :refer [are deftest is testing]]
[cljs.test :refer [deftest is testing]]
[status-im.constants :as constants]
[status-im.contexts.wallet.common.utils.networks :as utils]))
@@ -20,44 +20,3 @@
constants/arbitrum-mainnet-chain-id))
(is (= (utils/network->chain-id {:network :arbitrum :testnet-enabled? true :goerli-enabled? false})
constants/arbitrum-sepolia-chain-id))))
(deftest test-network-preference-prefix->network-names
(testing "network-preference-prefix->network-names function"
(is (= (utils/network-preference-prefix->network-names "eth")
(seq [:mainnet])))
(is (= (utils/network-preference-prefix->network-names "eth:opt")
(seq [:mainnet :optimism])))
(is (= (utils/network-preference-prefix->network-names "eth:opt:arb1")
(seq [:mainnet :optimism :arbitrum])))))
(deftest short-names->network-preference-prefix-test
(are [expected short-names]
(= expected (utils/short-names->network-preference-prefix short-names))
"eth:" ["eth"]
"eth:opt:" ["eth" "opt"]
"eth:opt:arb1:" ["eth" "opt" "arb1"]))
(deftest network-preference-prefix->network-names-test
(are [expected short-names]
(= expected (utils/network-preference-prefix->network-names short-names))
(seq [:mainnet]) "eth"
(seq [:mainnet :optimism]) "eth:opt"
(seq [:mainnet :optimism :arbitrum]) "eth:opt:arb1"))
(deftest test-network-ids->formatted-text
(testing "Empty network-ids should return an empty string"
(is (= "" (utils/network-ids->formatted-text []))))
(testing "Single network-id should return the capitalized name of that network"
(is (= "Mainnet" (utils/network-ids->formatted-text [constants/ethereum-mainnet-chain-id]))))
(testing "Two network-ids should return a comma-separated string with 'and' for the last item"
(is (= "Mainnet and Optimism"
(utils/network-ids->formatted-text [constants/ethereum-mainnet-chain-id
constants/optimism-mainnet-chain-id]))))
(testing "Multiple network-ids should return a comma-separated string with 'and' for the last item"
(is (= "Mainnet, Optimism and Arbitrum"
(utils/network-ids->formatted-text [constants/ethereum-mainnet-chain-id
constants/optimism-mainnet-chain-id
constants/arbitrum-mainnet-chain-id])))))
+6 -16
View File
@@ -31,8 +31,7 @@
(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]]
[:dispatch [:wallet/fetch-activities]]]}))
:fx [[:dispatch [:navigate-to :screen/wallet.accounts address]]]}))
(rf/reg-event-fx :wallet/navigate-to-new-account
(fn [{:keys [db]} [address]]
@@ -325,23 +324,14 @@
(rf/dispatch [:wallet/set-ens-address nil ens])
(on-error-fn))))}]]]})))
(defn- resolved-address->prefixed-address
[address networks]
(let [prefixes (->> networks
(map network-utils/network->short-name)
network-utils/short-names->network-preference-prefix)]
(str prefixes (eip55/address->checksum address))))
(rf/reg-event-fx
:wallet/set-ens-address
(fn [{:keys [db]} [result ens]]
(let [networks [constants/ethereum-network-name constants/optimism-network-name]
suggestion (if result
[{:type item-types/address
:ens ens
:address (eip55/address->checksum result)
:networks networks
:full-address (resolved-address->prefixed-address result networks)}]
(let [suggestion (if result
[{:type item-types/address
:ens ens
:address (eip55/address->checksum result)
:networks [:ethereum :optimism]}]
[])]
{:db (-> db
(assoc-in [:wallet :ui :search-address :local-suggestions] suggestion)
@@ -1,17 +1,13 @@
(ns status-im.contexts.wallet.home.style
(:require
[quo.foundations.colors :as colors]
[react-native.safe-area :as safe-area]
[status-im.contexts.shell.jump-to.constants :as constants]))
[react-native.safe-area :as safe-area]))
(def tabs
{:padding-horizontal 20
:padding-top 8
:padding-bottom 12})
(def list-container
{:padding-bottom constants/floating-shell-button-height})
(def accounts-list
{:padding-top 8
:padding-bottom 16
+22 -23
View File
@@ -86,26 +86,25 @@
[rn/view {:style (style/home-container)}
[common.top-nav/view]
[refreshable-flat-list/view
{:refresh-control [rn/refresh-control
{:refreshing (and tokens-loading? init-loaded?)
:colors [colors/neutral-40]
:tint-color colors/neutral-40
:on-refresh #(rf/dispatch [:wallet/get-accounts])}]
:header [rn/view {:style (style/header-container theme)}
[quo/wallet-overview
{:state (if tokens-loading? :loading :default)
:time-frame :none
:metrics :none
:balance formatted-balance
:networks networks
:dropdown-on-press #(rf/dispatch [:show-bottom-sheet
{:content network-filter/view}])}]
(when (ff/enabled? ::ff/wallet.graph)
[quo/wallet-graph {:time-frame :empty}])
[render-cards cards account-list-ref]
[render-tabs tabs-data set-selected-tab selected-tab]]
:content-container-style style/list-container
:sticky-header-indices [0]
:data []
:render-fn #()
:footer [tabs/view {:selected-tab selected-tab}]}]]))
{: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}]}]]))
+39 -64
View File
@@ -39,38 +39,32 @@
token-decimals (if collectible 0 (:decimals token))
native-token? (and token (= token-display-name "ETH"))
routes-available? (pos? (count chosen-route))
token-networks (:networks token)
token-networks-ids (when token-networks (mapv #(:chain-id %) token-networks))
from-network-amounts-by-chain (send-utils/network-amounts-by-chain {:route chosen-route
:token-decimals
token-decimals
:native-token?
native-token?
:receiver? false})
:to? false})
from-network-values-for-ui (send-utils/network-values-for-ui from-network-amounts-by-chain)
to-network-amounts-by-chain (send-utils/network-amounts-by-chain {:route chosen-route
:token-decimals
token-decimals
:native-token?
native-token?
:receiver? true})
:to? true})
to-network-values-for-ui (send-utils/network-values-for-ui to-network-amounts-by-chain)
sender-network-values (if routes-available?
(send-utils/network-amounts
{:network-values from-network-values-for-ui
:disabled-chain-ids disabled-from-chain-ids
:receiver-networks receiver-networks
:token-networks-ids token-networks-ids
:receiver? false})
(send-utils/network-amounts from-network-values-for-ui
disabled-from-chain-ids
receiver-networks
false)
(send-utils/reset-network-amounts-to-zero
sender-network-values))
receiver-network-values (if routes-available?
(send-utils/network-amounts
{:network-values to-network-values-for-ui
:disabled-chain-ids disabled-from-chain-ids
:receiver-networks receiver-networks
:token-networks-ids token-networks-ids
:receiver? true})
(send-utils/network-amounts to-network-values-for-ui
disabled-from-chain-ids
receiver-networks
true)
(send-utils/reset-network-amounts-to-zero
receiver-network-values))
network-links (when routes-available?
@@ -153,7 +147,6 @@
(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-preferred-networks] receiver-networks)
(assoc-in [:wallet :ui :send :receiver-networks] receiver-networks))
:fx [(when (and collectible-tx? one-collectible?)
[:dispatch [:wallet/get-suggested-routes {:amount 1}]])
@@ -183,44 +176,26 @@
;; `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.
(let [{token-networks :networks} token
receiver-networks (get-in db [:wallet :ui :send :receiver-networks])
token-networks-ids (mapv #(:chain-id %) token-networks)
token-not-supported-in-receiver-networks? (not (some (set receiver-networks)
token-networks-ids))]
{:db (cond-> db
:always (update-in [:wallet :ui :send] dissoc :collectible)
:always (assoc-in [:wallet :ui :send :token-display-name]
(:symbol token))
:always (assoc-in
[:wallet :ui :send
:token-not-supported-in-receiver-networks?]
token-not-supported-in-receiver-networks?)
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
{:current-screen stack-id
:start-flow? start-flow?
:flow-id :wallet-send-flow}]]]})))
{: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
{:current-screen stack-id
:start-flow? start-flow?
:flow-id :wallet-send-flow}]]]}))
(rf/reg-event-fx
:wallet/edit-token-to-send
(fn [{:keys [db]} [token]]
(let [{token-networks :networks} token
receiver-networks (get-in db [:wallet :ui :send :receiver-networks])
token-networks-ids (mapv #(:chain-id %) token-networks)
token-not-supported-in-receiver-networks? (not (some (set receiver-networks)
token-networks-ids))]
{:db (-> db
(assoc-in [:wallet :ui :send :token] token)
(assoc-in [:wallet :ui :send :token-display-name] token)
(assoc-in [:wallet :ui :send :token-not-supported-in-receiver-networks?]
token-not-supported-in-receiver-networks?))
:fx [[:dispatch [:hide-bottom-sheet]]
[:dispatch [:wallet/clean-suggested-routes]]]})))
{:db (-> db
(assoc-in [:wallet :ui :send :token] token)
(assoc-in [:wallet :ui :send :token-display-name] token))
:fx [[:dispatch [:hide-bottom-sheet]]
[:dispatch [:wallet/clean-suggested-routes]]]}))
(rf/reg-event-fx :wallet/clean-selected-token
(fn [{:keys [db]}]
@@ -332,21 +307,18 @@
balances-per-chain
:disabled-chain-ids
disabled-from-chain-ids}))
token-networks-ids (when token (mapv #(:chain-id %) (:networks token)))
sender-network-values (when token-available-networks-for-suggested-routes
(send-utils/loading-network-amounts
{:valid-networks token-available-networks-for-suggested-routes
:disabled-chain-ids disabled-from-chain-ids
:receiver-networks receiver-networks
:token-networks-ids token-networks-ids
:receiver? false}))
token-available-networks-for-suggested-routes
disabled-from-chain-ids
receiver-networks
false))
receiver-network-values (when token-available-networks-for-suggested-routes
(send-utils/loading-network-amounts
{:valid-networks token-available-networks-for-suggested-routes
:disabled-chain-ids disabled-from-chain-ids
:receiver-networks receiver-networks
:token-networks-ids token-networks-ids
:receiver? true}))
token-available-networks-for-suggested-routes
disabled-from-chain-ids
receiver-networks
true))
request-params [transaction-type-param
from-address
to-address
@@ -387,7 +359,10 @@
{:db (-> db
(assoc-in [:wallet :transactions] transaction-details)
(assoc-in [:wallet :ui :send :transaction-ids] transaction-ids))
:fx [[:dispatch [:dismiss-modal :screen/wallet.transaction-confirmation]]]})))
:fx [[:dispatch
[:wallet/wizard-navigate-forward
{:current-screen :screen/wallet.transaction-confirmation
:flow-id :wallet-send-flow}]]]})))
(rf/reg-event-fx :wallet/close-transaction-progress-page
(fn [_]
@@ -396,7 +371,7 @@
[:dispatch [:wallet/clean-send-address]]
[:dispatch [:wallet/clean-disabled-from-networks]]
[:dispatch [:wallet/select-address-tab nil]]
[:dispatch [:dismiss-modal :screen/wallet.transaction-confirmation]]]}))
[:dispatch [:dismiss-modal :screen/wallet.transaction-progress]]]}))
(defn- transaction-data
[{:keys [from-address to-address token-address route data eth-transfer?]}]
@@ -19,9 +19,12 @@
{:screen-id :screen/wallet.select-asset
:skip-step? (fn [db] (or (token-selected? db) (collectible-selected? db)))}
{:screen-id :screen/wallet.send-input-amount
:skip-step? (fn [db] (= (get-in db [:wallet :ui :send :tx-type]) :collectible))}
: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-confirmation}
{:screen-id :screen/wallet.transaction-progress}])
@@ -76,8 +76,7 @@
:wallet/wallet-send-to-values-by-chain {1 (money/bignumber "250")}
:wallet/wallet-send-sender-network-values nil
:wallet/wallet-send-receiver-network-values nil
:wallet/wallet-send-network-links nil
:wallet/wallet-send-receiver-preferred-networks [1]})
:wallet/wallet-send-network-links nil})
(h/describe "Send > input amount screen"
(h/setup-restorable-re-frame)
@@ -1,5 +1,4 @@
(ns status-im.contexts.wallet.send.input-amount.style
(:require [quo.foundations.colors :as colors]))
(ns status-im.contexts.wallet.send.input-amount.style)
(def screen
{:flex 1})
@@ -39,24 +38,3 @@
{:height 40
:width "100%"
:align-items :center})
(defn token-not-available-container
[theme]
{:height 90
:flex-direction :row
:background-color (colors/resolve-color :danger theme 5)
:border-color (colors/resolve-color :danger theme 10)
:border-width 1
:border-radius 12
:margin-horizontal 20
:padding 12})
(def token-not-available-content-container
{:margin-left 8
:align-items :flex-start})
(defn token-not-available-text
[theme]
{:height 36
:flex 1
:color (colors/resolve-color :danger theme)})
@@ -2,8 +2,6 @@
(:require
[clojure.string :as string]
[quo.core :as quo]
[quo.foundations.colors :as colors]
[quo.theme]
[react-native.core :as rn]
[react-native.safe-area :as safe-area]
[reagent.core :as reagent]
@@ -14,7 +12,6 @@
[status-im.contexts.wallet.send.input-amount.style :as style]
[status-im.contexts.wallet.send.routes.view :as routes]
[status-im.contexts.wallet.send.utils :as send-utils]
[status-im.contexts.wallet.sheets.unpreferred-networks-alert.view :as unpreferred-networks-alert]
[utils.address :as address]
[utils.i18n :as i18n]
[utils.money :as money]
@@ -29,7 +26,7 @@
string/upper-case)))
(defn- estimated-fees
[{:keys [loading-routes? fees amount receiver]}]
[{:keys [loading-suggested-routes? fees amount receiver]}]
[rn/view {:style style/estimated-fees-container}
[rn/view {:style style/estimated-fees-content-container}
[quo/button
@@ -38,20 +35,20 @@
:size 32
:inner-style {:opacity 1}
:accessibility-label :advanced-button
:disabled? loading-routes?
:disabled? loading-suggested-routes?
:on-press #(js/alert "Not implemented yet")}
:i/advanced]]
[quo/data-item
{:container-style style/fees-data-item
:label :none
:status (if loading-routes? :loading :default)
:status (if loading-suggested-routes? :loading :default)
:size :small
:title (i18n/label :t/fees)
:subtitle fees}]
[quo/data-item
{:container-style style/amount-data-item
:label :none
:status (if loading-routes? :loading :default)
:status (if loading-suggested-routes? :loading :default)
:size :small
:title (i18n/label :t/user-gets {:name receiver})
:subtitle amount}]])
@@ -80,36 +77,6 @@
(rf/dispatch [:wallet/edit-token-to-send token])
(clear-input!))}]]))
(defn- token-not-available
[token-symbol receiver-networks token-networks]
(let [theme (quo.theme/use-theme)
add-token-networks (fn []
(let [chain-ids (concat receiver-networks
(mapv #(:chain-id %) token-networks))]
(rf/dispatch [:wallet/update-receiver-networks chain-ids])))]
[rn/view {:style (style/token-not-available-container theme)}
[rn/view
[quo/icon :i/alert
{:size 16
:color colors/danger-50}]]
[rn/view {:style style/token-not-available-content-container}
[quo/text
{:style (style/token-not-available-text theme)
:size :paragraph-2}
(i18n/label :t/token-not-available-on-receiver-networks {:token-symbol token-symbol})]
[quo/button
{:size 24
:customization-color colors/danger-50
:on-press add-token-networks}
(i18n/label :t/add-networks-token-can-be-sent-to {:token-symbol token-symbol})]]]))
(defn- show-unpreferred-networks-alert
[on-confirm]
(rf/dispatch
[:show-bottom-sheet
{:content (fn []
[unpreferred-networks-alert/view
{:on-confirm on-confirm}])}]))
(defn view
;; crypto-decimals, limit-crypto and initial-crypto-currency? args are needed
;; for component tests only
@@ -127,112 +94,91 @@
crypto-currency? (reagent/atom initial-crypto-currency?)
on-navigate-back on-navigate-back]
(fn []
(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/set-token-amount-to-send
{:amount
(controlled-input/input-value
input-state)
:stack-id current-screen-id}]))
{fiat-currency :currency} (rf/sub [:profile/profile])
(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/set-token-amount-to-send
{:amount (controlled-input/input-value
input-state)
:stack-id current-screen-id}]))
{fiat-currency :currency} (rf/sub [:profile/profile])
{token-symbol :symbol
token-networks :networks} (rf/sub [:wallet/wallet-send-token])
token-networks :networks} (rf/sub [:wallet/wallet-send-token])
{token-balance :total-balance
:as
token} (rf/sub
[:wallet/current-viewing-account-tokens-filtered
(str token-symbol)])
conversion-rate (-> token :market-values-per-currency :usd :price)
loading-routes? (rf/sub
[:wallet/wallet-send-loading-suggested-routes?])
token} (rf/sub
[:wallet/current-viewing-account-tokens-filtered
(str token-symbol)])
conversion-rate (-> token :market-values-per-currency :usd :price)
loading-routes? (rf/sub
[:wallet/wallet-send-loading-suggested-routes?])
route (rf/sub [:wallet/wallet-send-route])
to-address (rf/sub [:wallet/wallet-send-to-address])
route (rf/sub [:wallet/wallet-send-route])
to-address (rf/sub [:wallet/wallet-send-to-address])
on-confirm (or default-on-confirm handle-on-confirm)
crypto-decimals (or default-crypto-decimals
(utils/get-crypto-decimals-count token))
crypto-limit (or default-limit-crypto
(utils/get-standard-crypto-format
token
token-balance))
fiat-limit (.toFixed (* token-balance conversion-rate) 2)
current-limit (if @crypto-currency? crypto-limit fiat-limit)
valid-input? (not (or (string/blank?
(controlled-input/input-value
input-state))
(<= (controlled-input/numeric-value
input-state)
0)
(> (controlled-input/numeric-value
input-state)
current-limit)))
current-currency (if @crypto-currency? token-symbol fiat-currency)
input-num-value (controlled-input/numeric-value input-state)
confirm-disabled? (or (nil? route)
(empty? route)
(string/blank? (controlled-input/input-value
input-state))
(<= input-num-value 0)
(> input-num-value current-limit))
amount-text (str (controlled-input/input-value input-state)
" "
token-symbol)
first-route (first route)
native-currency-symbol (when-not confirm-disabled?
(get-in first-route
[:from :native-currency-symbol]))
native-token (when native-currency-symbol
(rf/sub [:wallet/token-by-symbol
native-currency-symbol]))
fee-in-native-token (when-not confirm-disabled?
(send-utils/calculate-full-route-gas-fee route))
fee-in-crypto-formatted (when fee-in-native-token
(utils/get-standard-crypto-format
native-token
fee-in-native-token))
fee-in-fiat (when-not confirm-disabled?
(utils/calculate-token-fiat-value
{:currency fiat-currency
:balance fee-in-native-token
:token native-token}))
currency-symbol (rf/sub [:profile/currency-symbol])
fee-formatted (when fee-in-fiat
(utils/get-standard-fiat-format
fee-in-crypto-formatted
currency-symbol
fee-in-fiat))
show-select-asset-sheet #(rf/dispatch
[:show-bottom-sheet
{:content (fn []
[select-asset-bottom-sheet
clear-input!])}])
sender-network-values (rf/sub
[:wallet/wallet-send-sender-network-values])
receiver-network-values (rf/sub
[:wallet/wallet-send-receiver-network-values])
token-not-supported-in-receiver-networks? (every? #(= (:type %) :not-available)
(filter #(not= (:type %) :add)
receiver-network-values))
suggested-routes (rf/sub [:wallet/wallet-send-suggested-routes])
routes (when suggested-routes
(or (:best suggested-routes) []))
no-routes-found? (and
(every-network-value-is-zero?
sender-network-values)
(not (nil? routes))
(not loading-routes?)
(not token-not-supported-in-receiver-networks?))
receiver-networks (rf/sub [:wallet/wallet-send-receiver-networks])
receiver-preferred-networks (rf/sub
[:wallet/wallet-send-receiver-preferred-networks])
receiver-preferred-networks-set (set receiver-preferred-networks)
sending-to-unpreferred-networks? (not (every? (fn [receiver-selected-network]
(contains?
receiver-preferred-networks-set
receiver-selected-network))
receiver-networks))]
on-confirm (or default-on-confirm handle-on-confirm)
crypto-decimals (or default-crypto-decimals
(utils/get-crypto-decimals-count token))
crypto-limit (or default-limit-crypto
(utils/get-standard-crypto-format
token
token-balance))
fiat-limit (.toFixed (* token-balance conversion-rate) 2)
current-limit (if @crypto-currency? crypto-limit fiat-limit)
valid-input? (not (or (string/blank? (controlled-input/input-value
input-state))
(<= (controlled-input/numeric-value input-state) 0)
(> (controlled-input/numeric-value input-state)
current-limit)))
current-currency (if @crypto-currency? token-symbol fiat-currency)
input-num-value (controlled-input/numeric-value input-state)
confirm-disabled? (or (nil? route)
(empty? route)
(string/blank? (controlled-input/input-value input-state))
(<= input-num-value 0)
(> input-num-value current-limit))
amount-text (str (controlled-input/input-value input-state)
" "
token-symbol)
first-route (first route)
native-currency-symbol (when-not confirm-disabled?
(get-in first-route [:from :native-currency-symbol]))
native-token (when native-currency-symbol
(rf/sub [:wallet/token-by-symbol
native-currency-symbol]))
fee-in-native-token (when-not confirm-disabled?
(send-utils/calculate-full-route-gas-fee route))
fee-in-crypto-formatted (when fee-in-native-token
(utils/get-standard-crypto-format
native-token
fee-in-native-token))
fee-in-fiat (when-not confirm-disabled?
(utils/calculate-token-fiat-value
{:currency fiat-currency
:balance fee-in-native-token
:token native-token}))
currency-symbol (rf/sub [:profile/currency-symbol])
fee-formatted (when fee-in-fiat
(utils/get-standard-fiat-format
fee-in-crypto-formatted
currency-symbol
fee-in-fiat))
show-select-asset-sheet #(rf/dispatch
[:show-bottom-sheet
{:content (fn []
[select-asset-bottom-sheet
clear-input!])}])
loading-suggested-routes? (rf/sub
[:wallet/wallet-send-loading-suggested-routes?])
sender-network-values (rf/sub
[:wallet/wallet-send-sender-network-values])
suggested-routes (rf/sub [:wallet/wallet-send-suggested-routes])
routes (when suggested-routes
(or (:best suggested-routes) []))
no-routes-found? (and
(every-network-value-is-zero? sender-network-values)
(not (nil? routes))
(not loading-suggested-routes?))]
(rn/use-mount
(fn []
(let [dismiss-keyboard-fn #(when (= % "active") (rn/dismiss-keyboard!))
@@ -265,21 +211,16 @@
:on-swap #(reset! crypto-currency? %)
:on-token-press show-select-asset-sheet}]
[routes/view
{:token token
:input-value (controlled-input/input-value input-state)
:valid-input? valid-input?
:token-not-supported-in-receiver-networks? token-not-supported-in-receiver-networks?
:current-screen-id current-screen-id}]
(when (and (not loading-routes?)
sender-network-values
token-not-supported-in-receiver-networks?)
[token-not-available token-symbol receiver-networks token-networks])
{:token token
:input-value (controlled-input/input-value input-state)
:valid-input? valid-input?
:current-screen-id current-screen-id}]
(when (or loading-routes? (seq route))
[estimated-fees
{:loading-routes? loading-routes?
:fees fee-formatted
:amount amount-text
:receiver (address/get-shortened-key to-address)}])
{:loading-suggested-routes? loading-routes?
:fees fee-formatted
:amount amount-text
:receiver (address/get-shortened-key to-address)}])
(when no-routes-found?
[rn/view {:style style/no-routes-found-container}
[quo/info-message
@@ -295,14 +236,10 @@
button-one-label)
:button-one-props (merge button-one-props
{:disabled? (and (not no-routes-found?) confirm-disabled?)
:on-press (cond
no-routes-found?
:on-press (if no-routes-found?
#(rf/dispatch [:wallet/get-suggested-routes
{:amount (controlled-input/input-value
input-state)}])
sending-to-unpreferred-networks?
#(show-unpreferred-networks-alert on-confirm)
:else
on-confirm)}
(when no-routes-found?
{:type :grey}))}]
@@ -1,11 +1,14 @@
(ns status-im.contexts.wallet.send.routes.view
(:require
[clojure.string :as string]
[quo.core :as quo]
[quo.foundations.colors :as colors]
[quo.foundations.resources :as resources]
[react-native.core :as rn]
[reagent.core :as reagent]
[status-im.contexts.wallet.common.utils.networks :as network-utils]
[status-im.contexts.wallet.send.routes.style :as style]
[status-im.contexts.wallet.send.utils :as send-utils]
[status-im.contexts.wallet.sheets.network-preferences.view :as network-preferences]
[utils.debounce :as debounce]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
@@ -16,6 +19,19 @@
(def network-link-1x-height 56)
(def network-link-2x-height 111)
(defn- make-network-item
[{:keys [network-name chain-id] :as _network}
{:keys [title color on-change network-preferences] :as _options}]
{:title (or title (string/capitalize (name network-name)))
:image :icon-avatar
:image-props {:icon (resources/get-network network-name)
:size :size-20}
:action :selector
:action-props {:type :checkbox
:customization-color color
:checked? (some #(= % chain-id) @network-preferences)
:on-change on-change}})
(defn fetch-routes
[amount valid-input? bounce-duration-ms]
(if valid-input?
@@ -24,93 +40,82 @@
bounce-duration-ms)
(rf/dispatch [:wallet/clean-suggested-routes])))
(defn- open-preferences
[]
(rf/dispatch
[:show-bottom-sheet
{:content
(fn []
(let [receiver-networks (rf/sub [:wallet/wallet-send-receiver-networks])
receiver-preferred-networks (rf/sub
[:wallet/wallet-send-receiver-preferred-networks])
{token-symbol :symbol
token-networks :networks} (rf/sub [:wallet/wallet-send-token])
token-chain-ids-set (set (mapv #(:chain-id %) token-networks))
[selected-receiver-networks
set-selected-receiver-networks] (rn/use-state receiver-networks)
receiver-preferred-networks-set (set receiver-preferred-networks)
receiver-selected-preferred-networks (filter #(contains?
receiver-preferred-networks-set
%)
selected-receiver-networks)
receiver-selected-non-preferred-networks (filter #(not (contains?
receiver-preferred-networks-set
%))
selected-receiver-networks)
not-available-preferred-networks (filter (fn [preferred-chain-id]
(not (contains? token-chain-ids-set
preferred-chain-id)))
receiver-selected-preferred-networks)
not-available-non-preferred-networks (filter (fn [preferred-chain-id]
(not (contains?
token-chain-ids-set
preferred-chain-id)))
receiver-selected-non-preferred-networks)
first-section-warning-label (when (not-empty not-available-preferred-networks)
(i18n/label
:t/token-not-available-on-networks
{:token-symbol token-symbol
:networks
(network-utils/network-ids->formatted-text
not-available-preferred-networks)}))
second-section-warning-label (when (not-empty
not-available-non-preferred-networks)
(i18n/label
:t/token-not-available-on-networks
{:token-symbol token-symbol
:networks
(network-utils/network-ids->formatted-text
not-available-non-preferred-networks)}))]
[network-preferences/view
{:title (i18n/label :t/edit-receiver-networks)
:first-section-label (i18n/label :t/preferred-by-receiver)
:second-section-label (i18n/label :t/not-preferred-by-receiver)
:selected-networks (set (map network-utils/id->network
receiver-networks))
:receiver-preferred-networks receiver-preferred-networks
:button-label (i18n/label :t/apply-changes)
:first-section-warning-label first-section-warning-label
:second-section-warning-label second-section-warning-label
:on-change #(set-selected-receiver-networks %)
:on-save (fn [chain-ids]
(rf/dispatch [:hide-bottom-sheet])
(rf/dispatch [:wallet/update-receiver-networks
chain-ids]))}]))}]))
(defn networks-drawer
[{:keys [on-save theme]}]
(let [network-details (rf/sub [:wallet/network-details])
{:keys [color]} (rf/sub [:wallet/current-viewing-account])
selected-networks (rf/sub [:wallet/wallet-send-receiver-networks])
prefix (rf/sub [:wallet/wallet-send-address-prefix])
prefix-seq (string/split prefix #":")
grouped-details (group-by #(contains? (set prefix-seq) (:short-name %)) network-details)
preferred (get grouped-details true [])
not-preferred (get grouped-details false [])
network-preferences (reagent/atom selected-networks)
toggle-network (fn [{:keys [chain-id]}]
(swap! network-preferences
(fn [preferences]
(if (some #(= % chain-id) preferences)
(vec (remove #(= % chain-id) preferences))
(conj preferences chain-id)))))]
(fn []
[rn/view
[quo/drawer-top {:title (i18n/label :t/edit-receiver-networks)}]
[quo/category
{:list-type :settings
:label (i18n/label :t/preferred-by-receiver)
:data (mapv (fn [network]
(make-network-item network
{:color color
:network-preferences network-preferences
:on-change #(toggle-network network)}))
preferred)}]
(when (pos? (count not-preferred))
[quo/category
{:list-type :settings
:label (i18n/label :t/not-preferred-by-receiver)
:data (mapv (fn [network]
(make-network-item network
{:color color
:network-preferences network-preferences
:on-change #(toggle-network network)}))
not-preferred)}])
(when (not= selected-networks @network-preferences)
[rn/view {:style (style/warning-container color theme)}
[quo/icon :i/info {:color (colors/resolve-color color theme)}]
[quo/text
{:size :paragraph-2
:style style/warning-text} (i18n/label :t/receiver-networks-warning)]])
[quo/bottom-actions
{:actions :one-action
:button-one-label (i18n/label :t/apply-changes)
:button-one-props {:disabled? (or (= selected-networks @network-preferences)
(empty? @network-preferences))
:on-press (fn []
(rf/dispatch [:wallet/update-receiver-networks
@network-preferences])
(rf/dispatch [:hide-bottom-sheet])
(on-save))
:customization-color color}}]])))
(defn render-network-values
[{:keys [network-values token-symbol on-press receiver? loading-routes?
token-not-supported-in-receiver-networks?]}]
[{:keys [network-values token-symbol on-press theme on-save to? loading-suggested-routes?]}]
[rn/view
(map-indexed (fn [index {:keys [chain-id total-amount type]}]
[rn/view
{:key (str (if receiver? "to" "from") "-" chain-id)
{:key (str (if to? "to" "from") "-" chain-id)
:style {:margin-top (if (pos? index) 11 7.5)}}
[quo/network-bridge
{:amount (if (= type :not-available)
(i18n/label :t/not-available)
(str total-amount " " token-symbol))
{:amount (str total-amount " " token-symbol)
:network (network-utils/id->network chain-id)
:status (cond (and (= type :not-available)
loading-routes?
token-not-supported-in-receiver-networks?)
:loading
(= type :not-available)
:disabled
:else type)
:on-press #(when (not loading-routes?)
:status type
:on-press #(when (not loading-suggested-routes?)
(cond
(= type :add)
(open-preferences)
(rf/dispatch [:show-bottom-sheet
{:content (fn []
[networks-drawer
{:theme theme
:on-save on-save}])}])
on-press (on-press chain-id total-amount)))}]])
network-values)])
@@ -175,13 +180,12 @@
(defn view
[{:keys [token theme input-value valid-input?
on-press-to-network current-screen-id
token-not-supported-in-receiver-networks?]}]
on-press-to-network current-screen-id]}]
(let [token-symbol (:symbol token)
nav-current-screen-id (rf/sub [:view-id])
active-screen? (= nav-current-screen-id current-screen-id)
loading-routes? (rf/sub
[:wallet/wallet-send-loading-suggested-routes?])
loading-suggested-routes? (rf/sub
[:wallet/wallet-send-loading-suggested-routes?])
sender-network-values (rf/sub
[:wallet/wallet-send-sender-network-values])
receiver-network-values (rf/sub
@@ -216,27 +220,23 @@
:container-style style/section-label-right}]])
[rn/view {:style style/routes-inner-container}
[render-network-values
{:token-symbol token-symbol
:network-values sender-network-values
:on-press (fn [chain-id-to-disable]
(disable-chain
chain-id-to-disable
disabled-from-chain-ids
token-available-networks-for-suggested-routes))
:receiver? false
:theme theme
:loading-routes? loading-routes?
:token-not-supported-in-receiver-networks? false}]
{:token-symbol token-symbol
:network-values sender-network-values
:on-press #(disable-chain %1
disabled-from-chain-ids
token-available-networks-for-suggested-routes)
:to? false
:theme theme
:loading-suggested-routes? loading-suggested-routes?}]
[render-network-links
{:network-links network-links
:sender-network-values sender-network-values}]
[render-network-values
{:token-symbol token-symbol
:network-values receiver-network-values
:on-press on-press-to-network
:receiver? true
:loading-routes? loading-routes?
:theme theme
:token-not-supported-in-receiver-networks? token-not-supported-in-receiver-networks?
:on-save #(fetch-routes input-value valid-input? 0)}]]]))
{:token-symbol token-symbol
:network-values receiver-network-values
:on-press on-press-to-network
:to? true
:loading-suggested-routes? loading-suggested-routes?
:theme theme
:on-save #(fetch-routes input-value valid-input? 0)}]]]))
@@ -15,7 +15,3 @@
{:justify-self :flex-end
:margin-bottom 20
:margin-horizontal 20})
(def network-text-container
{:padding-horizontal 12
:padding-top 4})
@@ -8,7 +8,7 @@
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn- my-accounts
(defn my-accounts
[theme]
(let [other-accounts (rf/sub [:wallet/accounts-without-current-viewing-account])]
(if (zero? (count other-accounts))
@@ -27,30 +27,15 @@
:stack-id :screen/wallet.select-address}])}]))
other-accounts))))
(defn- recent-transactions
[theme]
(let [recent-recipients (rf/sub [:wallet/recent-recipients])]
(if (zero? (count recent-recipients))
[quo/empty-state
{:title (i18n/label :t/no-recent-transactions)
:description (i18n/label :t/make-one-it-is-easy-we-promise)
:image (resources/get-themed-image :angry-man theme)
:container-style style/empty-container-style}]
(into [rn/view {:style style/my-accounts-container}]
(map (fn [address]
[quo/address
{:address address
:on-press #(rf/dispatch [:wallet/select-send-address
{:address address
:recipient address
:stack-id :screen/wallet.select-address}])}]))
recent-recipients))))
(defn view
[{:keys [selected-tab]}]
(let [theme (quo.theme/use-theme)]
(case selected-tab
:tab/recent [recent-transactions theme]
:tab/recent [quo/empty-state
{:title (i18n/label :t/no-recent-transactions)
:description (i18n/label :t/make-one-it-is-easy-we-promise)
:image (resources/get-themed-image :angry-man theme)
:container-style style/empty-container-style}]
:tab/saved [quo/empty-state
{:title (i18n/label :t/no-saved-addresses)
:description (i18n/label :t/you-like-to-type-43-characters)
@@ -2,7 +2,6 @@
(:require
[quo.core :as quo]
[quo.foundations.colors :as colors]
[quo.theme]
[react-native.core :as rn]
[react-native.safe-area :as safe-area]
[reagent.core :as reagent]
@@ -79,22 +78,23 @@
:valid-ens-or-address? valid-ens-or-address?}])))
(defn- ens-linked-address
[{:keys [address networks]}]
(let [theme (quo.theme/use-theme)]
[quo/text
{:size :paragraph-2
:style style/network-text-container}
(map (fn [network]
^{:key (str network)}
[quo/text
{:size :paragraph-2
:style {:color (colors/resolve-color network theme)}}
(str (subs (name network) 0 3) ":")])
networks)
[quo/text
{:size :paragraph-2
:weight :monospace}
address]]))
[{:keys [address networks theme]}]
[quo/text
{:size :paragraph-2
:style {:padding-horizontal 12
:padding-top 4}}
(map (fn [network]
^{:key (str network)}
[quo/text
{:size :paragraph-2
:style {:color (colors/resolve-color network theme)}}
(str (subs (name network) 0 3) ":")])
networks)
[quo/text
{:size :paragraph-2
:weight :monospace
:style {:color (colors/theme-colors colors/neutral-100 colors/white theme)}}
address]])
(defn- suggestion-component
[]
@@ -151,10 +151,9 @@
input-value (reagent/atom "")
input-focused? (reagent/atom false)]
(fn []
(let [selected-tab (or (rf/sub [:wallet/send-tab]) (:id (first tabs-data)))
valid-ens-or-address? (boolean (rf/sub [:wallet/valid-ens-or-address?]))
local-suggestion-address (rf/sub [:wallet/local-suggestions->full-address])
color (rf/sub [:wallet/current-viewing-account-color])]
(let [selected-tab (or (rf/sub [:wallet/send-tab]) (:id (first tabs-data)))
valid-ens-or-address? (boolean (rf/sub [:wallet/valid-ens-or-address?]))
{:keys [color]} (rf/sub [:wallet/current-viewing-account])]
[floating-button-page/view
{:footer-container-padding 0
:header [account-switcher/view
@@ -168,8 +167,7 @@
:disabled? (not valid-ens-or-address?)
:on-press #(rf/dispatch
[:wallet/select-send-address
{:address (or local-suggestion-address
@input-value)
{:address @input-value
:stack-id
:screen/wallet.select-address}])
:customization-color color}
@@ -67,9 +67,6 @@
(rf/dispatch [:wallet/clean-selected-token])
(rf/dispatch [:wallet/clean-selected-collectible])
(rf/dispatch [:navigate-back]))]
(rn/use-unmount (fn []
(rf/dispatch [:wallet/clean-selected-token])
(rf/dispatch [:wallet/clean-selected-collectible])))
(fn []
[rn/safe-area-view {:style style/container}
[account-switcher/view
+63 -105
View File
@@ -43,22 +43,21 @@
(money/wei->ether (reduce money/add (map calculate-gas-fee route))))
(defn network-amounts-by-chain
[{:keys [route token-decimals native-token? receiver?]}]
(reduce
(fn [acc path]
(let [amount-hex (if receiver? (:amount-in path) (:amount-out path))
amount-units (native-module/hex-to-number
(utils.hex/normalize-hex amount-hex))
amount (money/with-precision
(if native-token?
(money/wei->ether amount-units)
(money/token->unit amount-units
token-decimals))
6)
chain-id (if receiver? (get-in path [:to :chain-id]) (get-in path [:from :chain-id]))]
(update acc chain-id money/add amount)))
{}
route))
[{:keys [route token-decimals native-token? to?]}]
(reduce (fn [acc path]
(let [amount-hex (if to? (:amount-in path) (:amount-out path))
amount-units (native-module/hex-to-number
(utils.hex/normalize-hex amount-hex))
amount (money/with-precision
(if native-token?
(money/wei->ether amount-units)
(money/token->unit amount-units
token-decimals))
6)
chain-id (if to? (get-in path [:to :chain-id]) (get-in path [:from :chain-id]))]
(update acc chain-id money/add amount)))
{}
route))
(defn network-values-for-ui
[amounts]
@@ -94,103 +93,62 @@
network-amounts))
(defn network-amounts
[{:keys [network-values disabled-chain-ids receiver-networks token-networks-ids receiver?]}]
(let [disabled-set (set disabled-chain-ids)
receiver-networks-set (set receiver-networks)
network-values-keys (set (keys network-values))
routes-found? (pos? (count network-values-keys))
token-networks-ids-set (set token-networks-ids)
not-available-networks (if receiver?
(filter #(not (token-networks-ids-set %))
receiver-networks)
[])
not-available-networks-set (set not-available-networks)
network-values-with-disabled-chains (when routes-found?
(reduce
(fn [acc k]
(if (or (contains? network-values-keys k)
(and receiver?
(not (contains? receiver-networks-set
k))))
acc
(assoc acc k (money/bignumber "0"))))
network-values
disabled-chain-ids))
network-values-with-not-available-chains (if (and receiver? routes-found?)
(let [network-values-keys
(set (keys
network-values-with-disabled-chains))]
(reduce
(fn [acc k]
(if (not (contains? network-values-keys k))
(assoc acc k nil)
acc))
network-values-with-disabled-chains
not-available-networks))
network-values-with-disabled-chains)]
(cond-> (->>
network-values-with-not-available-chains
(map
(fn [[chain-id amount]]
{:chain-id chain-id
:total-amount amount
:type (cond
(contains? not-available-networks-set chain-id) :not-available
(or receiver? (not (contains? disabled-set chain-id))) :default
(and (not receiver?) (contains? disabled-set chain-id)) :disabled)}))
(sort-by (fn [network-amount]
(get network-priority-score
(network-utils/id->network (:chain-id network-amount)))))
(filter
(fn [network-amount]
(or (and receiver?
(or (contains? receiver-networks-set (:chain-id network-amount))
(money/greater-than (:total-amount network-amount) (money/bignumber "0"))))
(not receiver?))))
(vec))
(and receiver?
[network-values disabled-chain-ids receiver-networks to?]
(let [disabled-set (set disabled-chain-ids)
receiver-networks-set (set receiver-networks)
network-values-keys (set (keys network-values))
routes-found? (pos? (count network-values-keys))
updated-network-values (when routes-found?
(reduce (fn [acc k]
(if (or (contains? network-values-keys k)
(and to?
(not (contains? receiver-networks-set k))))
acc
(assoc acc k (money/bignumber "0"))))
network-values
disabled-chain-ids))]
(cond-> (->> updated-network-values
(map
(fn [[k v]]
{:chain-id k
:total-amount v
:type (if (or to? (not (contains? disabled-set k))) :default :disabled)}))
(sort-by #(get network-priority-score (network-utils/id->network (:chain-id %))))
(filter
#(or (and to?
(or (contains? receiver-networks-set (:chain-id %))
(money/greater-than (:total-amount %) (money/bignumber "0"))))
(not to?)))
(vec))
(and to?
routes-found?
(< (count network-values-with-not-available-chains) available-networks-count))
(< (count updated-network-values) available-networks-count))
(conj {:type :add}))))
(defn loading-network-amounts
[{:keys [valid-networks disabled-chain-ids receiver-networks token-networks-ids receiver?]}]
(let [disabled-set (set disabled-chain-ids)
receiver-networks-set (set receiver-networks)
receiver-networks-count (count receiver-networks)
token-networks-ids-set (set token-networks-ids)
valid-networks-set (set valid-networks)
not-available-networks (if receiver?
(filter #(not (token-networks-ids-set %)) receiver-networks)
[])
not-available-networks-set (set not-available-networks)
valid-networks (concat valid-networks
disabled-chain-ids
(when receiver?
(filter #(not (valid-networks-set %))
not-available-networks)))]
[valid-networks disabled-chain-ids receiver-networks to?]
(let [disabled-set (set disabled-chain-ids)
receiver-networks-set (set receiver-networks)
receiver-networks-count (count receiver-networks)
valid-networks (concat valid-networks disabled-chain-ids)]
(cond-> (->> valid-networks
(map
(fn [chain-id]
(cond->
{:chain-id chain-id
:type (cond
(contains? not-available-networks-set chain-id) :not-available
(or receiver?
(not (contains? disabled-set chain-id))) :loading
(and (not receiver?) (contains? disabled-set chain-id)) :disabled)}
(and (not receiver?) (contains? disabled-set chain-id))
(assoc :total-amount (money/bignumber "0")))))
(sort-by (fn [network-amount]
(map (fn [k]
(cond-> {:chain-id k
:type (if (or to?
(not (contains? disabled-set k)))
:loading
:disabled)}
(and (not to?) (contains? disabled-set k))
(assoc :total-amount (money/bignumber "0")))))
(sort-by (fn [item]
(get network-priority-score
(network-utils/id->network (:chain-id network-amount)))))
(network-utils/id->network (:chain-id item)))))
(filter
(fn [network-amount]
(or (and receiver? (contains? receiver-networks-set (:chain-id network-amount)))
(and (not receiver?)
(not (contains? disabled-chain-ids (:chain-id network-amount)))))))
#(or (and to? (contains? receiver-networks-set (:chain-id %)))
(and (not to?)
(not (contains? disabled-chain-ids (:chain-id %))))))
(vec))
(and receiver? (< receiver-networks-count available-networks-count)) (conj {:type :add}))))
(and to? (< receiver-networks-count available-networks-count)) (conj {:type :add}))))
(defn network-links
[route from-values-by-chain to-values-by-chain]
@@ -38,11 +38,11 @@
:to {:chain-id "2"}}]
token-decimals 18
native-token? true
receiver? true
to? true
result (utils/network-amounts-by-chain {:route route
:token-decimals token-decimals
:native-token? native-token?
:receiver? receiver?})
:to? to?})
expected {"1" (money/bignumber "1")
"2" (money/bignumber "1")}]
(doseq [[chain-id exp-value] expected]
@@ -56,11 +56,11 @@
:to {:chain-id "1"}}]
token-decimals 18
native-token? true
receiver? true
to? true
result (utils/network-amounts-by-chain {:route route
:token-decimals token-decimals
:native-token? native-token?
:receiver? receiver?})
:to? to?})
expected {"1" (money/bignumber "2")}]
(doseq [[chain-id exp-value] expected]
(is (money/equal-to (get result chain-id) exp-value)))))
@@ -72,11 +72,11 @@
:from {:chain-id "2"}}]
token-decimals 6
native-token? false
receiver? false
to? false
result (utils/network-amounts-by-chain {:route route
:token-decimals token-decimals
:native-token? native-token?
:receiver? receiver?})
:to? to?})
expected {"1" (money/bignumber "2")
"2" (money/bignumber "2")}]
(doseq [[chain-id exp-value] expected]
@@ -268,13 +268,12 @@
(is (every? identity comparisons)))))
(deftest test-network-amounts
(testing "Handles disabled and receiver networks correctly when receiver? is true"
(testing "Handles disabled and receiver networks correctly when to? is true"
(let [network-values {"1" (money/bignumber "100")
"10" (money/bignumber "200")}
disabled-chain-ids ["1"]
receiver-networks ["10"]
token-networks-ids ["1" "10" "42161"]
receiver? true
to? true
expected [{:chain-id "1"
:total-amount (money/bignumber "100")
:type :default}
@@ -282,44 +281,39 @@
:total-amount (money/bignumber "200")
:type :default}
{:type :add}]
result (utils/network-amounts {:network-values network-values
:disabled-chain-ids disabled-chain-ids
:receiver-networks receiver-networks
:token-networks-ids token-networks-ids
:receiver? receiver?})]
result (utils/network-amounts network-values
disabled-chain-ids
receiver-networks
to?)]
(is (every? identity (map #(map/deep-compare %1 %2) expected result)))))
(testing "Adds default amount for non-disabled non-receiver networks when receiver? is false"
(testing "Adds default amount for non-disabled non-receiver networks when to? is false"
(let [network-values {"1" (money/bignumber "100")}
disabled-chain-ids ["10"]
receiver-networks []
token-networks-ids ["1" "10" "42161"]
receiver? false
to? false
expected [{:chain-id "1"
:total-amount (money/bignumber "100")
:type :default}
{:chain-id "10"
:total-amount (money/bignumber "0")
:type :disabled}]
result (utils/network-amounts {:network-values network-values
:disabled-chain-ids disabled-chain-ids
:receiver-networks receiver-networks
:token-networks-ids token-networks-ids
:receiver? receiver?})]
result (utils/network-amounts network-values
disabled-chain-ids
receiver-networks
to?)]
(is (every? identity (map #(map/deep-compare %1 %2) expected result)))))
(testing "Handles empty inputs correctly"
(let [network-values {}
disabled-chain-ids []
receiver-networks []
token-networks-ids []
receiver? true
to? true
expected []
result (utils/network-amounts {:network-values network-values
:disabled-chain-ids disabled-chain-ids
:receiver-networks receiver-networks
:token-networks-ids token-networks-ids
:receiver? receiver?})]
result (utils/network-amounts network-values
disabled-chain-ids
receiver-networks
to?)]
(is (= expected result))))
(testing "Processes case with multiple network interactions"
@@ -328,8 +322,7 @@
"42161" (money/bignumber "500")}
disabled-chain-ids ["1" "42161"]
receiver-networks ["10"]
token-networks-ids ["1" "10" "42161"]
receiver? true
to? true
expected [{:chain-id "1"
:total-amount (money/bignumber "300")
:type :default}
@@ -339,50 +332,10 @@
{:chain-id "42161"
:total-amount (money/bignumber "500")
:type :default}]
result (utils/network-amounts {:network-values network-values
:disabled-chain-ids disabled-chain-ids
:receiver-networks receiver-networks
:token-networks-ids token-networks-ids
:receiver? receiver?})]
(is (every? identity (map #(map/deep-compare %1 %2) expected result)))))
(testing "Does not assign :not-available type when receiver? is false"
(let [network-values {"1" (money/bignumber "100")}
disabled-chain-ids ["10"]
receiver-networks ["1"]
token-networks-ids ["1" "10"]
receiver? false
expected [{:chain-id "1"
:total-amount (money/bignumber "100")
:type :default}
{:chain-id "10"
:total-amount (money/bignumber "0")
:type :disabled}]
result (utils/network-amounts {:network-values network-values
:disabled-chain-ids disabled-chain-ids
:receiver-networks receiver-networks
:token-networks-ids token-networks-ids
:receiver? receiver?})]
(is (every? identity (map #(map/deep-compare %1 %2) expected result)))))
(testing
"Assigns :not-available type to networks not available in token-networks-ids when receiver? is true"
(let [network-values {"1" (money/bignumber "100")}
disabled-chain-ids []
receiver-networks ["1" "10"]
token-networks-ids ["1"]
receiver? false
expected [{:chain-id "1"
:total-amount (money/bignumber "100")
:type :default}
{:chain-id "10"
:total-amount nil
:type :not-available}]
result (utils/network-amounts {:network-values network-values
:disabled-chain-ids disabled-chain-ids
:receiver-networks receiver-networks
:token-networks-ids token-networks-ids
:receiver? receiver?})]
result (utils/network-amounts network-values
disabled-chain-ids
receiver-networks
to?)]
(is (every? identity (map #(map/deep-compare %1 %2) expected result))))))
(deftest test-loading-network-amounts
@@ -390,109 +343,63 @@
(let [valid-networks ["1" "10" "42161"]
disabled-chain-ids ["42161"]
receiver-networks ["1" "10"]
token-networks-ids ["1" "10" "42161"]
receiver? true
to? true
expected [{:chain-id "1" :type :loading}
{:chain-id "10" :type :loading}
{:type :add}]
result (utils/loading-network-amounts {:valid-networks valid-networks
:disabled-chain-ids disabled-chain-ids
:receiver-networks receiver-networks
:token-networks-ids token-networks-ids
:receiver? receiver?})
result (utils/loading-network-amounts valid-networks
disabled-chain-ids
receiver-networks
to?)
comparisons (map #(map/deep-compare %1 %2)
expected
result)]
(is (every? identity comparisons))))
(testing "Assigns :disabled type with zero total-amount to disabled networks when receiver? is false"
(testing "Assigns :disabled type with zero total-amount to disabled networks when to? is false"
(let [valid-networks ["1" "10" "42161"]
disabled-chain-ids ["10" "42161"]
receiver-networks ["1"]
token-networks-ids ["1" "10" "42161"]
receiver? false
to? false
expected [{:chain-id "1" :type :loading}
{:chain-id "10" :type :disabled :total-amount (money/bignumber "0")}
{:chain-id "42161" :type :disabled :total-amount (money/bignumber "0")}]
result (utils/loading-network-amounts {:valid-networks valid-networks
:disabled-chain-ids disabled-chain-ids
:receiver-networks receiver-networks
:token-networks-ids token-networks-ids
:receiver? receiver?})
result (utils/loading-network-amounts valid-networks
disabled-chain-ids
receiver-networks
to?)
comparisons (map #(map/deep-compare %1 %2)
expected
result)]
(is (every? identity comparisons))))
(testing "Filters out networks not in receiver networks when receiver? is true"
(testing "Filters out networks not in receiver networks when to? is true"
(let [valid-networks ["1" "10" "42161" "59144"]
disabled-chain-ids ["10"]
receiver-networks ["1" "42161"]
token-networks-ids ["1" "10" "42161"]
receiver? true
to? true
expected [{:chain-id "1" :type :loading}
{:chain-id "42161" :type :loading}]
result (utils/loading-network-amounts {:valid-networks valid-networks
:disabled-chain-ids disabled-chain-ids
:receiver-networks receiver-networks
:token-networks-ids token-networks-ids
:receiver? receiver?})
result (utils/loading-network-amounts valid-networks
disabled-chain-ids
receiver-networks
to?)
comparisons (map #(map/deep-compare %1 %2)
expected
result)]
(is (every? identity comparisons))))
(testing
"Appends :add type if receiver network count is less than available networks and receiver? is true"
(testing "Appends :add type if receiver network count is less than available networks and to? is true"
(let [valid-networks ["1" "10" "42161"]
disabled-chain-ids ["10"]
receiver-networks ["1"]
token-networks-ids ["1" "10" "42161"]
receiver? true
to? true
expected [{:chain-id "1" :type :loading}
{:type :add}]
result (utils/loading-network-amounts {:valid-networks valid-networks
:disabled-chain-ids disabled-chain-ids
:receiver-networks receiver-networks
:token-networks-ids token-networks-ids
:receiver? receiver?})
comparisons (map #(map/deep-compare %1 %2)
expected
result)]
(is (every? identity comparisons))))
(testing
"Assigns :not-available type to networks not available in token-networks-ids when receiver? is false"
(let [valid-networks ["42161"]
disabled-chain-ids []
receiver-networks ["1"]
token-networks-ids ["42161"]
receiver? false
expected [{:chain-id "42161" :type :loading}]
result (utils/loading-network-amounts {:valid-networks valid-networks
:disabled-chain-ids disabled-chain-ids
:receiver-networks receiver-networks
:token-networks-ids token-networks-ids
:receiver? receiver?})
comparisons (map #(map/deep-compare %1 %2)
expected
result)]
(is (every? identity comparisons))))
(testing
"Assigns :not-available type to networks not available in token-networks-ids when receiver? is true"
(let [valid-networks ["42161"]
disabled-chain-ids []
receiver-networks ["1"]
token-networks-ids ["42161"]
receiver? true
expected [{:chain-id "1" :type :not-available}
{:type :add}]
result (utils/loading-network-amounts {:valid-networks valid-networks
:disabled-chain-ids disabled-chain-ids
:receiver-networks receiver-networks
:token-networks-ids token-networks-ids
:receiver? receiver?})
result (utils/loading-network-amounts valid-networks
disabled-chain-ids
receiver-networks
to?)
comparisons (map #(map/deep-compare %1 %2)
expected
result)]

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