Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e7c701b90 | ||
|
|
f05261a1e9 |
@@ -26,7 +26,6 @@
|
||||
malli.generator malli.generator
|
||||
malli.transform malli.transform
|
||||
malli.util malli.util
|
||||
promesa.core p
|
||||
schema.core schema
|
||||
status-im.feature-flags ff
|
||||
taoensso.timbre log}}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{:lint-as {promesa.core/-> clojure.core/->
|
||||
promesa.core/->> clojure.core/->>
|
||||
promesa.core/as-> clojure.core/as->
|
||||
promesa.core/let clojure.core/let
|
||||
promesa.core/plet clojure.core/let
|
||||
promesa.core/loop clojure.core/loop
|
||||
promesa.core/recur clojure.core/recur
|
||||
promesa.core/with-redefs clojure.core/with-redefs
|
||||
promesa.core/doseq clojure.core/doseq}}
|
||||
@@ -22,37 +22,34 @@
|
||||
:multi-lhs-hang]
|
||||
|
||||
:fn-map
|
||||
{"reg-sub" :arg1-pair
|
||||
"h/describe" :arg1-body
|
||||
"h/describe-skip" :arg1-body
|
||||
"h/describe-only" :arg1-body
|
||||
"h/test" :arg1-body
|
||||
"h/test-skip" :arg1-body
|
||||
"h/test-only" :arg1-body
|
||||
"test/async" :arg1-body
|
||||
"test/use-fixtures" :arg1-body
|
||||
"global.describe" :arg1-body
|
||||
"global.test" :arg1-body
|
||||
"list-comp" :binding
|
||||
"defview" :arg1-body
|
||||
"letsubs" :binding
|
||||
"with-let" "let"
|
||||
"reg-event-fx" :arg1-pair
|
||||
"reg-fx" :arg1-pair
|
||||
"testing" :arg1-body
|
||||
"deftest-sub" :arg1-body
|
||||
"test-async" :arg1-body
|
||||
"wait-for" :arg1-body
|
||||
"with-deps-check" :arg1-body
|
||||
"schema/=>" :arg1-body
|
||||
"->" [:noarg1-body
|
||||
{:list {:constant-pair? false :force-nl? false}
|
||||
:next-inner-restore [[:list :constant-pair?]]}]
|
||||
"set!" "reset!"
|
||||
"assoc-when" "assoc"
|
||||
"assoc-some" "assoc"
|
||||
"conj-when" "conj"
|
||||
"conj-some" "conj"}
|
||||
{"reg-sub" :arg1-pair
|
||||
"h/describe" :arg1-body
|
||||
"h/describe-skip" :arg1-body
|
||||
"h/describe-only" :arg1-body
|
||||
"h/test" :arg1-body
|
||||
"h/test-skip" :arg1-body
|
||||
"h/test-only" :arg1-body
|
||||
"global.describe" :arg1-body
|
||||
"global.test" :arg1-body
|
||||
"list-comp" :binding
|
||||
"defview" :arg1-body
|
||||
"letsubs" :binding
|
||||
"with-let" "let"
|
||||
"reg-event-fx" :arg1-pair
|
||||
"reg-fx" :arg1-pair
|
||||
"testing" :arg1-body
|
||||
"deftest-sub" :arg1-body
|
||||
"wait-for" :arg1-body
|
||||
"with-deps-check" :arg1-body
|
||||
"schema/=>" :arg1-body
|
||||
"->" [:noarg1-body
|
||||
{:list {:constant-pair? false :force-nl? false}
|
||||
:next-inner-restore [[:list :constant-pair?]]}]
|
||||
"set!" "reset!"
|
||||
"assoc-when" "assoc"
|
||||
"assoc-some" "assoc"
|
||||
"conj-when" "conj"
|
||||
"conj-some" "conj"}
|
||||
|
||||
:style-map
|
||||
{:no-comma {:map {:comma? false}}
|
||||
|
||||
@@ -331,14 +331,13 @@ shadow-server:##@ Start shadow-cljs in server mode for watching
|
||||
|
||||
_test-clojure: export TARGET := clojure
|
||||
_test-clojure: export WATCH ?= false
|
||||
_test-clojure: status-go-library
|
||||
_test-clojure:
|
||||
ifeq ($(WATCH), true)
|
||||
yarn node-pre-gyp rebuild && \
|
||||
yarn install && \
|
||||
yarn shadow-cljs compile mocks && \
|
||||
nodemon --exec "yarn shadow-cljs compile test && node --require ./test-resources/override.js $$SHADOW_OUTPUT_TO" -e cljs
|
||||
else
|
||||
yarn node-pre-gyp rebuild && \
|
||||
yarn install && \
|
||||
yarn shadow-cljs compile mocks && \
|
||||
yarn shadow-cljs compile test && \
|
||||
node --require ./test-resources/override.js "$$SHADOW_OUTPUT_TO"
|
||||
@@ -351,9 +350,8 @@ test: _test-clojure
|
||||
|
||||
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 node-pre-gyp rebuild
|
||||
yarn install
|
||||
rm -f target/test/test.js
|
||||
yarn shadow-cljs compile mocks && \
|
||||
concurrently --kill-others --prefix-colors 'auto' --names 'build,repl' \
|
||||
@@ -361,7 +359,7 @@ test-watch-for-repl: ##@test Watch all Clojure tests and support REPL connection
|
||||
"until [ -f $$SHADOW_OUTPUT_TO ] ; do sleep 1 ; done ; node --require ./test-resources/override.js $$SHADOW_OUTPUT_TO --repl"
|
||||
|
||||
test-unit: export SHADOW_OUTPUT_TO := target/unit_test/test.js
|
||||
test-unit: export SHADOW_NS_REGEXP := ^(?!tests\.integration-test)(?!tests\.contract-test).*-test$$
|
||||
test-unit: export SHADOW_NS_REGEXP := ^(?!tests\.integration-test)(?!tests-im\.contract-test).*-test$$
|
||||
test-unit: ##@test Run unit tests
|
||||
test-unit: _test-clojure
|
||||
|
||||
@@ -375,25 +373,25 @@ test-contract: export SHADOW_NS_REGEXP := ^tests\.contract-test.*$$
|
||||
test-contract: ##@test Run contract tests
|
||||
test-contract: _test-clojure
|
||||
|
||||
test-android: jsbundle
|
||||
test-android: export TARGET := android
|
||||
test-android: ##@test Android Gradle test
|
||||
android-test: jsbundle
|
||||
android-test: export TARGET := android
|
||||
android-test:
|
||||
cd android && ./gradlew test
|
||||
|
||||
test-component-watch: export TARGET := clojure
|
||||
test-component-watch: export COMPONENT_TEST := true
|
||||
test-component-watch: export BABEL_ENV := test
|
||||
test-component-watch: export JEST_USE_SILENT_REPORTER := false
|
||||
test-component-watch: ##@ Watch tests and re-run no changes to cljs files
|
||||
component-test-watch: export TARGET := clojure
|
||||
component-test-watch: export COMPONENT_TEST := true
|
||||
component-test-watch: export BABEL_ENV := test
|
||||
component-test-watch: export JEST_USE_SILENT_REPORTER := false
|
||||
component-test-watch: ##@ Watch tests and re-run no changes to cljs files
|
||||
@scripts/check-metro-shadow-process.sh
|
||||
rm -rf ./component-spec
|
||||
nodemon --exec 'yarn shadow-cljs compile component-test && jest --config=test/jest/jest.config.js --testEnvironment node ' -e cljs
|
||||
|
||||
test-component: export TARGET := clojure
|
||||
test-component: export COMPONENT_TEST := true
|
||||
test-component: export BABEL_ENV := test
|
||||
test-component: export JEST_USE_SILENT_REPORTER := false
|
||||
test-component: ##@test Run component tests once in NodeJS
|
||||
component-test: export TARGET := clojure
|
||||
component-test: export COMPONENT_TEST := true
|
||||
component-test: export BABEL_ENV := test
|
||||
component-test: export JEST_USE_SILENT_REPORTER := false
|
||||
component-test: ##@test Run component tests once in NodeJS
|
||||
@scripts/check-metro-shadow-process.sh
|
||||
rm -rf ./component-spec
|
||||
yarn shadow-cljs compile component-test && \
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.12'
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
|
||||
/* Options section can't access functions in objects. */
|
||||
def isPRBuild = utils.isPRBuild()
|
||||
@@ -15,7 +15,7 @@ pipeline {
|
||||
buildDiscarder(logRotator(
|
||||
numToKeepStr: '10',
|
||||
daysToKeepStr: '20',
|
||||
artifactNumToKeepStr: '1',
|
||||
artifactNumToKeepStr: '10',
|
||||
))
|
||||
/* Allows combined build to copy */
|
||||
copyArtifactPermission('/status-mobile/*')
|
||||
@@ -34,10 +34,10 @@ pipeline {
|
||||
}
|
||||
|
||||
environment {
|
||||
LANG = 'en_US.UTF-8'
|
||||
LC_ALL = 'en_US.UTF-8'
|
||||
LANGUAGE = 'en_US.UTF-8'
|
||||
PLATFORM = "android${utils.isE2EBuild() ? "-e2e" : ""}"
|
||||
LANG = "en_US.UTF-8"
|
||||
LC_ALL = "en_US.UTF-8"
|
||||
LANGUAGE = "en_US.UTF-8"
|
||||
TARGET = "android${utils.isE2EBuild() ? "-e2e" : ""}"
|
||||
BUILD_ENV = 'prod'
|
||||
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
||||
FASTLANE_DISABLE_COLORS = 1
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.12'
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
|
||||
pipeline {
|
||||
agent { label 'linux' }
|
||||
@@ -13,7 +13,7 @@ pipeline {
|
||||
buildDiscarder(logRotator(
|
||||
numToKeepStr: '10',
|
||||
daysToKeepStr: '30',
|
||||
artifactNumToKeepStr: '1',
|
||||
artifactNumToKeepStr: '10',
|
||||
))
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.12'
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
|
||||
pipeline {
|
||||
agent { label 'linux' }
|
||||
|
||||
triggers {
|
||||
// Nightly at 0am
|
||||
cron 'H 0 * * *'
|
||||
// Nightly at 2am
|
||||
cron 'H 2 * * *'
|
||||
}
|
||||
|
||||
parameters {
|
||||
@@ -23,7 +23,6 @@ pipeline {
|
||||
buildDiscarder(logRotator(
|
||||
numToKeepStr: '10',
|
||||
daysToKeepStr: '30',
|
||||
artifactNumToKeepStr: '1',
|
||||
))
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.12'
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
|
||||
/* Options section can't access functions in objects. */
|
||||
def isPRBuild = utils.isPRBuild()
|
||||
@@ -23,7 +23,7 @@ pipeline {
|
||||
buildDiscarder(logRotator(
|
||||
numToKeepStr: '10',
|
||||
daysToKeepStr: '20',
|
||||
artifactNumToKeepStr: '1',
|
||||
artifactNumToKeepStr: '10',
|
||||
))
|
||||
/* Allows combined build to copy */
|
||||
copyArtifactPermission('/status-mobile/*')
|
||||
@@ -34,10 +34,10 @@ pipeline {
|
||||
}
|
||||
|
||||
environment {
|
||||
LANG = 'en_US.UTF-8'
|
||||
LC_ALL = 'en_US.UTF-8'
|
||||
LANGUAGE = 'en_US.UTF-8'
|
||||
PLATFORM = 'ios'
|
||||
LANG = "en_US.UTF-8"
|
||||
LC_ALL = "en_US.UTF-8"
|
||||
LANGUAGE = "en_US.UTF-8"
|
||||
TARGET = 'ios'
|
||||
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
||||
FASTLANE_DISABLE_COLORS = 1
|
||||
BUNDLE_PATH = "${HOME}/.bundle"
|
||||
|
||||
+35
-36
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.12'
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
|
||||
/* Options section can't access functions in objects. */
|
||||
def isPRBuild = utils.isPRBuild()
|
||||
@@ -10,12 +10,12 @@ pipeline {
|
||||
options {
|
||||
timestamps()
|
||||
/* Prevent Jenkins jobs from running forever */
|
||||
timeout(time: 20, unit: 'MINUTES')
|
||||
timeout(time: 15, unit: 'MINUTES')
|
||||
/* Limit builds retained */
|
||||
buildDiscarder(logRotator(
|
||||
numToKeepStr: '10',
|
||||
daysToKeepStr: '20',
|
||||
artifactNumToKeepStr: '1',
|
||||
artifactNumToKeepStr: '10',
|
||||
))
|
||||
/* Abort old PR builds. */
|
||||
disableConcurrentBuilds(
|
||||
@@ -29,47 +29,53 @@ pipeline {
|
||||
description: 'Specify build type. Values: pr / e2e / nightly / release',
|
||||
defaultValue: 'pr',
|
||||
)
|
||||
booleanParam(
|
||||
name: 'RUN_CONTRACT_TESTS',
|
||||
description: 'Whether to run optional and slow contract tests.',
|
||||
defaultValue: false,
|
||||
)
|
||||
}
|
||||
|
||||
environment {
|
||||
LANG = 'en_US.UTF-8'
|
||||
LC_ALL = 'en_US.UTF-8'
|
||||
LANGUAGE = 'en_US.UTF-8'
|
||||
PLATFORM = 'tests'
|
||||
LANG = "en_US.UTF-8"
|
||||
LC_ALL = "en_US.UTF-8"
|
||||
LANGUAGE = "en_US.UTF-8"
|
||||
TARGET = 'tests'
|
||||
BUILD_ENV = 'prod'
|
||||
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
||||
LOG_FILE = utils.pkgFilename(ext: 'log', arch: 'tests')
|
||||
CLJ_LINTER_PRINT_WARNINGS = 'true'
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Test') {
|
||||
stage('Checks') {
|
||||
parallel {
|
||||
stage('Lint') {
|
||||
steps { make('lint') }
|
||||
steps {
|
||||
sh """#!/bin/bash
|
||||
set -eo pipefail
|
||||
make lint CLJ_LINTER_PRINT_WARNINGS=true 2>&1 | tee ${LOG_FILE}
|
||||
"""
|
||||
}
|
||||
}
|
||||
stage('Unit') {
|
||||
steps { make('test-unit') }
|
||||
}
|
||||
stage('Component') {
|
||||
steps { make('test-component') }
|
||||
stage('Unit Tests') {
|
||||
steps {
|
||||
sh """#!/bin/bash
|
||||
set -eo pipefail
|
||||
make test-unit 2>&1 | tee -a ${LOG_FILE}
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Heavy Test') {
|
||||
parallel {
|
||||
stage('Contract') {
|
||||
when { expression { params.RUN_CONTRACT_TESTS } }
|
||||
steps { make('test-contract') }
|
||||
}
|
||||
stage('Integration') {
|
||||
steps { make('test-integration') }
|
||||
}
|
||||
stage('Integration Tests') {
|
||||
steps {
|
||||
sh """#!/bin/bash
|
||||
set -eo pipefail
|
||||
make test-integration 2>&1 | tee -a ${LOG_FILE}
|
||||
"""
|
||||
}
|
||||
}
|
||||
stage('Component Tests') {
|
||||
steps {
|
||||
sh """#!/bin/bash
|
||||
set -eo pipefail
|
||||
make component-test 2>&1 | tee -a ${LOG_FILE}
|
||||
"""
|
||||
}
|
||||
}
|
||||
stage('Upload') {
|
||||
@@ -86,10 +92,3 @@ pipeline {
|
||||
always { sh 'make purge' }
|
||||
}
|
||||
}
|
||||
|
||||
def make(target) {
|
||||
sh """#!/bin/bash
|
||||
set -eo pipefail
|
||||
make ${target} 2>&1 | tee -a ${LOG_FILE}
|
||||
"""
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.12'
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
|
||||
pipeline {
|
||||
|
||||
@@ -29,11 +29,6 @@ pipeline {
|
||||
|
||||
options {
|
||||
disableConcurrentBuilds()
|
||||
buildDiscarder(logRotator(
|
||||
numToKeepStr: '10',
|
||||
daysToKeepStr: '30',
|
||||
artifactNumToKeepStr: '1',
|
||||
))
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.12'
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
|
||||
pipeline {
|
||||
|
||||
@@ -47,11 +47,6 @@ pipeline {
|
||||
options {
|
||||
disableConcurrentBuilds()
|
||||
timeout(time: 90, unit: 'MINUTES')
|
||||
buildDiscarder(logRotator(
|
||||
numToKeepStr: '10',
|
||||
daysToKeepStr: '30',
|
||||
artifactNumToKeepStr: '1',
|
||||
))
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.12'
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
|
||||
pipeline {
|
||||
|
||||
@@ -28,11 +28,6 @@ pipeline {
|
||||
|
||||
options {
|
||||
disableConcurrentBuilds()
|
||||
buildDiscarder(logRotator(
|
||||
numToKeepStr: '10',
|
||||
daysToKeepStr: '30',
|
||||
artifactNumToKeepStr: '1',
|
||||
))
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.12'
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
|
||||
pipeline {
|
||||
agent { label 'macos' }
|
||||
|
||||
environment {
|
||||
LANG = 'en_US.UTF-8'
|
||||
LANGUAGE = 'en_US.UTF-8'
|
||||
LC_ALL = 'en_US.UTF-8'
|
||||
PLATFORM = 'ios'
|
||||
LANG = 'en_US.UTF-8'
|
||||
LANGUAGE = 'en_US.UTF-8'
|
||||
LC_ALL = 'en_US.UTF-8'
|
||||
TARGET = 'ios'
|
||||
FASTLANE_DISABLE_COLORS = 1
|
||||
/* avoid writing to r/o /nix */
|
||||
GEM_HOME = '~/.rubygems'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.12'
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
|
||||
pipeline {
|
||||
agent { label params.AGENT_LABEL }
|
||||
@@ -34,7 +34,6 @@ pipeline {
|
||||
buildDiscarder(logRotator(
|
||||
numToKeepStr: '20',
|
||||
daysToKeepStr: '30',
|
||||
artifactNumToKeepStr: '1',
|
||||
))
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.12'
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
|
||||
pipeline {
|
||||
agent { label 'linux' }
|
||||
|
||||
environment {
|
||||
LANG = 'en_US.UTF-8'
|
||||
LANGUAGE = 'en_US.UTF-8'
|
||||
LC_ALL = 'en_US.UTF-8'
|
||||
PLATFORM = 'ios'
|
||||
LANG = 'en_US.UTF-8'
|
||||
LANGUAGE = 'en_US.UTF-8'
|
||||
LC_ALL = 'en_US.UTF-8'
|
||||
TARGET = 'ios'
|
||||
FASTLANE_DISABLE_COLORS = 1
|
||||
/* avoid writing to r/o /nix */
|
||||
GEM_HOME = '~/.rubygems'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.12'
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
|
||||
@@ -16,10 +16,10 @@ Both of these links are showing it for React-Testing-Library (not Native) howeve
|
||||
## Running the tests
|
||||
To run these tests there are two methods.
|
||||
|
||||
`make test-component`
|
||||
`make component-test`
|
||||
setups and runs the test suite once.
|
||||
|
||||
`make test-component-watch`
|
||||
`make component-test-watch`
|
||||
setups and runs the test suite and watches for code changes will then retrigger the test suite.
|
||||
|
||||
## Writing Tests
|
||||
@@ -38,7 +38,7 @@ There is a file of utility functions defined in "src/test_helpers/component.cljs
|
||||
## Configuration
|
||||
Status Mobile has a bespoke tech stack, as such there is more complexities to configuring the tests.
|
||||
|
||||
### Shadow-CLJS
|
||||
### Shadow-CLJS
|
||||
the configuration for compiling our tests are defined in the "shadow-cljs.edn" file.
|
||||
The three main parts of this are
|
||||
`:target :npm-module`
|
||||
@@ -47,9 +47,9 @@ Needed for the configuration we are using
|
||||
a vector of entry points for the test files.
|
||||
and the `ns-regexp` to specify what tests to find. Since we have multiple forms of tests we decided that "component-spec" is the least likely to detect the wrong file type.
|
||||
|
||||
It's worth knowing that our tests are compiled to JS and then run in the temporary folder `component-tests`.
|
||||
It's worth knowing that our tests are compiled to JS and then run in the temporary folder `component-tests`.
|
||||
|
||||
### Jest
|
||||
There is also further configuration for Jest in "test/jest". There is a jest config file which has some mostly standard configuration pieces, where the tests live, what environment variables are set etc. This is documented by Jest here: https://jestjs.io/docs/configuration
|
||||
|
||||
There is also a setup file which is used to set some global and default values. Additionally this file is used to mock some of the react native (among other) dependencies.
|
||||
There is also a setup file which is used to set some global and default values. Additionally this file is used to mock some of the react native (among other) dependencies
|
||||
|
||||
+2
-2
@@ -54,13 +54,13 @@ Here I'm showing a terminal-only experience using Tmux (left pane Emacs, right p
|
||||
To run tests:
|
||||
|
||||
```
|
||||
make test-component
|
||||
make component-test
|
||||
```
|
||||
|
||||
Also test watcher can be launched. It will re-run the entire test suite when any file is modified
|
||||
|
||||
```
|
||||
make test-component-watch
|
||||
make component-test-watch
|
||||
```
|
||||
|
||||
Check [component tests doc](./component-tests-overview.md) for more.
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
<true/>
|
||||
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
|
||||
<array>
|
||||
<string>A00000080400010101</string>
|
||||
|
||||
@@ -1888,36 +1888,6 @@ void _InitLogging(const FunctionCallbackInfo<Value>& args) {
|
||||
delete c;
|
||||
}
|
||||
|
||||
void _RestoreAccountAndLogin(const FunctionCallbackInfo<Value>& args) {
|
||||
Isolate* isolate = args.GetIsolate();
|
||||
Local<Context> context = isolate->GetCurrentContext();
|
||||
|
||||
if (args.Length() != 1) {
|
||||
// Throw an Error that is passed back to JavaScript
|
||||
isolate->ThrowException(Exception::TypeError(
|
||||
String::NewFromUtf8Literal(isolate, "Wrong number of arguments for RestoreAccountAndLogin")));
|
||||
return;
|
||||
}
|
||||
|
||||
// Check the argument types
|
||||
|
||||
if (!args[0]->IsString()) {
|
||||
isolate->ThrowException(Exception::TypeError(
|
||||
String::NewFromUtf8Literal(isolate, "Wrong argument type for 'RestoreAccountAndLogin'")));
|
||||
return;
|
||||
}
|
||||
|
||||
String::Utf8Value arg0Obj(isolate, args[0]->ToString(context).ToLocalChecked());
|
||||
char *arg0 = *arg0Obj;
|
||||
|
||||
// Call exported Go function, which returns a C string
|
||||
char *c = RestoreAccountAndLogin(arg0);
|
||||
|
||||
Local<String> ret = String::NewFromUtf8(isolate, c).ToLocalChecked();
|
||||
args.GetReturnValue().Set(ret);
|
||||
delete c;
|
||||
}
|
||||
|
||||
|
||||
void init(Local<Object> exports) {
|
||||
NODE_SET_METHOD(exports, "multiAccountGenerateAndDeriveAddresses", _MultiAccountGenerateAndDeriveAddresses);
|
||||
@@ -1975,7 +1945,6 @@ void init(Local<Object> exports) {
|
||||
NODE_SET_METHOD(exports, "connectionChange", _ConnectionChange);
|
||||
NODE_SET_METHOD(exports, "pollSignal", _PollSignal);
|
||||
NODE_SET_METHOD(exports, "initLogging", _InitLogging);
|
||||
NODE_SET_METHOD(exports, "restoreAccountAndLogin", _RestoreAccountAndLogin);
|
||||
}
|
||||
|
||||
NODE_MODULE(NODE_GYP_MODULE_NAME, init)
|
||||
|
||||
+136
-154
@@ -90,20 +90,20 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "cider/cider-nrepl/0.31.0/cider-nrepl-0.31.0",
|
||||
"path": "cider/cider-nrepl/0.25.3/cider-nrepl-0.25.3",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "1f28a4a834a7a46cf24def971b1a705a6795c73a",
|
||||
"sha256": "0h4pyzy8rzzh567khvimw2cs8jr640kqxgaxvbfx1s5yfp56fka2"
|
||||
"sha1": "5ae0efd9377a5e60c084bdaf4a2ce094f759ce23",
|
||||
"sha256": "0drxf9nm23i1pcgrkwbcr09msq37csilzww38709add0hz8spjhq"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "cider/piggieback/0.5.2/piggieback-0.5.2",
|
||||
"path": "cider/piggieback/0.4.1/piggieback-0.4.1",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "ecfd5c286a85db3f059e75c37fca5722d9e26f79",
|
||||
"sha256": "1ps9yf3cxmlm447hqkidjb5xry90n0wl3jk0jn28fagq31lzylkl"
|
||||
"sha1": "0a02a3e2ecd7a126ab60d8a44793342f20ced79b",
|
||||
"sha256": "142vl5np33akcrnn6pksi0rjfsmmi528villxsj6cwcndvybiw4m"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -251,6 +251,15 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "c9ad4a0850ab676c5c64461a05ca524cdfff59f1",
|
||||
"sha256": "170rflxnqnah0265ik2aylmxkshyqbf2zas9bp2l32xqj9l6jsaf"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "com/google/errorprone/error_prone_annotations/2.15.0/error_prone_annotations-2.15.0",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -297,11 +306,11 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "com/google/javascript/closure-compiler-unshaded/v20230802/closure-compiler-unshaded-v20230802",
|
||||
"path": "com/google/javascript/closure-compiler-unshaded/v20230411/closure-compiler-unshaded-v20230411",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "0a2498a4d45bf5896042f31da0cd30c5e7b415af",
|
||||
"sha256": "0jvgqq0gnvm4jw2zac4677ds05klvsjalszdzcq3nw8g7fjyjv2x"
|
||||
"sha1": "2f5d7ab921f9cc07ffeb4e1c0f156f164c650eeb",
|
||||
"sha256": "0gphdrrhr88bcqa1scndachvhbayh7m11zm9hcsmvzn9bw72pabw"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -323,51 +332,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "c9ad4a0850ab676c5c64461a05ca524cdfff59f1",
|
||||
"sha256": "170rflxnqnah0265ik2aylmxkshyqbf2zas9bp2l32xqj9l6jsaf"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "com/taoensso/encore/3.68.0/encore-3.68.0",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "b098b58e27a7cf9ab5e46aedbb5ababc12805170",
|
||||
"sha256": "1i5bmm83y9wpgvl5h6ysjsw58qrqz4b4v5vqnsprq6f1pmakjfz2"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "com/taoensso/timbre/6.3.1/timbre-6.3.1",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "e1b04be262f38bbd9af8f1193b6b3f2c6a37129d",
|
||||
"sha256": "0p6rws5gpab5qldp739lyqvwdbak28vaxbjw2bg2slflkkahszc7"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "com/taoensso/truss/1.11.0/truss-1.11.0",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "4784f43191d5839448b58128bb455d62616086fd",
|
||||
"sha256": "16xqav4cv3cnfik2d8v3wn7zb2a97ybnrbp6v6nj8m1nmdhr16k7"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "com/taoensso/tufte/2.6.3/tufte-2.6.3",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "8862c6113ca743ebdcfa17bf4779a21fc08a7c7e",
|
||||
"sha256": "0i0wsv2g2hswgdik6zlgcs212clj1d7fvckxfcsmyfr0vvpc1dmd"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "commons-codec/commons-codec/1.15/commons-codec-1.15",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -404,6 +368,42 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "com/taoensso/encore/3.68.0/encore-3.68.0",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "b098b58e27a7cf9ab5e46aedbb5ababc12805170",
|
||||
"sha256": "1i5bmm83y9wpgvl5h6ysjsw58qrqz4b4v5vqnsprq6f1pmakjfz2"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "com/taoensso/timbre/6.3.1/timbre-6.3.1",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "e1b04be262f38bbd9af8f1193b6b3f2c6a37129d",
|
||||
"sha256": "0p6rws5gpab5qldp739lyqvwdbak28vaxbjw2bg2slflkkahszc7"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "com/taoensso/truss/1.11.0/truss-1.11.0",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "4784f43191d5839448b58128bb455d62616086fd",
|
||||
"sha256": "16xqav4cv3cnfik2d8v3wn7zb2a97ybnrbp6v6nj8m1nmdhr16k7"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "com/taoensso/tufte/2.6.3/tufte-2.6.3",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "8862c6113ca743ebdcfa17bf4779a21fc08a7c7e",
|
||||
"sha256": "0i0wsv2g2hswgdik6zlgcs212clj1d7fvckxfcsmyfr0vvpc1dmd"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "crypto-equality/crypto-equality/1.0.1/crypto-equality-1.0.1",
|
||||
"host": "https://repo.clojars.org",
|
||||
@@ -449,15 +449,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "funcool/promesa/11.0.678/promesa-11.0.678",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "0ee1690ba74b2609c2d85b51edacad13046a18e2",
|
||||
"sha256": "1wif8nwdbpchwg56fz47ymjnflmva0fzy0bw1s6bacnac472pmza"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "hiccup/hiccup/1.0.5/hiccup-1.0.5",
|
||||
"host": "https://repo.clojars.org",
|
||||
@@ -513,11 +504,11 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "io/undertow/undertow-core/2.3.10.Final/undertow-core-2.3.10.Final",
|
||||
"path": "io/undertow/undertow-core/2.2.4.Final/undertow-core-2.2.4.Final",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "96d1d5ca6406a75a285b95ea8f4b39e0fb2d707e",
|
||||
"sha256": "1s1m5hfhmfr7jsp4bn4c6fhdbgiz72mz0a96494nyhfa0b4lql8l"
|
||||
"sha1": "78650b4029dd9280c4769d9425b5559f12cb83bf",
|
||||
"sha256": "1brpkd2l98byf76jga6hj5drv5sj2d93lxlq2xz0rxpqyqas1xm4"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -603,11 +594,11 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "nrepl/nrepl/0.9.0/nrepl-0.9.0",
|
||||
"path": "nrepl/nrepl/1.0.0/nrepl-1.0.0",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "49beada131959f08f9a20899affbd1b10c03a668",
|
||||
"sha256": "1phak0479s27ffw9wzz7pi8cqqs6ipsm15dhgw9szxxcfhx529qa"
|
||||
"sha1": "f47774c43493efdc879d36b95ebd67ea0d9c890a",
|
||||
"sha256": "1fx5ssmixgqmklliw0ng8fjz41kkhys56x8dbwv9yqrfzws9f2x3"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -620,15 +611,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/apache/ant/ant-launcher/1.10.11/ant-launcher-1.10.11",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "ea0a0475fb6dfcdcf48b30410fd9d4f5c80df07e",
|
||||
"sha256": "0mnj5v660qvmrsi1m6z0dnykw3df8f1213byzp45l2wqgbgk1dfs"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/apache/ant/ant/1.10.11/ant-1.10.11",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -639,11 +621,11 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/babashka/sci.impl.types/0.0.2/sci.impl.types-0.0.2",
|
||||
"host": "https://repo.clojars.org",
|
||||
"path": "org/apache/ant/ant-launcher/1.10.11/ant-launcher-1.10.11",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "45a05ece33609c3ad26a6ea4e05130560da82306",
|
||||
"sha256": "0pwwqq11rcknpcwbwsbw7pgbgnd7hqiawn0r8yvk14qfwa6p7z46"
|
||||
"sha1": "ea0a0475fb6dfcdcf48b30410fd9d4f5c80df07e",
|
||||
"sha256": "0mnj5v660qvmrsi1m6z0dnykw3df8f1213byzp45l2wqgbgk1dfs"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -656,6 +638,15 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/babashka/sci.impl.types/0.0.2/sci.impl.types-0.0.2",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "45a05ece33609c3ad26a6ea4e05130560da82306",
|
||||
"sha256": "0pwwqq11rcknpcwbwsbw7pgbgnd7hqiawn0r8yvk14qfwa6p7z46"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/checkerframework/checker-qual/3.12.0/checker-qual-3.12.0",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -746,15 +737,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/google-closure-library-third-party/0.0-20230227-c7c0a541/google-closure-library-third-party-0.0-20230227-c7c0a541",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "f5ea82eb1309b81ada6a14371bb848323c65e38b",
|
||||
"sha256": "0jk9v4bfrxvz6wq1s86msry2mf47nwcjfplnn41yabqc44g82hva"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/google-closure-library/0.0-20230227-c7c0a541/google-closure-library-0.0-20230227-c7c0a541",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -764,6 +746,15 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/google-closure-library-third-party/0.0-20230227-c7c0a541/google-closure-library-third-party-0.0-20230227-c7c0a541",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "f5ea82eb1309b81ada6a14371bb848323c65e38b",
|
||||
"sha256": "0jk9v4bfrxvz6wq1s86msry2mf47nwcjfplnn41yabqc44g82hva"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/math.combinatorics/0.2.0/math.combinatorics-0.2.0",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -791,15 +782,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/tools.analyzer.jvm/1.2.2/tools.analyzer.jvm-1.2.2",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "449691b55d7d526258ce02c69b4699f2897c494d",
|
||||
"sha256": "0phfs1z1scvdi00348zjh223xncmgrkmlrnbca4dh7lk701gy34i"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/tools.analyzer/1.1.0/tools.analyzer-1.1.0",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -809,6 +791,15 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/tools.analyzer.jvm/1.2.2/tools.analyzer.jvm-1.2.2",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "449691b55d7d526258ce02c69b4699f2897c494d",
|
||||
"sha256": "0phfs1z1scvdi00348zjh223xncmgrkmlrnbca4dh7lk701gy34i"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/tools.cli/1.0.206/tools.cli-1.0.206",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -837,11 +828,11 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/tools.reader/1.3.7/tools.reader-1.3.7",
|
||||
"path": "org/clojure/tools.reader/1.3.6/tools.reader-1.3.6",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "c60dfd3d79cbc5ec6264ba45c14b8d4c9b6708b2",
|
||||
"sha256": "1mr0qx3gw1myfls07vrx3arwsi5n95b2lwk74ijpj0z3lzpzlj7m"
|
||||
"sha1": "927809dcb44fa726e4969d993e3e733636d95ebb",
|
||||
"sha256": "1q5q7fmshybvp55f6qys8i5sbzfaix5v9f9b55dkbhv55hgv7l8i"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -855,38 +846,38 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/jboss/logging/jboss-logging/3.4.3.Final/jboss-logging-3.4.3.Final",
|
||||
"path": "org/jboss/logging/jboss-logging/3.4.1.Final/jboss-logging-3.4.1.Final",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "c4bd7e12a745c0e7f6cf98c45cdcdf482fd827ea",
|
||||
"sha256": "0jdcziqbdzmah981zv3q88k2zrnclr2h1k3h3vjn002m9p54qchb"
|
||||
"sha1": "40fd4d696c55793e996d1ff3c475833f836c2498",
|
||||
"sha256": "1f7f4kjn3v6vibhgsr3k8hl0r2xq0c2rbcl82dx0bqg5jdyqgzlf"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/jboss/threads/jboss-threads/3.5.0.Final/jboss-threads-3.5.0.Final",
|
||||
"path": "org/jboss/threads/jboss-threads/3.1.0.Final/jboss-threads-3.1.0.Final",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "dd23d4788b3eafe9597ef3fe028e46ceb293ba8d",
|
||||
"sha256": "1cchp54dw1578my27siim3h5jbf240aq8q6xd3z2b1ajgxxbcl71"
|
||||
"sha1": "9b260c0302f637a84a52d3d118214a3c59217615",
|
||||
"sha256": "0yc0p71y7yjhqjhkvqqi9xqgljavp3aslnik2k7dppbxnkrnlff9"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/jboss/xnio/xnio-api/3.8.8.Final/xnio-api-3.8.8.Final",
|
||||
"path": "org/jboss/xnio/xnio-api/3.8.0.Final/xnio-api-3.8.0.Final",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "1ba9c8b9a8dea1c6cd656155943e6d4c2c631fa7",
|
||||
"sha256": "0wvqdcbardi55l77aw5404qgw70384hw155xvc66shn7l6z8h6bh"
|
||||
"sha1": "e2c29acf42ac6f42c34f0b74ba089e3f3d1b2394",
|
||||
"sha256": "041qnvb74bkgmfxyd23vdl26il55cmfbhi6a4bm3fcmyrpapjfjl"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/jboss/xnio/xnio-nio/3.8.8.Final/xnio-nio-3.8.8.Final",
|
||||
"path": "org/jboss/xnio/xnio-nio/3.8.0.Final/xnio-nio-3.8.0.Final",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "a5d2faf8d02e0a0bb9e9eabca8e38173cb640331",
|
||||
"sha256": "0pxw2iv1q1yzk39knc650rg4vflsyjzhf07mwm2s5aqn5h82sk3i"
|
||||
"sha1": "90c57dcf7f8c846b4da331d0e6e048c39842c92a",
|
||||
"sha256": "1zndnb5648wqw23gj80zjqk3yd8gq6grqhz9n4zrcqixx1z586jf"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -918,20 +909,11 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/slf4j/slf4j-api/2.0.9/slf4j-api-2.0.9",
|
||||
"path": "org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "7cf2726fdcfbc8610f9a71fb3ed639871f315340",
|
||||
"sha256": "0v1b7iydpnh2rvyzqvqbqm19vr2qva8icq84690bppnpr06r6608"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/slf4j/slf4j-nop/2.0.9/slf4j-nop-2.0.9",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "fa0627049304bf501bf6a0e4d1416bcaec9a72a9",
|
||||
"sha256": "10vdg9qkailjbzmf5mfnv328675swmnf1x3g9v7ymhxs29xkc4jn"
|
||||
"sha1": "6c62681a2f655b49963a5983b8b0950a6120ae14",
|
||||
"sha256": "1h512ry8g0nriazg3dqzs6s96502a77drw8vq26nfya97rg5gvyk"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -945,11 +927,11 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/wildfly/common/wildfly-common/1.5.4.Final/wildfly-common-1.5.4.Final",
|
||||
"path": "org/wildfly/common/wildfly-common/1.5.2.Final/wildfly-common-1.5.2.Final",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"jar": {
|
||||
"sha1": "735ceee5616d5143bac1bc740e444697073c002f",
|
||||
"sha256": "0sp48y3q7bmp3bjb7a6fpz8gb7ssizvxlw5wdv2xwa6mifpkrnlz"
|
||||
"sha1": "8eba40cfe86bcfcc223551e75201e6e7574c7c36",
|
||||
"sha256": "17rkkm9dqbxdzpamwl9jr8z285awsj6hzpavzmc87wcz9469hp5b"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -962,6 +944,15 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "reagent/reagent/1.2.0/reagent-1.2.0",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "1b9a181b5c7ed3557768d2ea0c66f5616aef5e97",
|
||||
"sha256": "0scvkzfqjs613z10rngh7427v3pxdqablf0fcl65pbpkzz16wgav"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "re-com/re-com/2.8.0/re-com-2.8.0",
|
||||
"host": "https://repo.clojars.org",
|
||||
@@ -971,6 +962,15 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "refactor-nrepl/refactor-nrepl/2.5.0/refactor-nrepl-2.5.0",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "6bc3441afc94f7ca024e41a864ca75e05df7e207",
|
||||
"sha256": "0w8hax99y98l53mixxzx2ja0vcnhjv8dnsaz1zj3vqk775ns5w6i"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "re-frame/re-frame/1.3.0/re-frame-1.3.0",
|
||||
"host": "https://repo.clojars.org",
|
||||
@@ -998,24 +998,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "reagent/reagent/1.2.0/reagent-1.2.0",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "1b9a181b5c7ed3557768d2ea0c66f5616aef5e97",
|
||||
"sha256": "0scvkzfqjs613z10rngh7427v3pxdqablf0fcl65pbpkzz16wgav"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "refactor-nrepl/refactor-nrepl/3.9.1/refactor-nrepl-3.9.1",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "f949af92dd1d6fef59d7447bd0cb62118e34eca1",
|
||||
"sha256": "0dml9yvjmji6xk2sk3cdmkvvnh13rw29szxxl363hap8yg28xcs1"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "ring-cors/ring-cors/0.1.8/ring-cors-0.1.8",
|
||||
"host": "https://repo.clojars.org",
|
||||
@@ -1053,11 +1035,11 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "thheller/shadow-cljs/2.26.2/shadow-cljs-2.26.2-aot",
|
||||
"path": "thheller/shadow-cljs/2.25.0/shadow-cljs-2.25.0-aot",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "ab6b31649cb03e352369698781207db4f6da6d5f",
|
||||
"sha256": "0mh28nykpillkym7hvplrr7vy5hn6a2ymafyf4yfl5y2kfx4yq42"
|
||||
"sha1": "013921db91ce4a3616aec9c72c1832a014a0fece",
|
||||
"sha256": "0ks380z7h8i2ylirvjgmlicq9jjpz9w71gjv521h4xs5fb273cl0"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1071,11 +1053,11 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "thheller/shadow-undertow/0.3.3/shadow-undertow-0.3.3",
|
||||
"path": "thheller/shadow-undertow/0.3.1/shadow-undertow-0.3.1",
|
||||
"host": "https://repo.clojars.org",
|
||||
"jar": {
|
||||
"sha1": "ba377c3b70fd942b3ca7e38f055412a441626711",
|
||||
"sha256": "10w2slj4znm93j0qq3ldj9hj0i7a50vbnmn6kv8i77fakikdjc48"
|
||||
"sha1": "9be444bea4037bb80b451cc52a8e80359c4c45be",
|
||||
"sha256": "174s2rdxvp7d4jg9kvzjadps42bdsbi05rs2pjy5i0ssq9n23zwa"
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
+25
-27
@@ -8,8 +8,8 @@ borkdude/edamame/1.3.23/edamame-1.3.23.jar
|
||||
borkdude/sci.impl.reflector/0.0.1/sci.impl.reflector-0.0.1.jar
|
||||
camel-snake-kebab/camel-snake-kebab/0.4.3/camel-snake-kebab-0.4.3.jar
|
||||
cheshire/cheshire/5.11.0/cheshire-5.11.0.jar
|
||||
cider/cider-nrepl/0.31.0/cider-nrepl-0.31.0.jar
|
||||
cider/piggieback/0.5.2/piggieback-0.5.2.jar
|
||||
cider/cider-nrepl/0.25.3/cider-nrepl-0.25.3.jar
|
||||
cider/piggieback/0.4.1/piggieback-0.4.1.jar
|
||||
clj-kondo/clj-kondo/2023.09.07/clj-kondo-2023.09.07.jar
|
||||
cljs-bean/cljs-bean/1.9.0/cljs-bean-1.9.0.jar
|
||||
clout/clout/2.1.2/clout-2.1.2.jar
|
||||
@@ -26,36 +26,35 @@ com/github/javaparser/javaparser-core/3.25.3/javaparser-core-3.25.3.jar
|
||||
com/google/auto/value/auto-value-annotations/1.6/auto-value-annotations-1.6.jar
|
||||
com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar
|
||||
com/google/code/gson/gson/2.9.1/gson-2.9.1.jar
|
||||
com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar
|
||||
com/google/errorprone/error_prone_annotations/2.15.0/error_prone_annotations-2.15.0.jar
|
||||
com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar
|
||||
com/google/guava/guava/31.0.1-jre/guava-31.0.1-jre.jar
|
||||
com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar
|
||||
com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar
|
||||
com/google/javascript/closure-compiler-unshaded/v20230802/closure-compiler-unshaded-v20230802.jar
|
||||
com/google/javascript/closure-compiler-unshaded/v20230411/closure-compiler-unshaded-v20230411.jar
|
||||
com/google/protobuf/protobuf-java/3.21.12/protobuf-java-3.21.12.jar
|
||||
com/google/re2j/re2j/1.3/re2j-1.3.jar
|
||||
com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar
|
||||
com/taoensso/encore/3.68.0/encore-3.68.0.jar
|
||||
com/taoensso/timbre/6.3.1/timbre-6.3.1.jar
|
||||
com/taoensso/truss/1.11.0/truss-1.11.0.jar
|
||||
com/taoensso/tufte/2.6.3/tufte-2.6.3.jar
|
||||
commons-codec/commons-codec/1.15/commons-codec-1.15.jar
|
||||
commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4.jar
|
||||
commons-io/commons-io/2.11.0/commons-io-2.11.0.jar
|
||||
compojure/compojure/1.5.2/compojure-1.5.2.jar
|
||||
com/taoensso/encore/3.68.0/encore-3.68.0.jar
|
||||
com/taoensso/timbre/6.3.1/timbre-6.3.1.jar
|
||||
com/taoensso/truss/1.11.0/truss-1.11.0.jar
|
||||
com/taoensso/tufte/2.6.3/tufte-2.6.3.jar
|
||||
crypto-equality/crypto-equality/1.0.1/crypto-equality-1.0.1.jar
|
||||
crypto-random/crypto-random/1.2.1/crypto-random-1.2.1.jar
|
||||
day8/re-frame/test/0.1.5/test-0.1.5.jar
|
||||
expound/expound/0.9.0/expound-0.9.0.jar
|
||||
fipp/fipp/0.6.26/fipp-0.6.26.jar
|
||||
funcool/promesa/11.0.678/promesa-11.0.678.jar
|
||||
hiccup/hiccup/1.0.5/hiccup-1.0.5.jar
|
||||
http-kit/http-kit/2.2.0/http-kit-2.2.0.jar
|
||||
instaparse/instaparse/1.4.0/instaparse-1.4.0.jar
|
||||
io/aviso/pretty/1.4.4/pretty-1.4.4.jar
|
||||
io/methvin/directory-watcher/0.17.1/directory-watcher-0.17.1.jar
|
||||
io/replikativ/datalog-parser/0.2.25/datalog-parser-0.2.25.jar
|
||||
io/undertow/undertow-core/2.3.10.Final/undertow-core-2.3.10.Final.jar
|
||||
io/undertow/undertow-core/2.2.4.Final/undertow-core-2.2.4.Final.jar
|
||||
javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar
|
||||
javax/servlet/servlet-api/2.5/servlet-api-2.5.jar
|
||||
javax/xml/bind/jaxb-api/2.3.0/jaxb-api-2.3.0.jar
|
||||
@@ -65,12 +64,12 @@ mvxcvi/arrangement/2.1.0/arrangement-2.1.0.jar
|
||||
net/cgrand/macrovich/0.2.1/macrovich-0.2.1.jar
|
||||
net/java/dev/jna/jna/5.12.1/jna-5.12.1.jar
|
||||
nrepl/bencode/1.1.0/bencode-1.1.0.jar
|
||||
nrepl/nrepl/0.9.0/nrepl-0.9.0.jar
|
||||
nrepl/nrepl/1.0.0/nrepl-1.0.0.jar
|
||||
nubank/matcher-combinators/3.8.8/matcher-combinators-3.8.8.jar
|
||||
org/apache/ant/ant-launcher/1.10.11/ant-launcher-1.10.11.jar
|
||||
org/apache/ant/ant/1.10.11/ant-1.10.11.jar
|
||||
org/babashka/sci.impl.types/0.0.2/sci.impl.types-0.0.2.jar
|
||||
org/apache/ant/ant-launcher/1.10.11/ant-launcher-1.10.11.jar
|
||||
org/babashka/sci/0.7.38/sci-0.7.38.jar
|
||||
org/babashka/sci.impl.types/0.0.2/sci.impl.types-0.0.2.jar
|
||||
org/checkerframework/checker-qual/3.12.0/checker-qual-3.12.0.jar
|
||||
org/clojure/clojure/1.11.1/clojure-1.11.1.jar
|
||||
org/clojure/clojurescript/1.11.60/clojurescript-1.11.60.jar
|
||||
@@ -81,42 +80,41 @@ org/clojure/core.rrb-vector/0.1.2/core.rrb-vector-0.1.2.jar
|
||||
org/clojure/core.specs.alpha/0.2.62/core.specs.alpha-0.2.62.jar
|
||||
org/clojure/data.json/2.4.0/data.json-2.4.0.jar
|
||||
org/clojure/data.priority-map/1.1.0/data.priority-map-1.1.0.jar
|
||||
org/clojure/google-closure-library-third-party/0.0-20230227-c7c0a541/google-closure-library-third-party-0.0-20230227-c7c0a541.jar
|
||||
org/clojure/google-closure-library/0.0-20230227-c7c0a541/google-closure-library-0.0-20230227-c7c0a541.jar
|
||||
org/clojure/google-closure-library-third-party/0.0-20230227-c7c0a541/google-closure-library-third-party-0.0-20230227-c7c0a541.jar
|
||||
org/clojure/math.combinatorics/0.2.0/math.combinatorics-0.2.0.jar
|
||||
org/clojure/spec.alpha/0.3.218/spec.alpha-0.3.218.jar
|
||||
org/clojure/test.check/1.1.1/test.check-1.1.1.jar
|
||||
org/clojure/tools.analyzer.jvm/1.2.2/tools.analyzer.jvm-1.2.2.jar
|
||||
org/clojure/tools.analyzer/1.1.0/tools.analyzer-1.1.0.jar
|
||||
org/clojure/tools.analyzer.jvm/1.2.2/tools.analyzer.jvm-1.2.2.jar
|
||||
org/clojure/tools.cli/1.0.206/tools.cli-1.0.206.jar
|
||||
org/clojure/tools.logging/1.1.0/tools.logging-1.1.0.jar
|
||||
org/clojure/tools.macro/0.1.5/tools.macro-0.1.5.jar
|
||||
org/clojure/tools.reader/1.3.7/tools.reader-1.3.7.jar
|
||||
org/clojure/tools.reader/1.3.6/tools.reader-1.3.6.jar
|
||||
org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar
|
||||
org/jboss/logging/jboss-logging/3.4.3.Final/jboss-logging-3.4.3.Final.jar
|
||||
org/jboss/threads/jboss-threads/3.5.0.Final/jboss-threads-3.5.0.Final.jar
|
||||
org/jboss/xnio/xnio-api/3.8.8.Final/xnio-api-3.8.8.Final.jar
|
||||
org/jboss/xnio/xnio-nio/3.8.8.Final/xnio-nio-3.8.8.Final.jar
|
||||
org/jboss/logging/jboss-logging/3.4.1.Final/jboss-logging-3.4.1.Final.jar
|
||||
org/jboss/threads/jboss-threads/3.1.0.Final/jboss-threads-3.1.0.Final.jar
|
||||
org/jboss/xnio/xnio-api/3.8.0.Final/xnio-api-3.8.0.Final.jar
|
||||
org/jboss/xnio/xnio-nio/3.8.0.Final/xnio-nio-3.8.0.Final.jar
|
||||
org/jspecify/jspecify/0.2.0/jspecify-0.2.0.jar
|
||||
org/msgpack/msgpack/0.6.12/msgpack-0.6.12.jar
|
||||
org/ow2/asm/asm/9.4/asm-9.4.jar
|
||||
org/slf4j/slf4j-api/2.0.9/slf4j-api-2.0.9.jar
|
||||
org/slf4j/slf4j-nop/2.0.9/slf4j-nop-2.0.9.jar
|
||||
org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar
|
||||
org/wildfly/client/wildfly-client-config/1.0.1.Final/wildfly-client-config-1.0.1.Final.jar
|
||||
org/wildfly/common/wildfly-common/1.5.4.Final/wildfly-common-1.5.4.Final.jar
|
||||
org/wildfly/common/wildfly-common/1.5.2.Final/wildfly-common-1.5.2.Final.jar
|
||||
prismatic/schema/1.1.7/schema-1.1.7.jar
|
||||
reagent/reagent/1.2.0/reagent-1.2.0.jar
|
||||
re-com/re-com/2.8.0/re-com-2.8.0.jar
|
||||
refactor-nrepl/refactor-nrepl/2.5.0/refactor-nrepl-2.5.0.jar
|
||||
re-frame/re-frame/1.3.0/re-frame-1.3.0.jar
|
||||
re-frisk-remote/re-frisk-remote/1.6.0/re-frisk-remote-1.6.0.jar
|
||||
re-frisk/sente/1.15.0/sente-1.15.0.jar
|
||||
reagent/reagent/1.2.0/reagent-1.2.0.jar
|
||||
refactor-nrepl/refactor-nrepl/3.9.1/refactor-nrepl-3.9.1.jar
|
||||
ring-cors/ring-cors/0.1.8/ring-cors-0.1.8.jar
|
||||
ring/ring-codec/1.2.0/ring-codec-1.2.0.jar
|
||||
ring/ring-core/1.9.6/ring-core-1.9.6.jar
|
||||
thheller/shadow-client/1.3.3/shadow-client-1.3.3.jar
|
||||
thheller/shadow-cljs/2.26.2/shadow-cljs-2.26.2-aot.jar
|
||||
thheller/shadow-cljs/2.25.0/shadow-cljs-2.25.0-aot.jar
|
||||
thheller/shadow-cljsjs/0.0.22/shadow-cljsjs-0.0.22.jar
|
||||
thheller/shadow-undertow/0.3.3/shadow-undertow-0.3.3.jar
|
||||
thheller/shadow-undertow/0.3.1/shadow-undertow-0.3.1.jar
|
||||
thheller/shadow-util/0.7.0/shadow-util-0.7.0.jar
|
||||
tigris/tigris/0.1.2/tigris-0.1.2.jar
|
||||
|
||||
@@ -53,14 +53,6 @@ copyNodeModules() {
|
||||
|
||||
# Find files that were modified and should cause a re-copying of node modules.
|
||||
# Some files are generated/modified by build processes and should be ignored.
|
||||
#
|
||||
# react-native/ReactCommon/react/renderer/components/rncore/*
|
||||
# generated at runtime by react-native
|
||||
# related code https://github.com/facebook/react-native/blob/v0.72.5/packages/react-native/ReactCommon/React-rncore.podspec#L19
|
||||
#
|
||||
# react-native-config/ios/ReactNativeConfig/GeneratedDotEnv.m
|
||||
# generated at runtime by react-native-config
|
||||
# related code https://github.com/lugg/react-native-config/blob/v1.5.0/react-native-config.podspec#L52
|
||||
findFilesNewerThan() {
|
||||
local sentinel="${1}"
|
||||
local dir="${2}"
|
||||
@@ -69,8 +61,6 @@ findFilesNewerThan() {
|
||||
-not -ipath "*/*android/build/*" -prune \
|
||||
-not -ipath "*/xcuserdata/*" -prune \
|
||||
-not -ipath "*/scripts/.packager.env" \
|
||||
-not -path "*/node_modules/react-native/ReactCommon/react/renderer/components/rncore/*" \
|
||||
-not -path "*/node_modules/react-native-config/ios/ReactNativeConfig/GeneratedDotEnv.m" \
|
||||
-print
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
|
||||
# Increment a version string using Semantic Versioning (SemVer) terminology.
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
[com.cognitect/transit-cljs "0.8.280"]
|
||||
[camel-snake-kebab "0.4.3"]
|
||||
[metosin/malli "0.13.0"]
|
||||
[funcool/promesa "11.0.678"]
|
||||
|
||||
;; Dev dependencies
|
||||
[refactor-nrepl "3.9.1"]
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { useAnimatedReaction, withTiming, runOnJS } from 'react-native-reanimated';
|
||||
import { useState } from 'react';
|
||||
import { withTiming, runOnJS } from 'react-native-reanimated';
|
||||
|
||||
export function messagesListOnScroll(distanceFromListTop, chatListScrollY, callback) {
|
||||
return function (event) {
|
||||
@@ -13,21 +12,3 @@ export function messagesListOnScroll(distanceFromListTop, chatListScrollY, callb
|
||||
runOnJS(callback)(layoutHeight, newDistance);
|
||||
};
|
||||
}
|
||||
|
||||
export function useMessagesScrolledToThreshold(distanceFromListTop, threshold) {
|
||||
const [scrolledToThreshold, setScrolledToThreshold] = useState(false);
|
||||
|
||||
useAnimatedReaction(
|
||||
function () {
|
||||
return distanceFromListTop.value <= threshold;
|
||||
},
|
||||
function (current) {
|
||||
if (current !== scrolledToThreshold) {
|
||||
runOnJS(setScrolledToThreshold)(current);
|
||||
}
|
||||
},
|
||||
[scrolledToThreshold],
|
||||
);
|
||||
|
||||
return scrolledToThreshold;
|
||||
}
|
||||
|
||||
@@ -19,13 +19,6 @@ export function navigationHeaderPosition(distanceFromListTop, isAllLoaded, topBa
|
||||
});
|
||||
}
|
||||
|
||||
export function navigationButtonsCompleteOpacity(isCalculationComplete) {
|
||||
return useDerivedValue(function () {
|
||||
'worklet';
|
||||
return isCalculationComplete.value ? withTiming(1) : 0;
|
||||
});
|
||||
}
|
||||
|
||||
export function interpolateNavigationViewOpacity(props) {
|
||||
return useDerivedValue(function () {
|
||||
'worklet';
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
["eth-phishing-detect" :as eth-phishing-detect]
|
||||
[clojure.string :as string]
|
||||
[legacy.status-im.bottom-sheet.events :as bottom-sheet]
|
||||
[legacy.status-im.browser.eip3085 :as eip3085]
|
||||
[legacy.status-im.browser.eip3326 :as eip3326]
|
||||
[legacy.status-im.browser.permissions :as browser.permissions]
|
||||
[legacy.status-im.browser.webview-ref :as webview-ref]
|
||||
@@ -15,7 +16,6 @@
|
||||
[native-module.core :as native-module]
|
||||
[re-frame.core :as re-frame]
|
||||
[react-native.platform :as platform]
|
||||
[status-im.common.json-rpc.events :as json-rpc]
|
||||
[status-im.common.universal-links :as links]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.contexts.chat.events :as chat.events]
|
||||
@@ -443,6 +443,9 @@
|
||||
(= method "wallet_switchEthereumChain")
|
||||
(eip3326/handle-switch-ethereum-chain cofx dapp-name id message-id (first params))
|
||||
|
||||
(= method "wallet_addEthereumChain")
|
||||
(eip3085/handle-add-ethereum-chain cofx dapp-name id message-id (first params))
|
||||
|
||||
:else
|
||||
{:browser/call-rpc [payload
|
||||
#(re-frame/dispatch [:browser.callback/call-rpc
|
||||
@@ -655,11 +658,12 @@
|
||||
stored-bookmarks)]
|
||||
{:db (assoc db :bookmarks/bookmarks bookmarks)}))
|
||||
|
||||
(re-frame/reg-fx :browser/initialize-browser
|
||||
(fn []
|
||||
(json-rpc/call {:method "wakuext_getBrowsers"
|
||||
:on-success [::initialize-browsers]})
|
||||
(json-rpc/call {:method "browsers_getBookmarks"
|
||||
:on-success [::initialize-bookmarks]})
|
||||
(json-rpc/call {:method "permissions_getDappPermissions"
|
||||
:on-success [::initialize-dapp-permissions]})))
|
||||
(rf/defn initialize-browser
|
||||
[_]
|
||||
{:json-rpc/call
|
||||
[{:method "wakuext_getBrowsers"
|
||||
:on-success #(re-frame/dispatch [::initialize-browsers %])}
|
||||
{:method "browsers_getBookmarks"
|
||||
:on-success #(re-frame/dispatch [::initialize-bookmarks %])}
|
||||
{:method "permissions_getDappPermissions"
|
||||
:on-success #(re-frame/dispatch [::initialize-dapp-permissions %])}]})
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
;(`wallet_addEthereumChain`)
|
||||
(ns legacy.status-im.browser.eip3085
|
||||
(:require
|
||||
[clojure.string :as string]
|
||||
[legacy.status-im.network.core :as network]
|
||||
[legacy.status-im.ui.screens.browser.eip3085.sheet :as sheet]
|
||||
[legacy.status-im.utils.random :as random]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.constants :as constants]
|
||||
[taoensso.timbre :as log]
|
||||
@@ -36,3 +40,37 @@
|
||||
:message "User rejected the request."}}
|
||||
:dispatch [:bottom-sheet/hide-old]})
|
||||
|
||||
(rf/defn handle-add-ethereum-chain
|
||||
{:events [:eip3085/handle-add-ethereum-chain]}
|
||||
[{{:networks/keys [networks] :as db} :db :as cofx}
|
||||
dapp-name id message-id
|
||||
{:keys [chainId blockExplorerUrls chainName iconUrls nativeCurrency rpcUrls] :as params}]
|
||||
(let [manage {:name {:value chainName}
|
||||
:symbol {:value (:symbol nativeCurrency)}
|
||||
:url {:value (first rpcUrls)}
|
||||
:network-id {:value chainId}
|
||||
:chain {:value :custom}}]
|
||||
(if (network/valid-manage? manage)
|
||||
(let [{:keys [name url chain network-id symbol]} manage
|
||||
random-id (string/replace (random/id) "-" "")
|
||||
network (network/new-network random-id
|
||||
(:value name)
|
||||
(:value symbol)
|
||||
(:value url)
|
||||
(:value chain)
|
||||
(:value network-id))
|
||||
new-networks (assoc networks random-id network)
|
||||
params (assoc params
|
||||
:new-networks new-networks
|
||||
:id id
|
||||
:new-network network)]
|
||||
(if (network/chain-id-available? networks network)
|
||||
{:dispatch [:bottom-sheet/show-sheet-old
|
||||
{:content (fn []
|
||||
[sheet/permissions-panel dapp-name message-id params])}]}
|
||||
(send-success-call-to-bridge cofx id message-id)))
|
||||
{:browser/send-to-bridge {:type constants/web3-send-async-callback
|
||||
:messageId message-id
|
||||
:error {:code -32602
|
||||
:message "invalid network parameters"}}})))
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
[legacy.status-im.chat.models.loading :as chat.loading]
|
||||
[legacy.status-im.data-store.messages :as data-store.messages]
|
||||
[legacy.status-im.utils.deprecated-types :as types]
|
||||
[re-frame.core :as re-frame]
|
||||
[react-native.platform :as platform]
|
||||
[status-im.contexts.chat.messenger.messages.delete-message.events :as delete-message]
|
||||
[status-im.contexts.chat.messenger.messages.list.events :as message-list]
|
||||
@@ -134,7 +135,9 @@
|
||||
message-id (:messageId removed-message)]
|
||||
(data-store.messages/mark-messages-seen chat-id
|
||||
[message-id]
|
||||
nil)))
|
||||
#(re-frame/dispatch
|
||||
[:chat/decrease-unviewed-count
|
||||
chat-id %3]))))
|
||||
removed-messages)
|
||||
remove-messages-fx (fn [{:keys [db]}]
|
||||
{:dispatch [:activity-center.notifications/fetch-unread-count]})]
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
[legacy.status-im.bottom-sheet.events :as bottom-sheet]
|
||||
legacy.status-im.communities.e2e
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.contexts.shell.activity-center.events :as activity-center]
|
||||
[status-im.navigation.events :as navigation]
|
||||
[taoensso.timbre :as log]
|
||||
[utils.re-frame :as rf]))
|
||||
@@ -83,12 +84,13 @@
|
||||
(navigation/navigate-back)
|
||||
(handle-response response-js)))
|
||||
|
||||
(re-frame/reg-event-fx ::member-banned
|
||||
(fn [{:keys [db]} [response-js]]
|
||||
{:db (assoc db :bottom-sheet/show? false)
|
||||
:fx [[:dismiss-bottom-sheet-overlay-old]
|
||||
[:sanitize-messages-and-process-response response-js]
|
||||
[:activity-center.notifications/fetch-unread-count]]}))
|
||||
(rf/defn member-banned
|
||||
{:events [::member-banned]}
|
||||
[cofx response-js]
|
||||
(rf/merge cofx
|
||||
(bottom-sheet/hide-bottom-sheet-old)
|
||||
(handle-response response-js)
|
||||
(activity-center/notifications-fetch-unread-count)))
|
||||
|
||||
(rf/defn member-ban
|
||||
{:events [::member-ban]}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.contexts.chat.contacts.events :as contacts-store]
|
||||
[status-im.contexts.chat.messenger.messages.list.events :as message-list]
|
||||
[status-im.contexts.shell.activity-center.events :as activity-center]
|
||||
[status-im.navigation.events :as navigation]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
@@ -44,23 +45,21 @@
|
||||
(apply
|
||||
rf/merge
|
||||
cofx
|
||||
{:db (->
|
||||
db
|
||||
(update :chats dissoc public-key)
|
||||
(update :chats-home-list disj public-key)
|
||||
(assoc-in [:contacts/contacts public-key
|
||||
:added?]
|
||||
false))
|
||||
:fx [[:activity-center.notifications/fetch-unread-count]
|
||||
[:effects/push-notifications-clear-message-notifications [public-key]]
|
||||
[:dispatch [:shell/close-switcher-card public-key]]]}
|
||||
{:db (->
|
||||
db
|
||||
(update :chats dissoc public-key)
|
||||
(update :chats-home-list disj public-key)
|
||||
(assoc-in [:contacts/contacts public-key
|
||||
:added?]
|
||||
false))
|
||||
:dispatch [:shell/close-switcher-card public-key]
|
||||
:effects/push-notifications-clear-message-notifications [public-key]}
|
||||
(activity-center/notifications-fetch-unread-count)
|
||||
fxs)))
|
||||
|
||||
(rf/defn block-contact
|
||||
{:events [:contact.ui/block-contact-confirmed]}
|
||||
[{:keys [db] :as cofx} public-key
|
||||
{:keys [handle-navigation?]
|
||||
:or {handle-navigation? true}}]
|
||||
[{:keys [db] :as cofx} public-key]
|
||||
(let [contact (-> (contact.db/public-key->contact
|
||||
(:contacts/contacts db)
|
||||
public-key)
|
||||
@@ -77,10 +76,9 @@
|
||||
(re-frame/dispatch [:sanitize-messages-and-process-response block-contact])
|
||||
(re-frame/dispatch [:hide-popover])))
|
||||
;; reset navigation to avoid going back to non existing one to one chat
|
||||
(when handle-navigation?
|
||||
(if from-one-to-one-chat?
|
||||
(navigation/pop-to-root :shell-stack)
|
||||
(navigation/navigate-back))))))
|
||||
(if from-one-to-one-chat?
|
||||
(navigation/pop-to-root :shell-stack)
|
||||
(navigation/navigate-back)))))
|
||||
|
||||
(rf/defn contact-unblocked
|
||||
{:events [:contacts/unblocked]}
|
||||
|
||||
@@ -45,12 +45,12 @@
|
||||
(query-fn (comp participant-set :public-key) (vals all-contacts))))
|
||||
|
||||
(defn get-all-contacts-in-group-chat
|
||||
[members admins contacts {:keys [public-key preferred-name name display-name] :as current-account}]
|
||||
[members admins contacts {:keys [public-key preferred-name name] :as current-account}]
|
||||
(let [current-contact (some->
|
||||
current-account
|
||||
(select-keys [:name :preferred-name :public-key :images :compressed-key])
|
||||
(select-keys [:name :preferred-name :public-key :images])
|
||||
(set/rename-keys {:name :alias :preferred-name :name})
|
||||
(assoc :primary-name (or display-name preferred-name name)))
|
||||
(assoc :primary-name (or preferred-name name)))
|
||||
all-contacts (cond-> contacts
|
||||
current-contact
|
||||
(assoc public-key current-contact))]
|
||||
|
||||
@@ -29,41 +29,37 @@
|
||||
|
||||
(testing "transforms messages from RPC response"
|
||||
(is
|
||||
(= {:last-message {:quoted-message nil
|
||||
:outgoing-status nil
|
||||
:command-parameters nil
|
||||
:link-previews []
|
||||
:status-link-previews []
|
||||
:content {:sticker nil
|
||||
:rtl? nil
|
||||
:ens-name nil
|
||||
:parsed-text nil
|
||||
:response-to nil
|
||||
:chat-id nil
|
||||
:image nil
|
||||
:line-count nil
|
||||
:links nil
|
||||
:text nil}
|
||||
:bridge-message nil
|
||||
:outgoing false}
|
||||
(= {:last-message {:quoted-message nil
|
||||
:outgoing-status nil
|
||||
:command-parameters nil
|
||||
:link-previews []
|
||||
:content {:sticker nil
|
||||
:rtl? nil
|
||||
:ens-name nil
|
||||
:parsed-text nil
|
||||
:response-to nil
|
||||
:chat-id nil
|
||||
:image nil
|
||||
:line-count nil
|
||||
:links nil
|
||||
:text nil}
|
||||
:outgoing false}
|
||||
:message nil
|
||||
:reply-message {:quoted-message nil
|
||||
:outgoing-status nil
|
||||
:command-parameters nil
|
||||
:link-previews []
|
||||
:status-link-previews []
|
||||
:content {:sticker nil
|
||||
:rtl? nil
|
||||
:ens-name nil
|
||||
:parsed-text nil
|
||||
:response-to nil
|
||||
:chat-id nil
|
||||
:image nil
|
||||
:line-count nil
|
||||
:links nil
|
||||
:text nil}
|
||||
:bridge-message nil
|
||||
:outgoing false}}
|
||||
:reply-message {:quoted-message nil
|
||||
:outgoing-status nil
|
||||
:command-parameters nil
|
||||
:link-previews []
|
||||
:content {:sticker nil
|
||||
:rtl? nil
|
||||
:ens-name nil
|
||||
:parsed-text nil
|
||||
:response-to nil
|
||||
:chat-id nil
|
||||
:image nil
|
||||
:line-count nil
|
||||
:links nil
|
||||
:text nil}
|
||||
:outgoing false}}
|
||||
(-> raw-notification
|
||||
store/<-rpc
|
||||
(select-keys [:last-message :message :reply-message])))))
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
(ns legacy.status-im.data-store.chats
|
||||
(:require
|
||||
[clojure.set :as set]
|
||||
[clojure.string :as string]
|
||||
[legacy.status-im.data-store.messages :as messages]
|
||||
[legacy.status-im.utils.deprecated-types :as types]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.common.json-rpc.events :as json-rpc]
|
||||
[status-im.constants :as constants]
|
||||
[taoensso.timbre :as log]))
|
||||
[taoensso.timbre :as log]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn rpc->type
|
||||
[{:keys [chat-type name] :as chat}]
|
||||
@@ -60,80 +58,69 @@
|
||||
:admins #{}
|
||||
:members-joined #{})))
|
||||
|
||||
(defn <-color
|
||||
[value]
|
||||
(if (and (some? value)
|
||||
(string/starts-with? value "#"))
|
||||
value
|
||||
(keyword value)))
|
||||
|
||||
(defn <-rpc
|
||||
[chat]
|
||||
(-> chat
|
||||
(set/rename-keys {:id :chat-id
|
||||
:communityId :community-id
|
||||
:syncedFrom :synced-from
|
||||
:syncedTo :synced-to
|
||||
:membershipUpdateEvents :membership-update-events
|
||||
:deletedAtClockValue :deleted-at-clock-value
|
||||
:chatType :chat-type
|
||||
:unviewedMessagesCount :unviewed-messages-count
|
||||
:unviewedMentionsCount :unviewed-mentions-count
|
||||
:lastMessage :last-message
|
||||
:lastClockValue :last-clock-value
|
||||
:invitationAdmin :invitation-admin
|
||||
:profile :profile-public-key
|
||||
:muteTill :muted-till
|
||||
:hideIfPermissionsNotMet :hide-if-permissions-not-met?})
|
||||
(set/rename-keys {:id :chat-id
|
||||
:communityId :community-id
|
||||
:syncedFrom :synced-from
|
||||
:syncedTo :synced-to
|
||||
:membershipUpdateEvents :membership-update-events
|
||||
:deletedAtClockValue :deleted-at-clock-value
|
||||
:chatType :chat-type
|
||||
:unviewedMessagesCount :unviewed-messages-count
|
||||
:unviewedMentionsCount :unviewed-mentions-count
|
||||
:lastMessage :last-message
|
||||
:lastClockValue :last-clock-value
|
||||
:invitationAdmin :invitation-admin
|
||||
:profile :profile-public-key
|
||||
:muteTill :muted-till})
|
||||
rpc->type
|
||||
unmarshal-members
|
||||
(update :last-message #(when % (messages/<-rpc %)))
|
||||
(update :color <-color)
|
||||
(dissoc :members)))
|
||||
|
||||
(defn <-rpc-js
|
||||
[^js chat]
|
||||
(-> {:name (.-name chat)
|
||||
:description (.-description chat)
|
||||
:color (<-color (.-color chat))
|
||||
:emoji (.-emoji chat)
|
||||
:timestamp (.-timestamp chat)
|
||||
:alias (.-alias chat)
|
||||
:muted (.-muted chat)
|
||||
:joined (.-joined chat)
|
||||
:muted-till (.-muteTill chat)
|
||||
:chat-id (.-id chat)
|
||||
:community-id (.-communityId chat)
|
||||
:synced-from (.-syncedFrom chat)
|
||||
:synced-to (.-syncedTo chat)
|
||||
:deleted-at-clock-value (.-deletedAtClockValue chat)
|
||||
:chat-type (.-chatType chat)
|
||||
:unviewed-messages-count (.-unviewedMessagesCount chat)
|
||||
:unviewed-mentions-count (.-unviewedMentionsCount chat)
|
||||
:last-message {:content {:text (.-text chat)
|
||||
:parsed-text (types/js->clj (.-parsedText
|
||||
chat))
|
||||
:response-to (.-responseTo chat)}
|
||||
:content-type (.-contentType chat)
|
||||
:community-id (.-contentCommunityId chat)
|
||||
:outgoing (boolean (.-outgoingStatus chat))
|
||||
:album-images-count (.-albumImagesCount chat)
|
||||
:from (.-from chat)
|
||||
:deleted? (.-deleted chat)
|
||||
:deleted-for-me? (.-deletedForMe chat)}
|
||||
:last-clock-value (.-lastClockValue chat)
|
||||
:profile-public-key (.-profile chat)
|
||||
:highlight (.-highlight chat)
|
||||
:active (.-active chat)
|
||||
:members (types/js->clj (.-members chat))
|
||||
:hide-if-permissions-not-met (.-hideIfPermissionsNotMet chat)}
|
||||
(-> {:name (.-name chat)
|
||||
:description (.-description chat)
|
||||
:color (.-color chat)
|
||||
:emoji (.-emoji chat)
|
||||
:timestamp (.-timestamp chat)
|
||||
:alias (.-alias chat)
|
||||
:muted (.-muted chat)
|
||||
:joined (.-joined chat)
|
||||
:muted-till (.-muteTill chat)
|
||||
:chat-id (.-id chat)
|
||||
:community-id (.-communityId chat)
|
||||
:synced-from (.-syncedFrom chat)
|
||||
:synced-to (.-syncedTo chat)
|
||||
:deleted-at-clock-value (.-deletedAtClockValue chat)
|
||||
:chat-type (.-chatType chat)
|
||||
:unviewed-messages-count (.-unviewedMessagesCount chat)
|
||||
:unviewed-mentions-count (.-unviewedMentionsCount chat)
|
||||
:last-message {:content {:text (.-text chat)
|
||||
:parsed-text (types/js->clj (.-parsedText chat))
|
||||
:response-to (.-responseTo chat)}
|
||||
:content-type (.-contentType chat)
|
||||
:community-id (.-contentCommunityId chat)
|
||||
:outgoing (boolean (.-outgoingStatus chat))
|
||||
:album-images-count (.-albumImagesCount chat)
|
||||
:from (.-from chat)
|
||||
:deleted? (.-deleted chat)
|
||||
:deleted-for-me? (.-deletedForMe chat)}
|
||||
:last-clock-value (.-lastClockValue chat)
|
||||
:profile-public-key (.-profile chat)
|
||||
:highlight (.-highlight chat)
|
||||
:active (.-active chat)
|
||||
:members (types/js->clj (.-members chat))}
|
||||
rpc->type
|
||||
unmarshal-members))
|
||||
|
||||
(re-frame/reg-fx :fetch-chats-preview
|
||||
(fn [{:keys [on-success]}]
|
||||
(json-rpc/call {:method "wakuext_chatsPreview"
|
||||
:params []
|
||||
:js-response true
|
||||
:on-success #(on-success ^js %)
|
||||
:on-error #(log/error "failed to fetch chats" 0 -1 %)})))
|
||||
(rf/defn fetch-chats-preview
|
||||
[_ {:keys [on-success]}]
|
||||
{:json-rpc/call [{:method "wakuext_chatsPreview"
|
||||
:params []
|
||||
:js-response true
|
||||
:on-success #(on-success ^js %)
|
||||
:on-error #(log/error "failed to fetch chats" 0 -1 %)}]})
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
(deftest normalize-chat-test
|
||||
(let [chat {:id "chat-id"
|
||||
:color "yellow"
|
||||
:color "color"
|
||||
:name "name"
|
||||
:chatType 3
|
||||
:members [{:id "a"
|
||||
@@ -26,7 +26,7 @@
|
||||
:timestamp 2}
|
||||
expected-chat {:public? false
|
||||
:group-chat true
|
||||
:color :yellow
|
||||
:color "color"
|
||||
:chat-name "name"
|
||||
:contacts #{"a" "b" "c" "d"}
|
||||
:chat-type 3
|
||||
|
||||
@@ -4,6 +4,13 @@
|
||||
[clojure.walk :as walk]
|
||||
[status-im.constants :as constants]))
|
||||
|
||||
(defn rpc->channel-permissions
|
||||
[rpc-channels-permissions]
|
||||
(update-vals rpc-channels-permissions
|
||||
(fn [{:keys [viewAndPostPermissions viewOnlyPermissions]}]
|
||||
{:view-only (set/rename-keys viewOnlyPermissions {:satisfied :satisfied?})
|
||||
:view-and-post (set/rename-keys viewAndPostPermissions {:satisfied :satisfied?})})))
|
||||
|
||||
(defn <-revealed-accounts-rpc
|
||||
[accounts]
|
||||
(mapv
|
||||
@@ -27,11 +34,8 @@
|
||||
(assoc acc
|
||||
(name k)
|
||||
(-> v
|
||||
(assoc :token-gated? (:tokenGated v)
|
||||
:can-post? (:canPost v)
|
||||
:can-view? (:canView v)
|
||||
:hide-if-permissions-not-met? (:hideIfPermissionsNotMet v))
|
||||
(dissoc :canPost :tokenGated :canView :hideIfPermissionsNotMet)
|
||||
(assoc :can-post? (:canPost v))
|
||||
(dissoc :canPost)
|
||||
(update :members walk/stringify-keys))))
|
||||
{}
|
||||
chats))
|
||||
@@ -64,7 +68,6 @@
|
||||
:canJoin :can-join?
|
||||
:requestedToJoinAt :requested-to-join-at
|
||||
:isMember :is-member?
|
||||
:outroMessage :outro-message
|
||||
:adminSettings :admin-settings
|
||||
:tokenPermissions :token-permissions
|
||||
:communityTokensMetadata :tokens-metadata
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
(ns legacy.status-im.data-store.communities-test
|
||||
(:require
|
||||
[cljs.test :refer [deftest is]]
|
||||
[legacy.status-im.data-store.communities :as sut]))
|
||||
|
||||
(def permissions
|
||||
{"community-id-chat-1"
|
||||
{:viewOnlyPermissions {:satisfied false
|
||||
:permissions {:token-permission-id-01 {:criteria [false]}}}
|
||||
:viewAndPostPermissions {:satisfied true :permissions {}}}
|
||||
"community-id-chat-2"
|
||||
{:viewOnlyPermissions {:satisfied true :permissions {}}
|
||||
:viewAndPostPermissions {:satisfied true :permissions {}}}})
|
||||
|
||||
(deftest rpc->channel-permissions-test
|
||||
(is (= {"community-id-chat-1"
|
||||
{:view-only {:satisfied? false
|
||||
:permissions {:token-permission-id-01 {:criteria [false]}}}
|
||||
:view-and-post {:satisfied? true :permissions {}}}
|
||||
"community-id-chat-2"
|
||||
{:view-only {:satisfied? true :permissions {}}
|
||||
:view-and-post {:satisfied? true :permissions {}}}}
|
||||
(sut/rpc->channel-permissions permissions))))
|
||||
@@ -16,41 +16,13 @@
|
||||
:community-id :communityId
|
||||
:clock-value :clock})))
|
||||
|
||||
(defn- <-status-link-previews-rpc
|
||||
[preview]
|
||||
(-> preview
|
||||
(update :community
|
||||
set/rename-keys
|
||||
{:communityId :community-id
|
||||
:displayName :display-name
|
||||
:membersCount :members-count
|
||||
:activeMembersCount :active-members-count})
|
||||
(update-in [:community :banner] set/rename-keys {:dataUri :data-uri})
|
||||
(update-in [:community :icon] set/rename-keys {:dataUri :data-uri})))
|
||||
|
||||
(defn ->status-link-previews-rpc
|
||||
[preview]
|
||||
(-> preview
|
||||
(update :community
|
||||
set/rename-keys
|
||||
{:community-id :communityId
|
||||
:display-name :displayName
|
||||
:members-count :membersCount
|
||||
:active-members-count :activeMembersCount})
|
||||
(update-in [:community :banner] set/rename-keys {:data-uri :dataUri})
|
||||
(update-in [:community :icon] set/rename-keys {:data-uri :dataUri})))
|
||||
|
||||
(defn- <-link-preview-rpc
|
||||
[preview]
|
||||
(-> preview
|
||||
(update :thumbnail set/rename-keys {:dataUri :data-uri})
|
||||
(update :favicon set/rename-keys {:dataUri :data-uri})))
|
||||
(update preview :thumbnail set/rename-keys {:dataUri :data-uri}))
|
||||
|
||||
(defn ->link-preview-rpc
|
||||
[preview]
|
||||
(-> preview
|
||||
(update :thumbnail set/rename-keys {:data-uri :dataUri})
|
||||
(update :favicon set/rename-keys {:data-uri :dataUri})))
|
||||
(update preview :thumbnail set/rename-keys {:data-uri :dataUri}))
|
||||
|
||||
(defn <-rpc
|
||||
[message]
|
||||
@@ -81,16 +53,8 @@
|
||||
:new :new?
|
||||
:albumImagesCount :album-images-count
|
||||
:displayName :display-name
|
||||
:linkPreviews :link-previews
|
||||
:statusLinkPreviews :status-link-previews
|
||||
:bridgeMessage :bridge-message})
|
||||
(update :bridge-message
|
||||
set/rename-keys
|
||||
{:bridgeName :bridge-name
|
||||
:userName :user-name
|
||||
:userAvatar :user-avatar})
|
||||
:linkPreviews :link-previews})
|
||||
(update :link-previews #(map <-link-preview-rpc %))
|
||||
(update :status-link-previews #(map <-status-link-previews-rpc %))
|
||||
(update :quoted-message
|
||||
set/rename-keys
|
||||
{:parsedText :parsed-text
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
:image nil
|
||||
:response-to "a"
|
||||
:links nil}
|
||||
:bridge-message nil
|
||||
:whisper-timestamp 1
|
||||
:contact-verification-state 1
|
||||
:contact-request-state 2
|
||||
@@ -38,19 +37,7 @@
|
||||
:compressed-key "c"
|
||||
:timestamp 3
|
||||
:link-previews [{:thumbnail {:url "http://localhost"
|
||||
:data-uri "data:image/png"}
|
||||
:favicon nil}]
|
||||
:status-link-previews [{:url "http://localhost"
|
||||
:community {:community-id "0x01"
|
||||
:display-name "Test Comm"
|
||||
:members-count 12
|
||||
:active-members-count 12
|
||||
:banner
|
||||
{:data-uri
|
||||
"data:image/png"}
|
||||
:icon
|
||||
{:data-uri
|
||||
"data:image/png"}}}]}
|
||||
:data-uri "data:image/png"}}]}
|
||||
message {:id message-id
|
||||
:whisperTimestamp 1
|
||||
:parsedText "parsed-text"
|
||||
@@ -74,17 +61,5 @@
|
||||
:timestamp 3
|
||||
:outgoingStatus "sending"
|
||||
:linkPreviews [{:thumbnail {:url "http://localhost"
|
||||
:dataUri "data:image/png"}
|
||||
:favicon nil}]
|
||||
:statusLinkPreviews [{:url "http://localhost"
|
||||
:community {:communityId "0x01"
|
||||
:displayName "Test Comm"
|
||||
:membersCount 12
|
||||
:activeMembersCount 12
|
||||
:banner
|
||||
{:dataUri
|
||||
"data:image/png"}
|
||||
:icon
|
||||
{:dataUri
|
||||
"data:image/png"}}}]}]
|
||||
:dataUri "data:image/png"}}]}]
|
||||
(is (= expected (m/<-rpc message))))))
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
(:require
|
||||
[clojure.set :as set]
|
||||
[clojure.walk :as walk]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.common.json-rpc.events :as json-rpc]
|
||||
[taoensso.timbre :as log]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
@@ -34,11 +32,11 @@
|
||||
:on-success #()
|
||||
:on-error #()}]})
|
||||
|
||||
(re-frame/reg-fx :switcher-cards/fetch
|
||||
(fn []
|
||||
(json-rpc/call {:method "wakuext_switcherCards"
|
||||
:params []
|
||||
:on-success #(rf/dispatch
|
||||
[:shell/switcher-cards-loaded
|
||||
(:switcherCards ^js %)])
|
||||
:on-error #(log/error "Failed to fetch switcher cards" %)})))
|
||||
(rf/defn fetch-switcher-cards-rpc
|
||||
[_]
|
||||
{:json-rpc/call [{:method "wakuext_switcherCards"
|
||||
:params []
|
||||
:on-success #(rf/dispatch
|
||||
[:shell/switcher-cards-loaded
|
||||
(:switcherCards ^js %)])
|
||||
:on-error #(log/error "Failed to fetch switcher cards" %)}]})
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
(:require
|
||||
[clojure.set :as set]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.common.json-rpc.events :as json-rpc]
|
||||
[taoensso.timbre :as log]))
|
||||
[taoensso.timbre :as log]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn <-rpc
|
||||
[visibility-status-update]
|
||||
@@ -18,13 +18,13 @@
|
||||
{:current-user-status :current-user-visibility-status})
|
||||
(update :current-user-visibility-status <-rpc)))
|
||||
|
||||
(re-frame/reg-fx :visibility-status-updates/fetch
|
||||
(fn []
|
||||
(json-rpc/call {:method "wakuext_statusUpdates"
|
||||
:params []
|
||||
:on-success #(re-frame/dispatch
|
||||
[:visibility-status-updates/visibility-status-updates-loaded
|
||||
(:statusUpdates ^js %)])
|
||||
:on-error #(log/error
|
||||
"failed to fetch visibility-status-updates"
|
||||
%)})))
|
||||
(rf/defn fetch-visibility-status-updates-rpc
|
||||
[_]
|
||||
{:json-rpc/call [{:method "wakuext_statusUpdates"
|
||||
:params []
|
||||
:on-success #(re-frame/dispatch
|
||||
[:visibility-status-updates/visibility-status-updates-loaded
|
||||
(:statusUpdates ^js %)])
|
||||
:on-error #(log/error
|
||||
"failed to fetch visibility-status-updates"
|
||||
%)}]})
|
||||
|
||||
@@ -239,7 +239,7 @@
|
||||
|
||||
(rf/defn tx-history-end-reached
|
||||
[{:keys [db] :as cofx} address]
|
||||
(let [syncing-allowed? (utils.mobile-sync/syncing-allowed? db)]
|
||||
(let [syncing-allowed? (utils.mobile-sync/syncing-allowed? cofx)]
|
||||
{:db (assoc-in db
|
||||
[:wallet-legacy :fetching address :all-fetched?]
|
||||
(if syncing-allowed?
|
||||
@@ -327,7 +327,7 @@
|
||||
{:chain-tokens (:wallet-legacy/all-tokens db)
|
||||
:addresses [address]
|
||||
:before-block min-known-block
|
||||
:fetch-more? (utils.mobile-sync/syncing-allowed? db)
|
||||
:fetch-more? (utils.mobile-sync/syncing-allowed? cofx)
|
||||
;; Transfers are requested before and including `min-known-block` because there is no
|
||||
;; guarantee that all transfers from that block are shown already. To make sure that we fetch
|
||||
;; the whole `default-transfers-limit` of transfers the number of transfers already received
|
||||
|
||||
@@ -8,16 +8,11 @@
|
||||
legacy.status-im.chat.models.loading
|
||||
legacy.status-im.contact.block
|
||||
legacy.status-im.currency.core
|
||||
legacy.status-im.data-store.chats
|
||||
legacy.status-im.data-store.switcher-cards
|
||||
legacy.status-im.data-store.visibility-status-updates
|
||||
legacy.status-im.fleet.core
|
||||
legacy.status-im.group-chats.core
|
||||
[legacy.status-im.keycard.core :as keycard]
|
||||
legacy.status-im.log-level.core
|
||||
legacy.status-im.mailserver.constants
|
||||
[legacy.status-im.mailserver.core :as mailserver]
|
||||
legacy.status-im.mobile-sync-settings.core
|
||||
legacy.status-im.multiaccounts.login.core
|
||||
legacy.status-im.multiaccounts.logout.core
|
||||
[legacy.status-im.multiaccounts.model :as multiaccounts.model]
|
||||
@@ -42,6 +37,7 @@
|
||||
[react-native.core :as rn]
|
||||
[react-native.permissions :as permissions]
|
||||
[react-native.platform :as platform]
|
||||
[status-im.common.biometric.events :as biometric]
|
||||
status-im.common.serialization
|
||||
status-im.common.standard-authentication.events
|
||||
[status-im.common.theme.core :as theme]
|
||||
@@ -124,7 +120,7 @@
|
||||
:content (i18n/label :t/biometric-auth-confirm-message)
|
||||
:confirm-button-text (i18n/label :t/biometric-auth-confirm-try-again)
|
||||
:cancel-button-text (i18n/label :t/biometric-auth-confirm-logout)
|
||||
:on-accept #(rf/dispatch [:biometric/authenticate {:on-fail on-biometric-auth-fail}])
|
||||
:on-accept #(biometric/authenticate nil {:on-fail on-biometric-auth-fail})
|
||||
:on-cancel #(re-frame/dispatch [:multiaccounts.logout.ui/logout-confirmed])})))
|
||||
|
||||
(rf/defn on-return-from-background
|
||||
@@ -146,7 +142,7 @@
|
||||
#(when-let [chat-id (:current-chat-id db)]
|
||||
{:dispatch [:chat/mark-all-as-read chat-id]})
|
||||
#(when requires-bio-auth
|
||||
{:dispatch [:biometric/authenticate {:on-fail on-biometric-auth-fail}]}))))
|
||||
(biometric/authenticate % {:on-fail on-biometric-auth-fail})))))
|
||||
|
||||
(rf/defn on-going-in-background
|
||||
[{:keys [db now]}]
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
[legacy.status-im.data-store.invitations :as data-store.invitations]
|
||||
[oops.core :as oops]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.common.json-rpc.events :as json-rpc]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.contexts.chat.events :as chat.events]
|
||||
[status-im.contexts.shell.activity-center.events :as activity-center]
|
||||
[status-im.navigation.events :as navigation]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
@@ -19,13 +19,15 @@
|
||||
(when (get-in cofx [:db :chats chat-id])
|
||||
(chat.events/pop-to-root-and-navigate-to-chat cofx chat-id nil)))
|
||||
|
||||
(re-frame/reg-event-fx :chat-removed
|
||||
(fn [{:keys [db]} [response chat-id]]
|
||||
{:db (dissoc db :current-chat-id)
|
||||
:fx [[:dispatch [:shell/close-switcher-card chat-id]]
|
||||
[:dispatch [:sanitize-messages-and-process-response response]]
|
||||
[:dispatch [:pop-to-root :shell-stack]]
|
||||
[:activity-center.notifications/fetch-unread-count]]}))
|
||||
(rf/defn handle-chat-removed
|
||||
{:events [:chat-removed]}
|
||||
[cofx response chat-id]
|
||||
(rf/merge cofx
|
||||
{:db (dissoc (:db cofx) :current-chat-id)
|
||||
:dispatch-n [[:shell/close-switcher-card chat-id]
|
||||
[:sanitize-messages-and-process-response response]
|
||||
[:pop-to-root :shell-stack]]}
|
||||
(activity-center/notifications-fetch-unread-count)))
|
||||
|
||||
(rf/defn handle-chat-update
|
||||
{:events [:chat-updated]}
|
||||
@@ -64,6 +66,16 @@
|
||||
:js-response true
|
||||
:on-success #(re-frame/dispatch [:chat-updated %])}]})
|
||||
|
||||
(rf/defn create
|
||||
{:events [:group-chats.ui/create-pressed]
|
||||
:interceptors [(re-frame/inject-cofx :random-guid-generator)]}
|
||||
[{:keys [db] :as cofx} group-name]
|
||||
(let [selected-contacts (:group/selected-contacts db)]
|
||||
{:json-rpc/call [{:method "wakuext_createGroupChatWithMembers"
|
||||
:params [nil group-name (into [] selected-contacts)]
|
||||
:js-response true
|
||||
:on-success #(re-frame/dispatch [:chat-updated %])}]}))
|
||||
|
||||
(rf/defn create-from-link
|
||||
{:events [:group-chats/create-from-link]}
|
||||
[cofx {:keys [chat-id invitation-admin chat-name]}]
|
||||
@@ -252,7 +264,8 @@
|
||||
{}
|
||||
invitations))})
|
||||
|
||||
(re-frame/reg-fx :group-chats/get-group-chat-invitations
|
||||
(fn []
|
||||
(json-rpc/call {:method "wakuext_getGroupChatInvitations"
|
||||
:on-success [::initialize-invitations]})))
|
||||
(rf/defn get-group-chat-invitations
|
||||
[_]
|
||||
{:json-rpc/call
|
||||
[{:method "wakuext_getGroupChatInvitations"
|
||||
:on-success #(re-frame/dispatch [::initialize-invitations %])}]})
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
[legacy.status-im.node.core :as node]
|
||||
[legacy.status-im.utils.mobile-sync :as mobile-network-utils]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.common.json-rpc.events :as json-rpc]
|
||||
[status-im.navigation.events :as navigation]
|
||||
[taoensso.timbre :as log]
|
||||
[utils.i18n :as i18n]
|
||||
@@ -62,7 +61,7 @@
|
||||
(dissoc :mailserver/current-request :mailserver/fetching-gaps-in-progress))})
|
||||
|
||||
(defn fetch-use-mailservers?
|
||||
[db]
|
||||
[{:keys [db]}]
|
||||
(get-in db [:profile/profile :use-mailservers?]))
|
||||
|
||||
(defonce showing-connection-error-popup? (atom false))
|
||||
@@ -118,32 +117,24 @@
|
||||
[{:keys [db] :as cofx}]
|
||||
{:db (dissoc db :mailserver/current-request)})
|
||||
|
||||
(defn needs-to-fetch-historic-messages?
|
||||
[db]
|
||||
(and
|
||||
(:messenger/started? db)
|
||||
(mobile-network-utils/syncing-allowed? db)
|
||||
(fetch-use-mailservers? db)
|
||||
(not (:mailserver/current-request db))))
|
||||
|
||||
(rf/defn process-next-messages-request
|
||||
{:events [::request-messages]}
|
||||
[{:keys [db]}]
|
||||
(when (needs-to-fetch-historic-messages? db)
|
||||
{:db (assoc db :mailserver/current-request true)
|
||||
:mailserver/request-all-historic-messages nil}))
|
||||
|
||||
(re-frame/reg-fx :mailserver/request-all-historic-messages
|
||||
(fn []
|
||||
(json-rpc/call {:method "wakuext_requestAllHistoricMessagesWithRetries"
|
||||
:params [false]
|
||||
:js-response true
|
||||
:on-success #(do
|
||||
(log/info "fetched historical messages")
|
||||
(re-frame/dispatch [::request-success %]))
|
||||
:on-error #(do
|
||||
(log/error "failed retrieve historical messages" %)
|
||||
(re-frame/dispatch [::request-error]))})))
|
||||
[{:keys [db now] :as cofx}]
|
||||
(when (and
|
||||
(:messenger/started? db)
|
||||
(mobile-network-utils/syncing-allowed? cofx)
|
||||
(fetch-use-mailservers? cofx)
|
||||
(not (:mailserver/current-request db)))
|
||||
{:db (assoc db :mailserver/current-request true)
|
||||
:json-rpc/call [{:method "wakuext_requestAllHistoricMessagesWithRetries"
|
||||
:params [false]
|
||||
:js-response true
|
||||
:on-success #(do
|
||||
(log/info "fetched historical messages")
|
||||
(re-frame/dispatch [::request-success %]))
|
||||
:on-error #(do
|
||||
(log/error "failed retrieve historical messages" %)
|
||||
(re-frame/dispatch [::request-error]))}]}))
|
||||
|
||||
(rf/defn handle-mailserver-changed
|
||||
[{:keys [db] :as cofx} ms]
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
[legacy.status-im.multiaccounts.model :as multiaccounts.model]
|
||||
[legacy.status-im.multiaccounts.update.core :as multiaccounts.update]
|
||||
[legacy.status-im.utils.mobile-sync :as utils]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.contexts.chat.home.add-new-contact.events :as add-new-contact]
|
||||
[status-im.navigation.events :as navigation]
|
||||
[taoensso.timbre :as log]
|
||||
[utils.re-frame :as rf]))
|
||||
@@ -18,24 +18,27 @@
|
||||
(or (nil? remember-choice?)
|
||||
remember-choice?))}))
|
||||
|
||||
(re-frame/reg-event-fx :mobile-network/on-network-status-change
|
||||
(fn [{:keys [db]}]
|
||||
(let [previously-initialized? (get db :network-status/initialized?)
|
||||
logged-in? (multiaccounts.model/logged-in? db)
|
||||
fetch-historic-messages? (mailserver/needs-to-fetch-historic-messages? db)]
|
||||
(if logged-in?
|
||||
{:db (cond-> (-> db
|
||||
(assoc :network-status/initialized? true)
|
||||
(assoc :bottom-sheet/show? false))
|
||||
fetch-historic-messages?
|
||||
(assoc :mailserver/current-request true))
|
||||
:fx [(when fetch-historic-messages?
|
||||
[:mailserver/request-all-historic-messages])
|
||||
[:dismiss-bottom-sheet-overlay-old]
|
||||
(when previously-initialized?
|
||||
(let [new-identity-input (get-in db [:contacts/new-identity :input])]
|
||||
[:dispatch [:contacts/set-new-identity {:input new-identity-input}]]))]}
|
||||
{:db (assoc db :network-status/initialized? true)}))))
|
||||
(rf/defn on-network-status-change
|
||||
[{:keys [db] :as cofx}]
|
||||
(let [initialized? (get db :network-status/initialized?)
|
||||
logged-in? (multiaccounts.model/logged-in? db)
|
||||
{:keys [remember-syncing-choice?]} (:profile/profile db)]
|
||||
(apply
|
||||
rf/merge
|
||||
cofx
|
||||
{:db (assoc db :network-status/initialized? true)}
|
||||
(cond
|
||||
;; NOTE(rasom): When we log into account on-network-status-change is
|
||||
;; dispatched, but that doesn't mean there was a status change, thus
|
||||
;; no reason to restart wallet.
|
||||
(and logged-in? initialized?)
|
||||
[(mailserver/process-next-messages-request)
|
||||
(bottom-sheet/hide-bottom-sheet-old)
|
||||
#(add-new-contact/set-new-identity-reconnected %)]
|
||||
|
||||
logged-in?
|
||||
[(mailserver/process-next-messages-request)
|
||||
(bottom-sheet/hide-bottom-sheet-old)]))))
|
||||
|
||||
(defn apply-settings
|
||||
([sync?] (apply-settings sync? :default))
|
||||
|
||||
@@ -13,14 +13,15 @@
|
||||
(native-module/logout)))
|
||||
|
||||
(rf/defn initialize-app-db
|
||||
[{{:keys [keycard initials-avatar-font-file biometrics]
|
||||
:network/keys [type]}
|
||||
[{{:keys [keycard initials-avatar-font-file]
|
||||
:biometric/keys [supported-type]
|
||||
:network/keys [type]}
|
||||
:db}]
|
||||
{:db (assoc db/app-db
|
||||
:network/type type
|
||||
:initials-avatar-font-file initials-avatar-font-file
|
||||
:keycard (dissoc keycard :secrets :pin :application-info)
|
||||
:biometrics biometrics
|
||||
:biometric/supported-type supported-type
|
||||
:syncing nil)})
|
||||
|
||||
(rf/defn logout-method
|
||||
@@ -45,7 +46,6 @@
|
||||
[_]
|
||||
;; we need to disable notifications before starting the logout process
|
||||
{:effects/push-notifications-disable nil
|
||||
:dispatch [:alert-banners/remove-all]
|
||||
:dispatch-later [{:ms 100
|
||||
:dispatch [::logout-method
|
||||
{:auth-method keychain/auth-method-none
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
(ns legacy.status-im.network.core
|
||||
(:require
|
||||
[clojure.string :as string]))
|
||||
[clojure.string :as string]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.navigation.events :as navigation]
|
||||
[utils.ethereum.chain :as chain]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(def url-regex
|
||||
#"https?://(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}(\.[a-z]{2,6})?\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)")
|
||||
@@ -9,6 +14,12 @@
|
||||
[url]
|
||||
(boolean (re-matches url-regex (str url))))
|
||||
|
||||
(def default-manage
|
||||
{:name {:value ""}
|
||||
:url {:value ""}
|
||||
:symbol {:value ""}
|
||||
:chain {:value :mainnet}})
|
||||
|
||||
(defn validate-string
|
||||
[{:keys [value]}]
|
||||
{:value value
|
||||
@@ -45,3 +56,123 @@
|
||||
[current-networks network]
|
||||
(let [chain-id (get-in network [:config :NetworkId])]
|
||||
(every? #(not= chain-id (get-in % [1 :config :NetworkId])) current-networks)))
|
||||
|
||||
(defn get-network
|
||||
[{:keys [db]} network-id]
|
||||
(get-in db [:networks/networks network-id]))
|
||||
|
||||
(rf/defn set-input
|
||||
{:events [::input-changed]}
|
||||
[{:keys [db]} input-key value]
|
||||
{:db (-> db
|
||||
(update-in [:networks/manage input-key] assoc :value value)
|
||||
(update-in [:networks/manage] validate-manage))})
|
||||
|
||||
;; No edit functionality actually implemented
|
||||
(rf/defn edit
|
||||
{:events [::add-network-pressed]}
|
||||
[{db :db}]
|
||||
{:db (assoc db :networks/manage (validate-manage default-manage))
|
||||
:dispatch [:navigate-to :edit-network]})
|
||||
|
||||
(rf/defn connect-success
|
||||
{:events [::connect-success]}
|
||||
[_ network-id]
|
||||
{:ui/show-confirmation
|
||||
{:title (i18n/label :t/close-app-title)
|
||||
:content (i18n/label :t/logout-app-content)
|
||||
:confirm-button-text (i18n/label :t/close-app-button)
|
||||
:on-accept #(re-frame/dispatch [::save-network-settings-pressed network-id])
|
||||
:on-cancel nil}})
|
||||
|
||||
(rf/defn connect-failure
|
||||
{:events [::connect-failure]}
|
||||
[_ reason]
|
||||
{:effects.utils/show-popup
|
||||
{:title (i18n/label :t/error)
|
||||
:content (str reason)}})
|
||||
|
||||
(rf/defn connect
|
||||
{:events [::connect-network-pressed]}
|
||||
[{:keys [db] :as cofx} network-id]
|
||||
(if (get-in db [:networks/networks network-id :config])
|
||||
(connect-success cofx network-id)
|
||||
(connect-failure cofx "A network with the specified id doesn't exist")))
|
||||
|
||||
(rf/defn delete
|
||||
{:events [::delete-network-pressed]}
|
||||
[{:keys [db]} network]
|
||||
(let [current-network? (= (:networks/current-network db) network)]
|
||||
(if (or current-network?
|
||||
(not (get-in db [:networks/networks network])))
|
||||
{:ui/show-error (i18n/label :t/delete-network-error)}
|
||||
{:ui/show-confirmation {:title (i18n/label :t/delete-network-title)
|
||||
:content (i18n/label :t/delete-network-confirmation)
|
||||
:confirm-button-text (i18n/label :t/delete)
|
||||
:on-accept #(re-frame/dispatch [::remove-network-confirmed
|
||||
network])
|
||||
:on-cancel nil}})))
|
||||
|
||||
(rf/defn save-network-settings
|
||||
{:events [::save-network-settings-pressed]}
|
||||
[{:keys [db] :as cofx} network]
|
||||
{:db (assoc db :networks/current-network network)
|
||||
:json-rpc/call [{:method "settings_saveSetting"
|
||||
:params [:networks/current-network network]
|
||||
:on-success #(re-frame/dispatch [:logout])}]})
|
||||
|
||||
(rf/defn remove-network
|
||||
{:events [::remove-network-confirmed]}
|
||||
[{:keys [db] :as cofx} network]
|
||||
(let [networks (dissoc (:networks/networks db) network)]
|
||||
{:db (assoc db :networks/networks networks)
|
||||
:json-rpc/call [{:method "settings_saveSetting"
|
||||
:params [:networks/networks (vals networks)]
|
||||
:on-success #(re-frame/dispatch [:navigate-back])}]}))
|
||||
|
||||
(defn new-network
|
||||
[random-id network-name sym upstream-url chain-type chain-id]
|
||||
(let [data-dir (str "/ethereum/" (name chain-type) "_rpc")
|
||||
config {:NetworkId (or (when chain-id (int chain-id))
|
||||
(chain/chain-keyword->chain-id chain-type))
|
||||
:DataDir data-dir
|
||||
:UpstreamConfig {:Enabled true
|
||||
:URL upstream-url}}]
|
||||
{:id random-id
|
||||
:name network-name
|
||||
:symbol sym
|
||||
:config config}))
|
||||
|
||||
(rf/defn save
|
||||
{:events [::save-network-pressed]
|
||||
:interceptors [(re-frame/inject-cofx :random-id-generator)]}
|
||||
[{{:networks/keys [manage networks] :as db} :db
|
||||
random-id-generator :random-id-generator
|
||||
:as cofx}]
|
||||
(if (valid-manage? manage)
|
||||
;; rename network-id from UI to chain-id
|
||||
(let [{:keys [name url chain network-id symbol]} manage
|
||||
random-id (string/replace (random-id-generator) "-" "")
|
||||
network (new-network random-id
|
||||
(:value name)
|
||||
(:value symbol)
|
||||
(:value url)
|
||||
(:value chain)
|
||||
(:value network-id))
|
||||
custom-chain-type? (= :custom (:value chain))
|
||||
new-networks (assoc networks random-id network)]
|
||||
(if (or (not custom-chain-type?)
|
||||
(chain-id-available? networks network))
|
||||
{:db (-> db
|
||||
(dissoc :networks/manage)
|
||||
(assoc :networks/networks new-networks))
|
||||
:json-rpc/call [{:method "settings_saveSetting"
|
||||
:params [:networks/networks (vals new-networks)]
|
||||
:on-success #(re-frame/dispatch [:navigate-back])}]}
|
||||
{:ui/show-error "chain-id already defined"}))
|
||||
{:ui/show-error "invalid network parameters"}))
|
||||
|
||||
(rf/defn open-network-details
|
||||
{:events [::network-entry-pressed]}
|
||||
[cofx network]
|
||||
(navigation/navigate-to cofx :network-details {:networks/selected-network network}))
|
||||
|
||||
@@ -31,6 +31,38 @@
|
||||
(testing "an https url not on the default port"
|
||||
(is (network.core/valid-rpc-url? "https://valid.something.else:65323"))))
|
||||
|
||||
(deftest new-network-test
|
||||
(let [actual (network.core/new-network "randomid"
|
||||
"network-name"
|
||||
"network-symbol"
|
||||
"upstream-url"
|
||||
:mainnet
|
||||
nil)]
|
||||
(is (= {:id "randomid"
|
||||
:name "network-name"
|
||||
:symbol "network-symbol"
|
||||
:config {:NetworkId 1
|
||||
:DataDir "/ethereum/mainnet_rpc"
|
||||
:UpstreamConfig {:Enabled true
|
||||
:URL "upstream-url"}}}
|
||||
actual))))
|
||||
|
||||
(deftest new-network-id-test
|
||||
(let [actual (network.core/new-network "randomid"
|
||||
"network-name"
|
||||
"network-symbol"
|
||||
"upstream-url"
|
||||
:mainnet
|
||||
"5777")]
|
||||
(is (= {:id "randomid"
|
||||
:name "network-name"
|
||||
:symbol "network-symbol"
|
||||
:config {:NetworkId 5777
|
||||
:DataDir "/ethereum/mainnet_rpc"
|
||||
:UpstreamConfig {:Enabled true
|
||||
:URL "upstream-url"}}}
|
||||
actual))))
|
||||
|
||||
(deftest valid-manage-test
|
||||
(testing "a valid manage"
|
||||
(is (network.core/valid-manage? {:url {:value "http://valid.com"}
|
||||
@@ -60,3 +92,101 @@
|
||||
:name {:value "valid"}
|
||||
:symbol {:value ""}
|
||||
:chain {:value "valid"}})))))
|
||||
|
||||
(deftest set-input-test
|
||||
(testing "it updates and validate a field"
|
||||
(is
|
||||
(= {:db {:networks/manage {:url {:value "http://valid.com"
|
||||
:error false}
|
||||
:name {:value ""
|
||||
:error true}
|
||||
:symbol {:value "symbol"
|
||||
:error false}
|
||||
:chain {:value "mainnet"
|
||||
:error false}
|
||||
:network-id {:value nil
|
||||
:error false}}}}
|
||||
(network.core/set-input {:db {:networks/manage {:url {:value "something"
|
||||
:error true}
|
||||
:name {:value ""
|
||||
:error false}
|
||||
:symbol {:value "symbol"
|
||||
:error false}
|
||||
:chain {:value "mainnet"
|
||||
:error false}}}}
|
||||
:url
|
||||
"http://valid.com")))))
|
||||
|
||||
(deftest not-save-invalid-url
|
||||
(testing "it does not save a network with an invalid url"
|
||||
(is
|
||||
(:ui/show-error (network.core/save {:random-id-generator (constantly "random")
|
||||
:db {:networks/manage {:url {:value "wrong"}
|
||||
:chain {:value "1"}
|
||||
:name {:value "empty"}}
|
||||
:profile/profile {}}})))))
|
||||
|
||||
(deftest save-valid-network
|
||||
(testing "save a valid network"
|
||||
(let [fx (network.core/save
|
||||
{:random-id-generator (constantly "random-id")
|
||||
:db {:networks/manage {:url {:value "http://valid.com"}
|
||||
:chain {:value :mainnet}
|
||||
:symbol {:value "symbol"}
|
||||
:name {:value "valid"}}
|
||||
:profile/profile {}
|
||||
:networks/networks {"random2"
|
||||
{:id "random2"
|
||||
:name "network-name"
|
||||
:symbol "symbol"
|
||||
:config {:NetworkId 1
|
||||
:DataDir "/ethereum/mainnet_rpc"
|
||||
:UpstreamConfig
|
||||
{:Enabled true
|
||||
:URL "upstream-url"}}}}}})]
|
||||
(is (= "settings_saveSetting" (:method (first (:json-rpc/call fx)))))
|
||||
(is (nil? (:networks/manage (:db fx))))
|
||||
(testing "and check that it has an id with `-` and the correct mainnet NetworkId"
|
||||
(is (= 1 (get-in fx [:db :networks/networks "randomid" :config :NetworkId])))))))
|
||||
|
||||
(deftest not-save-custom-chain-with-non-unique-id
|
||||
(testing "it does not save a custom chain with network-id already defined"
|
||||
(let [result (network.core/save
|
||||
{:random-id-generator (constantly "already-defined")
|
||||
:db {:networks/manage {:url {:value "http://valid.com"}
|
||||
:chain {:value :custom}
|
||||
:name {:value "valid"}
|
||||
:network-id {:value 1}}
|
||||
:profile/profile {}
|
||||
:networks/networks {"random"
|
||||
{:id "random"
|
||||
:name "network-name"
|
||||
:config {:NetworkId 1
|
||||
:DataDir "/ethereum/mainnet_rpc"
|
||||
:UpstreamConfig
|
||||
{:Enabled true
|
||||
:URL "upstream-url"}}}}}})]
|
||||
(is (:ui/show-error result)))))
|
||||
|
||||
(deftest save-valid-network-with-unique-chain-id-check
|
||||
(testing "save a valid network with chain-id not already defined"
|
||||
(let [fx (network.core/save
|
||||
{:random-id-generator (constantly "random")
|
||||
:db {:networks/manage {:url {:value "http://valid.com"}
|
||||
:chain {:value :mainnet}
|
||||
:name {:value "valid"}
|
||||
:symbol {:value "symbol"}
|
||||
:network-id {:value 5}}
|
||||
:profile/profile {}
|
||||
:networks/networks {"randomid"
|
||||
{:id "randomid"
|
||||
:name "network-name"
|
||||
:symbol "symbol"
|
||||
:config {:NetworkId 3
|
||||
:DataDir "/ethereum/mainnet_rpc"
|
||||
:UpstreamConfig
|
||||
{:Enabled true
|
||||
:URL "upstream-url"}}}}}})]
|
||||
(is (= "settings_saveSetting" (:method (first (:json-rpc/call fx)))))
|
||||
(is (nil? (:networks/manage (:db fx))))
|
||||
(is (get-in fx [:db :networks/networks "random"])))))
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
(ns legacy.status-im.network.net-info
|
||||
(:require
|
||||
["@react-native-community/netinfo" :default net-info]
|
||||
[legacy.status-im.mobile-sync-settings.core :as mobile-network]
|
||||
[native-module.core :as native-module]
|
||||
[re-frame.core :as re-frame]
|
||||
[taoensso.timbre :as log]
|
||||
@@ -12,11 +13,11 @@
|
||||
{:db (assoc db :network-status (if is-connected? :online :offline))}))
|
||||
|
||||
(rf/defn change-network-type
|
||||
[{:keys [db] :as cofx} network-type expensive?]
|
||||
[{:keys [db] :as cofx} old-network-type network-type expensive?]
|
||||
(rf/merge cofx
|
||||
{:db (assoc db :network/type network-type)
|
||||
:network/notify-status-go [network-type expensive?]
|
||||
:dispatch [:mobile-network/on-network-status-change]}))
|
||||
:network/notify-status-go [network-type expensive?]}
|
||||
(mobile-network/on-network-status-change)))
|
||||
|
||||
(rf/defn handle-network-info-change
|
||||
{:events [::network-info-changed]}
|
||||
@@ -36,7 +37,7 @@
|
||||
(when-not status-changed?
|
||||
(change-network-status isConnected))
|
||||
(when-not type-changed?
|
||||
(change-network-type type (:is-connection-expensive details))))))
|
||||
(change-network-type old-network-type type (:is-connection-expensive details))))))
|
||||
|
||||
(defn add-net-info-listener
|
||||
[]
|
||||
|
||||
@@ -72,3 +72,18 @@
|
||||
{:events [:show-tooltip]}
|
||||
[_ tooltip-id]
|
||||
{:show-tooltip tooltip-id})
|
||||
|
||||
(rf/defn show-profile
|
||||
{:events [:chat.ui/show-profile]}
|
||||
[{:keys [db]} identity ens-name]
|
||||
(let [my-public-key (get-in db [:profile/profile :public-key])]
|
||||
(if (not= my-public-key identity)
|
||||
{:db (-> db
|
||||
(assoc :contacts/identity identity)
|
||||
(assoc :contacts/ens-name ens-name))
|
||||
:dispatch [:contacts/build-contact
|
||||
{:pubkey identity
|
||||
:ens ens-name
|
||||
:success-fn (fn [_]
|
||||
{:dispatch [:open-modal :profile]})}]}
|
||||
{:dispatch [:navigate-to :my-profile]})))
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
(:require
|
||||
[legacy.status-im.utils.utils :as utils]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.common.json-rpc.events :as json-rpc]
|
||||
[status-im.constants :as constants]
|
||||
[utils.ethereum.chain :as chain]
|
||||
[utils.re-frame :as rf]))
|
||||
@@ -23,21 +22,6 @@
|
||||
:params [(chain/chain-id db) id]
|
||||
:on-success #()}]}))
|
||||
|
||||
(re-frame/reg-fx :stickers/load-packs
|
||||
(fn [chain-id]
|
||||
(json-rpc/call {:method "stickers_market"
|
||||
:params [chain-id]
|
||||
:on-success [:stickers/stickers-market-success]})
|
||||
(json-rpc/call {:method "stickers_installed"
|
||||
:params []
|
||||
:on-success [:stickers/stickers-installed-success]})
|
||||
(json-rpc/call {:method "stickers_pending"
|
||||
:params []
|
||||
:on-success [:stickers/stickers-pending-success]})
|
||||
(json-rpc/call {:method "stickers_recent"
|
||||
:params []
|
||||
:on-success [:stickers/stickers-recent-success]})))
|
||||
|
||||
(rf/defn load-packs
|
||||
{:events [:stickers/load-packs]}
|
||||
[{:keys [db]}]
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
(re-frame/reg-sub
|
||||
:mailserver/use-status-nodes?
|
||||
(fn [db _]
|
||||
(boolean (mailserver/fetch-use-mailservers? db))))
|
||||
(boolean (mailserver/fetch-use-mailservers? {:db db}))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:mailserver.edit/validation-errors
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
(ns legacy.status-im.subs.networks
|
||||
(:require
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.config :as config]
|
||||
[utils.ethereum.chain :as chain]))
|
||||
|
||||
(defn- filter-networks
|
||||
[network-type]
|
||||
(fn [network]
|
||||
(let [chain-id (chain/network->chain-id network)
|
||||
testnet? (chain/testnet? chain-id)
|
||||
custom? (:custom? network)]
|
||||
(case network-type
|
||||
:custom custom?
|
||||
:mainnet (and (not custom?) (not testnet?))
|
||||
:testnet (and (not custom?) testnet?)))))
|
||||
|
||||
(defn- label-networks
|
||||
[default-networks]
|
||||
(fn [network]
|
||||
(let [custom? (not (default-networks (:id network)))]
|
||||
(assoc network :custom? custom?))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:get-networks
|
||||
:<- [:networks/networks]
|
||||
(fn [networks]
|
||||
(let [networks (map (label-networks (into #{} (map :id config/default-networks)))
|
||||
(sort-by :name (vals networks)))
|
||||
types [:mainnet :testnet :custom]]
|
||||
(zipmap
|
||||
types
|
||||
(map #(filter (filter-networks %) networks) types)))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:manage-network-valid?
|
||||
:<- [:networks/manage]
|
||||
(fn [manage]
|
||||
(not-any? :error (vals manage))))
|
||||
@@ -5,6 +5,7 @@
|
||||
legacy.status-im.subs.ens
|
||||
legacy.status-im.subs.keycard
|
||||
legacy.status-im.subs.mailservers
|
||||
legacy.status-im.subs.networks
|
||||
legacy.status-im.subs.stickers
|
||||
[re-frame.core :as re-frame]))
|
||||
|
||||
@@ -99,7 +100,6 @@
|
||||
;;; Link previews
|
||||
(reg-root-key-sub :link-previews-whitelist :link-previews-whitelist)
|
||||
(reg-root-key-sub :chat/link-previews :chat/link-previews)
|
||||
(reg-root-key-sub :chat/status-link-previews :chat/status-link-previews)
|
||||
|
||||
;;commands
|
||||
(reg-root-key-sub :commands/select-account :commands/select-account)
|
||||
|
||||
@@ -13,21 +13,37 @@
|
||||
(re-frame/dispatch event))
|
||||
|
||||
(defn- normal-mode-settings-data
|
||||
[{:keys [current-log-level
|
||||
[{:keys [network-name
|
||||
current-log-level
|
||||
light-client-enabled?
|
||||
transactions-management-enabled?
|
||||
current-fleet
|
||||
webview-debug
|
||||
test-networks-enabled?
|
||||
is-goerli-enabled?
|
||||
peer-syncing-enabled?]}]
|
||||
is-goerli-enabled?]}]
|
||||
(keep
|
||||
identity
|
||||
[{:size :small
|
||||
:title (i18n/label :t/network)
|
||||
:accessibility-label :network-button
|
||||
:container-margin-top 8
|
||||
:on-press
|
||||
#(re-frame/dispatch [:navigate-to :network-settings])
|
||||
:accessory :text
|
||||
:accessory-text network-name
|
||||
:chevron true}
|
||||
{:size :small
|
||||
:title (i18n/label :t/network-info)
|
||||
:accessibility-label :network-button
|
||||
:container-margin-top 8
|
||||
:on-press
|
||||
#(re-frame/dispatch [:navigate-to :network-info])
|
||||
:chevron true}
|
||||
{:size :small
|
||||
:title (i18n/label :t/log-level)
|
||||
:accessibility-label :log-level-settings-button
|
||||
:on-press
|
||||
#(re-frame/dispatch [:open-modal :log-level-settings])
|
||||
#(re-frame/dispatch [:navigate-to :log-level-settings])
|
||||
:accessory :text
|
||||
:accessory-text current-log-level
|
||||
:chevron true}
|
||||
@@ -35,7 +51,7 @@
|
||||
:title (i18n/label :t/fleet)
|
||||
:accessibility-label :fleet-settings-button
|
||||
:on-press
|
||||
#(re-frame/dispatch [:open-modal :fleet-settings])
|
||||
#(re-frame/dispatch [:navigate-to :fleet-settings])
|
||||
:accessory :text
|
||||
:accessory-text current-fleet
|
||||
:chevron true}
|
||||
@@ -50,14 +66,14 @@
|
||||
:accessibility-label :rpc-usage-info
|
||||
:container-margin-top 8
|
||||
:on-press
|
||||
#(re-frame/dispatch [:open-modal :rpc-usage-info])
|
||||
#(re-frame/dispatch [:navigate-to :rpc-usage-info])
|
||||
:chevron true}
|
||||
{:size :small
|
||||
:title (i18n/label :t/peers-stats)
|
||||
:accessibility-label :peers-stats
|
||||
:container-margin-top 8
|
||||
:on-press
|
||||
#(re-frame/dispatch [:open-modal :peers-stats])
|
||||
#(re-frame/dispatch [:navigate-to :peers-stats])
|
||||
:chevron true}
|
||||
{:size :small
|
||||
:title (i18n/label :t/light-client-enabled)
|
||||
@@ -103,19 +119,11 @@
|
||||
#(re-frame/dispatch [:profile.settings/toggle-goerli-test-network])
|
||||
:accessory :switch
|
||||
:active is-goerli-enabled?}
|
||||
{:size :small
|
||||
:title "Peer syncing"
|
||||
:accessibility-label :peer-syncing
|
||||
:container-margin-bottom 8
|
||||
:on-press
|
||||
#(re-frame/dispatch [:profile.settings/toggle-peer-syncing])
|
||||
:accessory :switch
|
||||
:active peer-syncing-enabled?}
|
||||
{:size :small
|
||||
:title (i18n/label :t/set-currency)
|
||||
:accessibility-label :wallet-change-currency
|
||||
:on-press #(hide-sheet-and-dispatch
|
||||
[:open-modal :currency-settings])
|
||||
[:navigate-to :currency-settings])
|
||||
:chevron true}]))
|
||||
|
||||
(defn- flat-list-data
|
||||
@@ -134,20 +142,20 @@
|
||||
is-goerli-enabled? [:profile/is-goerli-enabled?]
|
||||
light-client-enabled? [:profile/light-client-enabled?]
|
||||
webview-debug [:profile/webview-debug]
|
||||
network-name [:network-name]
|
||||
transactions-management-enabled? [:wallet-legacy/transactions-management-enabled?]
|
||||
current-log-level [:log-level/current-log-level]
|
||||
current-fleet [:fleets/current-fleet]
|
||||
peer-syncing-enabled? [:profile/peer-syncing-enabled?]]
|
||||
current-fleet [:fleets/current-fleet]]
|
||||
[list/flat-list
|
||||
{:data (flat-list-data
|
||||
{:current-log-level current-log-level
|
||||
{:network-name network-name
|
||||
:current-log-level current-log-level
|
||||
:transactions-management-enabled? transactions-management-enabled?
|
||||
:light-client-enabled? light-client-enabled?
|
||||
:current-fleet current-fleet
|
||||
:dev-mode? false
|
||||
:webview-debug webview-debug
|
||||
:test-networks-enabled? test-networks-enabled?
|
||||
:is-goerli-enabled? is-goerli-enabled?
|
||||
:peer-syncing-enabled? peer-syncing-enabled?})
|
||||
:is-goerli-enabled? is-goerli-enabled?})
|
||||
:key-fn (fn [_ i] (str i))
|
||||
:render-fn render-item}]))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
(:require
|
||||
[legacy.status-im.react-native.resources :as resources]
|
||||
[legacy.status-im.ui.components.colors :as quo.colors]
|
||||
[legacy.status-im.ui.components.fast-image :as fast-image]
|
||||
[legacy.status-im.ui.screens.chat.message.legacy-style :as style]
|
||||
[quo.core :as quo]
|
||||
[quo.foundations.colors :as colors]
|
||||
@@ -144,6 +145,23 @@
|
||||
[rn/text {:style (style/status-text)}]
|
||||
(-> content :parsed-text peek :children))]])
|
||||
|
||||
;; EMOJI
|
||||
(defn emoji
|
||||
[]
|
||||
(fn [{:keys [content] :as message}]
|
||||
[rn/view (style/message-view message)
|
||||
[rn/view {:style (style/message-view-content)}
|
||||
[rn/view {:style (style/style-message-text)}
|
||||
[rn/text {:style (style/emoji-message message)}
|
||||
(:text content)]]]]))
|
||||
|
||||
;; STICKER
|
||||
(defn sticker
|
||||
[{:keys [content]}]
|
||||
[fast-image/fast-image
|
||||
{:style {:margin 10 :width 140 :height 140}
|
||||
:source {:uri (str (-> content :sticker :url) "&download=true")}}])
|
||||
|
||||
(defn contact-request-status-pending
|
||||
[]
|
||||
[rn/view {:style {:flex-direction :row}}
|
||||
|
||||
@@ -85,7 +85,9 @@
|
||||
:accessibility-label :share-community-link
|
||||
:type :secondary
|
||||
:on-press #(debounce/throttle-and-dispatch
|
||||
[::communities/share-community-confirmation-pressed @user-pk
|
||||
[(if can-invite?
|
||||
::communities/invite-people-confirmation-pressed
|
||||
::communities/share-community-confirmation-pressed) @user-pk
|
||||
selected]
|
||||
3000)}
|
||||
(i18n/label (if can-invite? :t/invite :t/share))]}]]))))
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
{:active (= value id)
|
||||
:accessory :radio
|
||||
:title (get titles id)
|
||||
:on-press #(re-frame/dispatch [:profile.settings/profile-update :default-sync-period id])}])
|
||||
:on-press #(re-frame/dispatch [:profile.settings/update-value :default-sync-period id])}])
|
||||
|
||||
(views/defview default-sync-period-settings
|
||||
[]
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
(ns legacy.status-im.ui.screens.network.edit-network.styles)
|
||||
|
||||
(def edit-network-view
|
||||
{:flex 1
|
||||
:margin-horizontal 16
|
||||
:margin-vertical 15})
|
||||
|
||||
(def bottom-container
|
||||
{:flex-direction :row
|
||||
:padding-vertical 4})
|
||||
|
||||
(def container {:flex 1})
|
||||
@@ -0,0 +1,72 @@
|
||||
(ns legacy.status-im.ui.screens.network.edit-network.views
|
||||
(:require
|
||||
[legacy.status-im.network.core :as network]
|
||||
[legacy.status-im.ui.components.core :as quo]
|
||||
[legacy.status-im.ui.components.list.item :as list.item]
|
||||
[legacy.status-im.ui.components.list.views :as list]
|
||||
[legacy.status-im.ui.components.react :as react]
|
||||
[legacy.status-im.ui.screens.network.edit-network.styles :as styles]
|
||||
[re-frame.core :as re-frame]
|
||||
[utils.i18n :as i18n])
|
||||
(:require-macros [legacy.status-im.utils.views :as views]))
|
||||
|
||||
(defn- render-network-type
|
||||
[type _ _ manage-network]
|
||||
(let [name (case type
|
||||
:mainnet (i18n/label :t/mainnet-network)
|
||||
:goerli (i18n/label :t/goerli-network)
|
||||
:custom (i18n/label :t/custom))]
|
||||
[list.item/list-item
|
||||
{:title name
|
||||
:accessory :radio
|
||||
:active (= (get-in manage-network [:chain :value]) type)
|
||||
:on-press #(re-frame/dispatch [::network/input-changed :chain type])}]))
|
||||
|
||||
(views/defview edit-network
|
||||
[]
|
||||
(views/letsubs [manage-network [:networks/manage]
|
||||
is-valid? [:manage-network-valid?]]
|
||||
(let [custom? (= (get-in manage-network [:chain :value]) :custom)]
|
||||
[react/keyboard-avoiding-view {:flex 1}
|
||||
[react/scroll-view
|
||||
[react/view styles/edit-network-view
|
||||
[react/view {:padding-vertical 8}
|
||||
[quo/text-input
|
||||
{:label (i18n/label :t/name)
|
||||
:placeholder (i18n/label :t/specify-name)
|
||||
:default-value (get-in manage-network [:name :value])
|
||||
:on-change-text #(re-frame/dispatch [::network/input-changed :name %])
|
||||
:auto-focus true}]]
|
||||
[react/view {:padding-vertical 8}
|
||||
[quo/text-input
|
||||
{:label (i18n/label :t/symbol)
|
||||
:placeholder (i18n/label :t/specify-symbol)
|
||||
:default-value (get-in manage-network [:symbol :value])
|
||||
:on-change-text #(re-frame/dispatch [::network/input-changed :symbol %])
|
||||
:auto-focus true}]]
|
||||
[react/view {:padding-vertical 8}
|
||||
[quo/text-input
|
||||
{:label (i18n/label :t/rpc-url)
|
||||
:placeholder (i18n/label :t/specify-rpc-url)
|
||||
:default-value (get-in manage-network [:url :value])
|
||||
:on-change-text #(re-frame/dispatch [::network/input-changed :url %])}]]]
|
||||
[quo/list-header (i18n/label :t/network-chain)]
|
||||
[list/flat-list
|
||||
{:data [:mainnet :goerli :custom]
|
||||
:key-fn (fn [_ i] (str i))
|
||||
:render-data manage-network
|
||||
:render-fn render-network-type}]
|
||||
(when custom?
|
||||
[react/view styles/edit-network-view
|
||||
[quo/text-input
|
||||
{:label (i18n/label :t/network-id)
|
||||
:placeholder (i18n/label :t/specify-network-id)
|
||||
:on-change-text #(re-frame/dispatch [::network/input-changed :network-id %])}]])]
|
||||
[react/view styles/bottom-container
|
||||
[react/view {:flex 1}]
|
||||
[quo/button
|
||||
{:after :main-icons/next
|
||||
:type :secondary
|
||||
:disabled (not is-valid?)
|
||||
:on-press #(re-frame/dispatch [::network/save-network-pressed])}
|
||||
(i18n/label :t/save)]]])))
|
||||
@@ -0,0 +1,47 @@
|
||||
(ns legacy.status-im.ui.screens.network.network-details.views
|
||||
(:require
|
||||
[legacy.status-im.network.core :as network]
|
||||
[legacy.status-im.ui.components.core :as quo]
|
||||
[legacy.status-im.ui.components.react :as react]
|
||||
[legacy.status-im.ui.screens.network.styles :as st]
|
||||
[legacy.status-im.ui.screens.network.views :as network-settings]
|
||||
[re-frame.core :as re-frame]
|
||||
[utils.debounce :refer [throttle-and-dispatch]]
|
||||
[utils.i18n :as i18n])
|
||||
(:require-macros [legacy.status-im.utils.views :as views]))
|
||||
|
||||
(views/defview network-details
|
||||
[]
|
||||
(views/letsubs [{:keys [networks/selected-network]} [:get-screen-params]
|
||||
current-network [:networks/current-network]
|
||||
networks [:get-networks]]
|
||||
(let [{:keys [id name config]} selected-network
|
||||
connected? (= id current-network)
|
||||
custom? (seq (filter #(= (:id %) id) (:custom networks)))]
|
||||
[:<>
|
||||
[react/view {:flex 1}
|
||||
[network-settings/network-badge
|
||||
{:name name
|
||||
:connected? connected?}]
|
||||
(when-not connected?
|
||||
[react/touchable-highlight
|
||||
{:on-press #(throttle-and-dispatch [::network/connect-network-pressed id] 1000)}
|
||||
[react/view st/connect-button-container
|
||||
[react/view
|
||||
{:style st/connect-button
|
||||
:accessibility-label :network-connect-button}
|
||||
[react/text {:style st/connect-button-label}
|
||||
(i18n/label :t/connect)]]
|
||||
[react/i18n-text
|
||||
{:style st/connect-button-description
|
||||
:key :connecting-requires-login}]]])
|
||||
[react/view (st/network-config-container)
|
||||
[react/text
|
||||
{:style st/network-config-text
|
||||
:accessibility-label :network-details-text}
|
||||
config]]]
|
||||
(when custom?
|
||||
[react/view st/bottom-container
|
||||
[react/view {:flex 1}
|
||||
[quo/button {:on-press #(re-frame/dispatch [::network/delete-network-pressed id])}
|
||||
(i18n/label :t/delete)]]])])))
|
||||
@@ -0,0 +1,90 @@
|
||||
(ns legacy.status-im.ui.screens.network.styles
|
||||
(:require
|
||||
[legacy.status-im.ui.components.colors :as colors]
|
||||
[legacy.status-im.utils.styles :as styles]))
|
||||
|
||||
(def wrapper
|
||||
{:flex 1})
|
||||
|
||||
(def badge-name-text
|
||||
{:font-size 17})
|
||||
|
||||
(styles/def badge-connected-text
|
||||
{:color colors/gray
|
||||
:ios {:margin-top 5}})
|
||||
|
||||
(def connect-button-container
|
||||
{:margin-top 8
|
||||
:margin-bottom 16
|
||||
:margin-horizontal 16})
|
||||
|
||||
(def connect-button
|
||||
{:height 52
|
||||
:align-items :center
|
||||
:justify-content :center
|
||||
:background-color colors/blue
|
||||
:border-radius 8
|
||||
:ios {:opacity 0.9}})
|
||||
|
||||
(def connect-button-label
|
||||
{:color colors/white-persist
|
||||
:font-size 17})
|
||||
|
||||
(def connect-button-description
|
||||
{:color colors/gray
|
||||
:margin-top 8
|
||||
:height 20})
|
||||
|
||||
(styles/defn network-config-container
|
||||
[]
|
||||
{:height 160
|
||||
:margin-top 8
|
||||
:padding-top 16
|
||||
:padding-left 16
|
||||
:margin-horizontal 16
|
||||
:background-color colors/gray-lighter
|
||||
:ios {:border-radius 9
|
||||
:opacity 0.9}
|
||||
:android {:border-radius 4}})
|
||||
|
||||
(styles/def network-config-text
|
||||
{:font-size 17
|
||||
:ios {:opacity 0.8}
|
||||
:android {:opacity 0.4}})
|
||||
|
||||
(defn network-icon
|
||||
[connected? size]
|
||||
{:width size
|
||||
:height size
|
||||
:border-radius (/ size 2)
|
||||
:background-color (if connected? colors/blue colors/gray-lighter)
|
||||
:align-items :center
|
||||
:justify-content :center})
|
||||
|
||||
(def network-badge
|
||||
{:height 88
|
||||
:padding-left 16
|
||||
:flex-direction :row
|
||||
:align-items :center})
|
||||
|
||||
(styles/def network-item
|
||||
{:flex-direction :row
|
||||
:align-items :center
|
||||
:padding-horizontal 16
|
||||
:ios {:height 64}
|
||||
:android {:height 56}})
|
||||
|
||||
(def network-item-name-text
|
||||
{:font-size 17})
|
||||
|
||||
(def network-item-connected-text
|
||||
{:color colors/gray
|
||||
:font-size 14
|
||||
:margin-top 6})
|
||||
|
||||
(def bottom-container
|
||||
{:flex-direction :row
|
||||
:margin-horizontal 12
|
||||
:margin-vertical 15})
|
||||
|
||||
(def container {:flex 1})
|
||||
@@ -0,0 +1,71 @@
|
||||
(ns legacy.status-im.ui.screens.network.views
|
||||
(:require
|
||||
[legacy.status-im.network.core :as network]
|
||||
[legacy.status-im.ui.components.colors :as colors]
|
||||
[legacy.status-im.ui.components.icons.icons :as icons]
|
||||
[legacy.status-im.ui.components.list.item :as list.item]
|
||||
[legacy.status-im.ui.components.list.views :as list]
|
||||
[legacy.status-im.ui.components.react :as react]
|
||||
[legacy.status-im.ui.components.topbar :as topbar]
|
||||
[legacy.status-im.ui.screens.network.styles :as styles]
|
||||
[re-frame.core :as re-frame]
|
||||
[utils.i18n :as i18n])
|
||||
(:require-macros [legacy.status-im.utils.views :as views]))
|
||||
|
||||
(defn- network-icon
|
||||
[connected? size]
|
||||
[react/view (styles/network-icon connected? size)
|
||||
[icons/icon :main-icons/network {:color (if connected? colors/white-persist colors/gray)}]])
|
||||
|
||||
(defn network-badge
|
||||
[& [{:keys [name connected?]}]]
|
||||
[react/view styles/network-badge
|
||||
[network-icon connected? 56]
|
||||
[react/view {:padding-left 16}
|
||||
[react/text {:style styles/badge-name-text}
|
||||
(or name (i18n/label :t/new-network))]
|
||||
(when connected?
|
||||
[react/i18n-text
|
||||
{:style styles/badge-connected-text
|
||||
:key :connected}])]])
|
||||
|
||||
(def mainnet?
|
||||
#{"mainnet" "mainnet_rpc"})
|
||||
|
||||
(defn render-network
|
||||
[{:keys [id name] :as network} _ _ current-network]
|
||||
(let [connected? (= id current-network)]
|
||||
[list.item/list-item
|
||||
{:on-press #(re-frame/dispatch [::network/network-entry-pressed network])
|
||||
:icon :main-icons/network
|
||||
:icon-bg-color (if connected? colors/blue colors/gray-lighter)
|
||||
:icon-color (if connected? colors/white-persist colors/gray)
|
||||
:title name
|
||||
:subtitle (when connected? (i18n/label :t/connected))
|
||||
:chevron true}]))
|
||||
|
||||
(views/defview network-settings
|
||||
[]
|
||||
(views/letsubs [current-network [:networks/current-network]
|
||||
networks [:get-networks]]
|
||||
[:<>
|
||||
[topbar/topbar
|
||||
{:title (i18n/label :t/network-settings)
|
||||
:right-accessories
|
||||
[{:icon :main-icons/add
|
||||
:on-press #(re-frame/dispatch [::network/add-network-pressed])}]}]
|
||||
[react/view styles/wrapper
|
||||
[list/section-list
|
||||
{:sections [{:title (i18n/label :t/main-networks)
|
||||
:key :mainnet
|
||||
:data (:mainnet networks)}
|
||||
{:title (i18n/label :t/test-networks)
|
||||
:key :testnet
|
||||
:data (:testnet networks)}
|
||||
{:title (i18n/label :t/custom-networks)
|
||||
:key :custom
|
||||
:data (:custom networks)}]
|
||||
:key-fn :id
|
||||
:default-separator? true
|
||||
:render-data current-network
|
||||
:render-fn render-network}]]]))
|
||||
@@ -0,0 +1,84 @@
|
||||
(ns legacy.status-im.ui.screens.network-info.views
|
||||
(:require
|
||||
[legacy.status-im.ethereum.decode :as decode]
|
||||
[legacy.status-im.ui.components.react :as react]
|
||||
[native-module.core :as native-module]
|
||||
[re-frame.core :as re-frame]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.common.json-rpc.events :as json-rpc]
|
||||
[utils.datetime :as datetime]))
|
||||
|
||||
(defn get-block
|
||||
[block callback]
|
||||
(json-rpc/call
|
||||
{:method "eth_getBlockByNumber"
|
||||
:params [block false]
|
||||
:on-success callback
|
||||
:on-error #(js/alert (str "can't fetch latest block" %))}))
|
||||
|
||||
(defn to-date
|
||||
[timestamp]
|
||||
(datetime/timestamp->long-date
|
||||
(* 1000 timestamp)))
|
||||
|
||||
(defn check-lag
|
||||
[]
|
||||
(let [latest-block (reagent/atom nil)
|
||||
last-loaded-block (reagent/atom nil)
|
||||
on-press
|
||||
(fn []
|
||||
(get-block
|
||||
"latest"
|
||||
(fn [res]
|
||||
(reset! latest-block res)
|
||||
(get-block
|
||||
(str "0x"
|
||||
(native-module/number-to-hex
|
||||
@(re-frame/subscribe [:ethereum/current-block])))
|
||||
(fn [res]
|
||||
(reset! last-loaded-block res))))))]
|
||||
(fn []
|
||||
[react/view
|
||||
{:style {:flex 1
|
||||
:margin-horizontal 16}}
|
||||
(if-not @latest-block
|
||||
[react/text
|
||||
{:on-press on-press}
|
||||
"PRESS TO REFRESH"]
|
||||
[react/text
|
||||
{:on-press on-press}
|
||||
(let [latest-block-number
|
||||
(decode/uint (:number @latest-block))
|
||||
|
||||
latest-block-timestamp
|
||||
(decode/uint (:timestamp @latest-block))
|
||||
|
||||
last-loaded-block-number
|
||||
(decode/uint (:number @last-loaded-block))
|
||||
|
||||
last-loaded-block-timestamp
|
||||
(decode/uint (:timestamp @last-loaded-block))]
|
||||
(str "Latest block number: "
|
||||
latest-block-number
|
||||
"\n"
|
||||
"Latest block time: "
|
||||
(to-date latest-block-timestamp)
|
||||
"\n"
|
||||
"Last loaded block: "
|
||||
last-loaded-block-number
|
||||
"\n"
|
||||
"Last loaded block time: "
|
||||
(to-date last-loaded-block-timestamp)
|
||||
"\n"
|
||||
"Seconds diff: "
|
||||
(- latest-block-timestamp
|
||||
last-loaded-block-timestamp)
|
||||
"\n"
|
||||
"Blocks diff: " (- latest-block-number
|
||||
last-loaded-block-number)
|
||||
"\n"
|
||||
"PRESS TO REFRESH"))])])))
|
||||
|
||||
(defn network-info
|
||||
[]
|
||||
[check-lag])
|
||||
@@ -8,6 +8,24 @@
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn local-notifications
|
||||
[]
|
||||
(let [{:keys [enabled?]} (rf/sub [:push-notifications/wallet-transactions])
|
||||
{:keys [notifications-enabled?]} (rf/sub [:profile/profile])]
|
||||
[:<>
|
||||
[quo/separator
|
||||
{:color (:ui-02 @colors/theme)
|
||||
:style {:margin-vertical 8}}]
|
||||
[quo/list-header (i18n/label :t/local-notifications)]
|
||||
[list.item/list-item
|
||||
{:size :small
|
||||
:title (i18n/label :t/notifications-transactions)
|
||||
:accessibility-label :notifications-button
|
||||
:active (and notifications-enabled? enabled?)
|
||||
:on-press #(rf/dispatch [:push-notifications.wallet/switch-transactions
|
||||
(not enabled?)])
|
||||
:accessory :switch}]]))
|
||||
|
||||
(defn notifications-settings-ios
|
||||
[]
|
||||
(let [{:keys [notifications-enabled?
|
||||
@@ -45,7 +63,8 @@
|
||||
:on-press #(rf/dispatch
|
||||
[:push-notifications/switch-block-mentions
|
||||
(not push-notifications-block-mentions?)])
|
||||
:accessory :switch}]]))
|
||||
:accessory :switch}]
|
||||
[local-notifications]]))
|
||||
|
||||
(defn notifications-settings-android
|
||||
[]
|
||||
@@ -57,7 +76,8 @@
|
||||
:subtitle (i18n/label :t/local-notifications-subtitle)
|
||||
:active notifications-enabled?
|
||||
:on-press #(rf/dispatch [:push-notifications/switch (not notifications-enabled?)])
|
||||
:accessory :switch}]]))
|
||||
:accessory :switch}]
|
||||
[local-notifications]]))
|
||||
|
||||
(defn notifications-settings
|
||||
[]
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
:subtitle (i18n/label :t/webview-camera-permission-requests-subtitle)
|
||||
:subtitle-max-lines 2
|
||||
:on-press #(re-frame/dispatch
|
||||
[:profile.settings/profile-update
|
||||
[:profile.settings/update-value
|
||||
:webview-allow-permission-requests?
|
||||
((complement boolean) webview-allow-permission-requests?)])}])
|
||||
[separator]
|
||||
@@ -169,7 +169,8 @@
|
||||
{:active (= value id)
|
||||
:accessory :radio
|
||||
:title (get titles id)
|
||||
:on-press #(re-frame/dispatch [:profile.settings/profile-update :profile-pictures-visibility id])}])
|
||||
:on-press #(re-frame/dispatch [:profile.settings/update-value :profile-pictures-visibility
|
||||
id])}])
|
||||
|
||||
(views/defview profile-pic
|
||||
[]
|
||||
|
||||
@@ -51,4 +51,4 @@
|
||||
:icon :main-icons/delete
|
||||
:theme :accent
|
||||
:title (i18n/label :t/profile-pic-remove)
|
||||
:on-press #(re-frame/dispatch [:profile.settings/delete-profile-picture])}])]))
|
||||
:on-press #(re-frame/dispatch [:profile.settings/delete-profile-picture nil])}])]))
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
:chevron true
|
||||
:icon :main-icons/username}
|
||||
registrar
|
||||
(assoc :on-press #(re-frame/dispatch [:open-modal :ens-main registrar])))]
|
||||
(assoc :on-press #(re-frame/dispatch [:navigate-to :ens-main registrar])))]
|
||||
[list.item/list-item
|
||||
{:title (i18n/label :t/contacts)
|
||||
:icon :main-icons/in-contacts
|
||||
@@ -112,7 +112,7 @@
|
||||
(str active-contacts-count)
|
||||
(i18n/label :t/none))
|
||||
:chevron true
|
||||
:on-press #(re-frame/dispatch [:open-modal :contacts-list])}]
|
||||
:on-press #(re-frame/dispatch [:navigate-to :contacts-list])}]
|
||||
[react/view {:padding-top 16}
|
||||
[quo/list-header (i18n/label :t/settings)]]
|
||||
[list.item/list-item
|
||||
@@ -122,71 +122,71 @@
|
||||
:chevron true
|
||||
:accessory (when mnemonic
|
||||
[components.common/counter {:size 22} 1])
|
||||
:on-press #(re-frame/dispatch [:open-modal :privacy-and-security])}]
|
||||
:on-press #(re-frame/dispatch [:navigate-to :privacy-and-security])}]
|
||||
(when config/quo-preview-enabled?
|
||||
[list.item/list-item
|
||||
{:icon :main-icons/appearance
|
||||
:title "Quo Preview"
|
||||
:accessibility-label :appearance-settings-button
|
||||
:chevron true
|
||||
:on-press #(re-frame/dispatch [:open-modal :quo-preview])}])
|
||||
:on-press #(re-frame/dispatch [:navigate-to :quo-preview])}])
|
||||
(when config/quo-preview-enabled?
|
||||
[list.item/list-item
|
||||
{:icon :main-icons/appearance
|
||||
:title "Status IM Components"
|
||||
:accessibility-label :status-im-common-components
|
||||
:chevron true
|
||||
:on-press #(re-frame/dispatch [:open-modal :status-im-preview])}])
|
||||
:on-press #(re-frame/dispatch [:navigate-to :status-im-preview])}])
|
||||
[list.item/list-item
|
||||
{:icon :main-icons/appearance
|
||||
:title (i18n/label :t/appearance)
|
||||
:accessibility-label :appearance-settings-button
|
||||
:chevron true
|
||||
:on-press #(re-frame/dispatch [:open-modal :appearance])}]
|
||||
:on-press #(re-frame/dispatch [:navigate-to :appearance])}]
|
||||
[list.item/list-item
|
||||
{:icon :main-icons/notification
|
||||
:title (i18n/label :t/notifications)
|
||||
:accessibility-label :notifications-settings-button
|
||||
:chevron true
|
||||
:on-press #(re-frame/dispatch [:open-modal :notifications])}]
|
||||
:on-press #(re-frame/dispatch [:navigate-to :notifications])}]
|
||||
[list.item/list-item
|
||||
{:icon :main-icons/mobile
|
||||
:title (i18n/label :t/sync-settings)
|
||||
:accessibility-label :sync-settings-button
|
||||
:chevron true
|
||||
:on-press #(re-frame/dispatch [:open-modal :sync-settings])}]
|
||||
:on-press #(re-frame/dispatch [:navigate-to :sync-settings])}]
|
||||
(when keycard-pairing
|
||||
[list.item/list-item
|
||||
{:icon :main-icons/keycard
|
||||
:title (i18n/label :t/keycard)
|
||||
:accessibility-label :keycard-button
|
||||
:chevron true
|
||||
:on-press #(re-frame/dispatch [:open-modal :keycard-settings])}])
|
||||
:on-press #(re-frame/dispatch [:navigate-to :keycard-settings])}])
|
||||
[list.item/list-item
|
||||
{:icon :main-icons/settings-advanced
|
||||
:title (i18n/label :t/advanced)
|
||||
:accessibility-label :advanced-button
|
||||
:chevron true
|
||||
:on-press #(re-frame/dispatch [:open-modal :advanced-settings])}]
|
||||
:on-press #(re-frame/dispatch [:navigate-to :advanced-settings])}]
|
||||
[list.item/list-item
|
||||
{:icon :main-icons/help
|
||||
:title (i18n/label :t/need-help)
|
||||
:accessibility-label :help-button
|
||||
:chevron true
|
||||
:on-press #(re-frame/dispatch [:open-modal :help-center])}]
|
||||
:on-press #(re-frame/dispatch [:navigate-to :help-center])}]
|
||||
[list.item/list-item
|
||||
{:icon :main-icons/info
|
||||
:title (i18n/label :t/about-app)
|
||||
:accessibility-label :about-button
|
||||
:chevron true
|
||||
:on-press #(re-frame/dispatch [:open-modal :about-app])}]
|
||||
:on-press #(re-frame/dispatch [:navigate-to :about-app])}]
|
||||
(when local-pairing-mode-enabled?
|
||||
[list.item/list-item
|
||||
{:icon :i/mobile
|
||||
:title (i18n/label :t/syncing)
|
||||
:accessibility-label :syncing
|
||||
:chevron true
|
||||
:on-press #(re-frame/dispatch [:open-modal :settings-syncing])}])
|
||||
:on-press #(re-frame/dispatch [:navigate-to :settings-syncing])}])
|
||||
[react/view {:padding-vertical 24}
|
||||
[list.item/list-item
|
||||
{:icon :main-icons/log-out
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
(ns legacy.status-im.ui.screens.screens
|
||||
(:require
|
||||
[legacy.status-im.ui.components.colors :as colors]
|
||||
[legacy.status-im.ui.components.icons.icons :as icons]
|
||||
[legacy.status-im.ui.screens.about-app.views :as about-app]
|
||||
[legacy.status-im.ui.screens.advanced-settings.views :as advanced-settings]
|
||||
[legacy.status-im.ui.screens.appearance.views :as appearance]
|
||||
@@ -23,6 +24,10 @@
|
||||
[legacy.status-im.ui.screens.link-previews-settings.views :as link-previews-settings]
|
||||
[legacy.status-im.ui.screens.log-level-settings.views :as log-level-settings]
|
||||
[legacy.status-im.ui.screens.mobile-network-settings.view :as mobile-network-settings]
|
||||
[legacy.status-im.ui.screens.network-info.views :as network-info]
|
||||
[legacy.status-im.ui.screens.network.edit-network.views :as edit-network]
|
||||
[legacy.status-im.ui.screens.network.network-details.views :as network-details]
|
||||
[legacy.status-im.ui.screens.network.views :as network]
|
||||
[legacy.status-im.ui.screens.notifications-settings.views :as notifications-settings]
|
||||
[legacy.status-im.ui.screens.offline-messaging-settings.edit-mailserver.views :as edit-mailserver]
|
||||
[legacy.status-im.ui.screens.offline-messaging-settings.views :as offline-messaging-settings]
|
||||
@@ -47,18 +52,10 @@
|
||||
[status-im.contexts.chat.group-details.view :as group-details]
|
||||
[utils.i18n :as i18n]))
|
||||
|
||||
(defn topbar-options
|
||||
[title]
|
||||
{:elevation 0
|
||||
:title {:color (if (colors/dark?) colors/white colors/black)
|
||||
:text (i18n/label title)}
|
||||
:rightButtonColor (if (colors/dark?) colors/white colors/black)
|
||||
:background {:color (if (colors/dark?) colors/black colors/white)}
|
||||
:backButton {:color (if (colors/dark?) colors/white colors/black)
|
||||
:id :legacy-back-button
|
||||
:testID :back-button
|
||||
:visible true
|
||||
:popStackOnPress false}})
|
||||
(defn right-button-options
|
||||
[id icon]
|
||||
{:id id
|
||||
:icon (icons/icon-source icon)})
|
||||
|
||||
(defn screens
|
||||
[]
|
||||
@@ -84,15 +81,20 @@
|
||||
|
||||
{:name :stickers
|
||||
:options {:insets {:top? true}
|
||||
:topBar (topbar-options :t/sticker-market)}
|
||||
:topBar {:title {:text (i18n/label :t/sticker-market)}}}
|
||||
:component stickers/packs}
|
||||
|
||||
{:name :stickers-pack
|
||||
:options {:insets {:top? true}}
|
||||
:component stickers/pack}
|
||||
|
||||
{:name :new-group
|
||||
:options {:insets {:top? true}}
|
||||
;;TODO custom subtitle
|
||||
:component group-chat/new-group}
|
||||
|
||||
{:name :currency-settings
|
||||
:options {:topBar (topbar-options :t/main-currency)
|
||||
:options {:topBar {:title {:text (i18n/label :t/main-currency)}}
|
||||
:insets {:top? true}}
|
||||
:component currency-settings/currency-settings}
|
||||
|
||||
@@ -102,27 +104,27 @@
|
||||
:options {:topBar {:visible false}}
|
||||
:component profile.user/my-profile}
|
||||
{:name :contacts-list
|
||||
:options {:topBar (topbar-options :t/contacts)
|
||||
:options {:topBar {:title {:text (i18n/label :t/contacts)}}
|
||||
:insets {:top? true}}
|
||||
:component contacts-list/contacts-list}
|
||||
{:name :ens-main
|
||||
:options {:topBar (topbar-options :t/ens-usernames)
|
||||
:options {:topBar {:title {:text (i18n/label :t/ens-usernames)}}
|
||||
:insets {:top? true}}
|
||||
:component ens/main}
|
||||
{:name :ens-search
|
||||
:options {:topBar (topbar-options :t/ens-your-username)
|
||||
:options {:topBar {:title {:text (i18n/label :t/ens-your-username)}}
|
||||
:insets {:top? true}}
|
||||
:component ens/search}
|
||||
{:name :ens-checkout
|
||||
:options {:topBar (topbar-options :t/ens-your-username)
|
||||
:options {:topBar {:title {:text (i18n/label :t/ens-your-username)}}
|
||||
:insets {:top? true}}
|
||||
:component ens/checkout}
|
||||
{:name :ens-confirmation
|
||||
:options {:topBar (topbar-options :t/ens-your-username)
|
||||
:options {:topBar {:title {:text (i18n/label :t/ens-your-username)}}
|
||||
:insets {:top? true}}
|
||||
:component ens/confirmation}
|
||||
{:name :ens-terms
|
||||
:options {:topBar (topbar-options :t/ens-terms-registration)
|
||||
:options {:topBar {:title {:text (i18n/label :t/ens-terms-registration)}}
|
||||
:insets {:top? true}}
|
||||
:component ens/terms}
|
||||
{:name :ens-name-details
|
||||
@@ -130,7 +132,7 @@
|
||||
:options {:insets {:top? true}}
|
||||
:component ens/name-details}
|
||||
{:name :blocked-users-list
|
||||
:options {:topBar (topbar-options :t/blocked-users)
|
||||
:options {:topBar {:title {:text (i18n/label :t/blocked-users)}}
|
||||
:insets {:top? true}}
|
||||
:component contacts-list/blocked-users-list}
|
||||
{:name :wakuv2-settings
|
||||
@@ -146,7 +148,7 @@
|
||||
:options {:insets {:top? true}}
|
||||
:component bootnodes-settings/bootnodes-settings}
|
||||
{:name :installations
|
||||
:options {:topBar (topbar-options (i18n/label :t/devices))
|
||||
:options {:topBar {:title {:text (i18n/label :t/devices)}}
|
||||
:insets {:top? true}}
|
||||
:component pairing/installations}
|
||||
{:name :edit-bootnode
|
||||
@@ -162,91 +164,107 @@
|
||||
:options {:insets {:top? true}}
|
||||
:component edit-mailserver/edit-mailserver}
|
||||
{:name :dapps-permissions
|
||||
:options {:topBar (topbar-options :t/dapps-permissions)
|
||||
:options {:topBar {:title {:text (i18n/label :t/dapps-permissions)}}
|
||||
:insets {:top? true}}
|
||||
:component dapps-permissions/dapps-permissions}
|
||||
{:name :privacy-and-security
|
||||
:options {:topBar (topbar-options :t/privacy-and-security)
|
||||
:options {:topBar {:title {:text (i18n/label :t/privacy-and-security)}}
|
||||
:insets {:top? true}}
|
||||
:component privacy-and-security/privacy-and-security}
|
||||
{:name :messages-from-contacts-only
|
||||
:options {:topBar (topbar-options :t/accept-new-chats-from)
|
||||
:options {:topBar {:title {:text (i18n/label :t/accept-new-chats-from)}}
|
||||
:insets {:top? true}}
|
||||
:component messages-from-contacts-only/messages-from-contacts-only-view}
|
||||
{:name :appearance
|
||||
:options {:topBar (topbar-options :t/appearance)
|
||||
:options {:topBar {:title {:text (i18n/label :t/appearance)}}
|
||||
:insets {:top? true}}
|
||||
:component appearance/appearance-view}
|
||||
{:name :privacy-and-security-profile-pic-show-to
|
||||
:options {:topbar (topbar-options :t/show-profile-pictures-to)
|
||||
:options {:topbar {:title {:text (i18n/label :t/show-profile-pictures-to)}}
|
||||
:insets {:top? true}}
|
||||
:component privacy-and-security/profile-pic-show-to}
|
||||
{:name :privacy-and-security-profile-pic
|
||||
:options {:topBar (topbar-options :t/show-profile-pictures)
|
||||
:options {:topBar {:title {:text (i18n/label :t/show-profile-pictures)}}
|
||||
:insets {:top? true}}
|
||||
:component privacy-and-security/profile-pic}
|
||||
{:name :notifications
|
||||
:options {:topBar (topbar-options :t/notification-settings)
|
||||
:options {:topBar {:title {:text (i18n/label :t/notification-settings)}}
|
||||
:insets {:top? true}}
|
||||
:component notifications-settings/notifications-settings}
|
||||
{:name :sync-settings
|
||||
:options {:topBar (topbar-options :t/sync-settings)
|
||||
:options {:topBar {:title {:text (i18n/label :t/sync-settings)}}
|
||||
:insets {:top? true}}
|
||||
:component sync-settings/sync-settings}
|
||||
{:name :advanced-settings
|
||||
:options {:topBar (topbar-options :t/advanced)
|
||||
:options {:topBar {:title {:text (i18n/label :t/advanced)}}
|
||||
:insets {:top? true}}
|
||||
:component advanced-settings/advanced-settings}
|
||||
{:name :help-center
|
||||
:options {:topBar (topbar-options :t/need-help)
|
||||
:options {:topBar {:title {:text (i18n/label :t/need-help)}}
|
||||
:insets {:top? true}}
|
||||
:component help-center/help-center}
|
||||
{:name :glossary
|
||||
:options {:topBar (topbar-options :t/glossary)
|
||||
:options {:topBar {:title {:text (i18n/label :t/glossary)}}
|
||||
:insets {:top? true}}
|
||||
:component glossary/glossary}
|
||||
{:name :about-app
|
||||
:options {:topBar (topbar-options :t/about-app)
|
||||
:options {:topBar {:title {:text (i18n/label :t/about-app)}}
|
||||
:insets {:top? true}}
|
||||
:component about-app/about-app}
|
||||
{:name :privacy-policy
|
||||
:options {:topBar (topbar-options :t/privacy-policy)
|
||||
:options {:topBar {:title {:text (i18n/label :t/privacy-policy)}}
|
||||
:insets {:top? true}}
|
||||
:component about-app/privacy-policy}
|
||||
{:name :terms-of-service
|
||||
:options {:topBar (topbar-options :t/terms-of-service)
|
||||
:options {:topBar {:title {:text (i18n/label :t/terms-of-service)}}
|
||||
:insets {:top? true}}
|
||||
:component about-app/tos}
|
||||
{:name :principles
|
||||
:options {:topBar (topbar-options :t/principles)
|
||||
:options {:topBar {:title {:text (i18n/label :t/principles)}}
|
||||
:insets {:top? true}}
|
||||
:component about-app/principles}
|
||||
{:name :manage-dapps-permissions
|
||||
;;TODO dynamic title
|
||||
:options {:insets {:top? true}}
|
||||
:component dapps-permissions/manage}
|
||||
{:name :network-settings
|
||||
;;TODO accessories
|
||||
:options {:insets {:top? true}}
|
||||
:component network/network-settings}
|
||||
{:name :network-details
|
||||
:options {:topBar {:title {:text (i18n/label :t/network-details)}}
|
||||
:insets {:top? true}}
|
||||
:component network-details/network-details}
|
||||
{:name :network-info
|
||||
:options {:topBar {:title {:text (i18n/label :t/network-info)}}
|
||||
:insets {:top? true}}
|
||||
:component network-info/network-info}
|
||||
{:name :rpc-usage-info
|
||||
:options {:topBar (topbar-options :t/rpc-usage-info)
|
||||
:options {:topBar {:title {:text (i18n/label :t/rpc-usage-info)}}
|
||||
:insets {:top? true}}
|
||||
:component rpc-usage-info/usage-info}
|
||||
{:name :peers-stats
|
||||
:options {:topBar (topbar-options :t/peers-stats)
|
||||
:options {:topBar {:title {:text (i18n/label :t/peers-stats)}}
|
||||
:insets {:top? true}}
|
||||
:component peers-stats/peers-stats}
|
||||
{:name :edit-network
|
||||
:options {:topBar {:title {:text (i18n/label :t/add-network)}}
|
||||
:insets {:top? true}}
|
||||
:component edit-network/edit-network}
|
||||
{:name :log-level-settings
|
||||
:options {:topBar (topbar-options :t/log-level-settings)
|
||||
:options {:topBar {:title {:text (i18n/label :t/log-level-settings)}}
|
||||
:insets {:top? true}}
|
||||
:component log-level-settings/log-level-settings}
|
||||
{:name :fleet-settings
|
||||
:options {:topBar (topbar-options :t/fleet-settings)
|
||||
:options {:topBar {:title {:text (i18n/label :t/fleet-settings)}}
|
||||
:insets {:top? true}}
|
||||
:component fleet-settings/fleet-settings}
|
||||
{:name :mobile-network-settings
|
||||
:options {:topBar (topbar-options :t/mobile-network-settings)
|
||||
:options {:topBar {:title {:text (i18n/label :t/mobile-network-settings)}}
|
||||
:insets {:top? true}}
|
||||
:component mobile-network-settings/mobile-network-settings}
|
||||
{:name :backup-settings
|
||||
:options {:topBar (topbar-options :t/backup-settings)
|
||||
:options {:topBar {:title {:text (i18n/label :t/backup-settings)}}
|
||||
:insets {:top? true}}
|
||||
:component backup-settings/backup-settings}
|
||||
{:name :backup-seed
|
||||
@@ -254,14 +272,14 @@
|
||||
:options {:insets {:top? true}}
|
||||
:component profile.seed/backup-seed}
|
||||
{:name :reset-password
|
||||
:options {:topBar (topbar-options :t/reset-password)
|
||||
:options {:topBar {:title {:text (i18n/label :t/reset-password)}}
|
||||
:insets {:top? true}}
|
||||
:component reset-password/reset-password}
|
||||
{:name :delete-profile
|
||||
:insets {:bottom? true}
|
||||
:component delete-profile/delete-profile}
|
||||
{:name :default-sync-period-settings
|
||||
:options {:topBar (topbar-options :t/default-sync-period)
|
||||
:options {:topBar {:title {:text (i18n/label :t/default-sync-period)}}
|
||||
:insets {:top? true}}
|
||||
:component default-sync-period-settings/default-sync-period-settings}
|
||||
|
||||
@@ -270,7 +288,7 @@
|
||||
;[Chat] Link preview settings
|
||||
|
||||
{:name :link-previews-settings
|
||||
:options {:topBar (topbar-options :t/chat-link-previews)
|
||||
:options {:topBar {:title {:text (i18n/label :t/chat-link-previews)}}
|
||||
:insets {:top? true}}
|
||||
:component link-previews-settings/link-previews-settings}
|
||||
|
||||
@@ -310,7 +328,7 @@
|
||||
;;TODO WHY MODAL?
|
||||
;[Profile] Notifications settings
|
||||
{:name :notifications-settings
|
||||
:options {:topBar (topbar-options :t/notification-settings)
|
||||
:options {:topBar {:title {:text (i18n/label :t/notification-settings)}}
|
||||
:popGesture false
|
||||
:hardwareBackButton {:dismissModalOnPress false
|
||||
:popStackOnPress false}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
[re-frame.core :as re-frame]
|
||||
[react-native.mail :as react-native-mail]
|
||||
[react-native.platform :as platform]
|
||||
[status-im.common.json-rpc.events :as json-rpc]
|
||||
[status-im.common.log :as log]
|
||||
[status-im.config :as config]
|
||||
[utils.datetime :as datetime]
|
||||
@@ -32,10 +31,11 @@
|
||||
[{:keys [db]} node-version]
|
||||
{:db (assoc db :web3-node-version node-version)})
|
||||
|
||||
(re-frame/reg-fx :logging/initialize-web3-client-version
|
||||
(fn []
|
||||
(json-rpc/call {:method "web3_clientVersion"
|
||||
:on-success [:logging/store-web3-client-version]})))
|
||||
(rf/defn initialize-web3-client-version
|
||||
{:events [:logging/initialize-web3-client-version]}
|
||||
[_]
|
||||
{:json-rpc/call [{:method "web3_clientVersion"
|
||||
:on-success #(re-frame/dispatch [:logging/store-web3-client-version %])}]})
|
||||
|
||||
(defn extract-url-components
|
||||
[address]
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
(= network-type "cellular"))
|
||||
|
||||
(defn syncing-allowed?
|
||||
[db]
|
||||
[{:keys [db]}]
|
||||
(let [network (:network/type db)
|
||||
{:keys [syncing-on-mobile-network?]} (:profile/profile db)]
|
||||
(or (= network "wifi")
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
(:require-macros [legacy.status-im.utils.slurp :refer [slurp]])
|
||||
(:require
|
||||
[legacy.status-im.fleet.default-fleet :refer (default-fleets)])
|
||||
(:require [tests.test-utils :as utils.test]))
|
||||
(:require [legacy.status-im.utils.test :as utils.test]))
|
||||
|
||||
;; to generate a js Proxy at js/__STATUS_MOBILE_JS_IDENTITY_PROXY__ that accept any (.xxx) call and
|
||||
;; return itself
|
||||
@@ -53,7 +53,7 @@
|
||||
:FlatList {}
|
||||
:SectionList {}
|
||||
:Text {}
|
||||
:StatusBar {:setBarStyle identity}
|
||||
:StatusBar {}
|
||||
:ScrollView {}
|
||||
:SafeAreaView {}
|
||||
:KeyboardAvoidingView {}
|
||||
|
||||
@@ -106,32 +106,6 @@ The convention is `:size-<number>`, e.g size `20` is `:size-20`
|
||||
- Try to make all other vars private because they should almost never be used
|
||||
directly.
|
||||
|
||||
## Default value when destructuring
|
||||
|
||||
Too often callers pass nil values because values can be wrapped in a `when` for example.
|
||||
In this case, the default value is not applied, because :or macro will use default only when the value is absent.
|
||||
Instead, use `(or (:value props) some-default-value)` in a `let` expression or as a parameter value.
|
||||
|
||||
```clojure
|
||||
;; bad (unreliable)
|
||||
(defn- view-internal
|
||||
[{:keys [auto-focus?
|
||||
init-value
|
||||
return-key-type]
|
||||
:or {auto-focus? false
|
||||
init-value 0
|
||||
return-key-type :done}}]
|
||||
...)
|
||||
|
||||
;; good
|
||||
(defn- view-internal
|
||||
[{:keys [theme size something] :as props}]
|
||||
(let [auto-focus? (or (:auto-focus? props) false)
|
||||
init-value (or (:init-value props) 0)
|
||||
return-key-type (or (:return-key-type props) :done)]
|
||||
...))
|
||||
```
|
||||
|
||||
## Component tests
|
||||
|
||||
We don't attempt to write component tests verifying how components look on the
|
||||
|
||||
@@ -2,17 +2,10 @@
|
||||
(:require
|
||||
[quo.foundations.colors :as colors]))
|
||||
|
||||
(defn- get-dimensions
|
||||
[size]
|
||||
(case size
|
||||
:size-24 24
|
||||
:size-20 20
|
||||
nil))
|
||||
|
||||
(defn collection-avatar
|
||||
[theme size]
|
||||
{:width (get-dimensions size)
|
||||
:height (get-dimensions size)
|
||||
[theme]
|
||||
{:width 24
|
||||
:height 24
|
||||
:border-width 1
|
||||
:border-color (colors/theme-colors colors/neutral-80-opa-10 colors/white-opa-10 theme)
|
||||
:border-radius 6})
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
:image - collection image
|
||||
:theme - keyword -> :light/:dark"
|
||||
[{:keys [image theme size] :or {size :size-24}}]
|
||||
[{:keys [image theme]}]
|
||||
[fast-image/fast-image
|
||||
{:accessibility-label :collection-avatar
|
||||
:source image
|
||||
:style (style/collection-avatar theme size)}])
|
||||
:style (style/collection-avatar theme)}])
|
||||
|
||||
(def view (quo.theme/with-theme view-internal))
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
:or {size :size-20
|
||||
customization-color :blue
|
||||
picture nil
|
||||
icon-name :i/members}}]
|
||||
icon-name :i/group}}]
|
||||
(let [container-size (get-in sizes [size :container])
|
||||
icon-size (get-in sizes [size :icon])]
|
||||
[rn/view
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.theme :as quo.theme]
|
||||
[react-native.core :as rn]
|
||||
[react-native.platform :as platform]))
|
||||
[react-native.platform :as platform]
|
||||
[reagent.core :as reagent]))
|
||||
|
||||
(defn remove-http-https-www
|
||||
[value]
|
||||
@@ -67,86 +68,78 @@
|
||||
[:cursor-color :placeholder-text-color :editable :on-change-text :on-focus
|
||||
:on-blur :on-clear :value :disabled? :blur? :customization-color :theme])
|
||||
|
||||
(defn view
|
||||
[{:keys [disabled? blur? on-change-text customization-color
|
||||
on-clear on-focus on-blur get-ref locked?
|
||||
favicon favicon-color favicon-size default-value]
|
||||
:or {default-value ""}
|
||||
:as props}]
|
||||
(let [ref (rn/use-ref-atom nil)
|
||||
on-ref (rn/use-callback
|
||||
(fn [r]
|
||||
(reset! ref r)
|
||||
(when get-ref (get-ref r)))
|
||||
[get-ref])
|
||||
theme (quo.theme/use-theme)
|
||||
[state set-state] (rn/use-state :default)
|
||||
[value set-value] (rn/use-state default-value)
|
||||
on-clear (rn/use-callback
|
||||
(fn []
|
||||
(.clear ^js @ref)
|
||||
(set-value "")
|
||||
(when on-clear (on-clear)))
|
||||
[on-clear])
|
||||
focus-input (rn/use-callback
|
||||
(fn []
|
||||
(set-state :active)
|
||||
(.focus ^js @ref)))
|
||||
on-blur (rn/use-callback
|
||||
(fn []
|
||||
(set-state :default)
|
||||
(when on-blur (on-blur)))
|
||||
[on-blur])
|
||||
on-change-text (rn/use-callback
|
||||
(fn [new-text]
|
||||
(set-value new-text)
|
||||
(when on-change-text (on-change-text new-text)))
|
||||
[on-change-text])
|
||||
on-focus (rn/use-callback
|
||||
(fn []
|
||||
(set-state :active)
|
||||
(when on-focus (on-focus)))
|
||||
[on-focus])
|
||||
clean-props (apply dissoc props props-to-remove)]
|
||||
[rn/view {:style style/root-container}
|
||||
(when (and (seq value) (= state :default))
|
||||
[rn/touchable-opacity
|
||||
{:style style/default-container
|
||||
:on-press focus-input}
|
||||
(when favicon
|
||||
[icon/icon favicon
|
||||
{:accessibility-label :browser-input-favicon
|
||||
:color favicon-color
|
||||
:container-style style/favicon-icon-container
|
||||
:size favicon-size}])
|
||||
[rn/text
|
||||
{:accessibility-label :browser-input-label
|
||||
:style (style/text)}
|
||||
(remove-http-https-www value)]
|
||||
(when locked?
|
||||
[lock-icon {:blur? blur? :theme theme}])])
|
||||
[rn/view {:style (style/active-container (or (empty? value) (= state :active)))}
|
||||
[rn/text-input
|
||||
(merge
|
||||
clean-props
|
||||
{:accessibility-label :browser-input
|
||||
:auto-capitalize :none
|
||||
:auto-correct false
|
||||
:cursor-color (cursor-color customization-color theme)
|
||||
:editable (not disabled?)
|
||||
:keyboard-appearance (colors/theme-colors :light :dark theme)
|
||||
:keyboard-type :web-search
|
||||
:on-blur on-blur
|
||||
:on-change-text on-change-text
|
||||
:on-focus on-focus
|
||||
:placeholder-text-color (placeholder-color state blur? theme)
|
||||
:ref on-ref
|
||||
:selection-color (when platform/ios?
|
||||
(cursor-color customization-color theme))
|
||||
:select-text-on-focus true
|
||||
:style (style/input disabled?)})]
|
||||
(when (seq value)
|
||||
[clear-button
|
||||
{:blur? blur?
|
||||
:on-press on-clear
|
||||
:theme theme}])]]))
|
||||
(defn- view-internal
|
||||
[{:keys [default-value]
|
||||
:or {default-value ""}}]
|
||||
(let [state (reagent/atom :default)
|
||||
value (reagent/atom default-value)
|
||||
set-active #(reset! state :active)
|
||||
set-default #(reset! state :default)
|
||||
set-value #(reset! value %)
|
||||
ref (atom nil)
|
||||
clear-input (fn []
|
||||
(.clear ^js @ref)
|
||||
(reset! value ""))
|
||||
focus-input (fn []
|
||||
(set-active)
|
||||
(.focus ^js @ref))]
|
||||
(fn [{:keys [disabled? blur? on-change-text customization-color
|
||||
on-clear on-focus on-blur theme get-ref locked?
|
||||
favicon favicon-color favicon-size]
|
||||
:as props}]
|
||||
(let [clean-props (apply dissoc props props-to-remove)]
|
||||
[rn/view {:style style/root-container}
|
||||
(when (and (seq @value) (= @state :default))
|
||||
[rn/touchable-opacity
|
||||
{:style style/default-container
|
||||
:on-press focus-input}
|
||||
(when favicon
|
||||
[icon/icon favicon
|
||||
{:accessibility-label :browser-input-favicon
|
||||
:color favicon-color
|
||||
:container-style style/favicon-icon-container
|
||||
:size favicon-size}])
|
||||
[rn/text
|
||||
{:accessibility-label :browser-input-label
|
||||
:style (style/text)} (remove-http-https-www @value)]
|
||||
(when locked?
|
||||
[lock-icon
|
||||
{:blur? blur?
|
||||
:theme theme}])])
|
||||
[rn/view {:style (style/active-container (or (empty? @value) (= @state :active)))}
|
||||
[rn/text-input
|
||||
(merge
|
||||
clean-props
|
||||
{:accessibility-label :browser-input
|
||||
:auto-capitalize :none
|
||||
:auto-correct false
|
||||
:cursor-color (cursor-color customization-color theme)
|
||||
:editable (not disabled?)
|
||||
:keyboard-appearance (colors/theme-colors :light :dark theme)
|
||||
:keyboard-type :web-search
|
||||
:on-blur (fn []
|
||||
(set-default)
|
||||
(when on-blur (on-blur)))
|
||||
:on-change-text (fn [new-text]
|
||||
(set-value new-text)
|
||||
(when on-change-text (on-change-text new-text)))
|
||||
:on-focus (fn []
|
||||
(set-active)
|
||||
(when on-focus (on-focus)))
|
||||
:placeholder-text-color (placeholder-color @state blur? theme)
|
||||
:ref (fn [r]
|
||||
(reset! ref r)
|
||||
(when get-ref (get-ref r)))
|
||||
:selection-color (when platform/ios?
|
||||
(cursor-color customization-color theme))
|
||||
:select-text-on-focus true
|
||||
:style (style/input disabled?)})]
|
||||
(when (seq @value)
|
||||
[clear-button
|
||||
{:blur? blur?
|
||||
:on-press (fn []
|
||||
(clear-input)
|
||||
(when on-clear (on-clear)))
|
||||
:theme theme}])]]))))
|
||||
|
||||
(def view (quo.theme/with-theme view-internal))
|
||||
|
||||
@@ -7,9 +7,10 @@
|
||||
[quo.foundations.customization-colors :as customization-colors]
|
||||
[quo.theme :as theme]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]))
|
||||
[react-native.core :as rn]
|
||||
[reagent.core :as reagent]))
|
||||
|
||||
(defn button
|
||||
(defn- button-internal
|
||||
"with label
|
||||
[button opts \"label\"]
|
||||
opts
|
||||
@@ -28,103 +29,102 @@
|
||||
:theme :light/:dark
|
||||
only icon
|
||||
[button {:icon-only? true} :i/close-circle]"
|
||||
[{:keys [on-press on-long-press disabled? type background size icon-left icon-right icon-top
|
||||
customization-color accessibility-label icon-only? container-style inner-style
|
||||
pressed? on-press-in on-press-out allow-multiple-presses?]
|
||||
:or {type :primary
|
||||
size 40
|
||||
customization-color (if (= type :primary) :blue nil)}}
|
||||
children]
|
||||
(let [[pressed-state? set-pressed-state] (rn/use-state false)
|
||||
theme (theme/use-theme-value)
|
||||
{:keys [icon-color background-color label-color border-color blur-type
|
||||
blur-overlay-color border-radius overlay-customization-color]}
|
||||
(button-properties/get-values {:customization-color customization-color
|
||||
:background background
|
||||
:type type
|
||||
:theme theme
|
||||
:pressed? (if pressed? pressed? pressed-state?)
|
||||
:icon-only? icon-only?})
|
||||
icon-size (when (= 24 size) 12)
|
||||
on-press-in-cb (rn/use-callback
|
||||
(fn []
|
||||
(set-pressed-state true)
|
||||
(when on-press-in (on-press-in))))
|
||||
on-press-out-cb (rn/use-callback
|
||||
(fn []
|
||||
(set-pressed-state nil)
|
||||
(when on-press-out (on-press-out))))]
|
||||
[rn/touchable-without-feedback
|
||||
{:disabled disabled?
|
||||
:accessibility-label accessibility-label
|
||||
:on-press-in on-press-in-cb
|
||||
:on-press-out on-press-out-cb
|
||||
:on-press on-press
|
||||
:allow-multiple-presses? allow-multiple-presses?
|
||||
:on-long-press on-long-press}
|
||||
[rn/view
|
||||
{:style (merge
|
||||
(style/shape-style-container size border-radius)
|
||||
container-style)}
|
||||
[rn/view
|
||||
{:style (merge
|
||||
(style/style-container {:size size
|
||||
:disabled? disabled?
|
||||
:border-radius border-radius
|
||||
:background-color background-color
|
||||
:border-color border-color
|
||||
:icon-only? icon-only?
|
||||
:icon-top icon-top
|
||||
:icon-left icon-left
|
||||
:icon-right icon-right})
|
||||
inner-style)}
|
||||
(when overlay-customization-color
|
||||
[customization-colors/overlay
|
||||
{:customization-color overlay-customization-color
|
||||
:theme theme
|
||||
:pressed? (if pressed? pressed? pressed-state?)}])
|
||||
(when (= background :photo)
|
||||
[blur/view
|
||||
{:blur-radius 20
|
||||
:blur-type blur-type
|
||||
:overlay-color blur-overlay-color
|
||||
:style style/blur-view}])
|
||||
(when icon-top
|
||||
[_ _]
|
||||
(let [pressed-state? (reagent/atom false)]
|
||||
(fn
|
||||
[{:keys [on-press on-long-press disabled? type background size icon-left icon-right icon-top
|
||||
customization-color theme accessibility-label icon-only? container-style inner-style
|
||||
pressed? on-press-in on-press-out allow-multiple-presses?]
|
||||
:or {type :primary
|
||||
size 40
|
||||
customization-color (if (= type :primary) :blue nil)}}
|
||||
children]
|
||||
(let [{:keys [icon-color background-color label-color border-color blur-type
|
||||
blur-overlay-color border-radius overlay-customization-color]}
|
||||
(button-properties/get-values {:customization-color customization-color
|
||||
:background background
|
||||
:type type
|
||||
:theme theme
|
||||
:pressed? (if pressed? pressed? @pressed-state?)
|
||||
:icon-only? icon-only?})
|
||||
icon-size (when (= 24 size) 12)]
|
||||
[rn/touchable-without-feedback
|
||||
{:disabled disabled?
|
||||
:accessibility-label accessibility-label
|
||||
:on-press-in (fn []
|
||||
(reset! pressed-state? true)
|
||||
(when on-press-in (on-press-in)))
|
||||
:on-press-out (fn []
|
||||
(reset! pressed-state? nil)
|
||||
(when on-press-out (on-press-out)))
|
||||
:on-press on-press
|
||||
:allow-multiple-presses? allow-multiple-presses?
|
||||
:on-long-press on-long-press}
|
||||
[rn/view
|
||||
[quo.icons/icon icon-top
|
||||
{:container-style {:margin-bottom 2}
|
||||
:color icon-color
|
||||
:size icon-size}]])
|
||||
(when icon-left
|
||||
[rn/view
|
||||
{:style (style/icon-left-icon-style
|
||||
{:size size
|
||||
:icon-size icon-size})}
|
||||
[quo.icons/icon icon-left
|
||||
{:color icon-color
|
||||
:size icon-size}]])
|
||||
[rn/view
|
||||
(cond
|
||||
icon-only?
|
||||
[quo.icons/icon children
|
||||
{:color label-color
|
||||
:size icon-size}]
|
||||
{:style (merge
|
||||
(style/shape-style-container size border-radius)
|
||||
container-style)}
|
||||
[rn/view
|
||||
{:style (merge
|
||||
(style/style-container {:size size
|
||||
:disabled? disabled?
|
||||
:border-radius border-radius
|
||||
:background-color background-color
|
||||
:border-color border-color
|
||||
:icon-only? icon-only?
|
||||
:icon-top icon-top
|
||||
:icon-left icon-left
|
||||
:icon-right icon-right})
|
||||
inner-style)}
|
||||
(when overlay-customization-color
|
||||
[customization-colors/overlay
|
||||
{:customization-color overlay-customization-color
|
||||
:theme theme
|
||||
:pressed? (if pressed? pressed? @pressed-state?)}])
|
||||
(when (= background :photo)
|
||||
[blur/view
|
||||
{:blur-radius 20
|
||||
:blur-type blur-type
|
||||
:overlay-color blur-overlay-color
|
||||
:style style/blur-view}])
|
||||
(when icon-top
|
||||
[rn/view
|
||||
[quo.icons/icon icon-top
|
||||
{:container-style {:margin-bottom 2}
|
||||
:color icon-color
|
||||
:size icon-size}]])
|
||||
(when icon-left
|
||||
[rn/view
|
||||
{:style (style/icon-left-icon-style
|
||||
{:size size
|
||||
:icon-size icon-size})}
|
||||
[quo.icons/icon icon-left
|
||||
{:color icon-color
|
||||
:size icon-size}]])
|
||||
[rn/view
|
||||
(cond
|
||||
icon-only?
|
||||
[quo.icons/icon children
|
||||
{:color label-color
|
||||
:size icon-size}]
|
||||
|
||||
(string? children)
|
||||
[text/text
|
||||
{:size (when (#{56 24} size) :paragraph-2)
|
||||
:weight :medium
|
||||
:number-of-lines 1
|
||||
:style {:color label-color}}
|
||||
children]
|
||||
(string? children)
|
||||
[text/text
|
||||
{:size (when (#{56 24} size) :paragraph-2)
|
||||
:weight :medium
|
||||
:number-of-lines 1
|
||||
:style {:color label-color}}
|
||||
children]
|
||||
|
||||
(vector? children)
|
||||
children)]
|
||||
(when icon-right
|
||||
[rn/view
|
||||
{:style (style/icon-right-icon-style
|
||||
{:size size
|
||||
:icon-size icon-size})}
|
||||
[quo.icons/icon icon-right
|
||||
{:color icon-color
|
||||
:size icon-size}]])]]]))
|
||||
(vector? children)
|
||||
children)]
|
||||
(when icon-right
|
||||
[rn/view
|
||||
{:style (style/icon-right-icon-style
|
||||
{:size size
|
||||
:icon-size icon-size})}
|
||||
[quo.icons/icon icon-right
|
||||
{:color icon-color
|
||||
:size icon-size}]])]]]))))
|
||||
|
||||
(def button (theme/with-theme button-internal))
|
||||
|
||||
@@ -3,24 +3,28 @@
|
||||
[quo.components.buttons.composer-button.style :as style]
|
||||
[quo.components.icon :as quo.icons]
|
||||
[quo.theme :as theme]
|
||||
[react-native.core :as rn]))
|
||||
[react-native.core :as rn]
|
||||
[reagent.core :as reagent]))
|
||||
|
||||
(defn view
|
||||
[{:keys [on-press on-long-press disabled? blur? icon accessibility-label container-style]}]
|
||||
(let [[pressed? set-pressed] (rn/use-state false)
|
||||
theme (theme/use-theme-value)
|
||||
on-press-in (rn/use-callback #(set-pressed true))
|
||||
on-press-out (rn/use-callback #(set-pressed nil))]
|
||||
[rn/pressable
|
||||
{:accessibility-label (or accessibility-label :composer-button)
|
||||
:on-press on-press
|
||||
:on-press-in on-press-in
|
||||
:on-press-out on-press-out
|
||||
:on-long-press on-long-press
|
||||
:disabled disabled?
|
||||
:style (merge (style/main {:pressed? pressed?
|
||||
:blur? blur?
|
||||
:theme theme
|
||||
:disabled? disabled?})
|
||||
container-style)}
|
||||
[quo.icons/icon icon {:color (style/get-label-color {:blur? blur? :theme theme})}]]))
|
||||
(defn- view-internal
|
||||
[_ _]
|
||||
(let [pressed? (reagent/atom false)]
|
||||
(fn
|
||||
[{:keys [on-press on-long-press disabled? theme blur? icon accessibility-label container-style]}]
|
||||
[rn/pressable
|
||||
{:accessibility-label (or accessibility-label :composer-button)
|
||||
:on-press on-press
|
||||
:on-press-in #(reset! pressed? true)
|
||||
:on-press-out #(reset! pressed? nil)
|
||||
:on-long-press on-long-press
|
||||
:disabled disabled?
|
||||
:style (merge (style/main {:pressed? @pressed?
|
||||
:blur? blur?
|
||||
:theme theme
|
||||
:disabled? disabled?})
|
||||
container-style)}
|
||||
[quo.icons/icon icon
|
||||
{:color (style/get-label-color {:blur? blur?
|
||||
:theme theme})}]])))
|
||||
|
||||
(def view (theme/with-theme view-internal))
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
[quo.components.markdown.text :as text]
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.theme :as quo.theme]
|
||||
[react-native.core :as rn]))
|
||||
[react-native.core :as rn]
|
||||
[reagent.core :as reagent]))
|
||||
|
||||
(defn- get-button-color
|
||||
[{:keys [type pressed? customization-color theme]}]
|
||||
@@ -44,48 +45,48 @@
|
||||
:color (get-icon-and-text-color type theme)
|
||||
:container-style (style/container type)}])
|
||||
|
||||
(defn view
|
||||
(defn- view-internal
|
||||
"[dynamic-button opts]
|
||||
opts
|
||||
{:type :jump-to/:mention/:notification-down/:notification-up/:search/:search-with-label/:scroll-to-bottom
|
||||
:on-press fn
|
||||
:count mentions or notifications count
|
||||
:customization-color customize jump-to and mention button color}"
|
||||
[{:keys [type label on-press customization-color style] :as args}]
|
||||
(let [theme (quo.theme/use-theme-value)
|
||||
[pressed? set-pressed] (rn/use-state false)
|
||||
button-color (get-button-color {:type type
|
||||
:pressed? pressed?
|
||||
:customization-color (or customization-color :primary)
|
||||
:theme theme})
|
||||
on-press-in (rn/use-callback #(set-pressed true))
|
||||
on-press-out (rn/use-callback #(set-pressed false))]
|
||||
[rn/touchable-opacity
|
||||
{:on-press-in on-press-in
|
||||
:on-press-out on-press-out
|
||||
:on-press on-press
|
||||
:active-opacity 1
|
||||
:hit-slop {:top 5 :bottom 5 :left 5 :right 5}
|
||||
:pointer-events :auto
|
||||
:style {:height 24}
|
||||
:accessibility-label type}
|
||||
[rn/view
|
||||
{:style (merge
|
||||
{:flex-direction :row
|
||||
:height 24
|
||||
:border-radius 12
|
||||
:background-color button-color}
|
||||
style)}
|
||||
(when (#{:mention :search :search-with-label :scroll-to-bottom} type)
|
||||
[icon-view type])
|
||||
(when (#{:jump-to :mention :notification-down :notification-up :search-with-label} type)
|
||||
[text/text
|
||||
{:weight :medium
|
||||
:size :paragraph-2
|
||||
:style (assoc (style/text type) :color (get-icon-and-text-color type theme))}
|
||||
(case type
|
||||
:jump-to label
|
||||
:search-with-label label
|
||||
(:mention :notification-down :notification-up) (str (:count args)))])
|
||||
(when (#{:jump-to :notification-down :notification-up} type)
|
||||
[icon-view type theme])]]))
|
||||
[_]
|
||||
(let [pressed? (reagent/atom false)]
|
||||
(fn [{:keys [type label on-press customization-color style theme] :as args}]
|
||||
[rn/touchable-opacity
|
||||
{:on-press-in #(reset! pressed? true)
|
||||
:on-press-out #(reset! pressed? false)
|
||||
:on-press on-press
|
||||
:active-opacity 1
|
||||
:hit-slop {:top 5 :bottom 5 :left 5 :right 5}
|
||||
:pointer-events :auto
|
||||
:style {:height 24}
|
||||
:accessibility-label type}
|
||||
[rn/view
|
||||
{:style (merge
|
||||
{:flex-direction :row
|
||||
:height 24
|
||||
:border-radius 12
|
||||
:background-color (get-button-color {:type type
|
||||
:pressed? @pressed?
|
||||
:customization-color (or customization-color
|
||||
:primary)
|
||||
:theme theme})}
|
||||
style)}
|
||||
(when (#{:mention :search :search-with-label :scroll-to-bottom} type)
|
||||
[icon-view type])
|
||||
(when (#{:jump-to :mention :notification-down :notification-up :search-with-label} type)
|
||||
[text/text
|
||||
{:weight :medium
|
||||
:size :paragraph-2
|
||||
:style (assoc (style/text type) :color (get-icon-and-text-color type theme))}
|
||||
(case type
|
||||
:jump-to label
|
||||
:search-with-label label
|
||||
(:mention :notification-down :notification-up) (str (:count args)))])
|
||||
(when (#{:jump-to :notification-down :notification-up} type)
|
||||
[icon-view type theme])]])))
|
||||
|
||||
(def view (quo.theme/with-theme view-internal))
|
||||
|
||||
@@ -6,25 +6,29 @@
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.theme :as quo.theme]
|
||||
[react-native.core :as rn]
|
||||
[reagent.core :as reagent]
|
||||
[utils.i18n :as i18n]))
|
||||
|
||||
(defn view
|
||||
[{:keys [on-press on-long-press disabled? container-style]}]
|
||||
(let [theme (quo.theme/use-theme-value)
|
||||
[pressed? set-pressed] (rn/use-state false)
|
||||
on-press-in (rn/use-callback #(set-pressed true))
|
||||
on-press-out (rn/use-callback #(set-pressed nil))]
|
||||
[rn/pressable
|
||||
{:accessibility-label :log-out-button
|
||||
:on-press on-press
|
||||
:on-press-in on-press-in
|
||||
:on-press-out on-press-out
|
||||
:on-long-press on-long-press
|
||||
:disabled disabled?
|
||||
:style (merge (style/main {:pressed? pressed?
|
||||
:theme theme
|
||||
:disabled? disabled?})
|
||||
container-style)}
|
||||
[icon/icon :i/log-out {:color (if pressed? colors/white-opa-40 colors/white-opa-70)}]
|
||||
[text/text {:weight :medium :size :paragraph-1}
|
||||
(i18n/label :t/logout)]]))
|
||||
(defn- view-internal
|
||||
[_]
|
||||
(let [pressed? (reagent/atom false)
|
||||
on-press-in #(reset! pressed? true)
|
||||
on-press-out #(reset! pressed? nil)]
|
||||
(fn
|
||||
[{:keys [on-press on-long-press disabled? theme container-style]}]
|
||||
[rn/pressable
|
||||
{:accessibility-label :log-out-button
|
||||
:on-press on-press
|
||||
:on-press-in on-press-in
|
||||
:on-press-out on-press-out
|
||||
:on-long-press on-long-press
|
||||
:disabled disabled?
|
||||
:style (merge (style/main {:pressed? @pressed?
|
||||
:theme theme
|
||||
:disabled? disabled?})
|
||||
container-style)}
|
||||
[icon/icon :i/log-out {:color (if pressed? colors/white-opa-40 colors/white-opa-70)}]
|
||||
[text/text {:weight :medium :size :paragraph-1}
|
||||
(i18n/label :t/logout)]])))
|
||||
|
||||
(def view (quo.theme/with-theme view-internal))
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
(ns quo.components.buttons.slide-button.animations
|
||||
(:require [react-native.reanimated :as reanimated]))
|
||||
(:require
|
||||
[oops.core :as oops]
|
||||
[quo.components.buttons.slide-button.utils :as utils]
|
||||
[react-native.gesture :as gesture]
|
||||
[react-native.reanimated :as reanimated]))
|
||||
|
||||
(def ^:private extrapolation
|
||||
{:extrapolateLeft "clamp"
|
||||
@@ -62,6 +66,36 @@
|
||||
:damping 30
|
||||
:stiffness 400}))
|
||||
|
||||
(defn- complete-animation
|
||||
[sliding-complete?]
|
||||
(reset! sliding-complete? true))
|
||||
|
||||
(defn reset-track-position
|
||||
[x-pos]
|
||||
(animate-spring x-pos 0))
|
||||
|
||||
;; Gestures
|
||||
(defn drag-gesture
|
||||
[x-pos
|
||||
gestures-disabled?
|
||||
disabled?
|
||||
track-width
|
||||
sliding-complete?]
|
||||
(let [gestures-enabled? (not (or disabled? @gestures-disabled?))]
|
||||
(-> (gesture/gesture-pan)
|
||||
(gesture/with-test-ID :slide-button-gestures)
|
||||
(gesture/enabled gestures-enabled?)
|
||||
(gesture/min-distance 0)
|
||||
(gesture/on-update (fn [event]
|
||||
(let [x-translation (oops/oget event "translationX")
|
||||
clamped-x (utils/clamp-value x-translation 0 track-width)
|
||||
reached-end? (>= clamped-x track-width)]
|
||||
(reanimated/set-shared-value x-pos clamped-x)
|
||||
(when (and reached-end? (not @sliding-complete?))
|
||||
(reset! gestures-disabled? true)
|
||||
(complete-animation sliding-complete?)))))
|
||||
(gesture/on-end (fn [event]
|
||||
(let [x-translation (oops/oget event "translationX")
|
||||
reached-end? (>= x-translation track-width)]
|
||||
(when (not reached-end?)
|
||||
(reset-track-position x-pos))))))))
|
||||
|
||||
@@ -11,33 +11,94 @@
|
||||
[quo.theme :as quo.theme]
|
||||
[react-native.core :as rn]
|
||||
[react-native.gesture :as gesture]
|
||||
[react-native.reanimated :as reanimated]))
|
||||
[react-native.reanimated :as reanimated]
|
||||
[reagent.core :as reagent]))
|
||||
|
||||
(defn drag-gesture
|
||||
[x-pos disabled? track-width sliding-complete?
|
||||
set-sliding-complete
|
||||
on-complete reset-fn]
|
||||
(-> (gesture/gesture-pan)
|
||||
(gesture/with-test-ID :slide-button-gestures)
|
||||
(gesture/enabled (not disabled?))
|
||||
(gesture/min-distance 0)
|
||||
(gesture/on-update (fn [event]
|
||||
(let [x-translation (oops/oget event "translationX")
|
||||
clamped-x (utils/clamp-value x-translation 0 track-width)
|
||||
reached-end? (>= clamped-x track-width)]
|
||||
(reanimated/set-shared-value x-pos clamped-x)
|
||||
(when (and reached-end? (not sliding-complete?))
|
||||
(set-sliding-complete true)
|
||||
(when on-complete (on-complete reset-fn))))))
|
||||
(gesture/on-end (fn [event]
|
||||
(let [x-translation (oops/oget event "translationX")
|
||||
reached-end? (>= x-translation track-width)]
|
||||
(when (not reached-end?)
|
||||
(animations/reset-track-position x-pos)))))))
|
||||
(defn- f-slider
|
||||
[{:keys [disabled?]}]
|
||||
(let [track-width (reagent/atom nil)
|
||||
sliding-complete? (reagent/atom false)
|
||||
gestures-disabled? (reagent/atom disabled?)
|
||||
on-track-layout (fn [evt]
|
||||
(let [width (oops/oget evt "nativeEvent.layout.width")]
|
||||
(reset! track-width width)))]
|
||||
(fn [{:keys [on-reset
|
||||
on-complete
|
||||
track-text
|
||||
track-icon
|
||||
disabled?
|
||||
customization-color
|
||||
size
|
||||
container-style
|
||||
theme
|
||||
type
|
||||
blur?]}]
|
||||
(let [x-pos (reanimated/use-shared-value 0)
|
||||
dimensions (partial utils/get-dimensions
|
||||
(or @track-width constants/default-width)
|
||||
size)
|
||||
interpolate-track (partial animations/interpolate-track
|
||||
x-pos
|
||||
(dimensions :usable-track)
|
||||
(dimensions :thumb))
|
||||
custom-color (if (= type :danger) :danger customization-color)]
|
||||
(rn/use-effect (fn []
|
||||
(when @sliding-complete?
|
||||
(on-complete)))
|
||||
[@sliding-complete?])
|
||||
(rn/use-effect (fn []
|
||||
(when on-reset
|
||||
(reset! sliding-complete? false)
|
||||
(reset! gestures-disabled? false)
|
||||
(animations/reset-track-position x-pos)
|
||||
(on-reset)))
|
||||
[on-reset])
|
||||
[gesture/gesture-detector
|
||||
{:gesture (animations/drag-gesture x-pos
|
||||
gestures-disabled?
|
||||
disabled?
|
||||
(dimensions :usable-track)
|
||||
sliding-complete?)}
|
||||
[reanimated/view
|
||||
{:test-ID :slide-button-track
|
||||
:style (merge (style/track {:disabled? disabled?
|
||||
:customization-color custom-color
|
||||
:height (dimensions :track-height)
|
||||
:blur? blur?})
|
||||
container-style)
|
||||
:on-layout (when-not (some? @track-width)
|
||||
on-track-layout)}
|
||||
[reanimated/view {:style (style/track-cover interpolate-track)}
|
||||
[rn/view {:style (style/track-cover-text-container @track-width)}
|
||||
[icon/icon track-icon
|
||||
{:color (utils/text-color custom-color theme blur?)
|
||||
:size 20}]
|
||||
[rn/view {:width 4}]
|
||||
[text/text
|
||||
{:weight :medium
|
||||
:size :paragraph-1
|
||||
:style (style/track-text custom-color theme blur?)}
|
||||
track-text]]]
|
||||
[reanimated/view
|
||||
{:style (style/thumb-container {:interpolate-track interpolate-track
|
||||
:thumb-size (dimensions :thumb)
|
||||
:customization-color custom-color
|
||||
:theme theme
|
||||
:blur? blur?})}
|
||||
[reanimated/view {:style (style/arrow-icon-container interpolate-track)}
|
||||
[icon/icon :arrow-right
|
||||
{:color colors/white
|
||||
:size 20}]]
|
||||
[reanimated/view
|
||||
{:style (style/action-icon interpolate-track
|
||||
(dimensions :thumb))}
|
||||
[icon/icon track-icon
|
||||
{:color colors/white
|
||||
:size 20}]]]]]))))
|
||||
|
||||
(defn view
|
||||
(defn- view-internal
|
||||
"Options
|
||||
- `on-complete` Callback called when the sliding is complete, returns reset fn as a parameter
|
||||
- `on-complete` Callback called when the sliding is complete
|
||||
- `disabled?` Boolean that disables the button
|
||||
(_and gestures_)
|
||||
- `size` :size/s-40`/`:size/s-48`
|
||||
@@ -45,73 +106,9 @@
|
||||
- `track-icon` Key of the icon shown on the track
|
||||
(e.g. `:face-id`)
|
||||
- `customization-color` Customization color
|
||||
- `on-reset` A callback which can be used to reset the component and run required functionality
|
||||
"
|
||||
[{:keys [on-complete track-text track-icon disabled? customization-color size
|
||||
container-style type blur?]}]
|
||||
(let [theme (quo.theme/use-theme-value)
|
||||
x-pos (reanimated/use-shared-value 0)
|
||||
[track-width set-track-width] (rn/use-state nil)
|
||||
[sliding-complete?
|
||||
set-sliding-complete] (rn/use-state false)
|
||||
on-track-layout (rn/use-callback
|
||||
#(set-track-width (oops/oget % "nativeEvent.layout.width")))
|
||||
reset-fn (rn/use-callback
|
||||
(fn []
|
||||
(set-sliding-complete false)
|
||||
(animations/reset-track-position x-pos)))
|
||||
dimensions (rn/use-callback
|
||||
(partial utils/get-dimensions
|
||||
(or track-width constants/default-width)
|
||||
size)
|
||||
[track-width])
|
||||
interpolate-track (rn/use-callback
|
||||
(partial animations/interpolate-track
|
||||
x-pos
|
||||
(dimensions :usable-track)
|
||||
(dimensions :thumb))
|
||||
[dimensions])
|
||||
custom-color (if (= type :danger) :danger customization-color)
|
||||
gesture (rn/use-memo #(drag-gesture x-pos
|
||||
disabled?
|
||||
(dimensions :usable-track)
|
||||
sliding-complete?
|
||||
set-sliding-complete
|
||||
on-complete
|
||||
reset-fn)
|
||||
[sliding-complete? disabled?])]
|
||||
[gesture/gesture-detector
|
||||
{:gesture gesture}
|
||||
[reanimated/view
|
||||
{:test-ID :slide-button-track
|
||||
:style (merge (style/track {:disabled? disabled?
|
||||
:customization-color custom-color
|
||||
:height (dimensions :track-height)
|
||||
:blur? blur?})
|
||||
container-style)
|
||||
:on-layout on-track-layout}
|
||||
[reanimated/view {:style (style/track-cover interpolate-track)}
|
||||
[rn/view {:style (style/track-cover-text-container track-width)}
|
||||
[icon/icon track-icon
|
||||
{:color (utils/text-color custom-color theme blur?)
|
||||
:size 20}]
|
||||
[rn/view {:width 4}]
|
||||
[text/text
|
||||
{:weight :medium
|
||||
:size :paragraph-1
|
||||
:style (style/track-text custom-color theme blur?)}
|
||||
track-text]]]
|
||||
[reanimated/view
|
||||
{:style (style/thumb-container {:interpolate-track interpolate-track
|
||||
:thumb-size (dimensions :thumb)
|
||||
:customization-color custom-color
|
||||
:theme theme
|
||||
:blur? blur?})}
|
||||
[reanimated/view {:style (style/arrow-icon-container interpolate-track)}
|
||||
[icon/icon :arrow-right
|
||||
{:color colors/white
|
||||
:size 20}]]
|
||||
[reanimated/view
|
||||
{:style (style/action-icon interpolate-track (dimensions :thumb))}
|
||||
[icon/icon track-icon
|
||||
{:color colors/white
|
||||
:size 20}]]]]]))
|
||||
[props]
|
||||
[:f> f-slider props])
|
||||
|
||||
(def view (quo.theme/with-theme view-internal))
|
||||
|
||||
@@ -4,24 +4,26 @@
|
||||
[quo.components.icon :as quo.icons]
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.theme :as theme]
|
||||
[react-native.core :as rn]))
|
||||
[react-native.core :as rn]
|
||||
[reagent.core :as reagent]))
|
||||
|
||||
(defn view
|
||||
[{:keys [on-press on-long-press disabled? icon accessibility-label container-style]}]
|
||||
(let [theme (theme/use-theme-value)
|
||||
[pressed? set-pressed] (rn/use-state false)
|
||||
on-press-in (rn/use-callback #(set-pressed true))
|
||||
on-press-out (rn/use-callback #(set-pressed nil))]
|
||||
[rn/pressable
|
||||
{:accessibility-label (or accessibility-label :wallet-button)
|
||||
:on-press on-press
|
||||
:on-press-in on-press-in
|
||||
:on-press-out on-press-out
|
||||
:on-long-press on-long-press
|
||||
:disabled disabled?
|
||||
:style (merge (style/main {:pressed? pressed?
|
||||
:theme theme
|
||||
:disabled? disabled?})
|
||||
container-style)}
|
||||
[quo.icons/icon icon
|
||||
{:color (colors/theme-colors colors/neutral-100 colors/white theme)}]]))
|
||||
(defn- view-internal
|
||||
[]
|
||||
(let [pressed? (reagent/atom false)]
|
||||
(fn
|
||||
[{:keys [on-press on-long-press disabled? icon accessibility-label container-style theme]}]
|
||||
[rn/pressable
|
||||
{:accessibility-label (or accessibility-label :wallet-button)
|
||||
:on-press on-press
|
||||
:on-press-in #(reset! pressed? true)
|
||||
:on-press-out #(reset! pressed? nil)
|
||||
:on-long-press on-long-press
|
||||
:disabled disabled?
|
||||
:style (merge (style/main {:pressed? @pressed?
|
||||
:theme theme
|
||||
:disabled? disabled?})
|
||||
container-style)}
|
||||
[quo.icons/icon icon
|
||||
{:color (colors/theme-colors colors/neutral-100 colors/white theme)}]])))
|
||||
|
||||
(def view (theme/with-theme view-internal))
|
||||
|
||||
@@ -8,36 +8,36 @@
|
||||
[quo.components.calendar.calendar.years-list.view :as years-list]
|
||||
[quo.theme :as theme]
|
||||
[react-native.core :as rn]
|
||||
[reagent.core :as reagent]
|
||||
[utils.number :as utils.number]))
|
||||
|
||||
(defn view
|
||||
[{:keys [on-change start-date end-date]}]
|
||||
(let [theme (theme/use-theme-value)
|
||||
[selected-year set-selected-year] (rn/use-state (utils/current-year))
|
||||
[selected-month set-selected-month] (rn/use-state (utils/current-month))
|
||||
on-change-year (rn/use-callback #(set-selected-year %))
|
||||
on-change-month (rn/use-callback
|
||||
(fn [new-date]
|
||||
(set-selected-year
|
||||
(utils.number/parse-int (:year new-date)))
|
||||
(set-selected-month
|
||||
(utils.number/parse-int (:month new-date)))))]
|
||||
[rn/view
|
||||
{:style (style/container theme)}
|
||||
[years-list/view
|
||||
{:on-change-year on-change-year
|
||||
:year selected-year}]
|
||||
[rn/view
|
||||
{:style style/container-main}
|
||||
[month-picker/view
|
||||
{:year selected-year
|
||||
:month selected-month
|
||||
:on-change on-change-month}]
|
||||
[weekdays-header/view]
|
||||
[days-grid/view
|
||||
{:year selected-year
|
||||
:month selected-month
|
||||
:start-date start-date
|
||||
:end-date end-date
|
||||
:on-change on-change
|
||||
:customization-color :blue}]]]))
|
||||
(defn- view-internal
|
||||
[]
|
||||
(let [selected-year (reagent/atom (utils/current-year))
|
||||
selected-month (reagent/atom (utils/current-month))
|
||||
on-change-year #(reset! selected-year %)
|
||||
on-change-month (fn [new-date]
|
||||
(reset! selected-year (utils.number/parse-int (:year new-date)))
|
||||
(reset! selected-month (utils.number/parse-int (:month new-date))))]
|
||||
(fn [{:keys [on-change start-date end-date theme]}]
|
||||
[rn/view
|
||||
{:style (style/container theme)}
|
||||
[years-list/view
|
||||
{:on-change-year on-change-year
|
||||
:year @selected-year}]
|
||||
[rn/view
|
||||
{:style style/container-main}
|
||||
[month-picker/view
|
||||
{:year @selected-year
|
||||
:month @selected-month
|
||||
:on-change on-change-month}]
|
||||
[weekdays-header/view]
|
||||
[days-grid/view
|
||||
{:year @selected-year
|
||||
:month @selected-month
|
||||
:start-date start-date
|
||||
:end-date end-date
|
||||
:on-change on-change
|
||||
:customization-color :blue}]]])))
|
||||
|
||||
(def view (theme/with-theme view-internal))
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
(ns quo.components.colors.color-picker.component-spec
|
||||
(:require
|
||||
[quo.components.colors.color-picker.view :as color-picker]
|
||||
[reagent.core :as reagent]
|
||||
[test-helpers.component :as h]))
|
||||
|
||||
(h/describe "color-picker"
|
||||
@@ -11,7 +12,7 @@
|
||||
(-> (h/expect event)
|
||||
(.toHaveBeenCalled))))
|
||||
(h/test "color picker color changed"
|
||||
(let [selected (atom nil)]
|
||||
(let [selected (reagent/atom nil)]
|
||||
(h/render [color-picker/view {:on-change #(reset! selected %)}])
|
||||
(h/fire-event :press (get (h/get-all-by-label-text :color-picker-item) 0))
|
||||
(-> (h/expect @selected)
|
||||
|
||||
@@ -4,7 +4,12 @@
|
||||
[quo.components.colors.color.view :as color]
|
||||
[quo.foundations.colors :as colors]
|
||||
[react-native.core :as rn]
|
||||
[react-native.gesture :as gesture]))
|
||||
[reagent.core :as reagent]))
|
||||
|
||||
(defn- on-change-handler
|
||||
[selected color-name on-change]
|
||||
(reset! selected color-name)
|
||||
(when on-change (on-change color-name)))
|
||||
|
||||
(defn get-item-layout
|
||||
[_ index]
|
||||
@@ -13,34 +18,15 @@
|
||||
:offset (* (+ constants/color-size 8) index)
|
||||
:index index})
|
||||
|
||||
(defn view
|
||||
(defn- view-internal
|
||||
"Options
|
||||
- `default-selected` Default selected color name.
|
||||
- `on-change` Callback called when a color is selected `(fn [color-name])`.
|
||||
- `blur?` Boolean to enable blur background support.}"
|
||||
[{:keys [default-selected blur? on-change feng-shui? container-style]}]
|
||||
(let [[selected set-selected] (rn/use-state default-selected)
|
||||
{window-width :width} (rn/get-window)
|
||||
ref (rn/use-ref-atom nil)
|
||||
on-ref (rn/use-callback #(reset! ref %))
|
||||
render-fn (rn/use-callback
|
||||
(fn [color idx]
|
||||
[color/view
|
||||
{:selected? (= color selected)
|
||||
:on-press (fn [color-name]
|
||||
(.scrollToIndex ^js @ref
|
||||
#js
|
||||
{:animated true
|
||||
:index idx
|
||||
:viewPosition 0.5})
|
||||
(set-selected color-name)
|
||||
(when on-change (on-change color-name)))
|
||||
:blur? blur?
|
||||
:key color
|
||||
:color color
|
||||
:idx idx
|
||||
:window-width window-width}])
|
||||
[selected blur? on-change @ref])]
|
||||
(let [selected (reagent/atom default-selected)
|
||||
{window-width :width} (rn/get-window)
|
||||
ref (atom nil)]
|
||||
(rn/use-mount
|
||||
(fn []
|
||||
(js/setTimeout
|
||||
@@ -53,15 +39,33 @@
|
||||
:index index
|
||||
:viewPosition 0.5})))))
|
||||
50)))
|
||||
[gesture/flat-list
|
||||
{:ref on-ref
|
||||
[rn/flat-list
|
||||
{:ref #(reset! ref %)
|
||||
;; TODO: using :feng-shui? temporarily while b & w is being developed.
|
||||
;; https://github.com/status-im/status-mobile/discussions/16676
|
||||
:data (if feng-shui?
|
||||
(conj colors/account-colors :feng-shui)
|
||||
colors/account-colors)
|
||||
:render-fn render-fn
|
||||
:render-fn (fn [color idx]
|
||||
[color/view
|
||||
{:selected? (= color @selected)
|
||||
:on-press (fn [e]
|
||||
(.scrollToIndex ^js @ref
|
||||
#js
|
||||
{:animated true
|
||||
:index idx
|
||||
:viewPosition 0.5})
|
||||
(on-change-handler selected e on-change))
|
||||
:blur? blur?
|
||||
:key color
|
||||
:color color
|
||||
:idx idx
|
||||
:window-width window-width}])
|
||||
:get-item-layout get-item-layout
|
||||
:horizontal true
|
||||
:shows-horizontal-scroll-indicator false
|
||||
:content-container-style container-style}]))
|
||||
|
||||
(defn view
|
||||
[props]
|
||||
[:f> view-internal props])
|
||||
|
||||
@@ -35,11 +35,12 @@
|
||||
(defn image
|
||||
"Same as rn/image but cache the image source in a js/Set, so the image won't
|
||||
flicker when re-render on android"
|
||||
[props]
|
||||
(let [[loaded-source set-loaded-source] (rn/use-state nil)
|
||||
on-source-loaded (rn/use-callback #(set-loaded-source %))]
|
||||
(if platform/ios?
|
||||
[rn/image props]
|
||||
[:<>
|
||||
[rn/image (assoc props :source loaded-source)]
|
||||
[caching-image props on-source-loaded]])))
|
||||
[]
|
||||
(let [loaded-source (reagent/atom nil)
|
||||
on-source-loaded #(reset! loaded-source %)]
|
||||
(fn [props]
|
||||
(if platform/ios?
|
||||
[rn/image props]
|
||||
[:<>
|
||||
[rn/image (assoc props :source @loaded-source)]
|
||||
[caching-image props on-source-loaded]]))))
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
(ns quo.components.community.channel-action.style
|
||||
(:require
|
||||
[quo.foundations.colors :as colors]))
|
||||
|
||||
(defn channel-action-container
|
||||
[{:keys [big? disabled?]}]
|
||||
(cond-> {}
|
||||
disabled? (assoc :opacity 0.3)
|
||||
big? (assoc :flex-grow 1)
|
||||
(not big?) (assoc :width 104)))
|
||||
|
||||
(defn channel-action
|
||||
[{:keys [color pressed? theme]}]
|
||||
{:height 102
|
||||
:padding 12
|
||||
:border-radius 16
|
||||
:background-color (colors/resolve-color color theme (if pressed? 20 10))
|
||||
:justify-content :space-between})
|
||||
|
||||
(def channel-action-row
|
||||
{:flex-direction :row
|
||||
:justify-content :space-between
|
||||
:align-items :center})
|
||||
@@ -1,39 +0,0 @@
|
||||
(ns quo.components.community.channel-action.view
|
||||
(:require
|
||||
[quo.components.community.channel-action.style :as style]
|
||||
[quo.components.counter.counter.view :as counter]
|
||||
[quo.components.icon :as icons]
|
||||
[quo.components.markdown.text :as text]
|
||||
[quo.theme]
|
||||
[react-native.core :as rn]))
|
||||
|
||||
(defn view
|
||||
[{:keys [big? customization-color label counter-value icon on-press accessibility-label disabled?]}]
|
||||
(let [theme (quo.theme/use-theme-value)
|
||||
[pressed? set-pressed] (rn/use-state false)
|
||||
on-press-in (rn/use-callback #(set-pressed true))
|
||||
on-press-out (rn/use-callback #(set-pressed false))]
|
||||
[rn/view
|
||||
{:style (style/channel-action-container
|
||||
{:big? big?
|
||||
:disabled? disabled?})}
|
||||
[rn/pressable
|
||||
(cond-> {:style (style/channel-action
|
||||
{:big? big?
|
||||
:color customization-color
|
||||
:pressed? pressed?
|
||||
:theme theme
|
||||
:disabled? disabled?})
|
||||
:accessibility-label accessibility-label}
|
||||
(not disabled?) (assoc :on-press on-press
|
||||
:on-press-in on-press-in
|
||||
:on-press-out on-press-out))
|
||||
[rn/view {:style style/channel-action-row}
|
||||
[icons/icon icon]
|
||||
(when counter-value
|
||||
[counter/view {:type :secondary} counter-value])]
|
||||
[text/text
|
||||
{:size :paragraph-1
|
||||
:weight :medium
|
||||
:number-of-lines 2}
|
||||
label]]]))
|
||||
@@ -0,0 +1,32 @@
|
||||
(ns quo.components.community.channel-actions
|
||||
(:require
|
||||
[quo.components.community.style :as style]
|
||||
[quo.components.counter.counter.view :as counter]
|
||||
[quo.components.icon :as icons]
|
||||
[quo.components.markdown.text :as text]
|
||||
[react-native.core :as rn]))
|
||||
|
||||
(defn channel-action
|
||||
[{:keys [big? color label counter-value icon on-press accessibility-label]}]
|
||||
[rn/touchable-opacity
|
||||
{:on-press on-press
|
||||
:style (style/channel-action-touch big?)
|
||||
:accessibility-label accessibility-label}
|
||||
[rn/view {:style (style/channel-action color)}
|
||||
[rn/view {:style style/channel-action-row}
|
||||
[icons/icon icon]
|
||||
(when counter-value
|
||||
[counter/view {:type :secondary} counter-value])]
|
||||
[text/text {:size :paragraph-1 :weight :medium :number-of-lines 2} label]]])
|
||||
|
||||
(defn channel-actions
|
||||
[{:keys [style actions]}]
|
||||
[rn/view {:style (merge {:flex-direction :row :flex 1} style)}
|
||||
(map-indexed
|
||||
(fn [index action]
|
||||
^{:key index}
|
||||
[:<>
|
||||
[channel-action action]
|
||||
(when (not= action (last actions))
|
||||
[rn/view {:width 16}])])
|
||||
actions)])
|
||||
@@ -1,16 +0,0 @@
|
||||
(ns quo.components.community.channel-actions.view
|
||||
(:require
|
||||
[quo.components.community.channel-action.view :as channel-action]
|
||||
[react-native.core :as rn]))
|
||||
|
||||
(defn view
|
||||
[{:keys [container-style actions]}]
|
||||
[rn/view {:style (assoc container-style :flex-direction :row)}
|
||||
(map-indexed
|
||||
(fn [index action]
|
||||
^{:key index}
|
||||
[:<>
|
||||
[channel-action/view action]
|
||||
(when (not= action (last actions))
|
||||
[rn/view {:width 16}])])
|
||||
actions)])
|
||||
@@ -133,6 +133,25 @@
|
||||
colors/neutral-80
|
||||
theme)})
|
||||
|
||||
(defn channel-action-touch
|
||||
[big?]
|
||||
{:flex 1
|
||||
:max-width (if big? 216 104)})
|
||||
|
||||
(defn channel-action
|
||||
[color]
|
||||
{:padding 12
|
||||
:height 102
|
||||
:flex 1
|
||||
:border-radius 16
|
||||
:background-color (colors/custom-color color 50 10)
|
||||
:justify-content :space-between})
|
||||
|
||||
(def channel-action-row
|
||||
{:flex-direction :row
|
||||
:justify-content :space-between
|
||||
:align-items :center})
|
||||
|
||||
(defn loading-card
|
||||
[width theme]
|
||||
(merge
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
[:catn
|
||||
[:props
|
||||
[:map {:closed true}
|
||||
[:container-style {:optional true} [:maybe :map]]
|
||||
[:value {:optional true} [:maybe [:or :string :int]]]
|
||||
[:status {:optional true} [:maybe :keyword]]
|
||||
[:size {:optional true} [:maybe [:enum :size-32 :size-24]]]
|
||||
@@ -20,7 +19,7 @@
|
||||
:any])
|
||||
|
||||
(defn- view-internal
|
||||
[{:keys [value accessibility-label container-style]
|
||||
[{:keys [value accessibility-label]
|
||||
:as props}]
|
||||
(let [default-props {:status :default
|
||||
:size :size-32}
|
||||
@@ -28,7 +27,7 @@
|
||||
[rn/view
|
||||
{:accessible true
|
||||
:accessibility-label (or accessibility-label :collectible-counter)
|
||||
:style (merge (style/container props) container-style)}
|
||||
:style (style/container props)}
|
||||
[text/text
|
||||
{:weight :medium
|
||||
:size (style/get-text-size props)
|
||||
|
||||
@@ -58,15 +58,14 @@
|
||||
:on-press on-press}
|
||||
[rn/view
|
||||
{:style (style/row-container sub-label)}
|
||||
(when icon
|
||||
[rn/view
|
||||
{:accessibility-label :left-icon-for-action
|
||||
:accessible true
|
||||
:style (style/left-icon sub-label)}
|
||||
[icon/icon icon
|
||||
{:color (or icon-color (get-icon-color danger? theme))
|
||||
:no-color no-icon-color?
|
||||
:size 20}]])
|
||||
[rn/view
|
||||
{:accessibility-label :left-icon-for-action
|
||||
:accessible true
|
||||
:style (style/left-icon sub-label)}
|
||||
[icon/icon icon
|
||||
{:color (or icon-color (get-icon-color danger? theme))
|
||||
:no-color no-icon-color?
|
||||
:size 20}]]
|
||||
[rn/view
|
||||
{:style style/text-container}
|
||||
[text/text
|
||||
|
||||
@@ -59,15 +59,4 @@
|
||||
:button-one-label "Request to join"}])
|
||||
(h/is-truthy (h/get-by-text "Eligible to join as"))
|
||||
(h/is-truthy (h/get-by-text "Admin"))
|
||||
(h/is-truthy (h/get-by-text "Request to join")))
|
||||
|
||||
(h/test "render with top description with custom text & 1 action"
|
||||
(render [bottom-actions/view
|
||||
{:description :top
|
||||
:role :admin
|
||||
:actions :one-action
|
||||
:description-top-text "You'll be an"
|
||||
:button-one-label "Request to join"}])
|
||||
(h/is-truthy (h/get-by-text "You'll be an"))
|
||||
(h/is-truthy (h/get-by-text "Admin"))
|
||||
(h/is-truthy (h/get-by-text "Request to join"))))
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
[:actions [:maybe [:enum :one-action :two-actions]]]
|
||||
[:description {:optional true} [:maybe [:enum :top :bottom :top-error]]]
|
||||
[:description-text {:optional true} [:maybe :string]]
|
||||
[:description-top-text {:optional true} [:maybe :string]]
|
||||
[:error-message {:optional true} [:maybe :string]]
|
||||
[:role {:optional true} [:maybe [:enum :admin :member :token-master :owner]]]
|
||||
[:button-one-label {:optional true} [:maybe :string]]
|
||||
@@ -39,8 +38,8 @@
|
||||
:owner :i/crown})
|
||||
|
||||
(defn- view-internal
|
||||
[{:keys [actions description description-text description-top-text error-message role button-one-label
|
||||
button-two-label blur? button-one-props button-two-props theme scroll? container-style]}]
|
||||
[{:keys [actions description description-text error-message role button-one-label button-two-label
|
||||
blur? button-one-props button-two-props theme scroll? container-style]}]
|
||||
[rn/view
|
||||
{:style (merge (style/container scroll? blur? theme) container-style)}
|
||||
(when (= description :top-error)
|
||||
@@ -55,11 +54,12 @@
|
||||
error-message]])
|
||||
|
||||
(when (and (= description :top) role)
|
||||
[rn/view {:style style/description-top}
|
||||
[rn/view
|
||||
{:style style/description-top}
|
||||
[text/text
|
||||
{:size :paragraph-2
|
||||
:style (style/description-top-text scroll? blur? theme)}
|
||||
(or description-top-text (i18n/label :t/eligible-to-join-as))]
|
||||
(i18n/label :t/eligible-to-join-as)]
|
||||
[context-tag/view
|
||||
{:type :icon
|
||||
:size 24
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user