Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f573ca6b4e | ||
|
|
f6ed540593 |
@@ -1,23 +1,20 @@
|
||||
{:lint-as {status-im.utils.views/defview clojure.core/defn
|
||||
status-im.utils.views/letsubs clojure.core/let
|
||||
reagent.core/with-let clojure.core/let
|
||||
status-im.utils.fx/defn clj-kondo.lint-as/def-catch-all
|
||||
utils.re-frame/defn clj-kondo.lint-as/def-catch-all
|
||||
quo.react/with-deps-check clojure.core/fn
|
||||
quo.previews.preview/list-comp clojure.core/for
|
||||
status-im.utils.styles/def clojure.core/def
|
||||
status-im.utils.styles/defn clojure.core/defn
|
||||
test-helpers.unit/deftest-sub clojure.core/defn
|
||||
taoensso.tufte/defnp clojure.core/defn}
|
||||
:linters {:consistent-alias {:level :error
|
||||
:aliases {clojure.string string
|
||||
clojure.set set
|
||||
clojure.walk walk
|
||||
taoensso.timbre log}}
|
||||
:invalid-arity {:skip-args [status-im.utils.fx/defn utils.re-frame/defn]}
|
||||
;; TODO remove number when this is fixed
|
||||
;; https://github.com/borkdude/clj-kondo/issues/867
|
||||
:unresolved-symbol {:exclude [PersistentPriorityMap.EMPTY
|
||||
number
|
||||
status-im.test-helpers/restore-app-db]}}
|
||||
:config-in-ns {mocks.js-dependencies {:linters {:clojure-lsp/unused-public-var {:level :off}}}}}
|
||||
{:lint-as {status-im.utils.views/defview clojure.core/defn
|
||||
status-im.utils.views/letsubs clojure.core/let
|
||||
reagent.core/with-let clojure.core/let
|
||||
status-im.utils.fx/defn clj-kondo.lint-as/def-catch-all
|
||||
utils.re-frame/defn clj-kondo.lint-as/def-catch-all
|
||||
quo.react/with-deps-check clojure.core/fn
|
||||
quo.previews.preview/list-comp clojure.core/for
|
||||
status-im.utils.styles/def clojure.core/def
|
||||
status-im.utils.styles/defn clojure.core/defn
|
||||
status-im.test-helpers/deftest-sub clojure.core/defn
|
||||
taoensso.tufte/defnp clojure.core/defn}
|
||||
:linters {:consistent-alias {:level :error
|
||||
:aliases {clojure.string string
|
||||
taoensso.timbre log}}
|
||||
:invalid-arity {:skip-args [status-im.utils.fx/defn utils.re-frame/defn]}
|
||||
;; TODO remove number when this is fixed
|
||||
;; https://github.com/borkdude/clj-kondo/issues/867
|
||||
:unresolved-symbol {:exclude [PersistentPriorityMap.EMPTY
|
||||
number
|
||||
status-im.test-helpers/restore-app-db]}}}
|
||||
|
||||
@@ -19,17 +19,15 @@
|
||||
:respect-bl]
|
||||
:fn-map
|
||||
{"reg-sub" :arg1-pair
|
||||
"h/describe" :arg1-body
|
||||
"h/test" :arg1-body
|
||||
"global.describe" :arg1-body
|
||||
"global.test" :arg1-body
|
||||
"list-comp" :binding
|
||||
"defview" :arg1-body
|
||||
"letsubs" :binding
|
||||
"testing" :arg1-body
|
||||
"deftest-sub" :arg1-body
|
||||
"wait-for" :arg1-body
|
||||
"with-deps-check" :arg1-body
|
||||
"ns" [:arg1-body
|
||||
{:list {:respect-nl? false}
|
||||
:vector {:respect-nl? false}}]
|
||||
"->" [:noarg1-body
|
||||
{:list {:constant-pair? false :force-nl? false}
|
||||
:next-inner-restore [[:list :constant-pair?]]}]
|
||||
@@ -41,6 +39,7 @@
|
||||
:remove {:fn-force-nl #{:noarg1-body}}
|
||||
:style-map
|
||||
{:no-comma {:map {:comma? false}}
|
||||
:rj-var {:pair {:justify {:max-variance 1000}}}
|
||||
:custom-justify
|
||||
{:doc "Justify everything using pre-1.1.2 approach"
|
||||
:binding {:justify? true :justify {:max-variance 1000}}
|
||||
|
||||
@@ -285,19 +285,16 @@ endif
|
||||
# Tests
|
||||
#--------------
|
||||
|
||||
lint: export TARGET := default
|
||||
lint: export TARGET := clojure
|
||||
lint: ##@test Run code style checks
|
||||
sh scripts/lint-re-frame-in-quo-components.sh && \
|
||||
clj-kondo --config .clj-kondo/config.edn --cache false --lint src && \
|
||||
ALL_CLOJURE_FILE=$$(git ls-files | grep -e \.clj$$ -e \.cljs$$ -e \.cljc$$ -e \.edn$$) && \
|
||||
zprint '{:search-config? true}' -sfc $$ALL_CLOJURE_FILE
|
||||
TARGETS=$$(git diff --diff-filter=d --cached --name-only src && echo src) && \
|
||||
clojure -Scp "$$CLASS_PATH" -m cljfmt.main check --indents indentation.edn $$TARGETS
|
||||
|
||||
lint-fix: export TARGET := default
|
||||
lint-fix: export TARGET := clojure
|
||||
lint-fix: ##@test Run code style checks and fix issues
|
||||
ALL_CLOJURE_FILE=$$(git ls-files | grep -e \.clj$$ -e \.cljs$$ -e \.cljc$$ -e \.edn$$) && \
|
||||
zprint '{:search-config? true}' -sw $$ALL_CLOJURE_FILE && \
|
||||
zprint '{:search-config? true}' -sw $$ALL_CLOJURE_FILE
|
||||
|
||||
clojure -Scp "$$CLASS_PATH" -m cljfmt.main fix src --indents indentation.edn
|
||||
|
||||
shadow-server: export TARGET := clojure
|
||||
shadow-server:##@ Start shadow-cljs in server mode for watching
|
||||
@@ -308,14 +305,6 @@ test-watch: ##@ Watch tests and re-run no changes to cljs files
|
||||
yarn install
|
||||
nodemon --exec 'yarn shadow-cljs compile mocks && yarn shadow-cljs compile test && node --require ./test-resources/override.js target/test/test.js' -e cljs
|
||||
|
||||
test-watch-for-repl: export TARGET := clojure
|
||||
test-watch-for-repl: ##@ Watch tests and support REPL connections
|
||||
yarn install
|
||||
rm -f target/test/test.js
|
||||
concurrently --kill-others --prefix-colors 'auto' --names 'build,repl' \
|
||||
'yarn shadow-cljs compile mocks && yarn shadow-cljs watch test --verbose' \
|
||||
'until [ -f ./target/test/test.js ] ; do sleep 1 ; done ; node --require ./test-resources/override.js ./target/test/test.js --repl'
|
||||
|
||||
test: export TARGET := clojure
|
||||
test: ##@test Run tests once in NodeJS
|
||||
# Here we create the gyp bindings for nodejs
|
||||
|
||||
@@ -20,8 +20,6 @@ printed out by mistake in a log entry (see https://github.com/status-im/status-m
|
||||
To minimize the risk of leaking passwords through logs, we should not pass
|
||||
passwords as strings in our codebase. We introduced a new type `MaskedData` in
|
||||
`status-im.utils.security`.
|
||||
update (16-Dec-2022) `status-im.utils.security` is now moved over to `utils.security.core`
|
||||
|
||||
We use `(security/mask-data <data to hide>` to wrap sensitive data into this
|
||||
type and then use `(security/unmask <masked-data>)` to get the plaintext back.
|
||||
|
||||
|
||||
@@ -364,7 +364,7 @@ actually subscribing to them, so reframe's signal graph gets validated too.
|
||||
(is (= expected (recipes [current-user all-recipes location]))))))
|
||||
|
||||
;; good
|
||||
(require '[test-helpers.unit :as h])
|
||||
(require '[status-im.test-helpers :as h])
|
||||
|
||||
(re-frame/reg-sub
|
||||
:user/recipes
|
||||
@@ -399,15 +399,13 @@ src
|
||||
├── react_native
|
||||
│ ├── gesture.cljs
|
||||
│ └── platform.cljs
|
||||
├── status_im/
|
||||
├── status_im2
|
||||
├── status_im
|
||||
│ ├── common
|
||||
│ │ └── components
|
||||
│ │ └── bottom_sheet.cljs
|
||||
│ ├── contexts/
|
||||
│ ├── setup/
|
||||
│ └── subs/
|
||||
├── test_helpers/
|
||||
└── utils.cljs
|
||||
```
|
||||
|
||||
@@ -416,23 +414,17 @@ src
|
||||
- `src/quo2/`: The component library for Status Mobile.
|
||||
- `src/react_native/`: Contains only low-level constructs to help React Native
|
||||
work in tandem with Clojure(Script).
|
||||
- `src/status_im2/`: Directory where we try to be as strict as possible about
|
||||
our guidelines and where we prefer to write code for the new, redesigned
|
||||
mobile app.
|
||||
- `src/status_im/`: Directory containing what we call "old code", not yet
|
||||
migrated to new guidelines for the new mobile app.
|
||||
- `src/status_im2/common/`: Directories named `common` can appear at any level
|
||||
of the directory tree. Just like directories named `utils`, their directory
|
||||
- `src/status_im/common/`: Directories named `common` can appear at any level of
|
||||
the directory tree. Just like directories named `utils`, their directory
|
||||
nesting level communicates their applicable limits.
|
||||
- `src/status_im2/common/components/`: Contains reusable components that are not
|
||||
- `src/status_im/common/components/`: Contains reusable components that are not
|
||||
part of the design system (quo2).
|
||||
- `src/status_im2/contexts/`: Contains [bounded contexts](#glossary), like
|
||||
- `src/status_im/contexts/`: Contains [bounded contexts](#glossary), like
|
||||
`browser/`, `messaging/`, etc. As much as possible, _bounded contexts_ should
|
||||
not directly require each other's namespaces.
|
||||
- `src/status_im2/setup/`: Contains namespaces that are mostly used to
|
||||
initialize the application, configure test runners, etc. In general, such
|
||||
namespaces should not be required from the outside.
|
||||
- `src/test_helpers/`: Reusable utilities for writing all kinds of tests.
|
||||
- `src/status_im/setup/`: Contains namespaces that are mostly used to initialize
|
||||
the application, configure test runners, etc. In general, such namespaces
|
||||
should not be required from the outside.
|
||||
- `src/status_im/subs/`: All subscriptions should live inside it.
|
||||
|
||||
Directories named `utils/` can appear at any level of the directory tree. The
|
||||
@@ -493,26 +485,18 @@ src
|
||||
[Unit tests](#glossary) should be created alongside their respective source
|
||||
implementation. We prefer them colocated with the source and not like most
|
||||
Clojure (JVM) codebases which mirror the sources in a top-level test directory.
|
||||
Component tests should be created in a separate directory `__tests__`. Example:
|
||||
|
||||
```
|
||||
├── models
|
||||
│ ├── message.cljs
|
||||
│ └── message_test.cljs
|
||||
├── __tests__
|
||||
│ └── input_bla_test.cljs
|
||||
├── models.cljs
|
||||
└── models_test.cljs
|
||||
```
|
||||
|
||||
Component tests should be created in a separate directory `__tests__`, colocated
|
||||
with the source. When the entire component implementation is isolated under a
|
||||
single directory, create a test file named `component_spec.cljs` instead.
|
||||
|
||||
```
|
||||
└── filter
|
||||
├── component_spec.cljs
|
||||
├── style.cljs
|
||||
└── view.cljs
|
||||
```
|
||||
|
||||
There's no hard rule on how integration test namespaces should be split, but
|
||||
we're at least striving to define them under appropriate bounded contexts that
|
||||
mirror the source code.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{letsubs [[:inner 0]]}
|
||||
@@ -19,11 +19,6 @@ def getStatusGoSHA1 = { ->
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
|
||||
@@ -59,12 +59,8 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
import java.util.zip.ZipEntry;
|
||||
@@ -531,33 +527,45 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
private void executeRunnableStatusGoMethod(Supplier<String> method, Callback callback) throws JSONException {
|
||||
@ReactMethod
|
||||
public void verify(final String address, final String password, final Callback callback) {
|
||||
Log.d(TAG, "verify");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable runnableTask = () -> {
|
||||
String res = method.get();
|
||||
callback.invoke(res);
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(runnableTask);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void verify(final String address, final String password, final Callback callback) throws JSONException {
|
||||
Activity currentActivity = getCurrentActivity();
|
||||
|
||||
final String absRootDirPath = this.getNoBackupDirectory();
|
||||
final String newKeystoreDir = pathCombine(absRootDirPath, "keystore");
|
||||
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.verifyAccountPassword(newKeystoreDir, address, password), callback);
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String result = Statusgo.verifyAccountPassword(newKeystoreDir, address, password);
|
||||
|
||||
callback.invoke(result);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void verifyDatabasePassword(final String keyUID, final String password, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.verifyDatabasePassword(keyUID, password), callback);
|
||||
public void verifyDatabasePassword(final String keyUID, final String password, final Callback callback) {
|
||||
Log.d(TAG, "verifyDatabasePassword");
|
||||
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String result = Statusgo.verifyDatabasePassword(keyUID, password);
|
||||
|
||||
callback.invoke(result);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
public String getKeyStorePath(String keyUID) {
|
||||
@@ -727,59 +735,209 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void addPeer(final String enode, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.addPeer(enode), callback);
|
||||
public void addPeer(final String enode, final Callback callback) {
|
||||
Log.d(TAG, "addPeer");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.addPeer(enode);
|
||||
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void multiAccountStoreAccount(final String json, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.multiAccountStoreAccount(json), callback);
|
||||
public void multiAccountStoreAccount(final String json, final Callback callback) {
|
||||
Log.d(TAG, "multiAccountStoreAccount");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.multiAccountStoreAccount(json);
|
||||
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void multiAccountLoadAccount(final String json, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.multiAccountLoadAccount(json), callback);
|
||||
public void multiAccountLoadAccount(final String json, final Callback callback) {
|
||||
Log.d(TAG, "multiAccountLoadAccount");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.multiAccountLoadAccount(json);
|
||||
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void multiAccountReset(final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.multiAccountReset(), callback);
|
||||
public void multiAccountReset(final Callback callback) {
|
||||
Log.d(TAG, "multiAccountReset");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.multiAccountReset();
|
||||
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void multiAccountDeriveAddresses(final String json, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.multiAccountDeriveAddresses(json), callback);
|
||||
public void multiAccountDeriveAddresses(final String json, final Callback callback) {
|
||||
Log.d(TAG, "multiAccountDeriveAddresses");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.multiAccountDeriveAddresses(json);
|
||||
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void multiAccountGenerateAndDeriveAddresses(final String json, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.multiAccountGenerateAndDeriveAddresses(json), callback);
|
||||
public void multiAccountGenerateAndDeriveAddresses(final String json, final Callback callback) {
|
||||
Log.d(TAG, "multiAccountGenerateAndDeriveAddresses");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.multiAccountGenerateAndDeriveAddresses(json);
|
||||
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void multiAccountStoreDerived(final String json, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.multiAccountStoreDerivedAccounts(json), callback);
|
||||
public void multiAccountStoreDerived(final String json, final Callback callback) {
|
||||
Log.d(TAG, "multiAccountStoreDerived");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.multiAccountStoreDerivedAccounts(json);
|
||||
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void multiAccountImportMnemonic(final String json, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.multiAccountImportMnemonic(json), callback);
|
||||
public void multiAccountImportMnemonic(final String json, final Callback callback) {
|
||||
Log.d(TAG, "multiAccountImportMnemonic");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.multiAccountImportMnemonic(json);
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void multiAccountImportPrivateKey(final String json, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.multiAccountImportPrivateKey(json), callback);
|
||||
public void multiAccountImportPrivateKey(final String json, final Callback callback) {
|
||||
Log.d(TAG, "multiAccountImportPrivateKey");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.multiAccountImportPrivateKey(json);
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void hashTransaction(final String txArgsJSON, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.hashTransaction(txArgsJSON), callback);
|
||||
public void hashTransaction(final String txArgsJSON, final Callback callback) {
|
||||
Log.d(TAG, "hashTransaction");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.hashTransaction(txArgsJSON);
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void hashMessage(final String message, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.hashMessage(message), callback);
|
||||
public void hashMessage(final String message, final Callback callback) {
|
||||
Log.d(TAG, "hashMessage");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.hashMessage(message);
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
@@ -789,7 +947,20 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||
final String keyStorePath = this.getKeyStorePath(keyUID);
|
||||
jsonConfig.put("keystorePath", keyStorePath);
|
||||
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.getConnectionStringForBootstrappingAnotherDevice(jsonConfig.toString()), callback);
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable runnableTask = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.getConnectionStringForBootstrappingAnotherDevice(jsonConfig.toString());
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(runnableTask);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
@@ -798,11 +969,6 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||
final String keyStorePath = pathCombine(this.getNoBackupDirectory(), "/keystore");
|
||||
jsonConfig.put("keystorePath", keyStorePath);
|
||||
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.inputConnectionStringForBootstrapping(connectionString, jsonConfig.toString()), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void multiformatSerializePublicKey(final String multiCodecKey, final String base58btc, final Callback callback) throws JSONException {
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
@@ -811,7 +977,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||
Runnable runnableTask = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.multiformatSerializePublicKey(multiCodecKey,base58btc);
|
||||
String res = Statusgo.inputConnectionStringForBootstrapping(connectionString,jsonConfig.toString());
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
@@ -819,117 +985,157 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||
StatusThreadPoolExecutor.getInstance().execute(runnableTask);
|
||||
}
|
||||
|
||||
|
||||
@ReactMethod
|
||||
public void multiformatDeserializePublicKey(final String multiCodecKey, final String base58btc, final Callback callback) throws JSONException {
|
||||
public void hashTypedData(final String data, final Callback callback) {
|
||||
Log.d(TAG, "hashTypedData");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable runnableTask = new Runnable() {
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.multiformatDeserializePublicKey(multiCodecKey,base58btc);
|
||||
String res = Statusgo.hashTypedData(data);
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(runnableTask);
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void compressPublicKey(final String multiCodecKey, final Callback callback) throws JSONException {
|
||||
public void hashTypedDataV4(final String data, final Callback callback) {
|
||||
Log.d(TAG, "hashTypedDataV4");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable runnableTask = new Runnable() {
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.compressPublicKey(multiCodecKey);
|
||||
String res = Statusgo.hashTypedDataV4(data);
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(runnableTask);
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void decompressPublicKey(final String multiCodecKey, final Callback callback) throws JSONException {
|
||||
public void sendTransactionWithSignature(final String txArgsJSON, final String signature, final Callback callback) {
|
||||
Log.d(TAG, "sendTransactionWithSignature");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable runnableTask = new Runnable() {
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.decompressPublicKey(multiCodecKey);
|
||||
String res = Statusgo.sendTransactionWithSignature(txArgsJSON, signature);
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(runnableTask);
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void deserializeAndCompressKey(final String desktopKey, final Callback callback) throws JSONException {
|
||||
public void sendTransaction(final String txArgsJSON, final String password, final Callback callback) {
|
||||
Log.d(TAG, "sendTransaction");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable runnableTask = new Runnable() {
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.deserializeAndCompressKey(desktopKey);
|
||||
String res = Statusgo.sendTransaction(txArgsJSON, password);
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(runnableTask);
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void hashTypedData(final String data, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.hashTypedData(data), callback);
|
||||
public void signMessage(final String rpcParams, final Callback callback) {
|
||||
Log.d(TAG, "signMessage");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.signMessage(rpcParams);
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void hashTypedDataV4(final String data, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.hashTypedDataV4(data), callback);
|
||||
public void recover(final String rpcParams, final Callback callback) {
|
||||
Log.d(TAG, "recover");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.recover(rpcParams);
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void sendTransactionWithSignature(final String txArgsJSON, final String signature, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.sendTransactionWithSignature(txArgsJSON, signature), callback);
|
||||
public void signTypedData(final String data, final String account, final String password, final Callback callback) {
|
||||
Log.d(TAG, "signTypedData");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.signTypedData(data, account, password);
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void sendTransaction(final String txArgsJSON, final String password, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.sendTransaction(txArgsJSON, password), callback);
|
||||
}
|
||||
public void signTypedDataV4(final String data, final String account, final String password, final Callback callback) {
|
||||
Log.d(TAG, "signTypedDataV4");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void signMessage(final String rpcParams, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.signMessage(rpcParams), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void recover(final String rpcParams, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.recover(rpcParams), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void signTypedData(final String data, final String account, final String password, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.signTypedData(data, account, password), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void signTypedDataV4(final String data, final String account, final String password, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.signTypedDataV4(data, account, password), callback);
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.signTypedDataV4(data, account, password);
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
@@ -1034,13 +1240,29 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void callRPC(final String payload, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.callRPC(payload), callback);
|
||||
public void callRPC(final String payload, final Callback callback) {
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.callRPC(payload);
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void callPrivateRPC(final String payload, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.callPrivateRPC(payload), callback);
|
||||
public void callPrivateRPC(final String payload, final Callback callback) {
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.callPrivateRPC(payload);
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
@@ -1103,30 +1325,105 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void extractGroupMembershipSignatures(final String signaturePairs, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.extractGroupMembershipSignatures(signaturePairs), callback);
|
||||
public void extractGroupMembershipSignatures(final String signaturePairs, final Callback callback) {
|
||||
Log.d(TAG, "extractGroupMembershipSignatures");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String result = Statusgo.extractGroupMembershipSignatures(signaturePairs);
|
||||
|
||||
callback.invoke(result);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void signGroupMembership(final String content, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.signGroupMembership(content), callback);
|
||||
public void signGroupMembership(final String content, final Callback callback) {
|
||||
Log.d(TAG, "signGroupMembership");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String result = Statusgo.signGroupMembership(content);
|
||||
|
||||
callback.invoke(result);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void getNodeConfig(final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.getNodeConfig(), callback);
|
||||
public void getNodeConfig(final Callback callback) {
|
||||
Log.d(TAG, "getNodeConfig");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String result = Statusgo.getNodeConfig();
|
||||
|
||||
callback.invoke(result);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void deleteMultiaccount(final String keyUID, final Callback callback) throws JSONException {
|
||||
public void deleteMultiaccount(final String keyUID, final Callback callback) {
|
||||
Log.d(TAG, "deleteMultiaccount");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
final String keyStoreDir = this.getKeyStorePath(keyUID);
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.deleteMultiaccount(keyUID, keyStoreDir), callback);
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.deleteMultiaccount(keyUID, keyStoreDir);
|
||||
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void deleteImportedKey(final String keyUID, final String address, final String password, final Callback callback) throws JSONException {
|
||||
public void deleteImportedKey(final String keyUID, final String address, final String password, final Callback callback) {
|
||||
Log.d(TAG, "deleteImportedKey");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
final String keyStoreDir = this.getKeyStorePath(keyUID);
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.deleteImportedKey(address, password, keyStoreDir), callback);
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.deleteImportedKey(address, password, keyStoreDir);
|
||||
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||
@@ -1135,8 +1432,24 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void generateAliasAsync(final String seed, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.generateAlias(seed), callback);
|
||||
public void generateAliasAsync(final String seed, final Callback callback) {
|
||||
Log.d(TAG, "generateAliasAsync");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.generateAlias(seed);
|
||||
|
||||
Log.d(TAG, res);
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||
@@ -1200,33 +1513,47 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void identiconAsync(final String seed, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.identicon(seed), callback);
|
||||
public void identiconAsync(final String seed, final Callback callback) {
|
||||
Log.d(TAG, "identiconAsync");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String res = Statusgo.identicon(seed);
|
||||
|
||||
Log.d(TAG, res);
|
||||
callback.invoke(res);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void generateAliasAndIdenticonAsync(final String seed, final Callback callback) {
|
||||
Log.d(TAG, "generateAliasAndIdenticonAsync");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Log.d(TAG, "generateAliasAndIdenticonAsync");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String resIdenticon = Statusgo.identicon(seed);
|
||||
String resAlias = Statusgo.generateAlias(seed);
|
||||
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String resIdenticon = Statusgo.identicon(seed);
|
||||
String resAlias = Statusgo.generateAlias(seed);
|
||||
|
||||
Log.d(TAG, resIdenticon);
|
||||
Log.d(TAG, resAlias);
|
||||
callback.invoke(resAlias, resIdenticon);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
Log.d(TAG, resIdenticon);
|
||||
Log.d(TAG, resAlias);
|
||||
callback.invoke(resAlias, resIdenticon);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1248,8 +1575,24 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void validateMnemonic(final String seed, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.validateMnemonic(seed), callback);
|
||||
public void validateMnemonic(final String seed, final Callback callback) {
|
||||
Log.d(TAG, "validateMnemonic");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String resValidateMnemonic = Statusgo.validateMnemonic(seed);
|
||||
|
||||
Log.d(TAG, resValidateMnemonic);
|
||||
callback.invoke(resValidateMnemonic);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
@@ -1300,14 +1643,35 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void reEncryptDbAndKeystore(final String keyUID, final String password, final String newPassword, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.changeDatabasePassword(keyUID, password, newPassword), callback);
|
||||
public void reEncryptDbAndKeystore(final String keyUID, final String password, final String newPassword, final Callback callback) {
|
||||
Log.d(TAG, "reEncryptDbAndKeyStore");
|
||||
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// changes db password and re-encrypts keystore
|
||||
String result = Statusgo.changeDatabasePassword(keyUID, password, newPassword);
|
||||
callback.invoke(result);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void convertToKeycardAccount(final String keyUID, final String accountData, final String options, final String password, final String newPassword, final Callback callback) throws JSONException {
|
||||
public void convertToKeycardAccount(final String keyUID, final String accountData, final String options, final String password, final String newPassword, final Callback callback) {
|
||||
Log.d(TAG, "convertToKeycardAccount");
|
||||
|
||||
final String keyStoreDir = this.getKeyStorePath(keyUID);
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.convertToKeycardAccount(keyStoreDir, accountData, options, password, newPassword), callback);
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String result = Statusgo.convertToKeycardAccount(keyStoreDir, accountData, options, password, newPassword);
|
||||
callback.invoke(result);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -339,38 +339,6 @@ RCT_EXPORT_METHOD(inputConnectionStringForBootstrapping:(NSString *)cs
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(multiformatSerializePublicKey:(NSString *)multiCodecKey
|
||||
base58btc:(NSString *)base58btc
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
NSString *result = StatusgoMultiformatSerializePublicKey(multiCodecKey,base58btc);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(multiformatDeserializePublicKey:(NSString *)multiCodecKey
|
||||
base58btc:(NSString *)base58btc
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
NSString *result = StatusgoMultiformatDeserializePublicKey(multiCodecKey,base58btc);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(decompressPublicKey:(NSString *)multiCodecKey
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
NSString *result = StatusgoDecompressPublicKey(multiCodecKey);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(compressPublicKey:(NSString *)multiCodecKey
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
NSString *result = StatusgoCompressPublicKey(multiCodecKey);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(deserializeAndCompressKey:(NSString *)desktopKey
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
NSString *result = StatusgoDeserializeAndCompressKey(desktopKey);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(hashTypedData:(NSString *)data
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
|
||||
@@ -51,45 +51,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "borkdude/edamame/0.0.11-alpha.28/edamame-0.0.11-alpha.28",
|
||||
"host": "https://repo.clojars.org",
|
||||
"pom": {
|
||||
"sha1": "488f403591739aab5a68ce6e7f82c0e855c23fd6",
|
||||
"sha256": "1cw712kzza733g55s02ql35q630zd8j8nmnpivcczjkg240jans4"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "371f3e232e7fdb04b7b2044825eb9822280e8f93",
|
||||
"sha256": "1iyxq6jypjd875cgdyllknh27mx5fnkyjz80mr927d5i94r0ywj4"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "borkdude/sci.impl.reflector/0.0.1/sci.impl.reflector-0.0.1",
|
||||
"host": "https://repo.clojars.org",
|
||||
"pom": {
|
||||
"sha1": "eb3aff6c7db85d91f7e05b98e06d1354a4fce36c",
|
||||
"sha256": "1bvr7cvpbvqi7swypzpbfrig16zipwvmg4m47y2x5chs5czwxv15"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "33dfc86102e0ea400498cbca47572459c1c43b00",
|
||||
"sha256": "0a5gxmj8kzc01y9bn7l4x7c1v5q9wcbvw5hdr525d3ylsyl6xfkw"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "borkdude/sci/0.2.1-alpha.1/sci-0.2.1-alpha.1",
|
||||
"host": "https://repo.clojars.org",
|
||||
"pom": {
|
||||
"sha1": "516cb8e3a8e430d59d9c3e7a51f9f859e3b249e0",
|
||||
"sha256": "1nrww29m90q1avaahw7i5418c18crc3cidhbg3ml7h7vjjplsl9y"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "96e39dcbc3fb3a41c6bf2e628303cf0f534b28a3",
|
||||
"sha256": "1cjvz85ls982rmx90igv4mcfaa53fj5z29df9mf4jplyig3l9dxb"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "cider/cider-nrepl/0.25.3/cider-nrepl-0.25.3",
|
||||
"host": "https://repo.clojars.org",
|
||||
@@ -117,15 +78,15 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "clj-stacktrace/clj-stacktrace/0.2.8/clj-stacktrace-0.2.8",
|
||||
"path": "cljfmt/cljfmt/0.6.7/cljfmt-0.6.7",
|
||||
"host": "https://repo.clojars.org",
|
||||
"pom": {
|
||||
"sha1": "c5a47e6858344c9fd42eecafc7920a7a18d6126d",
|
||||
"sha256": "1az0fs9k5xvzl8bz564apd77kqc83nl8sxsrvmswmbmkamvy4hd3"
|
||||
"sha1": "3d7ac9112908c9c9349adc056d1d06ae2cd33c21",
|
||||
"sha256": "1q46q43mykn61f032y5734j84gcjca41pwd3iik9xghnzmphy2mn"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "b0654b98763199ee57182526465d823492d1cc3f",
|
||||
"sha256": "1029wd82qyxv6ji9pd38m32nqia56h6845lqv4ym4dsz5i201g9a"
|
||||
"sha1": "91e8afa2c19db72acdef7f881aad905871ba6e69",
|
||||
"sha256": "0ara83gaqnafjgr2aqz5zqmywdsmhsz483xkkxpiwbn9lfqvidmh"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -143,15 +104,15 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "cljsjs/react-dom-server/17.0.1-0/react-dom-server-17.0.1-0",
|
||||
"path": "cljsjs/react/17.0.1-0/react-17.0.1-0",
|
||||
"host": "https://repo.clojars.org",
|
||||
"pom": {
|
||||
"sha1": "ff154f318e1f63061b5bd42d9a38fc8547360cb4",
|
||||
"sha256": "166ynlrph7rx3nql0c85c37vcbcsnwbjamk71hw74rz451pgnncr"
|
||||
"sha1": "d5d3681281585d981375fe7bb29362bfcd0d4449",
|
||||
"sha256": "0rskh6mfq5h0l0wybs68w9v585a6zlnnfgrvsf5k3h51fk2p28da"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "d5c53eca9f3884402c76268b82e3828223dcbf90",
|
||||
"sha256": "1530hwqpxzxfjm6dy77whqwjzzx79jpnd9xvnkxy1lnk7l7lj494"
|
||||
"sha1": "726da8a9305a865df90d81e9a8d58f87ff0ee8bd",
|
||||
"sha256": "0bfmvw8gk98vdf9azll6041r1jaz1pmb0dyb35cfc8dr3mmr4ag7"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -169,15 +130,15 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "cljsjs/react/17.0.1-0/react-17.0.1-0",
|
||||
"path": "cljsjs/react-dom-server/17.0.1-0/react-dom-server-17.0.1-0",
|
||||
"host": "https://repo.clojars.org",
|
||||
"pom": {
|
||||
"sha1": "d5d3681281585d981375fe7bb29362bfcd0d4449",
|
||||
"sha256": "0rskh6mfq5h0l0wybs68w9v585a6zlnnfgrvsf5k3h51fk2p28da"
|
||||
"sha1": "ff154f318e1f63061b5bd42d9a38fc8547360cb4",
|
||||
"sha256": "166ynlrph7rx3nql0c85c37vcbcsnwbjamk71hw74rz451pgnncr"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "726da8a9305a865df90d81e9a8d58f87ff0ee8bd",
|
||||
"sha256": "0bfmvw8gk98vdf9azll6041r1jaz1pmb0dyb35cfc8dr3mmr4ag7"
|
||||
"sha1": "d5c53eca9f3884402c76268b82e3828223dcbf90",
|
||||
"sha256": "1530hwqpxzxfjm6dy77whqwjzzx79jpnd9xvnkxy1lnk7l7lj494"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -311,6 +272,32 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "com/googlecode/java-diff-utils/diffutils/1.3.0/diffutils-1.3.0",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"pom": {
|
||||
"sha1": "7d5e372ff32c90095800f96d8308c41af0285a41",
|
||||
"sha256": "1dj7p0m0kwnjvy1y3kq63zb6bw0azjf79i5xbccmy3wv63b1vqrg"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "7e060dd5b19431e6d198e91ff670644372f60fbd",
|
||||
"sha256": "1hn5plp7iyl626h8mrra56sysfm2qannj1dapr1m5afwkb24vfk1"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"pom": {
|
||||
"sha1": "5e902aae26ac5c36f6420f689f43333129dd69e2",
|
||||
"sha256": "10vzlnl8vbjv2jqf818wdb7kgy9c6qjka7fjmmi3vdpg1mcn6pv6"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "c9ad4a0850ab676c5c64461a05ca524cdfff59f1",
|
||||
"sha256": "170rflxnqnah0265ik2aylmxkshyqbf2zas9bp2l32xqj9l6jsaf"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "com/google/elemental2/elemental2-core/1.0.0-RC1/elemental2-core-1.0.0-RC1",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -441,19 +428,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"pom": {
|
||||
"sha1": "5e902aae26ac5c36f6420f689f43333129dd69e2",
|
||||
"sha256": "10vzlnl8vbjv2jqf818wdb7kgy9c6qjka7fjmmi3vdpg1mcn6pv6"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "c9ad4a0850ab676c5c64461a05ca524cdfff59f1",
|
||||
"sha256": "170rflxnqnah0265ik2aylmxkshyqbf2zas9bp2l32xqj9l6jsaf"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "com/ibm/icu/icu4j/66.1/icu4j-66.1",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -467,6 +441,58 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "commons-codec/commons-codec/1.10/commons-codec-1.10",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"pom": {
|
||||
"sha1": "44b9477418d2942d45550f7e7c66c16262062d0e",
|
||||
"sha256": "1yscxabk7i59vgfjg7c1y3prj39h1d8prnwgxbisc4ni29qdpf5x"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "4b95f4897fa13f2cd904aee711aeafc0c5295cd8",
|
||||
"sha256": "0scm6321zz76dc3bs8sy2qyami755lz4lq5455gl67bi9slxyha2"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"pom": {
|
||||
"sha1": "65112009d674333c1acfafb4e198ff250d710764",
|
||||
"sha256": "007nyd66fqp3fbrmnsbfp1fpkhmr2lk33qmkp3salqld3xd7qlc8"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "f95188e3d372e20e7328706c37ef366e5d7859b0",
|
||||
"sha256": "1xyyl54sfxsdcwxdyq6b0azmr31b4dwqns850jjkw9a9dwrh5v54"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "commons-io/commons-io/2.6/commons-io-2.6",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"pom": {
|
||||
"sha1": "5060835593e5b6ed18c82fc2e782f0a3c30a00b1",
|
||||
"sha256": "0q4a6fp6xkyd86ikymkyv2plhf9vj8aqvggxg9d1yad2jcw8c8qc"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "815893df5f31da2ece4040fe0a12fd44b577afaf",
|
||||
"sha256": "04v5fg53jl9gbn6pyz3l7kbpxv0xjzyasnw6yd1a3hhacq2d6xzq"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "compojure/compojure/1.5.2/compojure-1.5.2",
|
||||
"host": "https://repo.clojars.org",
|
||||
"pom": {
|
||||
"sha1": "9e8da477b6682094d56802cb155291a2acb829bd",
|
||||
"sha256": "036z64iprypccz03iq7lqxvw99xjh4xlsfmfwbs37pmhfnfmbdnx"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "0b5258d0616ffc5f64c2b6d95f09de56d24df439",
|
||||
"sha256": "1s2k05lwnlm9a66mxnsss437i9gp70dny8y2rlfkl090s6mdqsaf"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "com/taoensso/encore/2.105.0/encore-2.105.0",
|
||||
"host": "https://repo.clojars.org",
|
||||
@@ -545,58 +571,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "commons-codec/commons-codec/1.10/commons-codec-1.10",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"pom": {
|
||||
"sha1": "44b9477418d2942d45550f7e7c66c16262062d0e",
|
||||
"sha256": "1yscxabk7i59vgfjg7c1y3prj39h1d8prnwgxbisc4ni29qdpf5x"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "4b95f4897fa13f2cd904aee711aeafc0c5295cd8",
|
||||
"sha256": "0scm6321zz76dc3bs8sy2qyami755lz4lq5455gl67bi9slxyha2"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"pom": {
|
||||
"sha1": "65112009d674333c1acfafb4e198ff250d710764",
|
||||
"sha256": "007nyd66fqp3fbrmnsbfp1fpkhmr2lk33qmkp3salqld3xd7qlc8"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "f95188e3d372e20e7328706c37ef366e5d7859b0",
|
||||
"sha256": "1xyyl54sfxsdcwxdyq6b0azmr31b4dwqns850jjkw9a9dwrh5v54"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "commons-io/commons-io/2.6/commons-io-2.6",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"pom": {
|
||||
"sha1": "5060835593e5b6ed18c82fc2e782f0a3c30a00b1",
|
||||
"sha256": "0q4a6fp6xkyd86ikymkyv2plhf9vj8aqvggxg9d1yad2jcw8c8qc"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "815893df5f31da2ece4040fe0a12fd44b577afaf",
|
||||
"sha256": "04v5fg53jl9gbn6pyz3l7kbpxv0xjzyasnw6yd1a3hhacq2d6xzq"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "compojure/compojure/1.5.2/compojure-1.5.2",
|
||||
"host": "https://repo.clojars.org",
|
||||
"pom": {
|
||||
"sha1": "9e8da477b6682094d56802cb155291a2acb829bd",
|
||||
"sha256": "036z64iprypccz03iq7lqxvw99xjh4xlsfmfwbs37pmhfnfmbdnx"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "0b5258d0616ffc5f64c2b6d95f09de56d24df439",
|
||||
"sha256": "1s2k05lwnlm9a66mxnsss437i9gp70dny8y2rlfkl090s6mdqsaf"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "crypto-equality/crypto-equality/1.0.0/crypto-equality-1.0.0",
|
||||
"host": "https://repo.clojars.org",
|
||||
@@ -675,19 +649,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "hashp/hashp/0.2.1/hashp-0.2.1",
|
||||
"host": "https://repo.clojars.org",
|
||||
"pom": {
|
||||
"sha1": "32530b9106a64fd5442d2aa27c6da4175d1f1440",
|
||||
"sha256": "1z94k8c52r87rq3nhc0mqazcxff6d4phi8gy1bgndhiz4nq1mia7"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "fb501db2eb4a028c1875382d58c17c381aec47b8",
|
||||
"sha256": "1lwirzb60zvksvkb3arpwi4fk1xnp0x5ljmrca5vf7dq25lmwmsd"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "hiccup/hiccup/1.0.5/hiccup-1.0.5",
|
||||
"host": "https://repo.clojars.org",
|
||||
@@ -818,32 +779,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "mvxcvi/arrangement/1.2.0/arrangement-1.2.0",
|
||||
"host": "https://repo.clojars.org",
|
||||
"pom": {
|
||||
"sha1": "4f19bd291595870162eadd35456a0b2e76444a64",
|
||||
"sha256": "1qqnl05nwcjnzhlgplcsbckrp8pqvf8n6bf8kr8rz7lz2q4px3vb"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "036e640bb9e14c2aa95589a45a018eb8358ce3f6",
|
||||
"sha256": "1m3v1rkpdmv7aym5vq2swh0mf9mg7xppdr3vrl4g6qm3s42c24b7"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "mvxcvi/puget/1.3.1/puget-1.3.1",
|
||||
"host": "https://repo.clojars.org",
|
||||
"pom": {
|
||||
"sha1": "07104dc20a13c7e255fffee4f16de9a6873c187f",
|
||||
"sha256": "1129rb3qksg7n85j03k6d3sr6868g724097vxids1r4wqj2phxkf"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "a4f7dcf71ccd8d69d4ecd2b19f3d671dfc169308",
|
||||
"sha256": "029znh7p8f1h91gri4jhzwqsa0rnn3i34yr3kav55npym2sw5sfp"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "net/cgrand/macrovich/0.2.1/macrovich-0.2.1",
|
||||
"host": "https://repo.clojars.org",
|
||||
@@ -949,15 +884,15 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/core.rrb-vector/0.1.2/core.rrb-vector-0.1.2",
|
||||
"path": "org/clojure/core.rrb-vector/0.1.1/core.rrb-vector-0.1.1",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"pom": {
|
||||
"sha1": "e9336ac820c5a7e07fe0aa431df981cbab6db3e3",
|
||||
"sha256": "07q9qmxc7ggaxh27imgs34svn4j269rhslbnrs63ahrqzk5bmqlf"
|
||||
"sha1": "3231642aa1dcf628c864a5f208cd293fbd6a385a",
|
||||
"sha256": "18kk5sds5lg8r2kidhz9qpgyrvggkj8j4sgfdsmyyl93w3f16lnp"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "0404feea925608b921b56acd11d3b187a0d33fe4",
|
||||
"sha256": "13hkx1285f2imqlj6wbgyxki2yg8rmfr49iq1zijxm1cgfx8xyai"
|
||||
"sha1": "aafb7677ec1e9f344fc834bbbdb91e8ba02af474",
|
||||
"sha256": "0cqyy1vqrhilgwrdxsibd7360ch3hhwjnbbnzsak38v6i6mg66xl"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1000,19 +935,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/google-closure-library-third-party/0.0-20191016-6ae1f72f/google-closure-library-third-party-0.0-20191016-6ae1f72f",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"pom": {
|
||||
"sha1": "1aa0b32fd70e6644dcb06b88b55630d6bbb6f188",
|
||||
"sha256": "1wq6gvhlvy3mdhj1cb0w62kclqd7x42dqd0275l40rlla5q5h1z1"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "4fc15daa4fd1b150e8c6d32755796634446dd86a",
|
||||
"sha256": "1ykw162gng0lcbxn2f387vv1l4d7hfwyayhxgzqqgi9jx211fzw5"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/google-closure-library/0.0-20191016-6ae1f72f/google-closure-library-0.0-20191016-6ae1f72f",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -1026,6 +948,19 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/google-closure-library-third-party/0.0-20191016-6ae1f72f/google-closure-library-third-party-0.0-20191016-6ae1f72f",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"pom": {
|
||||
"sha1": "1aa0b32fd70e6644dcb06b88b55630d6bbb6f188",
|
||||
"sha256": "1wq6gvhlvy3mdhj1cb0w62kclqd7x42dqd0275l40rlla5q5h1z1"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "4fc15daa4fd1b150e8c6d32755796634446dd86a",
|
||||
"sha256": "1ykw162gng0lcbxn2f387vv1l4d7hfwyayhxgzqqgi9jx211fzw5"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/spec.alpha/0.2.176/spec.alpha-0.2.176",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -1052,19 +987,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/tools.analyzer.jvm/1.1.0/tools.analyzer.jvm-1.1.0",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"pom": {
|
||||
"sha1": "3f21bdbd549557232eb0bf0965b2beea34004d52",
|
||||
"sha256": "0cyyhf82pn4mjw4whr4sx3cnxrgsk862dq92gn79yawxr6842i51"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "027d2ebe594eb5f46d6bcea62593e184937b3011",
|
||||
"sha256": "0kcfcn12dmyrm7sk1jkrlcb7ws8kazfqziv62mfid62xc095gayz"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/tools.analyzer/1.0.0/tools.analyzer-1.0.0",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -1078,6 +1000,19 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/tools.analyzer.jvm/1.1.0/tools.analyzer.jvm-1.1.0",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"pom": {
|
||||
"sha1": "3f21bdbd549557232eb0bf0965b2beea34004d52",
|
||||
"sha256": "0cyyhf82pn4mjw4whr4sx3cnxrgsk862dq92gn79yawxr6842i51"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "027d2ebe594eb5f46d6bcea62593e184937b3011",
|
||||
"sha256": "0kcfcn12dmyrm7sk1jkrlcb7ws8kazfqziv62mfid62xc095gayz"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/clojure/tools.cli/1.0.194/tools.cli-1.0.194",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -1143,19 +1078,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/graalvm/js/js-scriptengine/20.1.0/js-scriptengine-20.1.0",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"pom": {
|
||||
"sha1": "020bac4e8232f0b051e3e6b8033f67653cf9c685",
|
||||
"sha256": "1avd7kmwh0i6nkcirwl358a6lkpqwara0f5a7qiw1fjivc81qmzq"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "a4accb1ced82da8d61bd2928f435de8af548dc2b",
|
||||
"sha256": "03001wa3xs08lw2rz27w5s0fyspyhkiiarqsrq9yf8gfysmnik2s"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/graalvm/js/js/20.1.0/js-20.1.0",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -1169,6 +1091,19 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/graalvm/js/js-scriptengine/20.1.0/js-scriptengine-20.1.0",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"pom": {
|
||||
"sha1": "020bac4e8232f0b051e3e6b8033f67653cf9c685",
|
||||
"sha256": "1avd7kmwh0i6nkcirwl358a6lkpqwara0f5a7qiw1fjivc81qmzq"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "a4accb1ced82da8d61bd2928f435de8af548dc2b",
|
||||
"sha256": "03001wa3xs08lw2rz27w5s0fyspyhkiiarqsrq9yf8gfysmnik2s"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/graalvm/regex/regex/20.1.0/regex-20.1.0",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -1299,6 +1234,19 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/ow2/asm/asm/7.1/asm-7.1",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"pom": {
|
||||
"sha1": "7e40eb6619fd20bd7d98bf775bfdd810aec87ac7",
|
||||
"sha256": "101i3pyrq082kjyz413hfqwkjjsyfnk9kx3rqr38ln56mlp78a8g"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "fa29aa438674ff19d5e1386d2c3527a0267f291e",
|
||||
"sha256": "1pnlb1ick32bihpzc599xl9ppd07qhls6pm0xaqwrj9cdlmzmcja"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/ow2/asm/asm-analysis/7.1/asm-analysis-7.1",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -1351,19 +1299,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/ow2/asm/asm/7.1/asm-7.1",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
"pom": {
|
||||
"sha1": "7e40eb6619fd20bd7d98bf775bfdd810aec87ac7",
|
||||
"sha256": "101i3pyrq082kjyz413hfqwkjjsyfnk9kx3rqr38ln56mlp78a8g"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "fa29aa438674ff19d5e1386d2c3527a0267f291e",
|
||||
"sha256": "1pnlb1ick32bihpzc599xl9ppd07qhls6pm0xaqwrj9cdlmzmcja"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "org/wildfly/client/wildfly-client-config/1.0.1.Final/wildfly-client-config-1.0.1.Final",
|
||||
"host": "https://repo1.maven.org/maven2",
|
||||
@@ -1416,6 +1351,19 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "reagent/reagent/1.0.0/reagent-1.0.0",
|
||||
"host": "https://repo.clojars.org",
|
||||
"pom": {
|
||||
"sha1": "93ad5ccb0101108fb0843a3f2c50da28f8fd8336",
|
||||
"sha256": "1l4xzgc4wbd8b29mhj5j336cf8w1zccaia0w413zf3bnj6jf5m38"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "a1dd4d40425bb2e1afad0fe72780b43ff394ccfa",
|
||||
"sha256": "1g607s1ymns85923bvhwrsj0y5czyqqq1jmxx0a58fnsm1b318fa"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "re-com/re-com/2.8.0/re-com-2.8.0",
|
||||
"host": "https://repo.clojars.org",
|
||||
@@ -1429,6 +1377,19 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "refactor-nrepl/refactor-nrepl/2.5.0/refactor-nrepl-2.5.0",
|
||||
"host": "https://repo.clojars.org",
|
||||
"pom": {
|
||||
"sha1": "0bce30b420249ba7e4b90cbb3e046b4bb5416389",
|
||||
"sha256": "0zmg5qc8d55pry7832isiwd2q237znfjqjpxchd2hvlpalh5qnva"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "6bc3441afc94f7ca024e41a864ca75e05df7e207",
|
||||
"sha256": "0w8hax99y98l53mixxzx2ja0vcnhjv8dnsaz1zj3vqk775ns5w6i"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "re-frame/re-frame/0.12.0/re-frame-0.12.0",
|
||||
"host": "https://repo.clojars.org",
|
||||
@@ -1468,32 +1429,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "reagent/reagent/1.0.0/reagent-1.0.0",
|
||||
"host": "https://repo.clojars.org",
|
||||
"pom": {
|
||||
"sha1": "93ad5ccb0101108fb0843a3f2c50da28f8fd8336",
|
||||
"sha256": "1l4xzgc4wbd8b29mhj5j336cf8w1zccaia0w413zf3bnj6jf5m38"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "a1dd4d40425bb2e1afad0fe72780b43ff394ccfa",
|
||||
"sha256": "1g607s1ymns85923bvhwrsj0y5czyqqq1jmxx0a58fnsm1b318fa"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "refactor-nrepl/refactor-nrepl/2.5.0/refactor-nrepl-2.5.0",
|
||||
"host": "https://repo.clojars.org",
|
||||
"pom": {
|
||||
"sha1": "0bce30b420249ba7e4b90cbb3e046b4bb5416389",
|
||||
"sha256": "0zmg5qc8d55pry7832isiwd2q237znfjqjpxchd2hvlpalh5qnva"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "6bc3441afc94f7ca024e41a864ca75e05df7e207",
|
||||
"sha256": "0w8hax99y98l53mixxzx2ja0vcnhjv8dnsaz1zj3vqk775ns5w6i"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "rewrite-clj/rewrite-clj/0.6.1/rewrite-clj-0.6.1",
|
||||
"host": "https://repo.clojars.org",
|
||||
@@ -1508,15 +1443,15 @@
|
||||
},
|
||||
|
||||
{
|
||||
"path": "rewrite-cljs/rewrite-cljs/0.4.5/rewrite-cljs-0.4.5",
|
||||
"path": "rewrite-cljs/rewrite-cljs/0.4.4/rewrite-cljs-0.4.4",
|
||||
"host": "https://repo.clojars.org",
|
||||
"pom": {
|
||||
"sha1": "378cd53218027b9a93640dcf64c040665f6c9c6b",
|
||||
"sha256": "1qrhrgzhqdyqizh0ngnr4zgj9xkfzq0qhsws4pxxra3qc9ikl9cq"
|
||||
"sha1": "4e7a2542517a5b0231631305461603605bea1592",
|
||||
"sha256": "050imgkzw5q7200klwrkd4v32xxy1f4aghs8g4ma5dbg4rl4pgcd"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "c35be115c39dadc71a4de3f584aa8ca295e11257",
|
||||
"sha256": "1dnw0jhr1hhqz80w3z5d8qdbaqdvgzg4fyhv6lffa51c9ca1dsr1"
|
||||
"sha1": "dd14a371d0d09eedccb39f01e3edabefb2d1e64f",
|
||||
"sha256": "0hb07wg71i2bjn8wzs8q6w1nb3jb2s36nhr9kv9mc0gyrr6im244"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1648,18 +1583,5 @@
|
||||
"sha1": "09af0b348e6253dcf9fd567d0d22ffebdea46176",
|
||||
"sha256": "1qg2iyblykfkzmplc2c46916b9m0h5ad6lxmvrk5qn3pdxqr8vw0"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "zprint/zprint/1.1.1/zprint-1.1.1",
|
||||
"host": "https://repo.clojars.org",
|
||||
"pom": {
|
||||
"sha1": "d7225bdc4978d3a8eac8613187cddd2efb9e39d2",
|
||||
"sha256": "0yyy31h88zww238c2v4zi9va3pjp7ii76zjggglakd3wm1fdbnck"
|
||||
},
|
||||
"jar": {
|
||||
"sha1": "3bd9bbedb188a66ccf72c1e22819e8e423a6757a",
|
||||
"sha256": "1bvrarxw0dqvxlhj6gdwrv6mklzh4p79537g293fqlm07f2knfph"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -2,16 +2,13 @@ args4j/args4j/2.0.26/args4j-2.0.26.jar
|
||||
bidi/bidi/2.1.6/bidi-2.1.6.jar
|
||||
binaryage/env-config/0.2.2/env-config-0.2.2.jar
|
||||
binaryage/oops/0.7.0/oops-0.7.0.jar
|
||||
borkdude/edamame/0.0.11-alpha.28/edamame-0.0.11-alpha.28.jar
|
||||
borkdude/sci.impl.reflector/0.0.1/sci.impl.reflector-0.0.1.jar
|
||||
borkdude/sci/0.2.1-alpha.1/sci-0.2.1-alpha.1.jar
|
||||
cider/cider-nrepl/0.25.3/cider-nrepl-0.25.3.jar
|
||||
cider/piggieback/0.4.1/piggieback-0.4.1.jar
|
||||
clj-stacktrace/clj-stacktrace/0.2.8/clj-stacktrace-0.2.8.jar
|
||||
cljfmt/cljfmt/0.6.7/cljfmt-0.6.7.jar
|
||||
cljs-bean/cljs-bean/1.3.0/cljs-bean-1.3.0.jar
|
||||
cljsjs/react-dom-server/17.0.1-0/react-dom-server-17.0.1-0.jar
|
||||
cljsjs/react-dom/17.0.1-0/react-dom-17.0.1-0.jar
|
||||
cljsjs/react/17.0.1-0/react-17.0.1-0.jar
|
||||
cljsjs/react-dom/17.0.1-0/react-dom-17.0.1-0.jar
|
||||
cljsjs/react-dom-server/17.0.1-0/react-dom-server-17.0.1-0.jar
|
||||
clout/clout/2.1.2/clout-2.1.2.jar
|
||||
com/andrewmcveigh/cljs-time/0.5.2/cljs-time-0.5.2.jar
|
||||
com/bhauman/cljs-test-display/0.1.1/cljs-test-display-0.1.1.jar
|
||||
@@ -22,6 +19,8 @@ com/cognitect/transit-js/0.8.846/transit-js-0.8.846.jar
|
||||
com/fasterxml/jackson/core/jackson-core/2.8.7/jackson-core-2.8.7.jar
|
||||
com/google/code/findbugs/jsr305/3.0.1/jsr305-3.0.1.jar
|
||||
com/google/code/gson/gson/2.7/gson-2.7.jar
|
||||
com/googlecode/java-diff-utils/diffutils/1.3.0/diffutils-1.3.0.jar
|
||||
com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar
|
||||
com/google/elemental2/elemental2-core/1.0.0-RC1/elemental2-core-1.0.0-RC1.jar
|
||||
com/google/errorprone/error_prone_annotations/2.3.1/error_prone_annotations-2.3.1.jar
|
||||
com/google/guava/guava/25.1-jre/guava-25.1-jre.jar
|
||||
@@ -32,25 +31,23 @@ com/google/jsinterop/base/1.0.0/base-1.0.0.jar
|
||||
com/google/jsinterop/jsinterop-annotations/1.0.2/jsinterop-annotations-1.0.2.jar
|
||||
com/google/protobuf/protobuf-java/3.11.1/protobuf-java-3.11.1.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/ibm/icu/icu4j/66.1/icu4j-66.1.jar
|
||||
commons-codec/commons-codec/1.10/commons-codec-1.10.jar
|
||||
commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4.jar
|
||||
commons-io/commons-io/2.6/commons-io-2.6.jar
|
||||
compojure/compojure/1.5.2/compojure-1.5.2.jar
|
||||
com/taoensso/encore/2.105.0/encore-2.105.0.jar
|
||||
com/taoensso/timbre/4.10.0/timbre-4.10.0.jar
|
||||
com/taoensso/truss/1.5.0/truss-1.5.0.jar
|
||||
com/taoensso/tufte/2.1.0/tufte-2.1.0.jar
|
||||
com/wsscode/pathom/2.2.31/pathom-2.2.31.jar
|
||||
com/wsscode/spec-inspec/1.0.0-alpha2/spec-inspec-1.0.0-alpha2.jar
|
||||
commons-codec/commons-codec/1.10/commons-codec-1.10.jar
|
||||
commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4.jar
|
||||
commons-io/commons-io/2.6/commons-io-2.6.jar
|
||||
compojure/compojure/1.5.2/compojure-1.5.2.jar
|
||||
crypto-equality/crypto-equality/1.0.0/crypto-equality-1.0.0.jar
|
||||
crypto-random/crypto-random/1.2.0/crypto-random-1.2.0.jar
|
||||
day8/re-frame/test/0.1.5/test-0.1.5.jar
|
||||
edn-query-language/eql/0.0.9/eql-0.0.9.jar
|
||||
expound/expound/0.8.5/expound-0.8.5.jar
|
||||
fipp/fipp/0.6.23/fipp-0.6.23.jar
|
||||
hashp/hashp/0.2.1/hashp-0.2.1.jar
|
||||
hiccup/hiccup/1.0.5/hiccup-1.0.5.jar
|
||||
hickory/hickory/0.7.1/hickory-0.7.1.jar
|
||||
http-kit/http-kit/2.2.0/http-kit-2.2.0.jar
|
||||
@@ -61,8 +58,6 @@ 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
|
||||
medley/medley/0.8.2/medley-0.8.2.jar
|
||||
mvxcvi/alphabase/1.0.0/alphabase-1.0.0.jar
|
||||
mvxcvi/arrangement/1.2.0/arrangement-1.2.0.jar
|
||||
mvxcvi/puget/1.3.1/puget-1.3.1.jar
|
||||
net/cgrand/macrovich/0.2.1/macrovich-0.2.1.jar
|
||||
nrepl/nrepl/0.7.0/nrepl-0.7.0.jar
|
||||
org/checkerframework/checker-qual/2.0.0/checker-qual-2.0.0.jar
|
||||
@@ -71,23 +66,23 @@ org/clojure/clojurescript/1.10.773/clojurescript-1.10.773.jar
|
||||
org/clojure/core.async/1.3.610/core.async-1.3.610.jar
|
||||
org/clojure/core.cache/1.0.207/core.cache-1.0.207.jar
|
||||
org/clojure/core.memoize/1.0.236/core.memoize-1.0.236.jar
|
||||
org/clojure/core.rrb-vector/0.1.2/core.rrb-vector-0.1.2.jar
|
||||
org/clojure/core.rrb-vector/0.1.1/core.rrb-vector-0.1.1.jar
|
||||
org/clojure/core.specs.alpha/0.2.44/core.specs.alpha-0.2.44.jar
|
||||
org/clojure/data.json/1.0.0/data.json-1.0.0.jar
|
||||
org/clojure/data.priority-map/1.0.0/data.priority-map-1.0.0.jar
|
||||
org/clojure/google-closure-library-third-party/0.0-20191016-6ae1f72f/google-closure-library-third-party-0.0-20191016-6ae1f72f.jar
|
||||
org/clojure/google-closure-library/0.0-20191016-6ae1f72f/google-closure-library-0.0-20191016-6ae1f72f.jar
|
||||
org/clojure/google-closure-library-third-party/0.0-20191016-6ae1f72f/google-closure-library-third-party-0.0-20191016-6ae1f72f.jar
|
||||
org/clojure/spec.alpha/0.2.176/spec.alpha-0.2.176.jar
|
||||
org/clojure/test.check/1.1.0/test.check-1.1.0.jar
|
||||
org/clojure/tools.analyzer.jvm/1.1.0/tools.analyzer.jvm-1.1.0.jar
|
||||
org/clojure/tools.analyzer/1.0.0/tools.analyzer-1.0.0.jar
|
||||
org/clojure/tools.analyzer.jvm/1.1.0/tools.analyzer.jvm-1.1.0.jar
|
||||
org/clojure/tools.cli/1.0.194/tools.cli-1.0.194.jar
|
||||
org/clojure/tools.logging/0.4.1/tools.logging-0.4.1.jar
|
||||
org/clojure/tools.macro/0.1.5/tools.macro-0.1.5.jar
|
||||
org/clojure/tools.reader/1.3.3/tools.reader-1.3.3.jar
|
||||
org/codehaus/mojo/animal-sniffer-annotations/1.14/animal-sniffer-annotations-1.14.jar
|
||||
org/graalvm/js/js-scriptengine/20.1.0/js-scriptengine-20.1.0.jar
|
||||
org/graalvm/js/js/20.1.0/js-20.1.0.jar
|
||||
org/graalvm/js/js-scriptengine/20.1.0/js-scriptengine-20.1.0.jar
|
||||
org/graalvm/regex/regex/20.1.0/regex-20.1.0.jar
|
||||
org/graalvm/sdk/graal-sdk/20.1.0/graal-sdk-20.1.0.jar
|
||||
org/graalvm/truffle/truffle-api/20.1.0/truffle-api-20.1.0.jar
|
||||
@@ -98,23 +93,23 @@ 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/jsoup/jsoup/1.9.2/jsoup-1.9.2.jar
|
||||
org/msgpack/msgpack/0.6.12/msgpack-0.6.12.jar
|
||||
org/ow2/asm/asm/7.1/asm-7.1.jar
|
||||
org/ow2/asm/asm-analysis/7.1/asm-analysis-7.1.jar
|
||||
org/ow2/asm/asm-commons/7.1/asm-commons-7.1.jar
|
||||
org/ow2/asm/asm-tree/7.1/asm-tree-7.1.jar
|
||||
org/ow2/asm/asm-util/7.1/asm-util-7.1.jar
|
||||
org/ow2/asm/asm/7.1/asm-7.1.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.2.Final/wildfly-common-1.5.2.Final.jar
|
||||
prismatic/schema/1.1.7/schema-1.1.7.jar
|
||||
quoin/quoin/0.1.2/quoin-0.1.2.jar
|
||||
reagent/reagent/1.0.0/reagent-1.0.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/0.12.0/re-frame-0.12.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.0.0/reagent-1.0.0.jar
|
||||
refactor-nrepl/refactor-nrepl/2.5.0/refactor-nrepl-2.5.0.jar
|
||||
rewrite-clj/rewrite-clj/0.6.1/rewrite-clj-0.6.1.jar
|
||||
rewrite-cljs/rewrite-cljs/0.4.5/rewrite-cljs-0.4.5.jar
|
||||
rewrite-cljs/rewrite-cljs/0.4.4/rewrite-cljs-0.4.4.jar
|
||||
ring-cors/ring-cors/0.1.8/ring-cors-0.1.8.jar
|
||||
ring/ring-codec/1.1.2/ring-codec-1.1.2.jar
|
||||
ring/ring-core/1.8.1/ring-core-1.8.1.jar
|
||||
@@ -125,4 +120,3 @@ thheller/shadow-cljs/2.11.16/shadow-cljs-2.11.16-aot.jar
|
||||
thheller/shadow-cljsjs/0.0.21/shadow-cljsjs-0.0.21.jar
|
||||
thheller/shadow-util/0.7.0/shadow-util-0.7.0.jar
|
||||
viebel/codox-klipse-theme/0.0.1/codox-klipse-theme-0.0.1.jar
|
||||
zprint/zprint/1.1.1/zprint-1.1.1.jar
|
||||
|
||||
@@ -17,8 +17,6 @@ in mkShell {
|
||||
lsof # used in start-react-native.sh
|
||||
# build specific utilities
|
||||
clojure maven watchman
|
||||
# lint specific utilities
|
||||
clj-kondo zprint
|
||||
# other nice to have stuff
|
||||
yarn nodejs python27
|
||||
] # and some special cases
|
||||
|
||||
@@ -23,7 +23,7 @@ let
|
||||
|
||||
# for calling clojure targets in CI or Makefile
|
||||
clojure = mkShell {
|
||||
buildInputs = with pkgs; [ clojure flock maven openjdk ];
|
||||
buildInputs = with pkgs; [ clojure flock maven openjdk clj-kondo ];
|
||||
inputsFrom = [ nodejs-sh ];
|
||||
# CLASSPATH from clojure deps with 'src' appended to find local sources.
|
||||
shellHook = with pkgs; ''
|
||||
|
||||
@@ -89,7 +89,6 @@
|
||||
"@testing-library/jest-native": "^5.0.0",
|
||||
"@testing-library/react-native": "^11.2.0",
|
||||
"@types/jest": "^28.1.6",
|
||||
"concurrently": "^7.6.0",
|
||||
"detox": "^19.9.1",
|
||||
"jest": "^25.1.0",
|
||||
"jest-circus": "^26.0.0",
|
||||
|
||||
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 878 B |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
@@ -19,9 +19,10 @@
|
||||
;; routing
|
||||
[bidi "2.1.6"]
|
||||
;; test dependencies
|
||||
[camel-snake-kebab "0.4.3"]
|
||||
[day8.re-frame/test "0.1.5"]
|
||||
[com.taoensso/tufte "2.1.0"]]
|
||||
[com.taoensso/tufte "2.1.0"]
|
||||
;; linting
|
||||
[cljfmt/cljfmt "0.6.7"]]
|
||||
|
||||
;; port and middleware for repl in development
|
||||
:nrepl {:port 7888
|
||||
@@ -82,25 +83,23 @@
|
||||
:output-dir "target/test"
|
||||
:optimizations :simple
|
||||
:target :node-test
|
||||
;; When running tests without a REPL you can uncomment below line to `make test-watch` a specific file
|
||||
;;:ns-regexp "status-im2.subs.subs-test$"
|
||||
:main
|
||||
status-im.test-runner/main
|
||||
;; When running tests without a REPL you can uncomment the below line to `make test-watch` a specific
|
||||
;; file
|
||||
;:ns-regexp "status-im.chat.models-test$"
|
||||
:main status-im.test-runner/main
|
||||
;; set :ui-driven to true to let shadow-cljs inject node-repl
|
||||
:ui-driven
|
||||
true
|
||||
:ui-driven true
|
||||
:closure-defines
|
||||
{status-im.utils.config/POKT_TOKEN #shadow/env "POKT_TOKEN"
|
||||
status-im.utils.config/OPENSEA_API_KEY #shadow/env "OPENSEA_API_KEY"}
|
||||
:compiler-options
|
||||
{;; needed because we override require and it
|
||||
;; messes with source-map which reports callstack
|
||||
;; exceeded exceptions instead of real issues
|
||||
:source-map false
|
||||
;; needed because we use deref in tests
|
||||
:static-fns false
|
||||
:optimizations :simple
|
||||
:infer-externs true}}
|
||||
:compiler-options {;; needed because we override require and it
|
||||
;; messes with source-map which reports callstack
|
||||
;; exceeded exceptions instead of real issues
|
||||
:source-map false
|
||||
;; needed because we use deref in tests
|
||||
:static-fns false
|
||||
:optimizations :simple
|
||||
:infer-externs true}}
|
||||
|
||||
;; mock.js-dependencies is mocking the react-native libraries
|
||||
;; we build it as a node library so that it can be required by
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
[clojure.string :as string]
|
||||
[status-im.goog.i18n :as goog.i18n]))
|
||||
|
||||
(defn setup
|
||||
(defn init
|
||||
[default-device-language translations-by-locale]
|
||||
(set! (.-fallbacks i18n) true)
|
||||
(set! (.-defaultSeparator i18n) "/")
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
import {useDerivedValue, runOnJS as reaRunOnJS, runOnJS} from "react-native-reanimated";
|
||||
|
||||
export function useTranslateY(initialTranslationY, bottomSheetDy, panY) {
|
||||
return useDerivedValue(() => {
|
||||
return initialTranslationY - (bottomSheetDy.value - panY.value)
|
||||
})
|
||||
}
|
||||
|
||||
export function useBackgroundOpacity(translateY, backgroundHeight, windowHeight) {
|
||||
return useDerivedValue(() => {
|
||||
const opacity = ((translateY.value - windowHeight) / -backgroundHeight) * 0.5
|
||||
|
||||
return Math.max(Math.min(opacity, 0.5), 0)
|
||||
})
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
import { useDerivedValue } from 'react-native-reanimated';
|
||||
|
||||
const MAX_SCALE = 1.8;
|
||||
|
||||
export function ringScale(scale, subtract) {
|
||||
return useDerivedValue(
|
||||
function () {
|
||||
'worklet'
|
||||
const value = scale.value;
|
||||
const maxDelta = MAX_SCALE - 1;
|
||||
const maxDeltaDiff = 1 - maxDelta;
|
||||
const maxVirtualScale = MAX_SCALE + maxDelta;
|
||||
const decimals = value - Math.floor(value);
|
||||
const normalizedValue = value >= maxVirtualScale ? (decimals + ((parseInt(value) - 1) * maxDeltaDiff) + 1) : value;
|
||||
return (((normalizedValue - subtract) > MAX_SCALE ? normalizedValue - maxDelta : normalizedValue) - subtract);
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
import { useDerivedValue, interpolate } from 'react-native-reanimated';
|
||||
|
||||
// Generic Worklets
|
||||
|
||||
export function applyAnimationsToStyle(animations, style) {
|
||||
@@ -29,12 +27,3 @@ export function applyAnimationsToStyle(animations, style) {
|
||||
return Object.assign(animatedStyle, style);
|
||||
};
|
||||
};
|
||||
|
||||
export function interpolateValue(sharedValue, inputRange, outputRange) {
|
||||
return useDerivedValue(
|
||||
function () {
|
||||
'worklet'
|
||||
return interpolate(sharedValue.value, inputRange, outputRange);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,22 +4,6 @@
|
||||
(:require [status-im.utils.test :as utils.test])
|
||||
(:require [status-im.chat.default-chats :refer (default-chats)]))
|
||||
|
||||
;; to generate a js Proxy at js/__STATUS_MOBILE_JS_IDENTITY_PROXY__ that accept any (.xxx) call and
|
||||
;; return itself
|
||||
;; For the convenience to mock eg.
|
||||
;; (-> reanimated/slide-out-up-animation .springify (.damping 20) (.stiffness 300))
|
||||
;; (-> reanimated/slide-out-up-animation (.damping 20) .springify (.stiffness 300))
|
||||
(js/eval
|
||||
"
|
||||
var globalThis
|
||||
if (typeof window === \"undefined\") {
|
||||
globalThis = global
|
||||
} else {
|
||||
globalThis = window
|
||||
}
|
||||
globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return () => globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__}})
|
||||
")
|
||||
|
||||
(def action-button #js {:default #js {:Item #js {}}})
|
||||
(def config #js {:default #js {}})
|
||||
(def camera #js {:RNCamera #js {:Constants #js {}}})
|
||||
@@ -138,10 +122,8 @@ globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return (
|
||||
(def react-native-share #js {:default {}})
|
||||
(def react-native-svg
|
||||
#js
|
||||
{:SvgUri #js {:render identity}
|
||||
:SvgXml #js {:render identity}
|
||||
:default #js {:render identity}
|
||||
:Path #js {:render identity}})
|
||||
{:SvgUri #js {:render identity}
|
||||
:SvgXml #js {:render identity}})
|
||||
(def react-native-webview #js {:default {}})
|
||||
(def react-native-audio-toolkit #js {:MediaStates {}})
|
||||
(def net-info #js {})
|
||||
@@ -254,10 +236,7 @@ globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return (
|
||||
:withTiming (fn [])
|
||||
:withDelay (fn [])
|
||||
:Easing #js {:bezier identity}
|
||||
:Keyframe (fn [])
|
||||
:SlideOutUp js/__STATUS_MOBILE_JS_IDENTITY_PROXY__
|
||||
:SlideInUp js/__STATUS_MOBILE_JS_IDENTITY_PROXY__
|
||||
:LinearTransition js/__STATUS_MOBILE_JS_IDENTITY_PROXY__})
|
||||
:Keyframe (fn [])})
|
||||
(def react-native-gesture-handler
|
||||
#js
|
||||
{:default #js {}
|
||||
@@ -342,9 +321,6 @@ globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return (
|
||||
|
||||
(def shell-worklets #js {})
|
||||
|
||||
(def bottom-sheet #js {})
|
||||
(def record-audio-worklets #js {})
|
||||
|
||||
;; Update i18n_resources.cljs
|
||||
(defn mock
|
||||
[module]
|
||||
@@ -393,8 +369,6 @@ globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return (
|
||||
"react-native-svg" react-native-svg
|
||||
"../src/js/worklet_factory.js" worklet-factory
|
||||
"../src/js/shell_worklets.js" shell-worklets
|
||||
"../src/js/bottom_sheet.js" bottom-sheet
|
||||
"../src/js/record_audio_worklets.js" record-audio-worklets
|
||||
"./fleets.js" default-fleets
|
||||
"./chats.js" default-chats
|
||||
"@walletconnect/client" wallet-connect-client
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
(ns quo2.components.avatars.account-avatar
|
||||
(:require [quo2.components.icon :as icons]
|
||||
[quo2.foundations.colors :as colors]
|
||||
[quo2.theme :as theme]
|
||||
[react-native.core :as rn]))
|
||||
|
||||
(def icon-color-value
|
||||
{:dark (get-in colors/customization [:dark :purple])
|
||||
:light (get-in colors/customization [:light :purple])})
|
||||
|
||||
(defn get-border-radius
|
||||
[size]
|
||||
(case size
|
||||
@@ -22,11 +27,12 @@
|
||||
20 11))
|
||||
|
||||
(defn account-avatar
|
||||
[{:keys [size icon color]
|
||||
:or {size 80
|
||||
icon :i/placeholder
|
||||
color :purple}}]
|
||||
(let [icon-color (colors/custom-color-by-theme color 50 60)
|
||||
[{:keys [size icon]
|
||||
:or {size 80
|
||||
icon :main-icons/placeholder}}]
|
||||
(let [icon-color (if (theme/dark?)
|
||||
(:dark icon-color-value)
|
||||
(:light icon-color-value))
|
||||
avatar-border-radius (get-border-radius size)
|
||||
inner-icon-size (get-inner-icon-sizes size)]
|
||||
[rn/view
|
||||
|
||||
@@ -24,9 +24,7 @@
|
||||
:align-items :center
|
||||
:justify-content :center
|
||||
:border-radius (/ container-size 2)
|
||||
;:background-color (colors/custom-color-by-theme color 50 60) ; TODO: this is temporary only.
|
||||
;Issue: https://github.com/status-im/status-mobile/issues/14566
|
||||
:background-color color}
|
||||
:background-color (colors/custom-color-by-theme color 50 60)}
|
||||
[icon/icon :i/group
|
||||
{:size icon-size
|
||||
:color colors/white-opa-70}]])))
|
||||
|
||||
@@ -141,7 +141,7 @@
|
||||
(if profile-picture
|
||||
;; display image
|
||||
[fast-image/fast-image
|
||||
{:source profile-picture
|
||||
{:source {:uri profile-picture}
|
||||
:style (container-styling inner-dimensions outer-dimensions)}]
|
||||
;; else display initials
|
||||
[container inner-dimensions outer-dimensions
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
(ns quo2.components.banners.--tests--.banner-component-spec
|
||||
(:require ["@testing-library/react-native" :as rtl]
|
||||
[quo2.components.banners.banner.view :as banner]
|
||||
[reagent.core :as reagent]))
|
||||
|
||||
(defn render-banner
|
||||
[opts]
|
||||
(rtl/render (reagent/as-element [banner/banner opts])))
|
||||
|
||||
(js/global.test "basic render of banner component"
|
||||
(fn []
|
||||
(render-banner {:pins-count "5"
|
||||
:latest-pin-text "this message"})
|
||||
(-> (js/expect (rtl/screen.getByText "this message"))
|
||||
(.toBeTruthy))
|
||||
(-> (js/expect (rtl/screen.getByText "5"))
|
||||
(.toBeTruthy))))
|
||||
@@ -1,19 +0,0 @@
|
||||
(ns quo2.components.banners.banner.style
|
||||
(:require [quo2.foundations.colors :as colors]))
|
||||
|
||||
|
||||
(def container
|
||||
{:width "100%"
|
||||
:height 50
|
||||
:background-color colors/primary-50-opa-20
|
||||
:flex-direction :row
|
||||
:align-items :center
|
||||
:padding-horizontal 20
|
||||
:padding-vertical 10})
|
||||
|
||||
(def counter
|
||||
{:padding-right 22
|
||||
:height 20
|
||||
:width 20
|
||||
:justify-content :center
|
||||
:align-items :center})
|
||||
@@ -1,24 +0,0 @@
|
||||
(ns quo2.components.banners.banner.view
|
||||
(:require [quo2.components.banners.banner.style :as style]
|
||||
[quo2.components.counter.counter :as counter]
|
||||
[quo2.components.icon :as icons]
|
||||
[quo2.components.markdown.text :as text]
|
||||
[react-native.core :as rn]))
|
||||
|
||||
(defn banner
|
||||
[{:keys [show-pin? latest-pin-text pins-count on-press]}]
|
||||
[rn/touchable-opacity
|
||||
{:accessibility-label :pinned-banner
|
||||
:style style/container
|
||||
:active-opacity 1
|
||||
:on-press on-press}
|
||||
(when show-pin? [icons/icon :i/pin {:size 20}])
|
||||
[text/text
|
||||
{:number-of-lines 1
|
||||
:size :paragraph-2
|
||||
:style {:margin-left 10 :margin-right 50}}
|
||||
latest-pin-text]
|
||||
[rn/view
|
||||
{:accessibility-label :pins-count
|
||||
:style style/counter}
|
||||
(when (pos? pins-count) [counter/counter {:type :secondary} pins-count])]])
|
||||
@@ -1,28 +0,0 @@
|
||||
(ns quo2.components.buttons.--tests--.buttons-component-spec
|
||||
(:require ["@testing-library/react-native" :as rtl]
|
||||
[quo2.components.buttons.button :as button]
|
||||
[reagent.core :as reagent]))
|
||||
|
||||
(defn render-button
|
||||
([options label]
|
||||
(rtl/render (reagent/as-element [button/button options label]))))
|
||||
|
||||
(js/global.test "default render of button component"
|
||||
(fn []
|
||||
(render-button {:accessibility-label "test-button"} "")
|
||||
(-> (js/expect (rtl/screen.getByLabelText "test-button"))
|
||||
(.toBeTruthy))))
|
||||
|
||||
(js/global.test "button renders with a label"
|
||||
(fn []
|
||||
(render-button {} "test-label")
|
||||
(-> (js/expect (rtl/screen.getByText "test-label"))
|
||||
(.toBeTruthy))))
|
||||
|
||||
(js/global.test "button on-press works"
|
||||
(let [event (js/jest.fn)]
|
||||
(fn []
|
||||
(render-button {:on-press event} "test-label")
|
||||
(rtl/fireEvent.press (rtl/screen.getByText "test-label"))
|
||||
(-> (js/expect event)
|
||||
(.toHaveBeenCalledTimes 1)))))
|
||||
@@ -32,9 +32,9 @@
|
||||
:outline {:icon-color colors/neutral-50
|
||||
:icon-secondary-color colors/neutral-50
|
||||
:label-color colors/neutral-100
|
||||
:border-color {:default colors/neutral-30
|
||||
:border-color {:default colors/neutral-20
|
||||
:pressed colors/neutral-40
|
||||
:disabled colors/neutral-30}}
|
||||
:disabled colors/neutral-20}}
|
||||
:ghost {:icon-color colors/neutral-50
|
||||
:icon-secondary-color colors/neutral-50
|
||||
:label-color colors/neutral-100
|
||||
@@ -138,8 +138,7 @@
|
||||
|
||||
(defn shape-style-container
|
||||
[type icon size]
|
||||
{:height size
|
||||
:border-radius (if (and icon (#{:primary :secondary :danger} type))
|
||||
{:border-radius (if (and icon (#{:primary :secondary :danger} type))
|
||||
24
|
||||
(case size
|
||||
56 12
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
:notification-up :i/arrow-up
|
||||
:search-with-label :i/search
|
||||
:search :i/search
|
||||
:scroll-to-bottom :i/arrow-down)
|
||||
:bottom :i/arrow-down)
|
||||
{:size 12
|
||||
:color (get-icon-and-text-color type)
|
||||
:container-style {:margin-top 6
|
||||
@@ -43,7 +43,7 @@
|
||||
:notification-up 2
|
||||
:search-with-label 8
|
||||
:search 6
|
||||
:scroll-to-bottom 6)
|
||||
:bottom 6)
|
||||
:margin-right (case type
|
||||
:jump-to 8
|
||||
:mention 2
|
||||
@@ -51,12 +51,12 @@
|
||||
:notification-up 8
|
||||
:search-with-label 4
|
||||
:search 6
|
||||
:scroll-to-bottom 6)}}])
|
||||
:bottom 6)}}])
|
||||
|
||||
(defn dynamic-button
|
||||
"[dynamic-button opts]
|
||||
opts
|
||||
{:type :jump-to/:mention/:notification-down/:notification-up/:search/:search-with-label/:scroll-to-bottom
|
||||
{:type :jump-to/:mention/:notification-down/:notification-up/:search/:search-with-label/:bottom
|
||||
:on-press fn
|
||||
:count mentions or notifications count
|
||||
:customization-color customize jump-to and mention button color}"
|
||||
@@ -77,7 +77,7 @@
|
||||
:border-radius 12
|
||||
:background-color (get-button-color type @pressed? (or customization-color :primary))}
|
||||
style)}
|
||||
(when (#{:mention :search :search-with-label :scroll-to-bottom} type)
|
||||
(when (#{:mention :search :search-with-label :bottom} type)
|
||||
[icon-view type])
|
||||
(when (#{:jump-to :mention :notification-down :notification-up :search-with-label} type)
|
||||
[text/text
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
(ns quo2.components.community.community-card-view
|
||||
(:require [quo2.components.community.community-view :as community-view]
|
||||
[quo2.components.community.icon :as icon]
|
||||
[quo2.components.community.style :as style]
|
||||
[react-native.core :as rn]))
|
||||
|
||||
(defn community-card-view-item
|
||||
[{:keys [name description locked images
|
||||
[{:keys [name description locked
|
||||
status tokens cover tags width]} on-press]
|
||||
[rn/touchable-opacity
|
||||
{:accessibility-label :community-card-item
|
||||
:on-press on-press}
|
||||
[rn/touchable-opacity {:on-press on-press}
|
||||
[rn/view {:style (style/community-card 20)}
|
||||
[rn/view
|
||||
{:style {:width width
|
||||
@@ -25,9 +22,9 @@
|
||||
{:flex 1
|
||||
:border-radius 20}}]]
|
||||
[rn/view (style/card-view-content-container 12)
|
||||
[rn/view (style/card-view-chat-icon 48)
|
||||
[icon/community-icon {:images images} 48]]
|
||||
|
||||
[rn/view (style/card-view-chat-icon 48)]
|
||||
;;TODO new pure component based on quo2 should be implemented without status-im usage
|
||||
;[communities.icon/community-icon-redesign community 48]]
|
||||
(when (= status :gated)
|
||||
[rn/view (style/permission-tag-styles)
|
||||
[community-view/permission-tag-container
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
(ns quo2.components.community.icon
|
||||
(:require [react-native.core :as rn]))
|
||||
|
||||
(defn community-icon
|
||||
[{:keys [images]} size]
|
||||
(let [thumbnail-image (get-in images [:thumbnail :uri])]
|
||||
[rn/image
|
||||
{:source {:uri thumbnail-image}
|
||||
:style {:border-radius 50
|
||||
:border-width 0
|
||||
:border-color :transparent
|
||||
:width size
|
||||
:height size}}]))
|
||||
@@ -7,7 +7,7 @@
|
||||
[quo2.components.markdown.text :as text]
|
||||
[quo2.components.tags.token-tag :as token-tag]
|
||||
[quo2.foundations.colors :as colors]
|
||||
[i18n.i18n :as i18n]
|
||||
[status-im.i18n.i18n :as i18n]
|
||||
[status-im.ui.components.fast-image :as fast-image]))
|
||||
|
||||
(def ^:private token-tag-horizontal-spacing 7)
|
||||
|
||||
@@ -10,25 +10,25 @@
|
||||
(rtl/render (reagent/as-element [counter/counter opts value]))))
|
||||
|
||||
(js/global.test "default render of counter component"
|
||||
(fn []
|
||||
(render-counter)
|
||||
(-> (js/expect (rtl/screen.getByTestId "counter-component"))
|
||||
(.toBeTruthy))))
|
||||
(fn []
|
||||
(render-counter)
|
||||
(-> (js/expect (rtl/screen.getByTestId "counter-component"))
|
||||
(.toBeTruthy))))
|
||||
|
||||
(js/global.test "renders counter with a string value"
|
||||
(fn []
|
||||
(render-counter {} "1")
|
||||
(-> (js/expect (rtl/screen.getByText "1"))
|
||||
(.toBeTruthy))))
|
||||
(fn []
|
||||
(render-counter {} "1")
|
||||
(-> (js/expect (rtl/screen.getByText "1"))
|
||||
(.toBeTruthy))))
|
||||
|
||||
(js/global.test "renders counter with an integer value"
|
||||
(fn []
|
||||
(render-counter {} 1)
|
||||
(-> (js/expect (rtl/screen.getByText "1"))
|
||||
(.toBeTruthy))))
|
||||
(fn []
|
||||
(render-counter {} 1)
|
||||
(-> (js/expect (rtl/screen.getByText "1"))
|
||||
(.toBeTruthy))))
|
||||
|
||||
(js/global.test "renders counter with value 99+ when the value is greater than 99"
|
||||
(fn []
|
||||
(render-counter {} "100")
|
||||
(-> (js/expect (rtl/screen.getByText "99+"))
|
||||
(.toBeTruthy))))
|
||||
(fn []
|
||||
(render-counter {} "100")
|
||||
(-> (js/expect (rtl/screen.getByText "99+"))
|
||||
(.toBeTruthy))))
|
||||
@@ -1,45 +0,0 @@
|
||||
(ns quo2.components.dividers.--tests--.divider-label-component-spec
|
||||
(:require ["@testing-library/react-native" :as rtl]
|
||||
[quo2.components.dividers.divider-label :as divider-label]
|
||||
[reagent.core :as reagent]))
|
||||
|
||||
(defn render-divider-label
|
||||
([]
|
||||
(render-divider-label {}))
|
||||
([opts]
|
||||
(rtl/render (reagent/as-element [divider-label/divider-label opts]))))
|
||||
|
||||
(js/global.test "default render of divider-label component"
|
||||
(fn []
|
||||
(render-divider-label)
|
||||
(-> (js/expect (rtl/screen.getByLabelText "divider-label"))
|
||||
(.toBeTruthy))))
|
||||
|
||||
(js/global.test "render divider-label component with a label"
|
||||
(fn []
|
||||
(render-divider-label {:label :hello})
|
||||
(-> (js/expect (rtl/screen.getByText "hello"))
|
||||
(.toBeTruthy))))
|
||||
|
||||
(js/global.test "render divider-label component with a counter-value"
|
||||
(fn []
|
||||
(render-divider-label {:label :hello
|
||||
:counter-value "1"})
|
||||
(-> (js/expect (rtl/screen.getByText "1"))
|
||||
(.toBeTruthy))))
|
||||
|
||||
(js/global.test "divider-label chevron icon renders to the left when set"
|
||||
(fn []
|
||||
(render-divider-label {:label :hello
|
||||
:counter-value "1"
|
||||
:chevron-position :left})
|
||||
(-> (js/expect (rtl/screen.getByTestId "divider-label-icon-left"))
|
||||
(.toBeTruthy))))
|
||||
|
||||
(js/global.test "divider-label chevron icon renders to the right when set"
|
||||
(fn []
|
||||
(render-divider-label {:label :hello
|
||||
:counter-value "1"
|
||||
:chevron-position :right})
|
||||
(-> (js/expect (rtl/screen.getByTestId "divider-label-icon-right"))
|
||||
(.toBeTruthy))))
|
||||
@@ -23,18 +23,14 @@
|
||||
text-and-icon-color (if dark? colors/neutral-40 colors/neutral-50)
|
||||
counter-text-color (if dark? colors/white colors/neutral-100)]
|
||||
[rn/view
|
||||
{:accessible true
|
||||
:accessibility-label :divider-label
|
||||
:style {:border-top-width 1
|
||||
:border-top-color border-and-counter-bg-color
|
||||
:padding-top padding-top
|
||||
:padding-horizontal 16
|
||||
:align-items :center
|
||||
:flex-direction :row}}
|
||||
{:style {:border-top-width 1
|
||||
:border-top-color border-and-counter-bg-color
|
||||
:padding-top padding-top
|
||||
:padding-horizontal 16
|
||||
:align-items :center
|
||||
:flex-direction :row}}
|
||||
(when (= chevron-position :left)
|
||||
[rn/view
|
||||
{:test-ID :divider-label-icon-left
|
||||
:style {:margin-right 4}}
|
||||
[rn/view {:style {:margin-right 4}}
|
||||
[icons/icon
|
||||
:main-icons/chevron-down
|
||||
{:color text-and-icon-color
|
||||
@@ -47,11 +43,10 @@
|
||||
:flex 1}}
|
||||
label]
|
||||
(when (= chevron-position :right)
|
||||
[rn/view {:test-ID :divider-label-icon-right}
|
||||
[icons/icon
|
||||
:main-icons/chevron-down
|
||||
{:color text-and-icon-color
|
||||
:size chevron-icon-container-width}]])
|
||||
[icons/icon
|
||||
:main-icons/chevron-down
|
||||
{:color text-and-icon-color
|
||||
:size chevron-icon-container-width}])
|
||||
(when (pos? counter-value)
|
||||
[rn/view
|
||||
{:style {:border-radius 6
|
||||
|
||||
@@ -8,46 +8,56 @@
|
||||
(rtl/render (reagent/as-element [action-drawer/action-drawer options]))))
|
||||
|
||||
(js/global.test "action-drawer renders with elements label displaying"
|
||||
(fn []
|
||||
(render-action-drawer [[{:icon :i/friend
|
||||
:label "a sample label"}]])
|
||||
(-> (js/expect (rtl/screen.getByText "a sample label"))
|
||||
(.toBeTruthy))))
|
||||
(fn []
|
||||
(render-action-drawer [[{:icon :i/friend
|
||||
:label "a sample label"}]])
|
||||
(-> (js/expect (rtl/screen.getByText "a sample label"))
|
||||
(.toBeTruthy))))
|
||||
|
||||
(js/global.test "action-drawer renders with elements sub-label displaying"
|
||||
(fn []
|
||||
(render-action-drawer [[{:icon :i/friend
|
||||
:label "a sample label"
|
||||
:sub-label "a sample sub label"}]])
|
||||
(-> (js/expect (rtl/screen.getByText "a sample sub label"))
|
||||
(.toBeTruthy))))
|
||||
(fn []
|
||||
(render-action-drawer [[{:icon :i/friend
|
||||
:label "a sample label"
|
||||
:sub-label "a sample sub label"}]])
|
||||
(-> (js/expect (rtl/screen.getByText "a sample sub label"))
|
||||
(.toBeTruthy))))
|
||||
|
||||
(js/global.test "action-drawer on click action works on element"
|
||||
(let [event (js/jest.fn)]
|
||||
(fn []
|
||||
(render-action-drawer [[{:icon :i/friend
|
||||
:label "a sample label"
|
||||
:on-press event}]])
|
||||
(rtl/fireEvent.press (rtl/screen.getByText "a sample label"))
|
||||
(-> (js/expect event)
|
||||
(.toHaveBeenCalled)))))
|
||||
(let [event (js/jest.fn)]
|
||||
(fn []
|
||||
(render-action-drawer [[{:icon :i/friend
|
||||
:label "a sample label"
|
||||
:on-press event}]])
|
||||
(rtl/fireEvent.press (rtl/screen.getByText "a sample label"))
|
||||
(-> (js/expect event)
|
||||
(.toHaveBeenCalled)))))
|
||||
|
||||
(js/global.test "action-drawer renders two icons when set"
|
||||
(fn []
|
||||
(render-action-drawer [[{:icon :i/friend
|
||||
:label "a sample label"
|
||||
:right-icon :i/friend
|
||||
:accessibility-label :first-element}]])
|
||||
(-> (js/expect (rtl/screen.getByLabelText "right-icon-for-action"))
|
||||
(.toBeTruthy))
|
||||
(-> (js/expect (rtl/screen.queryByLabelText "left-icon-for-action"))
|
||||
(.toBeTruthy))))
|
||||
(fn []
|
||||
(render-action-drawer [[{:icon :i/friend
|
||||
:label "a sample label"
|
||||
:right-icon :i/friend
|
||||
:accessibility-label :first-element}]])
|
||||
(-> (js/expect (rtl/screen.getByLabelText "right-icon-for-action"))
|
||||
(.toBeTruthy))
|
||||
(-> (js/expect (rtl/screen.queryByLabelText "left-icon-for-action"))
|
||||
(.toBeTruthy))))
|
||||
|
||||
(js/global.test "action-drawer does not render a divider when the add-divider? prop is false"
|
||||
(fn []
|
||||
(render-action-drawer [[{:icon :i/friend
|
||||
:label "a sample label"
|
||||
:add-divider? false
|
||||
:accessibility-label :first-element}]])
|
||||
(-> (js/expect (rtl/screen.getAllByLabelText "divider"))
|
||||
(.not)
|
||||
(.toBeTruthy))))
|
||||
|
||||
(js/global.test "action-drawer renders a divider when the add-divider? prop is true"
|
||||
(fn []
|
||||
(render-action-drawer [[{:icon :i/friend
|
||||
:label "a sample label"
|
||||
:add-divider? true
|
||||
:accessibility-label :first-element}]])
|
||||
(-> (js/expect (rtl/screen.getAllByLabelText "divider"))
|
||||
(.toBeTruthy))))
|
||||
(fn []
|
||||
(render-action-drawer [[{:icon :i/friend
|
||||
:label "a sample label"
|
||||
:add-divider? true
|
||||
:accessibility-label :first-element}]])
|
||||
(-> (js/expect (rtl/screen.getAllByLabelText "divider"))
|
||||
(.toBeTruthy))))
|
||||
@@ -41,5 +41,4 @@
|
||||
(get-icons 16)
|
||||
(get-icons 20)
|
||||
(get-icons 24)
|
||||
(get-icons 32)
|
||||
(get-icons 120)))
|
||||
(get-icons 32)))
|
||||
|
||||
@@ -15,24 +15,22 @@
|
||||
:text-color (theme-colors colors/danger-50 colors/danger-60)}))
|
||||
|
||||
(defn menu-item
|
||||
[{:keys [type title accessibility-label icon on-press style-props subtitle subtitle-color]
|
||||
[{:keys [type title accessibility-label icon on-press]
|
||||
:or {type :main}}]
|
||||
(let [{:keys [icon-color text-color background]} (themes type)]
|
||||
[rn/touchable-opacity
|
||||
(merge {:accessibility-label accessibility-label
|
||||
:style (merge style-props
|
||||
{:background-color background
|
||||
:height 48
|
||||
:flex-direction :row
|
||||
:align-items :center})}
|
||||
:style {:background-color background
|
||||
:height 48
|
||||
:flex-direction :row
|
||||
:align-items :center}}
|
||||
(when on-press
|
||||
{:on-press on-press}))
|
||||
[rn/view
|
||||
{:style {:flex-direction :row
|
||||
:flex-grow 0
|
||||
:flex-shrink 1
|
||||
:padding-horizontal 20
|
||||
:align-items :center}}
|
||||
:padding-horizontal 20}}
|
||||
[rn/view
|
||||
{:style {:width 20
|
||||
:height 20
|
||||
@@ -40,19 +38,10 @@
|
||||
:justify-content :center
|
||||
:margin-right 12}}
|
||||
[icons/icon icon {:color icon-color}]]
|
||||
[rn/view
|
||||
[text/text
|
||||
{:weight :medium
|
||||
:style {:color text-color}
|
||||
:ellipsize-mode :tail
|
||||
:number-of-lines 1
|
||||
:size :paragraph-1}
|
||||
title]
|
||||
(when subtitle
|
||||
[text/text
|
||||
{:weight :medium
|
||||
:style {:color subtitle-color}
|
||||
:ellipsize-mode :tail
|
||||
:number-of-lines 1
|
||||
:size :paragraph-1}
|
||||
subtitle])]]]))
|
||||
[text/text
|
||||
{:weight :medium
|
||||
:style {:color text-color}
|
||||
:ellipsize-mode :tail
|
||||
:number-of-lines 1
|
||||
:size :paragraph-1}
|
||||
title]]]))
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
(ns quo2.components.markdown.--tests--.text-component-spec
|
||||
(:require ["@testing-library/react-native" :as rtl]
|
||||
[quo2.components.markdown.text :as text]
|
||||
[reagent.core :as reagent]))
|
||||
|
||||
(defn render-text
|
||||
([options value]
|
||||
(rtl/render (reagent/as-element [text/text options value]))))
|
||||
|
||||
(js/global.test "text renders with text"
|
||||
(fn []
|
||||
(render-text {} "hello")
|
||||
(-> (js/expect (rtl/screen.getByText "hello"))
|
||||
(.toBeTruthy))))
|
||||
@@ -93,8 +93,7 @@
|
||||
:style style/middle-dot-chat-key}
|
||||
middle-dot])
|
||||
[text/text
|
||||
{:monospace true
|
||||
:size :paragraph-2
|
||||
:accessibility-label :message-timestamp
|
||||
:style (style/time-text ens?)}
|
||||
{:monospace true
|
||||
:size :paragraph-2
|
||||
:style (style/time-text ens?)}
|
||||
time-str]]))])
|
||||
|
||||
@@ -50,4 +50,4 @@
|
||||
[dynamic-button-view :mention dynamic-buttons {:margin-left 8}]
|
||||
[dynamic-button-view :notification-down dynamic-buttons {:margin-left 8}]
|
||||
[dynamic-button-view :notification-up dynamic-buttons {:margin-left 8}]
|
||||
[dynamic-button-view :scroll-to-bottom dynamic-buttons {:margin-left 8}]]]]))]))
|
||||
[dynamic-button-view :bottom dynamic-buttons {:margin-left 8}]]]]))]))
|
||||
|
||||
@@ -146,11 +146,12 @@
|
||||
[rn/view
|
||||
{:style (assoc centrify-style
|
||||
:flex-direction :row
|
||||
:flex 1
|
||||
:justify-content :flex-end)}
|
||||
(let [last-icon-index (-> right-section-buttons count dec)]
|
||||
(map-indexed (fn [index {:keys [icon on-press type style] :or {type :grey}}]
|
||||
(map-indexed (fn [index {:keys [icon on-press type] :or {type :grey}}]
|
||||
^{:key index}
|
||||
[rn/view {:style (merge {:margin-right (if (not= index last-icon-index) 8 0)} style)}
|
||||
[rn/view {:style {:margin-right (if (not= index last-icon-index) 8 0)}}
|
||||
[button/button {:on-press on-press :icon true :type type :size 32}
|
||||
icon]])
|
||||
right-section-buttons))])
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
[quo2.foundations.colors :as colors]
|
||||
[react-native.core :as rn]
|
||||
[reagent.core :as reagent]
|
||||
[i18n.i18n :as i18n]))
|
||||
[status-im.i18n.i18n :as i18n]))
|
||||
|
||||
(def ^:private max-reply-length
|
||||
280)
|
||||
@@ -81,21 +81,19 @@
|
||||
context))))
|
||||
|
||||
(defn- activity-message
|
||||
[{:keys [title body title-number-of-lines body-number-of-lines]}]
|
||||
[{:keys [title body]}]
|
||||
[rn/view {:style style/message-container}
|
||||
(when title
|
||||
[text/text
|
||||
{:size :paragraph-2
|
||||
:accessibility-label :activity-message-title
|
||||
:style style/message-title
|
||||
:number-of-lines title-number-of-lines}
|
||||
:style style/message-title}
|
||||
title])
|
||||
(if (string? body)
|
||||
[text/text
|
||||
{:style style/message-body
|
||||
:accessibility-label :activity-message-body
|
||||
:size :paragraph-1
|
||||
:number-of-lines body-number-of-lines}
|
||||
:size :paragraph-1}
|
||||
body]
|
||||
body)])
|
||||
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
(ns quo2.components.notifications.count-down-circle
|
||||
(:require [goog.string :as gstring]
|
||||
[quo2.foundations.colors :as colors]
|
||||
[quo2.theme :as theme]
|
||||
[react-native.core :as rn]
|
||||
[react-native.svg :as svg]
|
||||
[reagent.core :as reagent]))
|
||||
|
||||
(defn- get-path-props
|
||||
[size stroke-width rotation]
|
||||
(let [half-size (/ size 2)
|
||||
half-stroke-width (/ stroke-width 2)
|
||||
arc-radius (- half-size half-stroke-width)
|
||||
arc-diameter (* arc-radius 2)
|
||||
rotation-indicator (if (= rotation :clockwise) "1,0" "0,1")
|
||||
path-length (* js/Math.PI arc-diameter)
|
||||
path (gstring/format
|
||||
"m %s,%s a %s,%s 0 %s 0,%s a %s,%s 0 %s 0 ,-%s"
|
||||
half-size
|
||||
half-stroke-width
|
||||
arc-radius
|
||||
arc-radius
|
||||
rotation-indicator
|
||||
arc-diameter
|
||||
arc-radius
|
||||
arc-radius
|
||||
rotation-indicator
|
||||
arc-diameter)]
|
||||
{:path path
|
||||
:path-length path-length}))
|
||||
|
||||
(defn- linear-ease
|
||||
[time start goal duration]
|
||||
(if (zero? duration)
|
||||
start
|
||||
(-> time
|
||||
(/ duration)
|
||||
(* goal)
|
||||
(+ start))))
|
||||
|
||||
(defn- get-start-at
|
||||
[duration initial-remaining-time]
|
||||
(cond (or (zero? duration) (= duration initial-remaining-time)) 0
|
||||
(number? initial-remaining-time) (- duration initial-remaining-time)
|
||||
:else 0))
|
||||
|
||||
(def ^:private themes
|
||||
{:color {:light colors/neutral-80-opa-40
|
||||
:dark colors/white-opa-40}})
|
||||
|
||||
(defn circle-timer
|
||||
[{:keys [color duration size stroke-width trail-color rotation initial-remaining-time]}]
|
||||
(let [rotation (or rotation :clockwise)
|
||||
duration (or duration 4)
|
||||
stroke-width (or stroke-width 1)
|
||||
size (or size 9)
|
||||
max-stroke-width (max stroke-width 0)
|
||||
{:keys [path path-length]} (get-path-props size max-stroke-width rotation)
|
||||
start-at (get-start-at duration initial-remaining-time)
|
||||
elapsed-time (reagent/atom 0)
|
||||
prev-frame-time (reagent/atom nil)
|
||||
frame-request (reagent/atom nil)
|
||||
display-time (reagent/atom start-at)
|
||||
;; get elapsed frame time
|
||||
swap-elapsed-time-each-frame (fn swap-elapsed-time-each-frame [frame-time]
|
||||
(if (nil? @prev-frame-time)
|
||||
(do (reset! prev-frame-time frame-time)
|
||||
(reset! frame-request (js/requestAnimationFrame
|
||||
swap-elapsed-time-each-frame)))
|
||||
(let [delta (- (/ frame-time 1000)
|
||||
(/ @prev-frame-time 1000))
|
||||
current-elapsed (swap! elapsed-time + delta)
|
||||
current-display-time (+ start-at current-elapsed)
|
||||
completed? (>= current-display-time duration)]
|
||||
(reset! display-time (if completed?
|
||||
duration
|
||||
current-display-time))
|
||||
(when-not completed?
|
||||
(reset! prev-frame-time frame-time)
|
||||
(reset! frame-request (js/requestAnimationFrame
|
||||
swap-elapsed-time-each-frame))))))]
|
||||
(reagent/create-class
|
||||
{:component-will-unmount #(js/cancelAnimationFrame @frame-request)
|
||||
:reagent-render
|
||||
(fn []
|
||||
(reset! frame-request (js/requestAnimationFrame swap-elapsed-time-each-frame))
|
||||
[rn/view
|
||||
{:style {:position :relative
|
||||
:width size
|
||||
:height size}}
|
||||
[svg/svg
|
||||
{:view-box (str "0 0 " size " " size)
|
||||
:width size
|
||||
:height size}
|
||||
[svg/path
|
||||
{:d path :fill :none :stroke (or trail-color :transparent) :stroke-width stroke-width}]
|
||||
(when-not (= @display-time duration)
|
||||
[svg/path
|
||||
{:d path
|
||||
:fill :none
|
||||
:stroke (or color (get-in themes [:color (theme/get-theme)]))
|
||||
:stroke-linecap :square
|
||||
:stroke-width stroke-width
|
||||
:stroke-dasharray path-length
|
||||
:stroke-dashoffset (linear-ease @display-time 0 path-length duration)}])]])})))
|
||||
@@ -4,23 +4,18 @@
|
||||
[react-native.core :as rn]))
|
||||
|
||||
(defn info-count
|
||||
([count]
|
||||
(info-count {} count))
|
||||
([props count]
|
||||
(when (> count 0)
|
||||
[rn/view
|
||||
(merge props
|
||||
{:style (merge {:width 16
|
||||
:height 16
|
||||
:position :absolute
|
||||
:right 22
|
||||
:border-radius 6
|
||||
:justify-content :center
|
||||
:align-items :center
|
||||
:background-color (colors/theme-colors colors/primary-50 colors/primary-60)}
|
||||
(:style props))})
|
||||
[rn/text
|
||||
{:style (merge typography/font-medium
|
||||
typography/label
|
||||
{:color colors/white :text-align :center})}
|
||||
count]])))
|
||||
[count style]
|
||||
(when (> count 0)
|
||||
[rn/view
|
||||
{:style (merge {:width 16
|
||||
:height 16
|
||||
:position :absolute
|
||||
:right 22
|
||||
:border-radius 6
|
||||
:justify-content :center
|
||||
:align-items :center
|
||||
:background-color (colors/theme-colors colors/primary-50 colors/primary-60)}
|
||||
style)}
|
||||
[rn/text
|
||||
{:style (merge typography/font-medium typography/label {:color colors/white :text-align :center})}
|
||||
count]]))
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
(ns quo2.components.notifications.toast
|
||||
(:require [i18n.i18n :as i18n]
|
||||
[quo2.components.icon :as icon]
|
||||
[quo2.components.markdown.text :as text]
|
||||
[quo2.components.notifications.count-down-circle :as count-down-circle]
|
||||
[quo2.foundations.colors :as colors]
|
||||
[quo2.theme :as theme]
|
||||
[react-native.core :as rn]))
|
||||
|
||||
(def ^:private themes
|
||||
{:container {:light {:background-color colors/white-opa-70}
|
||||
:dark {:background-color colors/neutral-80-opa-70}}
|
||||
:text {:light {:color colors/neutral-100}
|
||||
:dark {:color colors/white}}
|
||||
:icon {:light {:color colors/neutral-100}
|
||||
:dark {:color colors/white}}
|
||||
:action-container {:light {:background-color :colors/neutral-80-opa-5}
|
||||
:dark {:background-color :colors/white-opa-5}}})
|
||||
|
||||
(defn- merge-theme-style
|
||||
[component-key styles]
|
||||
(merge (get-in themes [component-key (theme/get-theme)]) styles))
|
||||
|
||||
(defn toast-action-container
|
||||
[{:keys [on-press style]} & children]
|
||||
[rn/touchable-highlight {:on-press on-press}
|
||||
[into
|
||||
[rn/view
|
||||
{:style (merge
|
||||
{:flex-direction :row
|
||||
:padding-vertical 3
|
||||
:padding-horizontal 8
|
||||
:align-items :center
|
||||
:border-radius 8
|
||||
:background-color (get-in themes
|
||||
[:action-container (theme/get-theme)
|
||||
:background-color])}
|
||||
style)}]
|
||||
children]])
|
||||
|
||||
(defn toast-undo-action
|
||||
[duration on-press]
|
||||
[toast-action-container {:on-press on-press}
|
||||
[rn/view {:style {:margin-right 5}}
|
||||
[count-down-circle/circle-timer {:duration duration}]]
|
||||
[text/text
|
||||
{:size :paragraph-2 :weight :medium :style (merge-theme-style :text {})}
|
||||
[i18n/label :t/undo]]])
|
||||
|
||||
(defn- toast-container
|
||||
[{:keys [left middle right]}]
|
||||
[rn/view {:style {:padding-left 12 :padding-right 12}}
|
||||
[rn/view
|
||||
{:style (merge-theme-style :container
|
||||
{:flex-direction :row
|
||||
:width "100%"
|
||||
:margin :auto
|
||||
:justify-content :space-between
|
||||
:padding-vertical 8
|
||||
:padding-left 10
|
||||
:padding-right 8
|
||||
:border-radius 12})}
|
||||
[rn/view {:style {:padding 2}} left]
|
||||
[rn/view {:style {:padding 4 :flex 1}}
|
||||
[text/text
|
||||
{:size :paragraph-2 :weight :medium :style (merge-theme-style :text {})}
|
||||
middle]]
|
||||
(when right right)]])
|
||||
|
||||
(defn toast
|
||||
[{:keys [icon icon-color text action undo-duration undo-on-press]}]
|
||||
[toast-container
|
||||
{:left (when icon
|
||||
[icon/icon icon
|
||||
{:container-style {:width 20 :height 20}
|
||||
:color (or icon-color
|
||||
(get-in themes [:icon (theme/get-theme) :color]))}])
|
||||
:middle text
|
||||
:right (if undo-duration
|
||||
[toast-undo-action undo-duration undo-on-press]
|
||||
action)}])
|
||||
@@ -1,40 +0,0 @@
|
||||
(ns quo2.components.profile.profile-card.style
|
||||
(:require [quo2.foundations.colors :as colors]))
|
||||
|
||||
(defn card-container
|
||||
[customization-color]
|
||||
{:flex-direction :column
|
||||
:padding 12
|
||||
:flex 1
|
||||
:border-radius 16
|
||||
:background-color (colors/custom-color customization-color 50 40)})
|
||||
|
||||
(def card-header
|
||||
{:flex-direction :row
|
||||
:justify-content :space-between})
|
||||
|
||||
(def name-container
|
||||
{:flex-direction :row
|
||||
:margin-top 8
|
||||
:margin-bottom 2
|
||||
:align-items :center
|
||||
:padding-right 12})
|
||||
|
||||
(def user-name
|
||||
{:margin-right 4
|
||||
:color colors/white})
|
||||
|
||||
(def emoji-hash
|
||||
{:margin-top 10})
|
||||
|
||||
(def user-hash
|
||||
{:color colors/white-opa-60})
|
||||
|
||||
(def sign-button
|
||||
{:margin-top 14})
|
||||
|
||||
(def keycard-icon
|
||||
{:color colors/white-opa-40})
|
||||
|
||||
(def option-button
|
||||
{:background-color colors/white-opa-5})
|
||||
@@ -1,64 +0,0 @@
|
||||
(ns quo2.components.profile.profile-card.view
|
||||
(:require
|
||||
[quo2.components.profile.profile-card.style :as style]
|
||||
[quo2.foundations.colors :as colors]
|
||||
[quo2.components.avatars.user-avatar :as user-avatar]
|
||||
[quo2.components.icon :as icon]
|
||||
[quo2.components.markdown.text :as text]
|
||||
[quo2.components.buttons.button :as button]
|
||||
[react-native.core :as rn]))
|
||||
|
||||
|
||||
(defn profile-card
|
||||
[{:keys [show-sign-profile? key-card? profile-picture name hash customization-color sign-label
|
||||
emoji-hash on-press-dots on-press-sign show-emoji-hash?]
|
||||
:or {show-sign-profile? false
|
||||
show-emoji-hash? false
|
||||
customization-color :turquoise
|
||||
key-card? false}}]
|
||||
[rn/view
|
||||
{:style (style/card-container customization-color)}
|
||||
[rn/view
|
||||
{:style style/card-header}
|
||||
[user-avatar/user-avatar
|
||||
{:full-name name
|
||||
:profile-picture profile-picture
|
||||
:override-theme :dark
|
||||
:size :medium
|
||||
:status-indicator? false
|
||||
:ring? true}]
|
||||
[button/button
|
||||
{:size 32
|
||||
:type :blur-bg
|
||||
:icon true
|
||||
:override-theme :dark
|
||||
:style style/option-button
|
||||
:on-press on-press-dots}
|
||||
:i/options]]
|
||||
[rn/view
|
||||
{:style style/name-container}
|
||||
[text/text
|
||||
{:size :heading-2
|
||||
:weight :semi-bold
|
||||
:number-of-lines 1
|
||||
:style style/user-name} name]
|
||||
(when key-card?
|
||||
(icon/icon
|
||||
:i/keycard
|
||||
style/keycard-icon))]
|
||||
[text/text
|
||||
{:weight :monospace
|
||||
:number-of-lines 1
|
||||
:style style/user-hash} hash]
|
||||
(when (and show-emoji-hash? emoji-hash)
|
||||
[text/text
|
||||
{:weight :monospace
|
||||
:number-of-lines 1
|
||||
:style style/emoji-hash} emoji-hash])
|
||||
(when show-sign-profile?
|
||||
[button/button
|
||||
{:on-press on-press-sign
|
||||
:type :community
|
||||
:community-color (colors/custom-color customization-color 60)
|
||||
:community-text-color colors/white
|
||||
:style style/sign-button} sign-label])])
|
||||
@@ -1,228 +0,0 @@
|
||||
(ns quo2.components.record-audio.record-audio.style
|
||||
(:require [quo2.foundations.colors :as colors]
|
||||
[react-native.reanimated :as reanimated]))
|
||||
|
||||
(defn animated-circle
|
||||
[scale opacity color]
|
||||
(reanimated/apply-animations-to-style
|
||||
{:transform [{:scale scale}]
|
||||
:opacity opacity}
|
||||
{:width 56
|
||||
:height 56
|
||||
:border-width 1
|
||||
:border-color color
|
||||
:border-radius 28
|
||||
:position :absolute
|
||||
:justify-content :center
|
||||
:align-items :center
|
||||
:z-index 0}))
|
||||
|
||||
(defn record-button-big-container
|
||||
[translate-x translate-y opacity]
|
||||
(reanimated/apply-animations-to-style
|
||||
{:transform [{:translateY translate-y}
|
||||
{:translateX translate-x}]
|
||||
:opacity opacity}
|
||||
{:position :absolute
|
||||
:bottom 0
|
||||
:right 0
|
||||
:width 96
|
||||
:height 96
|
||||
:align-items :center
|
||||
:justify-content :center
|
||||
:z-index 0}))
|
||||
|
||||
(defn record-button-big-body
|
||||
[button-color]
|
||||
{:width 56
|
||||
:height 56
|
||||
:border-radius 28
|
||||
:justify-content :center
|
||||
:align-items :center
|
||||
:background-color button-color
|
||||
:overflow :hidden})
|
||||
|
||||
(defn record-button-big-red-overlay
|
||||
[red-overlay-opacity]
|
||||
(reanimated/apply-animations-to-style
|
||||
{:opacity red-overlay-opacity}
|
||||
{:position :absolute
|
||||
:top 0
|
||||
:left 0
|
||||
:right 0
|
||||
:bottom 0
|
||||
:background-color colors/danger-50}))
|
||||
|
||||
(defn record-button-big-gray-overlay
|
||||
[gray-overlay-opacity]
|
||||
(reanimated/apply-animations-to-style
|
||||
{:opacity gray-overlay-opacity}
|
||||
{:position :absolute
|
||||
:top 0
|
||||
:left 0
|
||||
:right 0
|
||||
:bottom 0
|
||||
:background-color (colors/theme-colors colors/neutral-80-opa-5-opaque colors/neutral-80)}))
|
||||
|
||||
(defn record-button-big-icon-container
|
||||
[icon-opacity]
|
||||
(reanimated/apply-animations-to-style
|
||||
{:opacity icon-opacity}
|
||||
{}))
|
||||
|
||||
(def stop-icon
|
||||
{:width 13
|
||||
:height 13
|
||||
:border-radius 4
|
||||
:background-color colors/white})
|
||||
|
||||
(defn send-button-container
|
||||
[opacity]
|
||||
(reanimated/apply-animations-to-style
|
||||
{:opacity opacity}
|
||||
{:justify-content :center
|
||||
:align-items :center
|
||||
:position :absolute
|
||||
:width 56
|
||||
:height 56
|
||||
:top 0
|
||||
:right 20}))
|
||||
|
||||
(defn send-button-connector
|
||||
[opacity width height border-radius-first-half border-radius-second-half]
|
||||
(reanimated/apply-animations-to-style
|
||||
{:opacity opacity
|
||||
:width width
|
||||
:height height
|
||||
:border-bottom-left-radius border-radius-second-half
|
||||
:border-top-left-radius border-radius-first-half
|
||||
:border-top-right-radius border-radius-first-half
|
||||
:border-bottom-right-radius border-radius-second-half}
|
||||
{:justify-content :center
|
||||
:align-items :center
|
||||
:align-self :center
|
||||
:background-color colors/primary-50
|
||||
:z-index 0}))
|
||||
|
||||
(defn send-button
|
||||
[translate-y opacity]
|
||||
(reanimated/apply-animations-to-style
|
||||
{:transform [{:translateY translate-y}]
|
||||
:opacity opacity}
|
||||
{:justify-content :center
|
||||
:align-items :center
|
||||
:background-color colors/primary-50
|
||||
:width 32
|
||||
:height 32
|
||||
:border-radius 16
|
||||
:position :absolute
|
||||
:top 0
|
||||
:right 32
|
||||
:z-index 10}))
|
||||
|
||||
(def send-icon-container
|
||||
{:z-index 10})
|
||||
|
||||
(defn lock-button-container
|
||||
[opacity]
|
||||
(reanimated/apply-animations-to-style
|
||||
{:opacity opacity}
|
||||
{:transform [{:rotate "45deg"}]
|
||||
:justify-content :center
|
||||
:align-items :center
|
||||
:position :absolute
|
||||
:width 56
|
||||
:height 56
|
||||
:top 20
|
||||
:left 20}))
|
||||
|
||||
(defn lock-button-connector
|
||||
[opacity width height border-radius-first-half border-radius-second-half]
|
||||
(reanimated/apply-animations-to-style
|
||||
{:opacity opacity
|
||||
:width width
|
||||
:height height
|
||||
:border-bottom-left-radius border-radius-first-half
|
||||
:border-top-left-radius border-radius-first-half
|
||||
:border-top-right-radius border-radius-second-half
|
||||
:border-bottom-right-radius border-radius-second-half}
|
||||
{:justify-content :center
|
||||
:align-items :center
|
||||
:align-self :center
|
||||
:background-color (colors/theme-colors colors/neutral-80-opa-5-opaque colors/neutral-80)
|
||||
:overflow :hidden}))
|
||||
|
||||
(defn lock-button
|
||||
[translate-x-y opacity]
|
||||
(reanimated/apply-animations-to-style
|
||||
{:transform [{:translateX translate-x-y}
|
||||
{:translateY translate-x-y}]
|
||||
:opacity opacity}
|
||||
{:width 32
|
||||
:height 32
|
||||
:justify-content :center
|
||||
:align-items :center
|
||||
:background-color (colors/theme-colors colors/neutral-80-opa-5-opaque colors/neutral-80)
|
||||
:border-radius 16
|
||||
:position :absolute
|
||||
:top 24
|
||||
:left 24
|
||||
:overflow :hidden
|
||||
:z-index 12}))
|
||||
|
||||
(defn delete-button-container
|
||||
[opacity]
|
||||
(reanimated/apply-animations-to-style
|
||||
{:opacity opacity}
|
||||
{:justify-content :center
|
||||
:align-items :center
|
||||
:position :absolute
|
||||
:width 56
|
||||
:height 56
|
||||
:bottom 20
|
||||
:left 0}))
|
||||
|
||||
(defn delete-button-connector
|
||||
[opacity width height border-radius-first-half border-radius-second-half]
|
||||
(reanimated/apply-animations-to-style
|
||||
{:opacity opacity
|
||||
:width width
|
||||
:height height
|
||||
:border-bottom-left-radius border-radius-first-half
|
||||
:border-top-left-radius border-radius-first-half
|
||||
:border-top-right-radius border-radius-second-half
|
||||
:border-bottom-right-radius border-radius-second-half}
|
||||
{:justify-content :center
|
||||
:align-items :center
|
||||
:align-self :center
|
||||
:background-color colors/danger-50
|
||||
:z-index 0}))
|
||||
|
||||
(defn delete-button
|
||||
[translate-x opacity]
|
||||
(reanimated/apply-animations-to-style
|
||||
{:transform [{:translateX translate-x}]
|
||||
:opacity opacity}
|
||||
{:width 32
|
||||
:height 32
|
||||
:justify-content :center
|
||||
:align-items :center
|
||||
:background-color colors/danger-50
|
||||
:border-radius 16
|
||||
:position :absolute
|
||||
:top 76
|
||||
:left 0
|
||||
:z-index 11}))
|
||||
|
||||
(defn record-button-container
|
||||
[opacity]
|
||||
(reanimated/apply-animations-to-style
|
||||
{:opacity opacity}
|
||||
{:margin-bottom 32
|
||||
:margin-right 32}))
|
||||
|
||||
(def input-container
|
||||
{:width 140
|
||||
:height 140
|
||||
:align-items :flex-end
|
||||
:justify-content :flex-end})
|
||||
@@ -1,767 +0,0 @@
|
||||
(ns quo2.components.record-audio.record-audio.view
|
||||
(:require [cljs-bean.core :as bean]
|
||||
[oops.core :as oops]
|
||||
[quo.react :refer [effect! memo]]
|
||||
[quo2.components.buttons.button :as button]
|
||||
[quo2.components.icon :as icons]
|
||||
[quo2.components.record-audio.record-audio.style :as style]
|
||||
[quo2.foundations.colors :as colors]
|
||||
[react-native.core :as rn]
|
||||
[react-native.reanimated :as reanimated]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.utils.utils :as utils]))
|
||||
|
||||
(def ^:private scale-to-each 1.8)
|
||||
(def ^:private scale-to-total 2.6)
|
||||
(def ^:private scale-padding 0.16)
|
||||
(def ^:private opacity-from-lock 1)
|
||||
(def ^:private opacity-from-default 0.5)
|
||||
(def ^:private signal-anim-duration 3900)
|
||||
(def ^:private signal-anim-duration-2 1950)
|
||||
|
||||
(def ^:private animated-ring
|
||||
(reagent/adapt-react-class
|
||||
(memo
|
||||
(fn [props]
|
||||
(let [{:keys [scale opacity color]} (bean/bean props)]
|
||||
(reagent/as-element
|
||||
[reanimated/view {:style (style/animated-circle scale opacity color)}]))))))
|
||||
|
||||
(def ^:private record-button-area-big
|
||||
{:width 56
|
||||
:height 56
|
||||
:x 64
|
||||
:y 64})
|
||||
|
||||
(def ^:private record-button-area
|
||||
{:width 48
|
||||
:height 48
|
||||
:x 68
|
||||
:y 68})
|
||||
|
||||
(defn- delete-button-area
|
||||
[active?]
|
||||
{:width (if active? 72 82)
|
||||
:height 56
|
||||
:x (if active? -16 -32)
|
||||
:y (if active? 64 70)})
|
||||
|
||||
(defn- lock-button-area
|
||||
[active?]
|
||||
{:width (if active? 72 100)
|
||||
:height (if active? 72 102)
|
||||
:x -32
|
||||
:y -32})
|
||||
|
||||
(defn- send-button-area
|
||||
[active?]
|
||||
{:width 56
|
||||
:height (if active? 72 92)
|
||||
:x 68
|
||||
:y (if active? -16 -32)})
|
||||
|
||||
(defn- touch-inside-area?
|
||||
[{:keys [location-x location-y ignore-min-y? ignore-max-y? ignore-min-x? ignore-max-x?]}
|
||||
{:keys [width height x y]}]
|
||||
(let [max-x (+ x width)
|
||||
max-y (+ y height)]
|
||||
(and
|
||||
(and
|
||||
(or ignore-min-x? (>= location-x x))
|
||||
(or ignore-max-x? (<= location-x max-x)))
|
||||
(and
|
||||
(or ignore-min-y? (>= location-y y))
|
||||
(or ignore-max-y? (<= location-y max-y))))))
|
||||
|
||||
(def record-audio-worklets (js/require "../src/js/record_audio_worklets.js"))
|
||||
|
||||
(defn- ring-scale
|
||||
[scale substract]
|
||||
(.ringScale ^js record-audio-worklets
|
||||
scale
|
||||
substract))
|
||||
|
||||
(defn- record-button-big
|
||||
[recording? ready-to-send? ready-to-lock? ready-to-delete? record-button-is-animating?
|
||||
record-button-at-initial-position? locked? reviewing-audio? recording-timer recording-length-ms
|
||||
clear-timeout touch-active?]
|
||||
[:f>
|
||||
(fn []
|
||||
(let [scale (reanimated/use-shared-value 1)
|
||||
opacity (reanimated/use-shared-value 0)
|
||||
opacity-from (if @ready-to-lock? opacity-from-lock opacity-from-default)
|
||||
animations (map
|
||||
(fn [index]
|
||||
(let [ring-scale (ring-scale scale (* scale-padding index))]
|
||||
{:scale ring-scale
|
||||
:opacity (reanimated/interpolate ring-scale
|
||||
[1 scale-to-each]
|
||||
[opacity-from 0])}))
|
||||
(range 0 5))
|
||||
rings-color (cond
|
||||
@ready-to-lock? (colors/theme-colors colors/neutral-80-opa-5-opaque
|
||||
colors/neutral-80)
|
||||
@ready-to-delete? colors/danger-50
|
||||
:else colors/primary-50)
|
||||
translate-y (reanimated/use-shared-value 0)
|
||||
translate-x (reanimated/use-shared-value 0)
|
||||
button-color colors/primary-50
|
||||
icon-color (if (and (not (colors/dark?)) @ready-to-lock?) colors/black colors/white)
|
||||
icon-opacity (reanimated/use-shared-value 1)
|
||||
red-overlay-opacity (reanimated/use-shared-value 0)
|
||||
gray-overlay-opacity (reanimated/use-shared-value 0)
|
||||
complete-animation (fn []
|
||||
(cond
|
||||
(and @ready-to-lock? (not @record-button-is-animating?))
|
||||
(do
|
||||
(reset! locked? true)
|
||||
(reset! ready-to-lock? false))
|
||||
(and (not @locked?) (not @reviewing-audio?))
|
||||
(do
|
||||
(reset! recording? false)
|
||||
(reset! ready-to-send? false)
|
||||
(reset! ready-to-delete? false)
|
||||
(reset! ready-to-lock? false)
|
||||
(utils/clear-interval @recording-timer)
|
||||
(reset! recording-length-ms 0))))
|
||||
start-animation (fn []
|
||||
(reanimated/set-shared-value opacity 1)
|
||||
(reanimated/animate-shared-value-with-timing scale
|
||||
2.6
|
||||
signal-anim-duration
|
||||
:linear)
|
||||
;; TODO: Research if we can implement this with withSequence method
|
||||
;; from Reanimated 2
|
||||
;; GitHub issue [#14561]:
|
||||
;; https://github.com/status-im/status-mobile/issues/14561
|
||||
(reset! clear-timeout
|
||||
(utils/set-timeout
|
||||
#(do (reanimated/set-shared-value scale scale-to-each)
|
||||
(reanimated/animate-shared-value-with-delay-repeat
|
||||
scale
|
||||
scale-to-total
|
||||
signal-anim-duration-2
|
||||
:linear
|
||||
0
|
||||
-1))
|
||||
signal-anim-duration)))
|
||||
stop-animation (fn []
|
||||
(reanimated/set-shared-value opacity 0)
|
||||
(reanimated/cancel-animation scale)
|
||||
(reanimated/set-shared-value scale 1)
|
||||
(when @clear-timeout (utils/clear-timeout @clear-timeout)))
|
||||
start-y-animation (fn []
|
||||
(reset! record-button-at-initial-position? false)
|
||||
(reset! record-button-is-animating? true)
|
||||
(reanimated/animate-shared-value-with-timing translate-y
|
||||
-64
|
||||
250
|
||||
:easing1)
|
||||
(reanimated/animate-shared-value-with-delay icon-opacity
|
||||
0 33.33
|
||||
:linear 76.66)
|
||||
(utils/set-timeout (fn []
|
||||
(reset! record-button-is-animating? false)
|
||||
(when-not @touch-active? (complete-animation)))
|
||||
250))
|
||||
reset-y-animation (fn []
|
||||
(reanimated/animate-shared-value-with-timing translate-y
|
||||
0
|
||||
300
|
||||
:easing1)
|
||||
(reanimated/animate-shared-value-with-timing icon-opacity
|
||||
1
|
||||
500
|
||||
:linear)
|
||||
(utils/set-timeout (fn []
|
||||
(reset! record-button-at-initial-position? true))
|
||||
500))
|
||||
start-x-animation (fn []
|
||||
(reset! record-button-at-initial-position? false)
|
||||
(reset! record-button-is-animating? true)
|
||||
(reanimated/animate-shared-value-with-timing translate-x
|
||||
-64
|
||||
250
|
||||
:easing1)
|
||||
(reanimated/animate-shared-value-with-delay icon-opacity
|
||||
0 33.33
|
||||
:linear 76.66)
|
||||
(reanimated/animate-shared-value-with-timing red-overlay-opacity
|
||||
1
|
||||
33.33
|
||||
:linear)
|
||||
(utils/set-timeout (fn []
|
||||
(reset! record-button-is-animating? false)
|
||||
(when-not @touch-active? (complete-animation)))
|
||||
250))
|
||||
reset-x-animation (fn []
|
||||
(reanimated/animate-shared-value-with-timing translate-x
|
||||
0
|
||||
300
|
||||
:easing1)
|
||||
(reanimated/animate-shared-value-with-timing icon-opacity
|
||||
1
|
||||
500
|
||||
:linear)
|
||||
(reanimated/animate-shared-value-with-timing red-overlay-opacity
|
||||
0
|
||||
100
|
||||
:linear)
|
||||
(utils/set-timeout (fn []
|
||||
(reset! record-button-at-initial-position? true))
|
||||
500))
|
||||
start-x-y-animation (fn []
|
||||
(reset! record-button-at-initial-position? false)
|
||||
(reset! record-button-is-animating? true)
|
||||
(reanimated/animate-shared-value-with-timing translate-y
|
||||
-44
|
||||
200
|
||||
:easing1)
|
||||
(reanimated/animate-shared-value-with-timing translate-x
|
||||
-44
|
||||
200
|
||||
:easing1)
|
||||
(reanimated/animate-shared-value-with-delay icon-opacity
|
||||
0 33.33
|
||||
:linear 33.33)
|
||||
(reanimated/animate-shared-value-with-timing gray-overlay-opacity
|
||||
1
|
||||
33.33
|
||||
:linear)
|
||||
(utils/set-timeout (fn []
|
||||
(reset! record-button-is-animating? false)
|
||||
(when-not @touch-active? (complete-animation)))
|
||||
200))
|
||||
reset-x-y-animation (fn []
|
||||
(reanimated/animate-shared-value-with-timing translate-y
|
||||
0
|
||||
300
|
||||
:easing1)
|
||||
(reanimated/animate-shared-value-with-timing translate-x
|
||||
0
|
||||
300
|
||||
:easing1)
|
||||
(reanimated/animate-shared-value-with-timing icon-opacity
|
||||
1
|
||||
500
|
||||
:linear)
|
||||
(reanimated/animate-shared-value-with-timing gray-overlay-opacity
|
||||
0
|
||||
800
|
||||
:linear)
|
||||
(utils/set-timeout (fn []
|
||||
(reset! record-button-at-initial-position? true))
|
||||
800))]
|
||||
(effect! #(cond
|
||||
@recording?
|
||||
(start-animation)
|
||||
(not @ready-to-lock?)
|
||||
(stop-animation))
|
||||
[@recording?])
|
||||
(effect! #(if @ready-to-lock?
|
||||
(start-x-y-animation)
|
||||
(reset-x-y-animation))
|
||||
[@ready-to-lock?])
|
||||
(effect! #(if @ready-to-send?
|
||||
(start-y-animation)
|
||||
(reset-y-animation))
|
||||
[@ready-to-send?])
|
||||
(effect! #(if @ready-to-delete?
|
||||
(start-x-animation)
|
||||
(reset-x-animation))
|
||||
[@ready-to-delete?])
|
||||
[reanimated/view
|
||||
{:style (style/record-button-big-container translate-x translate-y opacity)
|
||||
:pointer-events :none}
|
||||
[:<>
|
||||
(map-indexed
|
||||
(fn [id animation]
|
||||
^{:key id}
|
||||
[animated-ring
|
||||
{:scale (:scale animation)
|
||||
:opacity (:opacity animation)
|
||||
:color rings-color}])
|
||||
animations)]
|
||||
[rn/view {:style (style/record-button-big-body button-color)}
|
||||
[reanimated/view {:style (style/record-button-big-red-overlay red-overlay-opacity)}]
|
||||
[reanimated/view {:style (style/record-button-big-gray-overlay gray-overlay-opacity)}]
|
||||
[reanimated/view {:style (style/record-button-big-icon-container icon-opacity)}
|
||||
(if @locked?
|
||||
[rn/view {:style style/stop-icon}]
|
||||
[icons/icon :i/audio {:color icon-color}])]]]))])
|
||||
|
||||
(defn- send-button
|
||||
[recording? ready-to-send? reviewing-audio?]
|
||||
[:f>
|
||||
(fn []
|
||||
(let [opacity (reanimated/use-shared-value 0)
|
||||
translate-y (reanimated/use-shared-value 20)
|
||||
connector-opacity (reanimated/use-shared-value 0)
|
||||
width (reanimated/use-shared-value 12)
|
||||
height (reanimated/use-shared-value 24)
|
||||
border-radius-first-half (reanimated/use-shared-value 16)
|
||||
border-radius-second-half (reanimated/use-shared-value 8)
|
||||
start-y-animation (fn []
|
||||
(reanimated/animate-shared-value-with-delay translate-y
|
||||
12 50
|
||||
:linear 133.33)
|
||||
(reanimated/animate-shared-value-with-delay connector-opacity
|
||||
1 0
|
||||
:easing1 93.33)
|
||||
(reanimated/animate-shared-value-with-delay width
|
||||
56 83.33
|
||||
:easing1 80)
|
||||
(reanimated/animate-shared-value-with-delay height
|
||||
56 83.33
|
||||
:easing1 80)
|
||||
(reanimated/animate-shared-value-with-delay
|
||||
border-radius-first-half
|
||||
28 83.33
|
||||
:easing1 80)
|
||||
(reanimated/animate-shared-value-with-delay
|
||||
border-radius-second-half
|
||||
28 83.33
|
||||
:easing1 80))
|
||||
reset-y-animation (fn []
|
||||
(reanimated/animate-shared-value-with-timing translate-y
|
||||
0
|
||||
100
|
||||
:linear)
|
||||
(reanimated/set-shared-value connector-opacity 0)
|
||||
(reanimated/set-shared-value width 12)
|
||||
(reanimated/set-shared-value height 24)
|
||||
(reanimated/set-shared-value border-radius-first-half 16)
|
||||
(reanimated/set-shared-value border-radius-second-half 8))
|
||||
fade-in-animation (fn []
|
||||
(reanimated/animate-shared-value-with-timing translate-y
|
||||
0
|
||||
200
|
||||
:linear)
|
||||
(reanimated/animate-shared-value-with-timing opacity
|
||||
1
|
||||
200
|
||||
:linear))
|
||||
fade-out-animation (fn []
|
||||
(reanimated/animate-shared-value-with-timing translate-y
|
||||
(if @reviewing-audio?
|
||||
76
|
||||
20)
|
||||
200
|
||||
:linear)
|
||||
(when-not @reviewing-audio?
|
||||
(reanimated/animate-shared-value-with-timing opacity
|
||||
0
|
||||
200
|
||||
:linear))
|
||||
(reanimated/set-shared-value connector-opacity 0)
|
||||
(reanimated/set-shared-value width 24)
|
||||
(reanimated/set-shared-value height 12)
|
||||
(reanimated/set-shared-value border-radius-first-half 8)
|
||||
(reanimated/set-shared-value border-radius-second-half 16))
|
||||
fade-out-reset-animation (fn []
|
||||
(reanimated/animate-shared-value-with-timing opacity
|
||||
0
|
||||
200
|
||||
:linear)
|
||||
(reanimated/animate-shared-value-with-delay translate-y
|
||||
20 0
|
||||
:linear 200)
|
||||
(reanimated/set-shared-value connector-opacity 0)
|
||||
(reanimated/set-shared-value width 24)
|
||||
(reanimated/set-shared-value height 12)
|
||||
(reanimated/set-shared-value border-radius-first-half 8)
|
||||
(reanimated/set-shared-value border-radius-second-half 16))]
|
||||
(effect! #(if @recording?
|
||||
(fade-in-animation)
|
||||
(fade-out-animation))
|
||||
[@recording?])
|
||||
(effect! #(when-not @reviewing-audio?
|
||||
(fade-out-reset-animation))
|
||||
[@reviewing-audio?])
|
||||
(effect! #(cond
|
||||
@ready-to-send?
|
||||
(start-y-animation)
|
||||
@recording? (reset-y-animation))
|
||||
[@ready-to-send?])
|
||||
[:<>
|
||||
[reanimated/view {:style (style/send-button-container opacity)}
|
||||
[reanimated/view
|
||||
{:style (style/send-button-connector connector-opacity
|
||||
width
|
||||
height
|
||||
border-radius-first-half
|
||||
border-radius-second-half)}]]
|
||||
[reanimated/view
|
||||
{:style (style/send-button translate-y opacity)
|
||||
:pointer-events :none}
|
||||
[icons/icon :i/arrow-up
|
||||
{:color colors/white
|
||||
:size 20
|
||||
:container-style style/send-icon-container}]]]))])
|
||||
|
||||
(defn- lock-button
|
||||
[recording? ready-to-lock? locked?]
|
||||
[:f>
|
||||
(fn []
|
||||
(let [translate-x-y (reanimated/use-shared-value 20)
|
||||
opacity (reanimated/use-shared-value 0)
|
||||
connector-opacity (reanimated/use-shared-value 0)
|
||||
width (reanimated/use-shared-value 24)
|
||||
height (reanimated/use-shared-value 12)
|
||||
border-radius-first-half (reanimated/use-shared-value 8)
|
||||
border-radius-second-half (reanimated/use-shared-value 8)
|
||||
start-x-y-animation (fn []
|
||||
(reanimated/animate-shared-value-with-delay translate-x-y
|
||||
8 50
|
||||
:linear 116.66)
|
||||
(reanimated/animate-shared-value-with-delay connector-opacity
|
||||
1 0
|
||||
:easing1 80)
|
||||
(reanimated/animate-shared-value-with-delay width
|
||||
56 83.33
|
||||
:easing1 63.33)
|
||||
(reanimated/animate-shared-value-with-delay height
|
||||
56 83.33
|
||||
:easing1 63.33)
|
||||
(reanimated/animate-shared-value-with-delay
|
||||
border-radius-first-half
|
||||
28 83.33
|
||||
:easing1 63.33)
|
||||
(reanimated/animate-shared-value-with-delay
|
||||
border-radius-second-half
|
||||
28 83.33
|
||||
:easing1 63.33))
|
||||
reset-x-y-animation (fn []
|
||||
(reanimated/animate-shared-value-with-timing translate-x-y
|
||||
0
|
||||
100
|
||||
:linear)
|
||||
(reanimated/set-shared-value connector-opacity 0)
|
||||
(reanimated/set-shared-value width 24)
|
||||
(reanimated/set-shared-value height 12)
|
||||
(reanimated/set-shared-value border-radius-first-half 8)
|
||||
(reanimated/set-shared-value border-radius-second-half 16))
|
||||
fade-in-animation (fn []
|
||||
(reanimated/animate-shared-value-with-timing translate-x-y
|
||||
0
|
||||
220
|
||||
:linear)
|
||||
(reanimated/animate-shared-value-with-timing opacity
|
||||
1
|
||||
220
|
||||
:linear))
|
||||
fade-out-animation (fn []
|
||||
(reanimated/animate-shared-value-with-timing translate-x-y
|
||||
20
|
||||
200
|
||||
:linear)
|
||||
(reanimated/animate-shared-value-with-timing opacity
|
||||
0
|
||||
200
|
||||
:linear)
|
||||
(reanimated/set-shared-value connector-opacity 0)
|
||||
(reanimated/set-shared-value width 24)
|
||||
(reanimated/set-shared-value height 12)
|
||||
(reanimated/set-shared-value border-radius-first-half 8)
|
||||
(reanimated/set-shared-value border-radius-second-half 16))]
|
||||
(effect! #(if @recording?
|
||||
(fade-in-animation)
|
||||
(fade-out-animation))
|
||||
[@recording?])
|
||||
(effect! #(cond
|
||||
@ready-to-lock?
|
||||
(start-x-y-animation)
|
||||
(and @recording? (not @locked?))
|
||||
(reset-x-y-animation))
|
||||
[@ready-to-lock?])
|
||||
(effect! #(if @locked?
|
||||
(fade-out-animation)
|
||||
(reset-x-y-animation))
|
||||
[@locked?])
|
||||
[:<>
|
||||
[reanimated/view {:style (style/lock-button-container opacity)}
|
||||
[reanimated/view
|
||||
{:style (style/lock-button-connector connector-opacity
|
||||
width
|
||||
height
|
||||
border-radius-first-half
|
||||
border-radius-second-half)}]]
|
||||
[reanimated/view
|
||||
{:style (style/lock-button translate-x-y opacity)
|
||||
:pointer-events :none}
|
||||
[icons/icon (if @ready-to-lock? :i/locked :i/unlocked)
|
||||
{:color (colors/theme-colors colors/black colors/white)
|
||||
:size 20}]]]))])
|
||||
|
||||
(defn- delete-button
|
||||
[recording? ready-to-delete?]
|
||||
[:f>
|
||||
(fn []
|
||||
(let [opacity (reanimated/use-shared-value 0)
|
||||
translate-x (reanimated/use-shared-value 20)
|
||||
connector-opacity (reanimated/use-shared-value 0)
|
||||
width (reanimated/use-shared-value 24)
|
||||
height (reanimated/use-shared-value 12)
|
||||
border-radius-first-half (reanimated/use-shared-value 8)
|
||||
border-radius-second-half (reanimated/use-shared-value 8)
|
||||
start-x-animation (fn []
|
||||
(reanimated/animate-shared-value-with-delay translate-x
|
||||
12 50
|
||||
:linear 133.33)
|
||||
(reanimated/animate-shared-value-with-delay connector-opacity
|
||||
1 0
|
||||
:easing1 93.33)
|
||||
(reanimated/animate-shared-value-with-delay width
|
||||
56 83.33
|
||||
:easing1 80)
|
||||
(reanimated/animate-shared-value-with-delay height
|
||||
56 83.33
|
||||
:easing1 80)
|
||||
(reanimated/animate-shared-value-with-delay
|
||||
border-radius-first-half
|
||||
28 83.33
|
||||
:easing1 80)
|
||||
(reanimated/animate-shared-value-with-delay
|
||||
border-radius-second-half
|
||||
28 83.33
|
||||
:easing1 80))
|
||||
reset-x-animation (fn []
|
||||
(reanimated/animate-shared-value-with-timing translate-x
|
||||
0
|
||||
100
|
||||
:linear)
|
||||
(reanimated/set-shared-value connector-opacity 0)
|
||||
(reanimated/set-shared-value width 24)
|
||||
(reanimated/set-shared-value height 12)
|
||||
(reanimated/set-shared-value border-radius-first-half 8)
|
||||
(reanimated/set-shared-value border-radius-second-half 16))
|
||||
fade-in-animation (fn []
|
||||
(reanimated/animate-shared-value-with-timing translate-x
|
||||
0
|
||||
200
|
||||
:linear)
|
||||
(reanimated/animate-shared-value-with-timing opacity
|
||||
1
|
||||
200
|
||||
:linear))
|
||||
fade-out-animation (fn []
|
||||
(reanimated/animate-shared-value-with-timing translate-x
|
||||
20
|
||||
200
|
||||
:linear)
|
||||
(reanimated/animate-shared-value-with-timing opacity
|
||||
0
|
||||
200
|
||||
:linear)
|
||||
(reanimated/set-shared-value connector-opacity 0)
|
||||
(reanimated/set-shared-value width 24)
|
||||
(reanimated/set-shared-value height 12)
|
||||
(reanimated/set-shared-value border-radius-first-half 8)
|
||||
(reanimated/set-shared-value border-radius-second-half 16))]
|
||||
(effect! #(if @recording?
|
||||
(fade-in-animation)
|
||||
(fade-out-animation))
|
||||
[@recording?])
|
||||
(effect! #(cond
|
||||
@ready-to-delete?
|
||||
(start-x-animation)
|
||||
@recording?
|
||||
(reset-x-animation))
|
||||
[@ready-to-delete?])
|
||||
[:<>
|
||||
[reanimated/view {:style (style/delete-button-container opacity)}
|
||||
[reanimated/view
|
||||
{:style (style/delete-button-connector connector-opacity
|
||||
width
|
||||
height
|
||||
border-radius-first-half
|
||||
border-radius-second-half)}]]
|
||||
[reanimated/view
|
||||
{:style (style/delete-button translate-x opacity)
|
||||
:pointer-events :none}
|
||||
[icons/icon :i/delete
|
||||
{:color colors/white
|
||||
:size 20}]]]))])
|
||||
|
||||
(defn- record-button
|
||||
[recording? reviewing-audio?]
|
||||
[:f>
|
||||
(fn []
|
||||
(let [opacity (reanimated/use-shared-value 1)
|
||||
show-animation #(reanimated/set-shared-value opacity 1)
|
||||
hide-animation #(reanimated/set-shared-value opacity 0)]
|
||||
(effect! #(if (or @recording? @reviewing-audio?)
|
||||
(hide-animation)
|
||||
(show-animation))
|
||||
[@recording? @reviewing-audio?])
|
||||
[reanimated/view {:style (style/record-button-container opacity)}
|
||||
[button/button
|
||||
{:type :outline
|
||||
:size 32
|
||||
:width 32
|
||||
:accessibility-label :mic-button}
|
||||
[icons/icon :i/audio {:color (colors/theme-colors colors/neutral-100 colors/white)}]]]))])
|
||||
|
||||
(defn input-view
|
||||
[]
|
||||
[:f>
|
||||
(fn []
|
||||
(let [recording? (reagent/atom false)
|
||||
locked? (reagent/atom false)
|
||||
ready-to-send? (reagent/atom false)
|
||||
ready-to-lock? (reagent/atom false)
|
||||
ready-to-delete? (reagent/atom false)
|
||||
reviewing-audio? (reagent/atom false)
|
||||
clear-timeout (atom nil)
|
||||
record-button-at-initial-position? (atom true)
|
||||
record-button-is-animating? (atom false)
|
||||
touch-active? (atom false)
|
||||
recording-timer (atom nil)
|
||||
recording-length-ms (atom 0)
|
||||
on-start-should-set-responder
|
||||
(fn [^js e]
|
||||
(when-not @locked?
|
||||
(let [pressed-record-button? (touch-inside-area?
|
||||
{:location-x (oops/oget e "nativeEvent.locationX")
|
||||
:location-y (oops/oget e "nativeEvent.locationY")
|
||||
:ignore-min-y? false
|
||||
:ignore-max-y? false
|
||||
:ignore-min-x? false
|
||||
:ignore-max-x? false}
|
||||
record-button-area)]
|
||||
(when-not @reviewing-audio?
|
||||
(reset! recording? pressed-record-button?)
|
||||
(when pressed-record-button?
|
||||
;; TODO: By now we just track recording length, we need to add actual audio
|
||||
;; recording logic
|
||||
;; GitHub issue [#14558]: https://github.com/status-im/status-mobile/issues/14558
|
||||
(reset! recording-timer (utils/set-interval #(reset! recording-length-ms
|
||||
(+ @recording-length-ms 500))
|
||||
500))))
|
||||
(reset! touch-active? true)))
|
||||
true)
|
||||
on-responder-move
|
||||
(fn [^js e]
|
||||
(when-not @locked?
|
||||
(let [location-x (oops/oget e "nativeEvent.locationX")
|
||||
location-y (oops/oget e "nativeEvent.locationY")
|
||||
page-x (oops/oget e "nativeEvent.pageX")
|
||||
page-y (oops/oget e "nativeEvent.pageY")
|
||||
moved-to-send-button? (touch-inside-area?
|
||||
{:location-x location-x
|
||||
:location-y location-y
|
||||
:ignore-min-y? true
|
||||
:ignore-max-y? false
|
||||
:ignore-min-x? false
|
||||
:ignore-max-x? true}
|
||||
(send-button-area @ready-to-send?))
|
||||
moved-to-delete-button? (touch-inside-area?
|
||||
{:location-x location-x
|
||||
:location-y location-y
|
||||
:ignore-min-y? false
|
||||
:ignore-max-y? true
|
||||
:ignore-min-x? true
|
||||
:ignore-max-x? false}
|
||||
(delete-button-area @ready-to-delete?))
|
||||
moved-to-lock-button? (touch-inside-area?
|
||||
{:location-x location-x
|
||||
:location-y location-y
|
||||
:ignore-min-y? false
|
||||
:ignore-max-y? false
|
||||
:ignore-min-x? false
|
||||
:ignore-max-x? false}
|
||||
(lock-button-area @ready-to-lock?))
|
||||
moved-to-record-button? (and
|
||||
(touch-inside-area?
|
||||
{:location-x location-x
|
||||
:location-y location-y
|
||||
:ignore-min-y? false
|
||||
:ignore-max-y? false
|
||||
:ignore-min-x? false
|
||||
:ignore-max-x? false}
|
||||
record-button-area-big)
|
||||
(not= location-x page-x)
|
||||
(not= location-y page-y))]
|
||||
(cond
|
||||
(and
|
||||
(or
|
||||
(and moved-to-record-button? @ready-to-lock?)
|
||||
(and (not @locked?) moved-to-lock-button? @record-button-at-initial-position?))
|
||||
(not @ready-to-delete?)
|
||||
(not @ready-to-send?)
|
||||
@recording?)
|
||||
(reset! ready-to-lock? moved-to-lock-button?)
|
||||
(and
|
||||
(or
|
||||
(and moved-to-record-button? @ready-to-delete?)
|
||||
(and moved-to-delete-button? @record-button-at-initial-position?))
|
||||
(not @ready-to-lock?)
|
||||
(not @ready-to-send?)
|
||||
@recording?)
|
||||
(reset! ready-to-delete? moved-to-delete-button?)
|
||||
(and
|
||||
(or
|
||||
(and moved-to-record-button? @ready-to-send?)
|
||||
(and moved-to-send-button? @record-button-at-initial-position?))
|
||||
(not @ready-to-lock?)
|
||||
(not @ready-to-delete?)
|
||||
@recording?)
|
||||
(reset! ready-to-send? moved-to-send-button?)))))
|
||||
on-responder-release
|
||||
(fn [^js e]
|
||||
(let [on-record-button? (touch-inside-area?
|
||||
{:location-x (oops/oget e "nativeEvent.locationX")
|
||||
:location-y (oops/oget e "nativeEvent.locationY")
|
||||
:ignore-min-y? false
|
||||
:ignore-max-y? false
|
||||
:ignore-min-x? false
|
||||
:ignore-max-x? false}
|
||||
(if @reviewing-audio? record-button-area record-button-area-big))]
|
||||
(cond
|
||||
(and @reviewing-audio? on-record-button?)
|
||||
(reset! reviewing-audio? false)
|
||||
(and @ready-to-lock? (not @record-button-is-animating?))
|
||||
(do
|
||||
(reset! locked? true)
|
||||
(reset! ready-to-lock? false))
|
||||
(and (not @reviewing-audio?) on-record-button?)
|
||||
(do
|
||||
(when (>= @recording-length-ms 500) (reset! reviewing-audio? true))
|
||||
(reset! locked? false)
|
||||
(reset! recording? false)
|
||||
(reset! ready-to-lock? false)
|
||||
(utils/clear-interval @recording-timer)
|
||||
(reset! recording-length-ms 0))
|
||||
(and (not @locked?) (not @reviewing-audio?) (not @record-button-is-animating?))
|
||||
(do
|
||||
(reset! recording? false)
|
||||
(reset! ready-to-send? false)
|
||||
(reset! ready-to-delete? false)
|
||||
(reset! ready-to-lock? false)
|
||||
(utils/clear-interval @recording-timer)
|
||||
(reset! recording-length-ms 0))))
|
||||
(reset! touch-active? false))]
|
||||
(fn []
|
||||
[rn/view
|
||||
{:style style/input-container
|
||||
:pointer-events :box-only
|
||||
:on-start-should-set-responder on-start-should-set-responder
|
||||
:on-responder-move on-responder-move
|
||||
:on-responder-release on-responder-release}
|
||||
[delete-button recording? ready-to-delete?]
|
||||
[lock-button recording? ready-to-lock? locked?]
|
||||
[send-button recording? ready-to-send? reviewing-audio?]
|
||||
[record-button-big
|
||||
recording?
|
||||
ready-to-send?
|
||||
ready-to-lock?
|
||||
ready-to-delete?
|
||||
record-button-is-animating?
|
||||
record-button-at-initial-position?
|
||||
locked?
|
||||
reviewing-audio?
|
||||
recording-timer
|
||||
recording-length-ms
|
||||
clear-timeout
|
||||
touch-active?]
|
||||
[record-button recording? reviewing-audio?]])))])
|
||||
@@ -28,57 +28,57 @@
|
||||
(rtl/render (reagent/as-element [selectors/radio opts]))))
|
||||
|
||||
(js/global.test "default render of toggle component"
|
||||
(fn []
|
||||
(render-toggle)
|
||||
(-> (js/expect (rtl/screen.getByTestId "toggle-component"))
|
||||
(.toBeTruthy))))
|
||||
(fn []
|
||||
(render-toggle)
|
||||
(-> (js/expect (rtl/screen.getByTestId "toggle-component"))
|
||||
(.toBeTruthy))))
|
||||
|
||||
(js/global.test "toggle component on change is working"
|
||||
(let [mock-fn (js/jest.fn)]
|
||||
(fn []
|
||||
(render-toggle {:on-change mock-fn})
|
||||
(rtl/fireEvent.press (rtl/screen.getByTestId "toggle-component"))
|
||||
(-> (js/expect mock-fn)
|
||||
(.toHaveBeenCalledTimes 1)))))
|
||||
(let [mock-fn (js/jest.fn)]
|
||||
(fn []
|
||||
(render-toggle {:on-change mock-fn})
|
||||
(rtl/fireEvent.press (rtl/screen.getByTestId "toggle-component"))
|
||||
(-> (js/expect mock-fn)
|
||||
(.toHaveBeenCalledTimes 1)))))
|
||||
|
||||
(js/global.test "default render of radio component"
|
||||
(fn []
|
||||
(render-radio)
|
||||
(-> (js/expect (rtl/screen.getByTestId "radio-component"))
|
||||
(.toBeTruthy))))
|
||||
(fn []
|
||||
(render-radio)
|
||||
(-> (js/expect (rtl/screen.getByTestId "radio-component"))
|
||||
(.toBeTruthy))))
|
||||
|
||||
(js/global.test "radio component on change is working"
|
||||
(let [mock-fn (js/jest.fn)]
|
||||
(fn []
|
||||
(render-radio {:on-change mock-fn})
|
||||
(rtl/fireEvent.press (rtl/screen.getByTestId "radio-component"))
|
||||
(-> (js/expect mock-fn)
|
||||
(.toHaveBeenCalledTimes 1)))))
|
||||
(let [mock-fn (js/jest.fn)]
|
||||
(fn []
|
||||
(render-radio {:on-change mock-fn})
|
||||
(rtl/fireEvent.press (rtl/screen.getByTestId "radio-component"))
|
||||
(-> (js/expect mock-fn)
|
||||
(.toHaveBeenCalledTimes 1)))))
|
||||
|
||||
(js/global.test "default render of checkbox component"
|
||||
(fn []
|
||||
(render-checkbox)
|
||||
(-> (js/expect (rtl/screen.getByTestId "checkbox-component"))
|
||||
(.toBeTruthy))))
|
||||
(fn []
|
||||
(render-checkbox)
|
||||
(-> (js/expect (rtl/screen.getByTestId "checkbox-component"))
|
||||
(.toBeTruthy))))
|
||||
|
||||
(js/global.test "checkbox component on change is working"
|
||||
(let [mock-fn (js/jest.fn)]
|
||||
(fn []
|
||||
(render-checkbox {:on-change mock-fn})
|
||||
(rtl/fireEvent.press (rtl/screen.getByTestId "checkbox-component"))
|
||||
(-> (js/expect mock-fn)
|
||||
(.toHaveBeenCalledTimes 1)))))
|
||||
(let [mock-fn (js/jest.fn)]
|
||||
(fn []
|
||||
(render-checkbox {:on-change mock-fn})
|
||||
(rtl/fireEvent.press (rtl/screen.getByTestId "checkbox-component"))
|
||||
(-> (js/expect mock-fn)
|
||||
(.toHaveBeenCalledTimes 1)))))
|
||||
|
||||
(js/global.test "default render of checkbox-prefill component"
|
||||
(fn []
|
||||
(render-checkbox-prefill)
|
||||
(-> (js/expect (rtl/screen.getByTestId "checkbox-prefill-component"))
|
||||
(.toBeTruthy))))
|
||||
(fn []
|
||||
(render-checkbox-prefill)
|
||||
(-> (js/expect (rtl/screen.getByTestId "checkbox-prefill-component"))
|
||||
(.toBeTruthy))))
|
||||
|
||||
(js/global.test "checkbox-prefill component on change is working"
|
||||
(let [mock-fn (js/jest.fn)]
|
||||
(fn []
|
||||
(render-checkbox-prefill {:on-change mock-fn})
|
||||
(rtl/fireEvent.press (rtl/screen.getByTestId "checkbox-prefill-component"))
|
||||
(-> (js/expect mock-fn)
|
||||
(.toHaveBeenCalledTimes 1)))))
|
||||
(let [mock-fn (js/jest.fn)]
|
||||
(fn []
|
||||
(render-checkbox-prefill {:on-change mock-fn})
|
||||
(rtl/fireEvent.press (rtl/screen.getByTestId "checkbox-prefill-component"))
|
||||
(-> (js/expect mock-fn)
|
||||
(.toHaveBeenCalledTimes 1)))))
|
||||
@@ -0,0 +1,32 @@
|
||||
(ns quo2.components.selectors.disclaimer
|
||||
(:require [quo2.components.markdown.text :as text]
|
||||
[quo2.components.selectors.selectors :as selectors]
|
||||
[quo2.foundations.colors :as colors]
|
||||
[react-native.core :as rn]))
|
||||
|
||||
(defn disclaimer
|
||||
[{:keys [on-change accessibility-label container-style]} label]
|
||||
[rn/view
|
||||
{:style
|
||||
(merge
|
||||
container-style
|
||||
{:flex 1
|
||||
:flex-direction :row
|
||||
:background-color (colors/theme-colors
|
||||
colors/neutral-5
|
||||
colors/neutral-80-opa-40)
|
||||
:padding 11
|
||||
:align-self :stretch
|
||||
:border-radius 12
|
||||
:border-width 1
|
||||
:border-color (colors/theme-colors
|
||||
colors/neutral-20
|
||||
colors/neutral-70)})}
|
||||
[selectors/checkbox
|
||||
{:on-change on-change}]
|
||||
[text/text
|
||||
{:accessibility-label accessibility-label
|
||||
:size :paragraph-2
|
||||
:style {:margin-left 8}}
|
||||
label]])
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
(ns quo2.components.selectors.disclaimer.style
|
||||
(:require [quo2.foundations.colors :as colors]))
|
||||
|
||||
(defn container
|
||||
[]
|
||||
{:flex 1
|
||||
:flex-direction :row
|
||||
:background-color (colors/theme-colors colors/neutral-5 colors/neutral-80-opa-40)
|
||||
:padding 11
|
||||
:align-self :stretch
|
||||
:border-radius 12
|
||||
:border-width 1
|
||||
:border-color (colors/theme-colors colors/neutral-20 colors/neutral-70)})
|
||||
|
||||
(def text
|
||||
{:margin-left 8})
|
||||
@@ -1,17 +0,0 @@
|
||||
(ns quo2.components.selectors.disclaimer.view
|
||||
(:require [quo2.components.markdown.text :as text]
|
||||
[quo2.components.selectors.disclaimer.style :as style]
|
||||
[quo2.components.selectors.selectors :as selectors]
|
||||
[react-native.core :as rn]))
|
||||
|
||||
(defn view
|
||||
[{:keys [on-change accessibility-label container-style]} label]
|
||||
[rn/view
|
||||
{:style (merge container-style (style/container))}
|
||||
[selectors/checkbox
|
||||
{:accessibility-label accessibility-label
|
||||
:on-change on-change}]
|
||||
[text/text
|
||||
{:size :paragraph-2
|
||||
:style style/text}
|
||||
label]])
|
||||
@@ -1,16 +0,0 @@
|
||||
(ns quo2.components.selectors.filter.component-spec
|
||||
(:require [quo2.components.selectors.filter.view :as quo]
|
||||
[test-helpers.component :as h]))
|
||||
|
||||
(h/describe "selector filter component"
|
||||
(h/test "renders component"
|
||||
(h/render [quo/view])
|
||||
(-> (js/expect (h/get-by-label-text :selector-filter))
|
||||
(.toBeTruthy)))
|
||||
|
||||
(h/test "calls custom event handler when on-press-out is triggered"
|
||||
(let [on-press-out-mock (js/jest.fn)]
|
||||
(h/render [quo/view {:on-press-out on-press-out-mock}])
|
||||
(h/fire-event :press-out (h/get-by-label-text :selector-filter))
|
||||
(-> (js/expect on-press-out-mock)
|
||||
(.toHaveBeenCalledTimes 1)))))
|
||||
@@ -1,60 +0,0 @@
|
||||
(ns quo2.components.selectors.filter.style
|
||||
(:require [quo2.foundations.colors :as colors]))
|
||||
|
||||
(def container-default
|
||||
{:width 32
|
||||
:height 32
|
||||
:border-radius 10
|
||||
:align-items :center
|
||||
:justify-content :center
|
||||
:padding 6})
|
||||
|
||||
(defn container-border-color
|
||||
[pressed? blur? override-theme]
|
||||
(let [dark? (= :dark override-theme)]
|
||||
(cond
|
||||
(and (not pressed?) (not dark?) (not blur?))
|
||||
colors/neutral-20
|
||||
|
||||
(and (not pressed?) dark? (not blur?))
|
||||
colors/neutral-80
|
||||
|
||||
(and pressed? (not dark?) blur?)
|
||||
colors/neutral-80-opa-20
|
||||
|
||||
(or (and pressed? (not dark?) (not blur?))
|
||||
(and (not pressed?) (not dark?) blur?))
|
||||
colors/neutral-80-opa-10
|
||||
|
||||
(or (and pressed? dark? (not blur?))
|
||||
(and (not pressed?) dark? blur?)
|
||||
(and pressed? dark? blur?))
|
||||
colors/white-opa-10
|
||||
|
||||
:else
|
||||
nil)))
|
||||
|
||||
(defn container-background-color
|
||||
[pressed? override-theme]
|
||||
(when pressed?
|
||||
(if (= :dark override-theme)
|
||||
colors/primary-60
|
||||
colors/primary-50)))
|
||||
|
||||
(defn container-outer
|
||||
[pressed? override-theme]
|
||||
(merge container-default
|
||||
{:background-color (container-background-color pressed? override-theme)}))
|
||||
|
||||
(defn container-inner
|
||||
[pressed? blur? override-theme]
|
||||
(merge container-default
|
||||
{:border-width 1
|
||||
:border-color (container-border-color pressed? blur? override-theme)}))
|
||||
|
||||
(defn icon-color
|
||||
[pressed? override-theme]
|
||||
(if (and (not pressed?)
|
||||
(= :light override-theme))
|
||||
colors/neutral-100
|
||||
colors/white))
|
||||
@@ -1,23 +0,0 @@
|
||||
(ns quo2.components.selectors.filter.view
|
||||
(:require [quo2.components.icon :as icon]
|
||||
[quo2.components.selectors.filter.style :as style]
|
||||
[quo2.theme :as theme]
|
||||
[react-native.core :as rn]
|
||||
[reagent.core :as reagent]))
|
||||
|
||||
(defn view
|
||||
[initial-props]
|
||||
(let [pressed? (reagent/atom (:pressed? initial-props))]
|
||||
(fn [{:keys [blur? override-theme on-press-out]
|
||||
:or {override-theme (theme/get-theme)}}]
|
||||
[rn/touchable-without-feedback
|
||||
{:accessibility-label :selector-filter
|
||||
:on-press-out (fn []
|
||||
(swap! pressed? not)
|
||||
(when on-press-out
|
||||
(on-press-out @pressed?)))}
|
||||
[rn/view {:style (style/container-outer @pressed? override-theme)}
|
||||
[rn/view {:style (style/container-inner @pressed? blur? override-theme)}
|
||||
[icon/icon :i/unread
|
||||
{:color (style/icon-color @pressed? override-theme)
|
||||
:size 20}]]]])))
|
||||
@@ -2,9 +2,7 @@
|
||||
(:require [quo2.components.icon :as icons]
|
||||
[quo2.foundations.colors :as colors]
|
||||
[react-native.core :as rn]
|
||||
[reagent.core :as reagent]
|
||||
[quo2.components.selectors.styles :as style]))
|
||||
|
||||
[reagent.core :as reagent]))
|
||||
|
||||
(defn- get-color
|
||||
[checked? disabled? blurred-background?]
|
||||
@@ -68,7 +66,6 @@
|
||||
(colors/alpha colors/neutral-100 (if disabled? 0.3 1))
|
||||
(colors/alpha colors/white (if disabled? 0.3 1)))}]])]])))
|
||||
|
||||
|
||||
(defn checkbox
|
||||
[{:keys [default-checked?]}]
|
||||
(let [checked? (reagent/atom (or default-checked? false))]
|
||||
@@ -110,34 +107,6 @@
|
||||
{:size 20
|
||||
:color colors/white}]])]]])))
|
||||
|
||||
;; TODO (Omar): issue https://github.com/status-im/status-mobile/issues/14681
|
||||
;(defn checkbox
|
||||
; [{:keys [default-checked?]}]
|
||||
; (let [checked? (reagent/atom (or default-checked? false))]
|
||||
; @(reagent/track
|
||||
; (fn [{:keys [on-change disabled? blurred-background? container-style]}]
|
||||
; [rn/touchable-without-feedback
|
||||
; {:on-press (handle-press disabled? on-change checked?)}
|
||||
; [rn/view
|
||||
; {:style (merge
|
||||
; container-style
|
||||
; {:height 20
|
||||
; :width 20})}
|
||||
; [rn/view
|
||||
; {:style (style/checkbox-toggle checked? disabled? blurred-background?)
|
||||
; :accessibility-label (str "checkbox-" (if @checked? "on" "off"))
|
||||
; :accessibility-role :checkbox
|
||||
; :testID "checkbox-component"}
|
||||
; (when @checked?
|
||||
; [rn/view
|
||||
; {:style
|
||||
; {:height 20
|
||||
; :width 20}}
|
||||
; [icons/icon :i/check-small
|
||||
; {:size 20
|
||||
; :color colors/white}]])]]])
|
||||
; checked?)))
|
||||
|
||||
(defn radio
|
||||
[{:keys [default-checked?]}]
|
||||
(let [checked? (reagent/atom (or default-checked? false))]
|
||||
@@ -151,9 +120,7 @@
|
||||
:width 20
|
||||
:border-radius 20
|
||||
:border-width 1
|
||||
:border-color (style/get-color @checked?
|
||||
disabled?
|
||||
blurred-background?)
|
||||
:border-color (get-color @checked? disabled? blurred-background?)
|
||||
:background-color (when-not blurred-background?
|
||||
(colors/theme-colors colors/white
|
||||
(colors/alpha colors/neutral-80
|
||||
@@ -167,7 +134,7 @@
|
||||
{:margin-left :auto
|
||||
:height 14
|
||||
:width 14
|
||||
:background-color (when @checked? (style/get-color @checked? disabled? blurred-background?))
|
||||
:background-color (when @checked? (get-color @checked? disabled? blurred-background?))
|
||||
:border-radius 20
|
||||
:margin-right :auto
|
||||
:margin-top :auto
|
||||
@@ -185,9 +152,7 @@
|
||||
{:height 20
|
||||
:width 30
|
||||
:border-radius 20
|
||||
:background-color (style/get-color @checked?
|
||||
disabled?
|
||||
blurred-background?)})
|
||||
:background-color (get-color @checked? disabled? blurred-background?)})
|
||||
:accessibility-label (str "toggle-" (if @checked? "on" "off"))
|
||||
:accessibility-role :checkbox
|
||||
:testID "toggle-component"}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
(ns quo2.components.selectors.styles
|
||||
(:require [quo2.foundations.colors :as colors]))
|
||||
|
||||
(defn get-color
|
||||
[checked? disabled? blurred-background?]
|
||||
(cond
|
||||
checked?
|
||||
(colors/custom-color-by-theme
|
||||
:primary
|
||||
50
|
||||
60
|
||||
(when disabled? 30)
|
||||
(when disabled? 30))
|
||||
blurred-background?
|
||||
(colors/theme-colors
|
||||
(colors/alpha colors/neutral-80 (if disabled? 0.05 0.1))
|
||||
(colors/alpha colors/white (if disabled? 0.05 0.1)))
|
||||
:else
|
||||
(colors/theme-colors
|
||||
(colors/alpha colors/neutral-20 (if disabled? 0.4 1))
|
||||
(colors/alpha colors/neutral-70 (if disabled? 0.3 1)))))
|
||||
|
||||
(defn checkbox-toggle
|
||||
[checked? disabled? blurred-background?]
|
||||
{:flex 1
|
||||
:border-radius 6
|
||||
:border-width (if @checked? 0 1)
|
||||
:background-color (cond
|
||||
@checked?
|
||||
(get-color @checked? disabled? blurred-background?)
|
||||
blurred-background?
|
||||
(colors/theme-colors
|
||||
colors/white-opa-5
|
||||
colors/white-opa-10)
|
||||
:else
|
||||
(colors/theme-colors
|
||||
colors/white
|
||||
colors/neutral-80-opa-40))
|
||||
:border-color (if @checked?
|
||||
:none
|
||||
(get-color @checked? disabled? blurred-background?))})
|
||||
@@ -1,71 +0,0 @@
|
||||
(ns quo2.components.settings.accounts.style
|
||||
(:require [quo2.foundations.colors :as colors]))
|
||||
|
||||
(def card
|
||||
{:position :relative
|
||||
:padding 8
|
||||
:border-radius 16
|
||||
:height 160
|
||||
:width 160})
|
||||
|
||||
(defn background-top
|
||||
[custom-color]
|
||||
{:position :absolute
|
||||
:top 0
|
||||
:border-top-left-radius 16
|
||||
:border-top-right-radius 16
|
||||
:width 160
|
||||
:height 64
|
||||
:background-color (-> colors/customization
|
||||
(get-in [custom-color 50])
|
||||
(colors/alpha 0.2))})
|
||||
|
||||
(defn background-bottom
|
||||
[]
|
||||
{:position :absolute
|
||||
:top 40
|
||||
:border-radius 16
|
||||
:width 160
|
||||
:height 120
|
||||
:background-color (colors/theme-colors
|
||||
colors/white
|
||||
colors/neutral-90)})
|
||||
|
||||
(defn avatar-border
|
||||
[]
|
||||
{:margin 2
|
||||
:justify-content :center
|
||||
:align-items :center
|
||||
:width 52
|
||||
:height 52
|
||||
:border-radius 14
|
||||
:border-width 2
|
||||
:border-color (colors/theme-colors
|
||||
colors/white
|
||||
colors/neutral-90)})
|
||||
|
||||
(def menu-button-container
|
||||
{:justify-content :center
|
||||
:align-items :center
|
||||
:align-self :flex-start})
|
||||
(defn menu-button-color
|
||||
[]
|
||||
{:background-color (colors/theme-colors
|
||||
colors/white-opa-40
|
||||
colors/neutral-80-opa-40)})
|
||||
|
||||
(defn address-text
|
||||
[]
|
||||
{:color (colors/theme-colors
|
||||
colors/neutral-50
|
||||
colors/neutral-40)})
|
||||
|
||||
(def card-top
|
||||
{:flex-direction :row
|
||||
:align-items :center
|
||||
:justify-content :space-between})
|
||||
|
||||
(def card-bottom
|
||||
{:flex 1
|
||||
:margin-horizontal 4
|
||||
:margin-top 4})
|
||||
@@ -1,46 +0,0 @@
|
||||
(ns quo2.components.settings.accounts.view
|
||||
(:require [quo2.components.avatars.account-avatar :as account-avatar]
|
||||
[quo2.components.buttons.button :as button]
|
||||
[quo2.components.markdown.text :as text]
|
||||
[quo2.components.settings.accounts.style :as style]
|
||||
[react-native.core :as rn]))
|
||||
|
||||
(defn card-background
|
||||
[{:keys [custom-color]}]
|
||||
[:<>
|
||||
[rn/view {:style (style/background-top custom-color)}]
|
||||
[rn/view {:style (style/background-bottom)}]])
|
||||
|
||||
(defn avatar
|
||||
[avatar-props]
|
||||
[rn/view {:style (style/avatar-border)}
|
||||
[account-avatar/account-avatar (assoc avatar-props :size 48)]])
|
||||
|
||||
(defn menu-button
|
||||
[{:keys [on-press]}]
|
||||
[rn/view {:style style/menu-button-container}
|
||||
[button/button
|
||||
{:style (style/menu-button-color)
|
||||
:type :gray
|
||||
:icon true
|
||||
:size 24
|
||||
:on-press on-press}
|
||||
:i/more]])
|
||||
|
||||
(defn account
|
||||
[{:keys [account-name account-address avatar-icon custom-color on-press-menu]}]
|
||||
[rn/view {:style style/card}
|
||||
[card-background {:custom-color custom-color}]
|
||||
[rn/view {:style style/card-top}
|
||||
[avatar
|
||||
{:color custom-color
|
||||
:icon avatar-icon}]
|
||||
[menu-button {:on-press on-press-menu}]]
|
||||
[rn/view {:style style/card-bottom}
|
||||
[text/text {:size :paragraph-1 :weight :semi-bold}
|
||||
account-name]
|
||||
[text/text
|
||||
{:style (style/address-text)
|
||||
:size :paragraph-2
|
||||
:weight :medium}
|
||||
account-address]]])
|
||||
@@ -15,17 +15,16 @@
|
||||
(defn indicator
|
||||
[]
|
||||
[rn/view
|
||||
{:accessibility-label :notification-dot
|
||||
:style {:position :absolute
|
||||
:z-index 1
|
||||
:right -2
|
||||
:top -2
|
||||
:width 10
|
||||
:height 10
|
||||
:border-radius 5
|
||||
:justify-content :center
|
||||
:align-items :center
|
||||
:background-color (colors/theme-colors colors/neutral-5 colors/neutral-95)}}
|
||||
{:position :absolute
|
||||
:z-index 1
|
||||
:right -2
|
||||
:top -2
|
||||
:width 10
|
||||
:height 10
|
||||
:border-radius 5
|
||||
:justify-content :center
|
||||
:align-items :center
|
||||
:background-color (colors/theme-colors colors/neutral-5 colors/neutral-95)}
|
||||
[notification-dot]])
|
||||
|
||||
(defn tabs
|
||||
@@ -139,7 +138,6 @@
|
||||
:shows-horizontal-scroll-indicator false
|
||||
:data data
|
||||
:key-fn (comp str :id)
|
||||
:on-scroll-to-index-failed identity
|
||||
:on-scroll (fn [^js e]
|
||||
(when fade-end?
|
||||
(let [offset-x (oget
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
(ns quo2.components.tags.context-tags
|
||||
(:require [quo2.components.avatars.group-avatar :as group-avatar]
|
||||
[quo2.components.icon :as icons]
|
||||
[quo2.components.markdown.text :as text]
|
||||
[quo2.foundations.colors :as colors]
|
||||
[quo2.theme :as quo2.theme]
|
||||
[react-native.core :as rn]))
|
||||
|
||||
(defn padding-left-for-type
|
||||
[type]
|
||||
(case type
|
||||
:group-avatar 3
|
||||
8))
|
||||
|
||||
(defn trim-public-key
|
||||
[pk]
|
||||
(str (subs pk 0 6) "..." (subs pk (- (count pk) 3))))
|
||||
@@ -24,7 +29,7 @@
|
||||
:padding-left 8
|
||||
:background-color (if (= theme :light)
|
||||
colors/neutral-10
|
||||
colors/neutral-90)}
|
||||
colors/neutral-80)}
|
||||
style)]
|
||||
children))))
|
||||
|
||||
@@ -34,8 +39,7 @@
|
||||
[base-tag
|
||||
(-> opts
|
||||
(select-keys [:override-theme :style])
|
||||
(assoc-in [:style :padding-left] 3)
|
||||
(assoc-in [:style :padding-vertical] 2))
|
||||
(assoc-in [:style :padding-left] 3))
|
||||
[group-avatar/group-avatar opts]
|
||||
[text/text
|
||||
{:weight :medium
|
||||
@@ -53,74 +57,22 @@
|
||||
(trim-public-key public-key)]]))
|
||||
|
||||
(defn context-tag
|
||||
[_ _]
|
||||
(fn [params photo name channel-name]
|
||||
(let [text-style (:text-style params)
|
||||
text-params {:weight :medium
|
||||
:size :paragraph-2
|
||||
:style (assoc text-style :justify-content :center)}
|
||||
icon-color (colors/theme-colors colors/neutral-50 colors/neutral-40)]
|
||||
[base-tag (assoc-in params [:style :padding-left] 3)
|
||||
[rn/image
|
||||
{:style {:width 20
|
||||
:border-radius 10
|
||||
:background-color :red
|
||||
:height 20}
|
||||
:source photo}]
|
||||
[rn/view
|
||||
{:style {:align-items :center
|
||||
:flex-direction :row}}
|
||||
[text/text text-params (str " " name)]
|
||||
(when channel-name
|
||||
[:<>
|
||||
[icons/icon
|
||||
:i/chevron-right
|
||||
{:color icon-color
|
||||
:size 16}]
|
||||
[text/text text-params (str "# " channel-name)]])]])))
|
||||
[params photo name]
|
||||
(let [text-style (params :text-style)]
|
||||
[base-tag (assoc-in params [:style :padding-left] 3)
|
||||
[rn/image
|
||||
{:style {:width 20
|
||||
:border-radius 10
|
||||
:background-color :white
|
||||
:height 20}
|
||||
:source photo}]
|
||||
[text/text
|
||||
(merge {:weight :medium
|
||||
:size :paragraph-2}
|
||||
{:style text-style})
|
||||
(str " " name)]]))
|
||||
|
||||
(defn user-avatar-tag
|
||||
[]
|
||||
(fn [params username photo]
|
||||
[context-tag params {:uri photo} username]))
|
||||
|
||||
(defn audio-tag
|
||||
[duration params]
|
||||
[base-tag
|
||||
(merge
|
||||
{:style {:padding-left 2
|
||||
:padding-vertical 2}}
|
||||
params)
|
||||
[rn/view
|
||||
{:width 20
|
||||
:height 20
|
||||
:border-radius 10
|
||||
:align-items :center
|
||||
:justify-content :center
|
||||
:background-color colors/primary-50}
|
||||
[icons/icon
|
||||
:i/play
|
||||
{:color colors/white
|
||||
:size 12}]]
|
||||
[text/text
|
||||
{:weight :medium
|
||||
:size :paragraph-2
|
||||
:style {:margin-left 4
|
||||
:color (colors/theme-colors
|
||||
colors/neutral-100
|
||||
colors/white
|
||||
(:override-theme params))}}
|
||||
duration]])
|
||||
|
||||
(defn community-tag
|
||||
[avatar community-name params]
|
||||
[context-tag
|
||||
(merge
|
||||
{:style {:padding-vertical 2}
|
||||
:text-style {:margin-left 2
|
||||
:color (colors/theme-colors
|
||||
colors/neutral-100
|
||||
colors/white
|
||||
(:override-theme params))}}
|
||||
params)
|
||||
avatar community-name])
|
||||
|
||||
@@ -1,61 +1,51 @@
|
||||
(ns quo2.core
|
||||
(:refer-clojure :exclude [filter])
|
||||
(:require
|
||||
quo2.components.avatars.account-avatar
|
||||
quo2.components.avatars.channel-avatar
|
||||
quo2.components.avatars.group-avatar
|
||||
quo2.components.avatars.icon-avatar
|
||||
quo2.components.avatars.user-avatar
|
||||
quo2.components.avatars.wallet-user-avatar
|
||||
quo2.components.banners.banner.view
|
||||
quo2.components.buttons.button
|
||||
quo2.components.buttons.dynamic-button
|
||||
quo2.components.community.community-card-view
|
||||
quo2.components.community.community-list-view
|
||||
quo2.components.community.community-view
|
||||
quo2.components.community.discover-card
|
||||
quo2.components.community.icon
|
||||
quo2.components.community.token-gating
|
||||
quo2.components.counter.counter
|
||||
quo2.components.dividers.date
|
||||
quo2.components.dividers.divider-label
|
||||
quo2.components.dividers.new-messages
|
||||
quo2.components.drawers.action-drawers
|
||||
quo2.components.dropdowns.dropdown
|
||||
quo2.components.header
|
||||
quo2.components.icon
|
||||
quo2.components.info.info-message
|
||||
quo2.components.info.information-box
|
||||
quo2.components.list-items.channel
|
||||
quo2.components.list-items.menu-item
|
||||
quo2.components.list-items.preview-list
|
||||
quo2.components.loaders.skeleton
|
||||
quo2.components.markdown.text
|
||||
quo2.components.messages.author.view
|
||||
quo2.components.messages.gap
|
||||
quo2.components.messages.system-message
|
||||
quo2.components.navigation.floating-shell-button
|
||||
quo2.components.navigation.page-nav
|
||||
quo2.components.notifications.activity-log.view
|
||||
quo2.components.notifications.count-down-circle
|
||||
quo2.components.notifications.info-count
|
||||
quo2.components.notifications.notification-dot
|
||||
quo2.components.notifications.toast
|
||||
quo2.components.reactions.reaction
|
||||
quo2.components.selectors.disclaimer.view
|
||||
quo2.components.selectors.filter.view
|
||||
quo2.components.selectors.selectors
|
||||
quo2.components.separator
|
||||
quo2.components.settings.accounts.view
|
||||
quo2.components.settings.privacy-option
|
||||
quo2.components.tabs.account-selector
|
||||
quo2.components.tabs.tabs
|
||||
quo2.components.tags.context-tags
|
||||
quo2.components.tags.status-tags
|
||||
quo2.components.profile.profile-card.view
|
||||
quo2.components.tags.tags))
|
||||
(:require quo2.components.avatars.account-avatar
|
||||
quo2.components.avatars.channel-avatar
|
||||
quo2.components.avatars.group-avatar
|
||||
quo2.components.avatars.icon-avatar
|
||||
quo2.components.avatars.user-avatar
|
||||
quo2.components.avatars.wallet-user-avatar
|
||||
quo2.components.buttons.button
|
||||
quo2.components.buttons.dynamic-button
|
||||
quo2.components.community.community-card-view
|
||||
quo2.components.community.community-list-view
|
||||
quo2.components.community.community-view
|
||||
quo2.components.community.discover-card
|
||||
quo2.components.community.token-gating
|
||||
quo2.components.counter.counter
|
||||
quo2.components.dividers.date
|
||||
quo2.components.dividers.divider-label
|
||||
quo2.components.dividers.new-messages
|
||||
quo2.components.drawers.action-drawers
|
||||
quo2.components.dropdowns.dropdown
|
||||
quo2.components.header
|
||||
quo2.components.icon
|
||||
quo2.components.info.info-message
|
||||
quo2.components.info.information-box
|
||||
quo2.components.list-items.channel
|
||||
quo2.components.list-items.menu-item
|
||||
quo2.components.list-items.preview-list
|
||||
quo2.components.loaders.skeleton
|
||||
quo2.components.markdown.text
|
||||
quo2.components.messages.author.view
|
||||
quo2.components.messages.gap
|
||||
quo2.components.messages.system-message
|
||||
quo2.components.navigation.floating-shell-button
|
||||
quo2.components.navigation.page-nav
|
||||
quo2.components.notifications.activity-log.view
|
||||
quo2.components.notifications.info-count
|
||||
quo2.components.notifications.notification-dot
|
||||
quo2.components.reactions.reaction
|
||||
quo2.components.selectors.disclaimer
|
||||
quo2.components.selectors.selectors
|
||||
quo2.components.separator
|
||||
quo2.components.settings.privacy-option
|
||||
quo2.components.tabs.account-selector
|
||||
quo2.components.tabs.tabs
|
||||
quo2.components.tags.context-tags
|
||||
quo2.components.tags.status-tags
|
||||
quo2.components.tags.tags))
|
||||
|
||||
(def toast quo2.components.notifications.toast/toast)
|
||||
(def button quo2.components.buttons.button/button)
|
||||
(def dynamic-button quo2.components.buttons.dynamic-button/dynamic-button)
|
||||
(def text quo2.components.markdown.text/text)
|
||||
@@ -75,17 +65,14 @@
|
||||
(def user-avatar-tag quo2.components.tags.context-tags/user-avatar-tag)
|
||||
(def context-tag quo2.components.tags.context-tags/context-tag)
|
||||
(def group-avatar-tag quo2.components.tags.context-tags/group-avatar-tag)
|
||||
(def audio-tag quo2.components.tags.context-tags/audio-tag)
|
||||
(def community-tag quo2.components.tags.context-tags/community-tag)
|
||||
(def tabs quo2.components.tabs.tabs/tabs)
|
||||
(def scrollable-tabs quo2.components.tabs.tabs/scrollable-tabs)
|
||||
(def account-selector quo2.components.tabs.account-selector/account-selector)
|
||||
(def floating-shell-button quo2.components.navigation.floating-shell-button/floating-shell-button)
|
||||
(def status-tag quo2.components.tags.status-tags/status-tag)
|
||||
(def page-nav quo2.components.navigation.page-nav/page-nav)
|
||||
(def disclaimer quo2.components.selectors.disclaimer.view/view)
|
||||
(def disclaimer quo2.components.selectors.disclaimer/disclaimer)
|
||||
(def checkbox quo2.components.selectors.selectors/checkbox)
|
||||
(def filter quo2.components.selectors.filter.view/view)
|
||||
(def skeleton quo2.components.loaders.skeleton/skeleton)
|
||||
(def author quo2.components.messages.author.view/author)
|
||||
|
||||
@@ -97,9 +84,6 @@
|
||||
(def user-avatar quo2.components.avatars.user-avatar/user-avatar)
|
||||
(def wallet-user-avatar quo2.components.avatars.wallet-user-avatar/wallet-user-avatar)
|
||||
|
||||
;;;; BANNER
|
||||
(def banner quo2.components.banners.banner.view/banner)
|
||||
|
||||
;;;; COMMUNITY
|
||||
(def community-card-view-item quo2.components.community.community-card-view/community-card-view-item)
|
||||
(def communities-list-view-item quo2.components.community.community-list-view/communities-list-view-item)
|
||||
@@ -112,7 +96,6 @@
|
||||
(def permission-tag-container quo2.components.community.community-view/permission-tag-container)
|
||||
(def discover-card quo2.components.community.discover-card/discover-card)
|
||||
(def token-gating quo2.components.community.token-gating/token-gating)
|
||||
(def community-icon quo2.components.community.icon/community-icon)
|
||||
|
||||
;;;; DIVIDERS
|
||||
(def divider-label quo2.components.dividers.divider-label/divider-label)
|
||||
@@ -128,11 +111,6 @@
|
||||
(def activity-log quo2.components.notifications.activity-log.view/view)
|
||||
(def info-count quo2.components.notifications.info-count/info-count)
|
||||
(def notification-dot quo2.components.notifications.notification-dot/notification-dot)
|
||||
(def count-down-circle quo2.components.notifications.count-down-circle/circle-timer)
|
||||
|
||||
;;;; PROFILE
|
||||
(def profile-card quo2.components.profile.profile-card.view/profile-card)
|
||||
|
||||
;;;; SETTINGS
|
||||
(def privacy-option quo2.components.settings.privacy-option/card)
|
||||
(def account quo2.components.settings.accounts.view/account)
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
(ns quo2.core-spec
|
||||
(:require [quo2.components.banners.--tests--.banner-component-spec]
|
||||
[quo2.components.buttons.--tests--.buttons-component-spec]
|
||||
[quo2.components.counter.--tests--.counter-component-spec]
|
||||
[quo2.components.dividers.--tests--.divider-label-component-spec]
|
||||
(:require [quo2.components.counter.--tests--.counter-component-spec]
|
||||
[quo2.components.drawers.--tests--.action-drawers-component-spec]
|
||||
[quo2.components.markdown.--tests--.text-component-spec]
|
||||
[quo2.components.selectors.--tests--.selectors-component-spec]
|
||||
[quo2.components.selectors.filter.component-spec]))
|
||||
[quo2.components.selectors.--tests--.selectors-component-spec]))
|
||||
|
||||
@@ -14,21 +14,6 @@
|
||||
(let [rgb (string/split value #",")]
|
||||
(str (string/join "," (butlast rgb)) "," opacity ")")))))
|
||||
|
||||
(defn- alpha-opaque
|
||||
[value opacity]
|
||||
(when value
|
||||
(if (string/starts-with? value "#")
|
||||
(let [hex (string/replace value #"#" "")
|
||||
r (- 255 (* opacity (- 255 (js/parseInt (subs hex 0 2) 16))))
|
||||
g (- 255 (* opacity (- 255 (js/parseInt (subs hex 2 4) 16))))
|
||||
b (- 255 (* opacity (- 255 (js/parseInt (subs hex 4 6) 16))))]
|
||||
(str "rgb(" r "," g "," b ")"))
|
||||
(let [rgb (string/split value #",")
|
||||
r (- 255 (* opacity (- 255 (get rgb 0))))
|
||||
g (- 255 (* opacity (- 255 (get rgb 1))))
|
||||
b (- 255 (* opacity (- 255 (get rgb 2))))]
|
||||
(str "rgb(" r "," g "," b ")")))))
|
||||
|
||||
(def theme-alpha
|
||||
(memoize
|
||||
(fn
|
||||
@@ -65,7 +50,6 @@
|
||||
;;80 with transparency
|
||||
(def neutral-80-opa-5 (alpha neutral-80 0.05))
|
||||
(def neutral-80-opa-10 (alpha neutral-80 0.1))
|
||||
(def neutral-80-opa-15 (alpha neutral-80 0.15))
|
||||
(def neutral-80-opa-20 (alpha neutral-80 0.2))
|
||||
(def neutral-80-opa-30 (alpha neutral-80 0.3))
|
||||
(def neutral-80-opa-40 (alpha neutral-80 0.4))
|
||||
@@ -85,7 +69,6 @@
|
||||
|
||||
;;100 with transparency
|
||||
(def neutral-100-opa-0 (alpha neutral-100 0))
|
||||
(def neutral-100-opa-10 (alpha neutral-100 0.1))
|
||||
(def neutral-100-opa-60 (alpha neutral-100 0.6))
|
||||
(def neutral-100-opa-70 (alpha neutral-100 0.7))
|
||||
(def neutral-100-opa-80 (alpha neutral-100 0.8))
|
||||
@@ -93,9 +76,6 @@
|
||||
(def neutral-100-opa-95 (alpha neutral-100 0.95))
|
||||
(def neutral-100-opa-100 (alpha neutral-100 1))
|
||||
|
||||
;;80 with transparency opaque
|
||||
(def neutral-80-opa-5-opaque (alpha-opaque neutral-80 0.05))
|
||||
|
||||
;;;;White
|
||||
|
||||
;;Solid
|
||||
@@ -114,11 +94,6 @@
|
||||
(def white-opa-90 (alpha white 0.9))
|
||||
(def white-opa-95 (alpha white 0.95))
|
||||
|
||||
;;;;Black
|
||||
|
||||
;;Solid
|
||||
(def black "#000000")
|
||||
|
||||
;;;;Primary
|
||||
|
||||
;;Solid
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
(ns react-native.core
|
||||
(:require ["@react-native-community/blur" :as blur]
|
||||
["react" :as react]
|
||||
["react-native" :as react-native]
|
||||
[cljs-bean.core :as bean]
|
||||
[oops.core :as oops]
|
||||
[react-native.flat-list :as flat-list]
|
||||
[react-native.platform :as platform]
|
||||
[react-native.section-list :as section-list]
|
||||
@@ -67,8 +64,6 @@
|
||||
|
||||
(def status-bar (.-StatusBar ^js react-native))
|
||||
|
||||
(def style-sheet (.-StyleSheet ^js react-native))
|
||||
|
||||
(defn status-bar-height
|
||||
[]
|
||||
(.-currentHeight ^js status-bar))
|
||||
@@ -89,16 +84,3 @@
|
||||
(merge (when platform/ios? {:behavior :padding})
|
||||
props)]
|
||||
children))
|
||||
|
||||
(defn use-effect
|
||||
([effect] (use-effect effect []))
|
||||
([effect deps]
|
||||
(react/useEffect effect (bean/->js deps))))
|
||||
|
||||
(def use-ref react/useRef)
|
||||
(defn use-effect-once [effect] (use-effect effect))
|
||||
(defn use-unmount
|
||||
[f]
|
||||
(let [fn-ref (use-ref f)]
|
||||
(oops/oset! fn-ref "current" f)
|
||||
(use-effect-once (fn [] #((oops/oget fn-ref "current"))))))
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
(ns react-native.hooks
|
||||
(:require ["@react-native-community/hooks" :as hooks]))
|
||||
|
||||
(defn use-keyboard
|
||||
[]
|
||||
(let [kb (.useKeyboard hooks)]
|
||||
{:keyboard-shown (.-keyboardShown ^js kb)
|
||||
:keyboard-height (.-keyboardHeight ^js kb)}))
|
||||
@@ -1,25 +1,11 @@
|
||||
(ns react-native.reanimated
|
||||
(:require ["react-native" :as rn]
|
||||
["react-native-linear-gradient" :default LinearGradient]
|
||||
["react-native-reanimated" :default reanimated :refer
|
||||
(useSharedValue useAnimatedStyle
|
||||
withTiming
|
||||
withDelay
|
||||
withSpring
|
||||
withRepeat
|
||||
Easing
|
||||
Keyframe
|
||||
cancelAnimation
|
||||
SlideInUp
|
||||
SlideOutUp
|
||||
LinearTransition)]
|
||||
[clojure.string :as string]
|
||||
[reagent.core :as reagent]))
|
||||
|
||||
;; Animations
|
||||
(def slide-in-up-animation SlideInUp)
|
||||
(def slide-out-up-animation SlideOutUp)
|
||||
(def linear-transition LinearTransition)
|
||||
(:require
|
||||
["react-native" :as rn]
|
||||
["react-native-linear-gradient" :default LinearGradient]
|
||||
["react-native-reanimated" :default reanimated :refer
|
||||
(useSharedValue useAnimatedStyle withTiming withDelay withSpring withRepeat Easing Keyframe)]
|
||||
[clojure.string :as string]
|
||||
[reagent.core :as reagent]))
|
||||
|
||||
;; Animated Components
|
||||
(def create-animated-component (comp reagent/adapt-react-class (.-createAnimatedComponent reanimated)))
|
||||
@@ -40,7 +26,6 @@
|
||||
(def with-spring withSpring)
|
||||
(def key-frame Keyframe)
|
||||
(def with-repeat withRepeat)
|
||||
(def cancel-animation cancelAnimation)
|
||||
|
||||
;; Easings
|
||||
(def bezier (.-bezier ^js Easing))
|
||||
@@ -75,13 +60,6 @@
|
||||
;; Worklets
|
||||
(def worklet-factory (js/require "../src/js/worklet_factory.js"))
|
||||
|
||||
(defn interpolate
|
||||
[shared-value input-range output-range]
|
||||
(.interpolateValue ^js worklet-factory
|
||||
shared-value
|
||||
(clj->js input-range)
|
||||
(clj->js output-range)))
|
||||
|
||||
;;;; Component Animations
|
||||
|
||||
;; kebab-case styles are not working for worklets
|
||||
@@ -116,26 +94,4 @@
|
||||
(js-obj "duration" duration
|
||||
"easing" (get easings easing)))
|
||||
number-of-repetitions
|
||||
reverse?)))
|
||||
|
||||
(defn animate-shared-value-with-delay-repeat
|
||||
([anim val duration easing delay number-of-repetitions]
|
||||
(animate-shared-value-with-delay-repeat anim val duration easing delay number-of-repetitions false))
|
||||
([anim val duration easing delay number-of-repetitions reverse?]
|
||||
(set-shared-value anim
|
||||
(with-delay delay
|
||||
(with-repeat
|
||||
(with-timing val
|
||||
#js
|
||||
{:duration duration
|
||||
:easing (get easings easing)})
|
||||
number-of-repetitions
|
||||
reverse?)))))
|
||||
|
||||
(defn animate-shared-value-with-spring
|
||||
[anim val {:keys [mass stiffness damping]}]
|
||||
(set-shared-value anim
|
||||
(with-spring val
|
||||
(js-obj "mass" mass
|
||||
"damping" damping
|
||||
"stiffness" stiffness))))
|
||||
reverse?)))
|
||||
@@ -1,6 +0,0 @@
|
||||
(ns react-native.svg
|
||||
(:require ["react-native-svg" :as Svg]
|
||||
[reagent.core :as reagent]))
|
||||
|
||||
(def svg (reagent/adapt-react-class Svg/default))
|
||||
(def path (reagent/adapt-react-class Svg/Path))
|
||||
@@ -7,10 +7,10 @@
|
||||
[status-im.ethereum.core :as ethereum]
|
||||
[status-im.ethereum.ens :as ens]
|
||||
[status-im.ethereum.stateofus :as stateofus]
|
||||
[i18n.i18n :as i18n]
|
||||
[status-im.i18n.i18n :as i18n]
|
||||
[status-im.router.core :as router]
|
||||
[status-im.utils.db :as utils.db]
|
||||
[utils.re-frame :as rf]
|
||||
[status-im.utils.fx :as fx]
|
||||
[status-im.utils.random :as random]
|
||||
[status-im.utils.utils :as utils]
|
||||
[status-im2.navigation.events :as navigation]))
|
||||
@@ -24,7 +24,7 @@
|
||||
;;NOTE we want to handle only last resolve
|
||||
(def resolve-last-id (atom nil))
|
||||
|
||||
(rf/defn new-chat-set-new-identity
|
||||
(fx/defn new-chat-set-new-identity
|
||||
{:events [:new-chat/set-new-identity]}
|
||||
[{db :db} new-identity-raw new-ens-name id]
|
||||
(let [ens-error (and (= new-identity-raw "0x") (not (string/blank? new-ens-name)))]
|
||||
@@ -61,12 +61,12 @@
|
||||
new-identity
|
||||
@resolve-last-id])}})))))))
|
||||
|
||||
(rf/defn clear-new-identity
|
||||
(fx/defn clear-new-identity
|
||||
{:events [::clear-new-identity ::new-chat-focus]}
|
||||
[{:keys [db]}]
|
||||
{:db (dissoc db :contacts/new-identity)})
|
||||
|
||||
(rf/defn qr-code-handled
|
||||
(fx/defn qr-code-handled
|
||||
{:events [::qr-code-handled]}
|
||||
[{:keys [db] :as cofx} {:keys [type public-key chat-id data ens-name]}
|
||||
{:keys [new-contact? nickname] :as opts}]
|
||||
@@ -81,7 +81,7 @@
|
||||
validation-result (db/validate-pub-key db chat-key)]
|
||||
(if-not validation-result
|
||||
(if new-contact?
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
(contact/add-contact chat-key nickname ens-name)
|
||||
(navigation/navigate-to-cofx :contacts-list {}))
|
||||
(chat/start-chat cofx chat-key ens-name))
|
||||
@@ -93,7 +93,7 @@
|
||||
(i18n/label :t/can-not-add-yourself))
|
||||
:on-dismiss #(re-frame/dispatch [:pop-to-root-tab :chat-stack])}})))
|
||||
|
||||
(rf/defn qr-code-scanned
|
||||
(fx/defn qr-code-scanned
|
||||
{:events [:contact/qr-code-scanned]}
|
||||
[{:keys [db]} data opts]
|
||||
{::router/handle-uri {:chain (ethereum/chain-keyword db)
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
(ns status-im.backup.core
|
||||
(:require [re-frame.core :as re-frame]
|
||||
[utils.re-frame :as rf]
|
||||
[status-im.ethereum.json-rpc :as json-rpc]
|
||||
[status-im.utils.fx :as fx]
|
||||
[taoensso.timbre :as log]))
|
||||
|
||||
(rf/defn handle-backup-failed
|
||||
(fx/defn handle-backup-failed
|
||||
{:events [::backup-failed]}
|
||||
[{:keys [db]}]
|
||||
{:db (dissoc db :backup/performing-backup)})
|
||||
|
||||
(rf/defn handle-backup-perfomed
|
||||
(fx/defn handle-backup-perfomed
|
||||
{:events [::backup-performed]}
|
||||
[{:keys [db]}]
|
||||
{:db (dissoc db :backup/performing-backup)})
|
||||
|
||||
(rf/defn handle-perform-backup-pressed
|
||||
(fx/defn handle-perform-backup-pressed
|
||||
{:events [:multiaccounts.ui/perform-backup-pressed]}
|
||||
[{:keys [db]}]
|
||||
{:db (assoc db :backup/performing-backup true)
|
||||
:json-rpc/call [{:method "wakuext_backupData"
|
||||
:params []
|
||||
:on-error #(do
|
||||
(log/error "failed to perfom backup" %)
|
||||
(re-frame/dispatch [::backup-failed %]))
|
||||
:on-success #(re-frame/dispatch [::backup-performed %])}]})
|
||||
{:db (assoc db :backup/performing-backup true)
|
||||
::json-rpc/call [{:method "wakuext_backupData"
|
||||
:params []
|
||||
:on-error #(do
|
||||
(log/error "failed to perfom backup" %)
|
||||
(re-frame/dispatch [::backup-failed %]))
|
||||
:on-success #(re-frame/dispatch [::backup-performed %])}]})
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
(ns status-im.bootnodes.core
|
||||
(:require [clojure.string :as string]
|
||||
[re-frame.core :as re-frame]
|
||||
[i18n.i18n :as i18n]
|
||||
[status-im.i18n.i18n :as i18n]
|
||||
[status-im.multiaccounts.update.core :as multiaccounts.update]
|
||||
[utils.re-frame :as rf]
|
||||
[status-im.utils.fx :as fx]
|
||||
[status-im2.navigation.events :as navigation]))
|
||||
|
||||
(def address-regex #"enode://[a-zA-Z0-9]+:?(.*)\@\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b:(\d{1,5})")
|
||||
@@ -19,12 +19,12 @@
|
||||
:id (string/replace id "-" "")
|
||||
:name bootnode-name})
|
||||
|
||||
(rf/defn fetch
|
||||
(fx/defn fetch
|
||||
[cofx id]
|
||||
(let [network (get-in cofx [:db :networks/current-network])]
|
||||
(get-in cofx [:db :multiaccount :custom-bootnodes network id])))
|
||||
|
||||
(rf/defn set-input
|
||||
(fx/defn set-input
|
||||
{:events [:bootnodes.ui/input-changed]}
|
||||
[{:keys [db]} input-key value]
|
||||
{:db (update
|
||||
@@ -38,14 +38,14 @@
|
||||
:name (string/blank? value)
|
||||
:url (not (valid-address? value)))})})
|
||||
|
||||
(rf/defn edit
|
||||
(fx/defn edit
|
||||
{:events [:bootnodes.ui/add-bootnode-pressed]}
|
||||
[{:keys [db] :as cofx} id]
|
||||
(let [{:keys [id
|
||||
address
|
||||
name]}
|
||||
(fetch cofx id)
|
||||
fxs (rf/merge cofx
|
||||
fxs (fx/merge cofx
|
||||
(set-input :id id)
|
||||
(set-input :url (str address))
|
||||
(set-input :name (str name)))]
|
||||
@@ -56,11 +56,11 @@
|
||||
(let [network (:networks/current-network db)]
|
||||
(get-in db [:multiaccount :custom-bootnodes-enabled? network])))
|
||||
|
||||
(rf/defn delete
|
||||
(fx/defn delete
|
||||
[{{:keys [multiaccount] :as db} :db :as cofx} id]
|
||||
(let [network (:networks/current-network db)
|
||||
new-multiaccount (update-in multiaccount [:custom-bootnodes network] dissoc id)]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
{:db (assoc db :multiaccount new-multiaccount)}
|
||||
(multiaccounts.update/multiaccount-update
|
||||
:custom-bootnodes
|
||||
@@ -68,7 +68,7 @@
|
||||
{:success-event (when (custom-bootnodes-in-use? cofx)
|
||||
[:multiaccounts.update.callback/save-settings-success])}))))
|
||||
|
||||
(rf/defn upsert
|
||||
(fx/defn upsert
|
||||
{:events [:bootnodes.ui/save-pressed]
|
||||
:interceptors [(re-frame/inject-cofx :random-id-generator)]}
|
||||
[{{:bootnodes/keys [manage] :keys [multiaccount] :as db} :db
|
||||
@@ -86,7 +86,7 @@
|
||||
[network (:id bootnode)]
|
||||
bootnode)]
|
||||
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
{:db (dissoc db :bootnodes/manage)
|
||||
:dispatch [:navigate-back]}
|
||||
(multiaccounts.update/multiaccount-update
|
||||
@@ -95,7 +95,7 @@
|
||||
{:success-event (when (custom-bootnodes-in-use? cofx)
|
||||
[:multiaccounts.update.callback/save-settings-success])}))))
|
||||
|
||||
(rf/defn toggle-custom-bootnodes
|
||||
(fx/defn toggle-custom-bootnodes
|
||||
{:events [:bootnodes.ui/custom-bootnodes-switch-toggled]}
|
||||
[{:keys [db] :as cofx} value]
|
||||
(let [current-network (:networks/current-network db)
|
||||
@@ -106,14 +106,14 @@
|
||||
(assoc bootnodes-settings current-network value)
|
||||
{:success-event [:multiaccounts.update.callback/save-settings-success]})))
|
||||
|
||||
(rf/defn set-bootnodes-from-qr
|
||||
(fx/defn set-bootnodes-from-qr
|
||||
{:events [:bootnodes.callback/qr-code-scanned]}
|
||||
[cofx url]
|
||||
(assoc (set-input cofx :url (string/trim url))
|
||||
:dispatch
|
||||
[:navigate-back]))
|
||||
|
||||
(rf/defn show-delete-bootnode-confirmation
|
||||
(fx/defn show-delete-bootnode-confirmation
|
||||
{:events [:bootnodes.ui/delete-pressed]}
|
||||
[_ bootnode-id]
|
||||
{:ui/show-confirmation {:title (i18n/label :t/delete-bootnode-title)
|
||||
@@ -122,9 +122,9 @@
|
||||
:on-accept #(re-frame/dispatch [:bootnodes.ui/delete-confirmed
|
||||
bootnode-id])}})
|
||||
|
||||
(rf/defn delete-bootnode
|
||||
(fx/defn delete-bootnode
|
||||
{:events [:bootnodes.ui/delete-confirmed]}
|
||||
[cofx bootnode-id]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
(delete bootnode-id)
|
||||
(navigation/navigate-back)))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
(ns status-im.bottom-sheet.core
|
||||
(:require [utils.re-frame :as rf]))
|
||||
(:require [status-im.utils.fx :as fx]))
|
||||
|
||||
(rf/defn show-bottom-sheet
|
||||
(fx/defn show-bottom-sheet
|
||||
[{:keys [db]} {:keys [view options]}]
|
||||
{:show-bottom-sheet nil
|
||||
:db (assoc db
|
||||
@@ -9,7 +9,7 @@
|
||||
:bottom-sheet/view view
|
||||
:bottom-sheet/options options)})
|
||||
|
||||
(rf/defn show-bottom-sheet-event
|
||||
(fx/defn show-bottom-sheet-event
|
||||
{:events [:bottom-sheet/show-sheet]}
|
||||
[cofx view options]
|
||||
(show-bottom-sheet
|
||||
@@ -17,12 +17,8 @@
|
||||
{:view view
|
||||
:options options}))
|
||||
|
||||
(rf/defn hide-bottom-sheet
|
||||
(fx/defn hide-bottom-sheet
|
||||
{:events [:bottom-sheet/hide]}
|
||||
[{:keys [db]}]
|
||||
{:db (assoc db :bottom-sheet/show? false)})
|
||||
|
||||
(rf/defn hide-bottom-sheet-navigation-overlay
|
||||
{:events [:bottom-sheet/hide-navigation-overlay]}
|
||||
[{}]
|
||||
{:hide-bottom-sheet nil})
|
||||
{:hide-bottom-sheet nil
|
||||
:db (assoc db :bottom-sheet/show? false)})
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
(ns status-im.browser.core
|
||||
(:require
|
||||
["eth-phishing-detect" :as eth-phishing-detect]
|
||||
[clojure.string :as string]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.bottom-sheet.core :as bottom-sheet]
|
||||
[status-im.browser.eip3085 :as eip3085]
|
||||
[status-im.browser.eip3326 :as eip3326]
|
||||
[status-im.browser.permissions :as browser.permissions]
|
||||
[status-im.browser.webview-ref :as webview-ref]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.ethereum.core :as ethereum]
|
||||
[status-im.ethereum.ens :as ens]
|
||||
[i18n.i18n :as i18n]
|
||||
[status-im.multiaccounts.update.core :as multiaccounts.update]
|
||||
[status-im.native-module.core :as status]
|
||||
[status-im.signing.core :as signing]
|
||||
[status-im.ui.components.list-selection :as list-selection]
|
||||
[utils.re-frame :as rf]
|
||||
[status-im.utils.http :as http]
|
||||
[status-im.utils.platform :as platform]
|
||||
[status-im.utils.random :as random]
|
||||
[status-im.utils.types :as types]
|
||||
[status-im.utils.universal-links.utils :as links]
|
||||
[status-im2.navigation.events :as navigation]
|
||||
[taoensso.timbre :as log]
|
||||
[utils.debounce :as debounce]
|
||||
[utils.security.core :as security]))
|
||||
(:require ["eth-phishing-detect" :as eth-phishing-detect]
|
||||
[clojure.string :as string]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.bottom-sheet.core :as bottom-sheet]
|
||||
[status-im.browser.eip3085 :as eip3085]
|
||||
[status-im.browser.eip3326 :as eip3326]
|
||||
[status-im.browser.permissions :as browser.permissions]
|
||||
[status-im.browser.webview-ref :as webview-ref]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.ethereum.core :as ethereum]
|
||||
[status-im.ethereum.ens :as ens]
|
||||
[status-im.ethereum.json-rpc :as json-rpc]
|
||||
[status-im.i18n.i18n :as i18n]
|
||||
[status-im.multiaccounts.update.core :as multiaccounts.update]
|
||||
[status-im.native-module.core :as status]
|
||||
[status-im.signing.core :as signing]
|
||||
[status-im.ui.components.list-selection :as list-selection]
|
||||
[status-im.utils.fx :as fx]
|
||||
[status-im.utils.http :as http]
|
||||
[status-im.utils.platform :as platform]
|
||||
[status-im.utils.random :as random]
|
||||
[status-im.utils.security :as security]
|
||||
[status-im.utils.types :as types]
|
||||
[status-im.utils.universal-links.utils :as links]
|
||||
[status-im2.navigation.events :as navigation]
|
||||
[taoensso.timbre :as log]
|
||||
[utils.debounce :as debounce]))
|
||||
|
||||
(rf/defn update-browser-option
|
||||
(fx/defn update-browser-option
|
||||
[{:keys [db]} option-key option-value]
|
||||
{:db (assoc-in db [:browser/options option-key] option-value)})
|
||||
|
||||
(rf/defn update-browser-options
|
||||
(fx/defn update-browser-options
|
||||
[{:keys [db]} options]
|
||||
{:db (update db :browser/options merge options)})
|
||||
|
||||
@@ -52,22 +52,22 @@
|
||||
(when url
|
||||
(string/starts-with? url "https://")))))
|
||||
|
||||
(rf/defn remove-browser
|
||||
(fx/defn remove-browser
|
||||
{:events [:browser.ui/remove-browser-pressed]}
|
||||
[{:keys [db]} browser-id]
|
||||
{:db (update-in db [:browser/browsers] dissoc browser-id)
|
||||
:json-rpc/call [{:method "wakuext_deleteBrowser"
|
||||
:params [browser-id]
|
||||
:on-success #()}]})
|
||||
{:db (update-in db [:browser/browsers] dissoc browser-id)
|
||||
::json-rpc/call [{:method "wakuext_deleteBrowser"
|
||||
:params [browser-id]
|
||||
:on-success #()}]})
|
||||
|
||||
(rf/defn clear-all-browsers
|
||||
(fx/defn clear-all-browsers
|
||||
{:events [:browser.ui/clear-all-browsers-pressed]}
|
||||
[{:keys [db]}]
|
||||
{:db (dissoc db :browser/browsers)
|
||||
:json-rpc/call (for [browser-id (keys (get db :browser/browsers))]
|
||||
{:method "wakuext_deleteBrowser"
|
||||
:params [browser-id]
|
||||
:on-success #()})})
|
||||
{:db (dissoc db :browser/browsers)
|
||||
::json-rpc/call (for [browser-id (keys (get db :browser/browsers))]
|
||||
{:method "wakuext_deleteBrowser"
|
||||
:params [browser-id]
|
||||
:on-success #()})})
|
||||
|
||||
(defn update-dapp-name
|
||||
[{:keys [name] :as browser}]
|
||||
@@ -84,7 +84,7 @@
|
||||
(re-frame/dispatch [:browser.callback/resolve-ens-multihash-success url])
|
||||
(re-frame/dispatch [:browser.callback/resolve-ens-multihash-error])))
|
||||
|
||||
(rf/defn resolve-url
|
||||
(fx/defn resolve-url
|
||||
[{:keys [db]} {:keys [error? resolved-url]}]
|
||||
(when (not error?)
|
||||
(let [current-url (get-current-url (get-current-browser db))
|
||||
@@ -96,69 +96,69 @@
|
||||
:cb resolve-ens-contenthash-callback}}
|
||||
{:db (update db :browser/options assoc :url (or resolved-url current-url) :resolving? false)}))))
|
||||
|
||||
(rf/defn update-browser
|
||||
(fx/defn update-browser
|
||||
[{:keys [db]}
|
||||
{:keys [browser-id] :as browser}]
|
||||
(let [updated-browser (-> browser
|
||||
(update-dapp-name)
|
||||
(check-if-phishing-url))]
|
||||
{:db (update-in db
|
||||
[:browser/browsers browser-id]
|
||||
merge
|
||||
updated-browser)
|
||||
:json-rpc/call [{:method "wakuext_addBrowser"
|
||||
:params [(select-keys updated-browser
|
||||
[:browser-id :timestamp :name :dapp? :history
|
||||
:history-index])]
|
||||
:on-success #()}]}))
|
||||
{:db (update-in db
|
||||
[:browser/browsers browser-id]
|
||||
merge
|
||||
updated-browser)
|
||||
::json-rpc/call [{:method "wakuext_addBrowser"
|
||||
:params [(select-keys updated-browser
|
||||
[:browser-id :timestamp :name :dapp? :history
|
||||
:history-index])]
|
||||
:on-success #()}]}))
|
||||
|
||||
(rf/defn store-bookmark
|
||||
(fx/defn store-bookmark
|
||||
{:events [:browser/store-bookmark]}
|
||||
[{:keys [db]}
|
||||
{:keys [url] :as bookmark}]
|
||||
{:db (assoc-in db [:bookmarks/bookmarks url] bookmark)
|
||||
:json-rpc/call [{:method "wakuext_addBookmark"
|
||||
:params [bookmark]
|
||||
:on-success #()}]})
|
||||
{:db (assoc-in db [:bookmarks/bookmarks url] bookmark)
|
||||
::json-rpc/call [{:method "wakuext_addBookmark"
|
||||
:params [bookmark]
|
||||
:on-success #()}]})
|
||||
|
||||
(rf/defn update-bookmark
|
||||
(fx/defn update-bookmark
|
||||
{:events [:browser/update-bookmark]}
|
||||
[{:keys [db] :as cofx}
|
||||
{:keys [url] :as bookmark}]
|
||||
(let [old-bookmark (get-in db [:bookmarks/bookmarks url])
|
||||
new-bookmark (merge old-bookmark bookmark)]
|
||||
(rf/merge cofx
|
||||
{:db (assoc-in db [:bookmarks/bookmarks url] new-bookmark)
|
||||
:json-rpc/call [{:method "wakuext_updateBookmark"
|
||||
:params [url bookmark]
|
||||
:on-success #()}]})))
|
||||
(fx/merge cofx
|
||||
{:db (assoc-in db [:bookmarks/bookmarks url] new-bookmark)
|
||||
::json-rpc/call [{:method "wakuext_updateBookmark"
|
||||
:params [url bookmark]
|
||||
:on-success #()}]})))
|
||||
|
||||
(rf/defn delete-bookmark
|
||||
(fx/defn delete-bookmark
|
||||
{:events [:browser/delete-bookmark]}
|
||||
[{:keys [db] :as cofx}
|
||||
url]
|
||||
(let [old-bookmark (get-in db [:bookmarks/bookmarks url])
|
||||
removed-bookmark (merge old-bookmark {:removed true})]
|
||||
(rf/merge cofx
|
||||
{:db (update db :bookmarks/bookmarks dissoc url)
|
||||
:json-rpc/call [{:method "wakuext_removeBookmark"
|
||||
:params [url]
|
||||
:on-success #()}]})))
|
||||
(fx/merge cofx
|
||||
{:db (update db :bookmarks/bookmarks dissoc url)
|
||||
::json-rpc/call [{:method "wakuext_removeBookmark"
|
||||
:params [url]
|
||||
:on-success #()}]})))
|
||||
|
||||
(defn can-go-back?
|
||||
[{:keys [history-index]}]
|
||||
(pos? history-index))
|
||||
|
||||
(rf/defn navigate-to-previous-page
|
||||
(fx/defn navigate-to-previous-page
|
||||
{:events [:browser.ui/previous-page-button-pressed]}
|
||||
[cofx]
|
||||
(let [{:keys [history-index] :as browser} (get-current-browser (:db cofx))]
|
||||
(when (can-go-back? browser)
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
(update-browser (assoc browser :history-index (dec history-index)))
|
||||
(resolve-url nil)))))
|
||||
|
||||
(rf/defn ignore-unsafe
|
||||
(fx/defn ignore-unsafe
|
||||
{:events [:browser/ignore-unsafe]}
|
||||
[cofx]
|
||||
(let [browser (get-current-browser (:db cofx))
|
||||
@@ -169,16 +169,16 @@
|
||||
[{:keys [history-index history]}]
|
||||
(< history-index (dec (count history))))
|
||||
|
||||
(rf/defn navigate-to-next-page
|
||||
(fx/defn navigate-to-next-page
|
||||
{:events [:browser.ui/next-page-button-pressed]}
|
||||
[cofx]
|
||||
(let [{:keys [history-index] :as browser} (get-current-browser (:db cofx))]
|
||||
(when (can-go-forward? browser)
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
(update-browser (assoc browser :history-index (inc history-index)))
|
||||
(resolve-url nil)))))
|
||||
|
||||
(rf/defn update-browser-history
|
||||
(fx/defn update-browser-history
|
||||
[cofx browser url]
|
||||
(let [history-index (:history-index browser)
|
||||
history (:history browser)]
|
||||
@@ -190,14 +190,14 @@
|
||||
:history new-history
|
||||
:history-index new-index))))))
|
||||
|
||||
(rf/defn resolve-ens-multihash-success
|
||||
(fx/defn resolve-ens-multihash-success
|
||||
{:events [:browser.callback/resolve-ens-multihash-success]}
|
||||
[{:keys [db] :as cofx} url]
|
||||
(let [current-url (get-current-url (get-current-browser db))
|
||||
host (http/url-host current-url)
|
||||
path (subs current-url (+ (.indexOf ^js current-url host) (count host)))
|
||||
gateway url]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
{:db (-> (update db
|
||||
:browser/options
|
||||
assoc
|
||||
@@ -205,7 +205,7 @@
|
||||
:resolving? false)
|
||||
(assoc-in [:browser/options :resolved-ens host] gateway))})))
|
||||
|
||||
(rf/defn resolve-ens-multihash-error
|
||||
(fx/defn resolve-ens-multihash-error
|
||||
{:events [:browser.callback/resolve-ens-multihash-error]}
|
||||
[{:keys [db] :as cofx}]
|
||||
(update-browser-options cofx
|
||||
@@ -213,19 +213,19 @@
|
||||
:resolving? false
|
||||
:error? true}))
|
||||
|
||||
(rf/defn handle-browser-error
|
||||
(fx/defn handle-browser-error
|
||||
{:events [:browser/error-occured]}
|
||||
[cofx]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
(update-browser-option :error? true)
|
||||
(update-browser-option :loading? false)))
|
||||
|
||||
(rf/defn handle-pdf
|
||||
(fx/defn handle-pdf
|
||||
[_ url]
|
||||
(when (and platform/android? (string/ends-with? url ".pdf"))
|
||||
{:browser/show-web-browser-selection url}))
|
||||
|
||||
(rf/defn handle-message-link
|
||||
(fx/defn handle-message-link
|
||||
{:events [:browser.ui/message-link-pressed]}
|
||||
[_ link]
|
||||
(when (security/safe-link? link)
|
||||
@@ -233,7 +233,7 @@
|
||||
{:dispatch [:universal-links/handle-url link]}
|
||||
{:browser/show-browser-selection link})))
|
||||
|
||||
(rf/defn update-browser-on-nav-change
|
||||
(fx/defn update-browser-on-nav-change
|
||||
[cofx url error?]
|
||||
(let [browser (get-current-browser (:db cofx))
|
||||
options (get-in cofx [:db :browser/options])
|
||||
@@ -251,18 +251,18 @@
|
||||
(second resolved-ens)
|
||||
(first resolved-ens)))
|
||||
url)]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
(update-browser-history browser resolved-url)
|
||||
(handle-pdf url)
|
||||
(resolve-url {:error? error? :resolved-url (when resolved-ens url)}))))))
|
||||
|
||||
(rf/defn update-browser-name
|
||||
(fx/defn update-browser-name
|
||||
[cofx title]
|
||||
(let [browser (get-current-browser (:db cofx))]
|
||||
(when (and browser (not (:dapp? browser)) title (not (string/blank? title)))
|
||||
(update-browser cofx (assoc browser :name title)))))
|
||||
|
||||
(rf/defn navigation-state-changed
|
||||
(fx/defn navigation-state-changed
|
||||
{:events [:browser/navigation-state-changed]}
|
||||
[cofx event error?]
|
||||
(let [{:strs [url loading title]} (js->clj event)
|
||||
@@ -270,12 +270,12 @@
|
||||
(if (links/universal-link? url)
|
||||
(when-not (and deep-link? platform/ios?) ;; ios webview handles this
|
||||
{:dispatch [:universal-links/handle-url url]})
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
(update-browser-option :loading? loading)
|
||||
(update-browser-name title)
|
||||
(update-browser-on-nav-change url error?)))))
|
||||
|
||||
(rf/defn open-url-in-current-browser
|
||||
(fx/defn open-url-in-current-browser
|
||||
"Opens a url in the current browser, which mean no new entry is added to the home page
|
||||
and history of the current browser is updated so that the user can navigate back to the
|
||||
origin url"
|
||||
@@ -285,12 +285,12 @@
|
||||
normalized-url (http/normalize-and-decode-url url)]
|
||||
(if (links/universal-link? normalized-url)
|
||||
{:dispatch [:universal-links/handle-url normalized-url]}
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
(update-browser-option :url-editing? false)
|
||||
(update-browser-history browser normalized-url)
|
||||
(resolve-url nil)))))
|
||||
|
||||
(rf/defn open-url
|
||||
(fx/defn open-url
|
||||
"Opens a url in the browser. If a host can be extracted from the url and
|
||||
there is already a browser for this host, this browser is reused
|
||||
If the browser is reused, the history is flushed"
|
||||
@@ -302,7 +302,7 @@
|
||||
:history [normalized-url]}]
|
||||
(if (links/universal-link? normalized-url)
|
||||
{:dispatch [:universal-links/handle-url normalized-url]}
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
{:db (assoc db
|
||||
:browser/options
|
||||
{:browser-id (:browser-id browser)})}
|
||||
@@ -311,12 +311,12 @@
|
||||
(update-browser browser)
|
||||
(resolve-url nil)))))
|
||||
|
||||
(rf/defn open-existing-browser
|
||||
(fx/defn open-existing-browser
|
||||
"Opens an existing browser with it's history"
|
||||
{:events [:browser.ui/browser-item-selected]}
|
||||
[{:keys [db] :as cofx} browser-id]
|
||||
(let [browser (get-in db [:browser/browsers browser-id])]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
{:db (assoc db
|
||||
:browser/options
|
||||
{:browser-id browser-id})}
|
||||
@@ -324,7 +324,7 @@
|
||||
(navigation/set-stack-root :browser-stack :browser)
|
||||
(resolve-url nil))))
|
||||
|
||||
(rf/defn web3-error-callback
|
||||
(fx/defn web3-error-callback
|
||||
{:events [:browser.dapp/transaction-on-error]}
|
||||
[_ message-id message]
|
||||
{:browser/send-to-bridge
|
||||
@@ -332,7 +332,7 @@
|
||||
:messageId message-id
|
||||
:error message}})
|
||||
|
||||
(rf/defn dapp-complete-transaction
|
||||
(fx/defn dapp-complete-transaction
|
||||
{:events [:browser.dapp/transaction-on-result]}
|
||||
[_ message-id id result]
|
||||
;;TODO check and test id
|
||||
@@ -361,7 +361,7 @@
|
||||
(ethereum/address? second-param)
|
||||
[second-param (if typed? first-param (normalize-message first-param))]))))
|
||||
|
||||
(rf/defn send-to-bridge
|
||||
(fx/defn send-to-bridge
|
||||
{:events [:browser.callback/call-rpc]}
|
||||
[_ message]
|
||||
{:browser/send-to-bridge message})
|
||||
@@ -373,7 +373,7 @@
|
||||
constants/web3-eth-sign constants/web3-keycard-sign-typed-data}
|
||||
method))
|
||||
|
||||
(rf/defn web3-send-async
|
||||
(fx/defn web3-send-async
|
||||
[cofx dapp-name {:keys [method params id] :as payload} message-id]
|
||||
(let [message? (web3-sign-message? method)
|
||||
dapps-address (get-in cofx [:db :multiaccount :dapps-address])
|
||||
@@ -433,7 +433,7 @@
|
||||
:error %1
|
||||
:result %2}])]}))))
|
||||
|
||||
(rf/defn handle-no-permissions
|
||||
(fx/defn handle-no-permissions
|
||||
[cofx {:keys [method id]} message-id]
|
||||
(if (= method "eth_accounts")
|
||||
;; eth_accounts returns empty array for compatibility with meta-mask
|
||||
@@ -459,28 +459,28 @@
|
||||
(and (permissioned-method method)
|
||||
(not (some #{constants/dapp-permission-web3} (get-in permissions [dapp-name :permissions]))))))
|
||||
|
||||
(rf/defn web3-send-async-read-only
|
||||
(fx/defn web3-send-async-read-only
|
||||
[{:keys [db] :as cofx} dapp-name {:keys [method] :as payload} message-id]
|
||||
(if (has-permissions? db dapp-name method)
|
||||
(handle-no-permissions cofx payload message-id)
|
||||
(web3-send-async cofx dapp-name payload message-id)))
|
||||
|
||||
(rf/defn handle-scanned-qr-code
|
||||
(fx/defn handle-scanned-qr-code
|
||||
{:events [:browser.bridge.callback/qr-code-scanned]}
|
||||
[cofx data {{:keys [dapp-name permission message-id]} :data}]
|
||||
(rf/merge (assoc-in cofx [:db :browser/options :yielding-control?] false)
|
||||
(fx/merge (assoc-in cofx [:db :browser/options :yielding-control?] false)
|
||||
(browser.permissions/send-response-to-bridge permission message-id true data)
|
||||
(browser.permissions/process-next-permission dapp-name)
|
||||
(navigation/navigate-back)))
|
||||
|
||||
(rf/defn handle-canceled-qr-code
|
||||
(fx/defn handle-canceled-qr-code
|
||||
{:events [:browser.bridge.callback/qr-code-canceled]}
|
||||
[cofx {{:keys [dapp-name permission message-id]} :data}]
|
||||
(rf/merge (assoc-in cofx [:db :browser/options :yielding-control?] false)
|
||||
(fx/merge (assoc-in cofx [:db :browser/options :yielding-control?] false)
|
||||
(browser.permissions/send-response-to-bridge permission message-id true nil)
|
||||
(browser.permissions/process-next-permission dapp-name)))
|
||||
|
||||
(rf/defn process-bridge-message
|
||||
(fx/defn process-bridge-message
|
||||
{:events [:browser/bridge-message-received]}
|
||||
[{:keys [db] :as cofx} message]
|
||||
(let [browser (get-current-browser
|
||||
@@ -557,10 +557,10 @@
|
||||
message (i18n/label :t/share-dapp-text {:link link})]
|
||||
(list-selection/open-share {:message message})))
|
||||
|
||||
(rf/defn dapps-account-selected
|
||||
(fx/defn dapps-account-selected
|
||||
{:events [:dapps-account-selected]}
|
||||
[{:keys [db] :as cofx} address]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
{:browser/clear-web-data nil}
|
||||
(bottom-sheet/hide-bottom-sheet)
|
||||
(browser.permissions/clear-dapps-permissions)
|
||||
@@ -570,38 +570,38 @@
|
||||
{:dispatch [:browser.ui/browser-item-selected
|
||||
(get-in db [:browser/options :browser-id])]}))))
|
||||
|
||||
(rf/defn open-empty-tab
|
||||
(fx/defn open-empty-tab
|
||||
{:events [:browser.ui/open-empty-tab]}
|
||||
[cofx]
|
||||
(debounce/clear :browser/navigation-state-changed)
|
||||
(navigation/set-stack-root cofx :browser-stack :empty-tab))
|
||||
|
||||
(rf/defn url-input-pressed
|
||||
(fx/defn url-input-pressed
|
||||
{:events [:browser.ui/url-input-pressed]}
|
||||
[cofx _]
|
||||
(update-browser-option cofx :url-editing? true))
|
||||
|
||||
(rf/defn url-input-blured
|
||||
(fx/defn url-input-blured
|
||||
{:events [:browser.ui/url-input-blured]}
|
||||
[cofx]
|
||||
(update-browser-option cofx :url-editing? false))
|
||||
|
||||
(rf/defn lock-pressed
|
||||
(fx/defn lock-pressed
|
||||
{:events [:browser.ui/lock-pressed]}
|
||||
[cofx secure?]
|
||||
(update-browser-option cofx :show-tooltip (if secure? :secure :not-secure)))
|
||||
|
||||
(rf/defn close-tooltip-pressed
|
||||
(fx/defn close-tooltip-pressed
|
||||
{:events [:browser.ui/close-tooltip-pressed]}
|
||||
[cofx]
|
||||
(update-browser-option cofx :show-tooltip nil))
|
||||
|
||||
(rf/defn loading-started
|
||||
(fx/defn loading-started
|
||||
{:events [:browser/loading-started]}
|
||||
[cofx]
|
||||
(update-browser-options cofx {:error? false :loading? true}))
|
||||
|
||||
(rf/defn handle-bookmarks
|
||||
(fx/defn handle-bookmarks
|
||||
[{:keys [db]} bookmarks]
|
||||
(let [changed-bookmarks (reduce (fn [acc {:keys [url] :as bookmark}]
|
||||
(assoc acc url bookmark))
|
||||
|
||||
@@ -4,13 +4,14 @@
|
||||
(:require [clojure.string :as string]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.ethereum.json-rpc :as json-rpc]
|
||||
[status-im.network.core :as network]
|
||||
[status-im.ui.screens.browser.eip3085.sheet :as sheet]
|
||||
[utils.re-frame :as rf]
|
||||
[status-im.utils.fx :as fx]
|
||||
[status-im.utils.random :as random]
|
||||
[taoensso.timbre :as log]))
|
||||
|
||||
(rf/defn send-success-call-to-bridge
|
||||
(fx/defn send-success-call-to-bridge
|
||||
{:events [:eip3085/send-success-call-to-bridge]}
|
||||
[_ id messageId]
|
||||
{:browser/send-to-bridge {:type constants/web3-send-async-callback
|
||||
@@ -19,18 +20,18 @@
|
||||
:id (int id)
|
||||
:result nil}}})
|
||||
|
||||
(rf/defn allow-permission
|
||||
(fx/defn allow-permission
|
||||
{:events [:eip3085.ui/dapp-permission-allowed]}
|
||||
[{:keys [db] :as cofx} message-id {:keys [new-networks id]}]
|
||||
{:db (assoc db :networks/networks new-networks)
|
||||
:json-rpc/call [{:method "settings_saveSetting"
|
||||
:params [:networks/networks (vals new-networks)]
|
||||
:on-success #(re-frame/dispatch [:eip3085/send-success-call-to-bridge cofx id
|
||||
message-id])
|
||||
:on-error #(log/error "failed to perform settings_saveSetting" %)}]
|
||||
:dispatch [:bottom-sheet/hide]})
|
||||
{:db (assoc db :networks/networks new-networks)
|
||||
::json-rpc/call [{:method "settings_saveSetting"
|
||||
:params [:networks/networks (vals new-networks)]
|
||||
:on-success #(re-frame/dispatch [:eip3085/send-success-call-to-bridge cofx id
|
||||
message-id])
|
||||
:on-error #(log/error "failed to perform settings_saveSetting" %)}]
|
||||
:dispatch [:bottom-sheet/hide]})
|
||||
|
||||
(rf/defn deny-permission
|
||||
(fx/defn deny-permission
|
||||
{:events [:eip3085.ui/dapp-permission-denied]}
|
||||
[_ message-id _]
|
||||
{:browser/send-to-bridge {:type constants/web3-send-async-callback
|
||||
@@ -39,7 +40,7 @@
|
||||
:message "User rejected the request."}}
|
||||
:dispatch [:bottom-sheet/hide]})
|
||||
|
||||
(rf/defn handle-add-ethereum-chain
|
||||
(fx/defn handle-add-ethereum-chain
|
||||
{:events [:eip3085/handle-add-ethereum-chain]}
|
||||
[{{:networks/keys [networks] :as db} :db :as cofx}
|
||||
dapp-name id message-id
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
(:require [status-im.constants :as constants]
|
||||
[status-im.ethereum.core :as ethereum]
|
||||
[status-im.ui.screens.browser.eip3326.sheet :as sheet]
|
||||
[utils.re-frame :as rf]))
|
||||
[status-im.utils.fx :as fx]))
|
||||
|
||||
(rf/defn deny-permission
|
||||
(fx/defn deny-permission
|
||||
{:events [:eip3326.ui/dapp-permission-denied]}
|
||||
[{:keys [db] :as cofx} message-id _]
|
||||
{:browser/send-to-bridge {:type constants/web3-send-async-callback
|
||||
@@ -15,7 +15,7 @@
|
||||
:message "User rejected the request."}}
|
||||
:dispatch [:bottom-sheet/hide]})
|
||||
|
||||
(rf/defn handle-switch-ethereum-chain
|
||||
(fx/defn handle-switch-ethereum-chain
|
||||
{:events [:eip3326/handle-switch-ethereum-chain]}
|
||||
[{:keys [db] :as cofx} dapp-name id message-id {:keys [chainId] :as params}]
|
||||
(let [target-chain-id (js/parseInt chainId 16)
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
(ns status-im.browser.permissions
|
||||
(:require [status-im.constants :as constants]
|
||||
[i18n.i18n :as i18n]
|
||||
[status-im.ethereum.json-rpc :as json-rpc]
|
||||
[status-im.i18n.i18n :as i18n]
|
||||
[status-im.qr-scanner.core :as qr-scanner]
|
||||
[utils.re-frame :as rf]
|
||||
[status-im.utils.fx :as fx]
|
||||
[status-im2.navigation.events :as navigation]))
|
||||
|
||||
(declare process-next-permission)
|
||||
@@ -20,18 +21,18 @@
|
||||
:description (i18n/label :t/allowing-authorizes-this-dapp)
|
||||
:icon :main-icons/wallet}})
|
||||
|
||||
(rf/defn permission-yield-control
|
||||
(fx/defn permission-yield-control
|
||||
[{:keys [db] :as cofx} dapp-name permission message-id params]
|
||||
(cond
|
||||
(= permission constants/dapp-permission-qr-code)
|
||||
(rf/merge (assoc-in cofx [:db :browser/options :yielding-control?] true)
|
||||
(fx/merge (assoc-in cofx [:db :browser/options :yielding-control?] true)
|
||||
(qr-scanner/scan-qr-code {:handler :browser.bridge.callback/qr-code-scanned
|
||||
:cancel-handler :browser.bridge.callback/qr-code-canceled
|
||||
:data {:dapp-name dapp-name
|
||||
:permission permission
|
||||
:message-id message-id}}))))
|
||||
|
||||
(rf/defn permission-show-permission
|
||||
(fx/defn permission-show-permission
|
||||
[{:keys [db] :as cofx} dapp-name permission message-id yield-control?]
|
||||
{:db (assoc-in db
|
||||
[:browser/options :show-permission]
|
||||
@@ -47,7 +48,7 @@
|
||||
constants/dapp-permission-web3 [(:dapps-address multiaccount)]}
|
||||
allowed-permission)))
|
||||
|
||||
(rf/defn send-response-to-bridge
|
||||
(fx/defn send-response-to-bridge
|
||||
"Send response to the bridge. If the permission is allowed, send data associated
|
||||
with the permission"
|
||||
[{:keys [db] :as cofx} permission message-id allowed? data]
|
||||
@@ -58,7 +59,7 @@
|
||||
allowed?
|
||||
(assoc :data data))})
|
||||
|
||||
(rf/defn update-dapp-permissions
|
||||
(fx/defn update-dapp-permissions
|
||||
[{:keys [db]} dapp-name permission allowed?]
|
||||
(let [dapp-permissions-set (set (get-in db [:dapps/permissions dapp-name :permissions]))
|
||||
allowed-permissions-set (if allowed?
|
||||
@@ -66,37 +67,37 @@
|
||||
(disj dapp-permissions-set permission))
|
||||
allowed-permissions {:dapp dapp-name
|
||||
:permissions (vec allowed-permissions-set)}]
|
||||
{:db (assoc-in db [:dapps/permissions dapp-name] allowed-permissions)
|
||||
:json-rpc/call [{:method "permissions_addDappPermissions"
|
||||
:params [allowed-permissions]
|
||||
:on-success #()}]}))
|
||||
{:db (assoc-in db [:dapps/permissions dapp-name] allowed-permissions)
|
||||
::json-rpc/call [{:method "permissions_addDappPermissions"
|
||||
:params [allowed-permissions]
|
||||
:on-success #()}]}))
|
||||
|
||||
(rf/defn revoke-permissions
|
||||
(fx/defn revoke-permissions
|
||||
{:events [:browser/revoke-dapp-permissions]}
|
||||
[{:keys [db] :as cofx} dapp]
|
||||
(rf/merge cofx
|
||||
{:db (update-in db [:dapps/permissions] dissoc dapp)
|
||||
:json-rpc/call [{:method "permissions_deleteDappPermissions"
|
||||
:params [dapp]
|
||||
:on-success #()}]}))
|
||||
(fx/merge cofx
|
||||
{:db (update-in db [:dapps/permissions] dissoc dapp)
|
||||
::json-rpc/call [{:method "permissions_deleteDappPermissions"
|
||||
:params [dapp]
|
||||
:on-success #()}]}))
|
||||
|
||||
(rf/defn revoke-dapp-permissions
|
||||
(fx/defn revoke-dapp-permissions
|
||||
{:events [:dapps/revoke-access]}
|
||||
[cofx dapp]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
(revoke-permissions dapp)
|
||||
(navigation/navigate-back)))
|
||||
|
||||
(rf/defn clear-dapps-permissions
|
||||
(fx/defn clear-dapps-permissions
|
||||
[{:keys [db]}]
|
||||
(let [dapp-permissions (keys (:dapps/permissions db))]
|
||||
{:db (dissoc db :dapps/permissions)
|
||||
:json-rpc/call (for [dapp dapp-permissions]
|
||||
{:method "permissions_deleteDappPermissions"
|
||||
:params [dapp]
|
||||
:on-success #()})}))
|
||||
{:db (dissoc db :dapps/permissions)
|
||||
::json-rpc/call (for [dapp dapp-permissions]
|
||||
{:method "permissions_deleteDappPermissions"
|
||||
:params [dapp]
|
||||
:on-success #()})}))
|
||||
|
||||
(rf/defn process-next-permission
|
||||
(fx/defn process-next-permission
|
||||
"Process next permission by removing it from pending permissions and prompting user
|
||||
if there is no pending permissions left, save all granted permissions
|
||||
and return the result to the bridge"
|
||||
@@ -112,41 +113,41 @@
|
||||
(permission-yield-control new-cofx dapp-name permission message-id params)
|
||||
(permission-show-permission new-cofx dapp-name permission message-id yield-control?)))))))
|
||||
|
||||
(rf/defn send-response-and-process-next-permission
|
||||
(fx/defn send-response-and-process-next-permission
|
||||
[{:keys [db] :as cofx} dapp-name requested-permission message-id]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
(send-response-to-bridge requested-permission
|
||||
message-id
|
||||
true
|
||||
(get-permission-data cofx requested-permission))
|
||||
(process-next-permission dapp-name)))
|
||||
|
||||
(rf/defn allow-permission
|
||||
(fx/defn allow-permission
|
||||
"Add permission to set of allowed permission and process next permission"
|
||||
{:events [:browser.permissions.ui/dapp-permission-allowed]}
|
||||
[{:keys [db] :as cofx}]
|
||||
(let [{:keys [requested-permission message-id dapp-name yield-control? params]}
|
||||
(get-in db [:browser/options :show-permission])]
|
||||
(rf/merge (assoc-in cofx [:db :browser/options :show-permission] nil)
|
||||
(fx/merge (assoc-in cofx [:db :browser/options :show-permission] nil)
|
||||
(update-dapp-permissions dapp-name requested-permission true)
|
||||
(if yield-control?
|
||||
(permission-yield-control dapp-name requested-permission message-id params)
|
||||
(send-response-and-process-next-permission dapp-name requested-permission message-id)))))
|
||||
|
||||
(rf/defn deny-permission
|
||||
(fx/defn deny-permission
|
||||
"Add permission to set of allowed permission and process next permission"
|
||||
{:events [:browser.permissions.ui/dapp-permission-denied]}
|
||||
[{:keys [db] :as cofx}]
|
||||
(let [{:keys [requested-permission message-id dapp-name]} (get-in db
|
||||
[:browser/options :show-permission])]
|
||||
(rf/merge (assoc-in cofx [:db :browser/options :show-permission] nil)
|
||||
(fx/merge (assoc-in cofx [:db :browser/options :show-permission] nil)
|
||||
(send-response-to-bridge requested-permission
|
||||
message-id
|
||||
false
|
||||
(get-permission-data cofx requested-permission))
|
||||
(process-next-permission dapp-name))))
|
||||
|
||||
(rf/defn process-permission
|
||||
(fx/defn process-permission
|
||||
"Process the permission requested by a dapp
|
||||
If supported permission is already granted, return the result immediatly to the bridge
|
||||
Otherwise process the first permission which will prompt user"
|
||||
|
||||
@@ -3,21 +3,22 @@
|
||||
[quo.design-system.colors :as colors]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.add-new.db :as new-public-chat.db]
|
||||
[status-im.chat.models.delete-message :as delete-message]
|
||||
[status-im.chat.models.delete-message-for-me :as delete-for-me]
|
||||
[status-im.chat.models.loading :as loading]
|
||||
[status-im.chat.models.message-list :as message-list]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.data-store.chats :as chats-store]
|
||||
[status-im.data-store.contacts :as contacts-store]
|
||||
[i18n.i18n :as i18n]
|
||||
[status-im.ethereum.json-rpc :as json-rpc]
|
||||
[status-im.i18n.i18n :as i18n]
|
||||
[status-im.mailserver.core :as mailserver]
|
||||
[status-im.multiaccounts.model :as multiaccounts.model]
|
||||
[status-im.ui.screens.chat.state :as chat.state]
|
||||
[status-im.utils.clocks :as utils.clocks]
|
||||
[utils.re-frame :as rf]
|
||||
[status-im.utils.fx :as fx]
|
||||
[status-im.utils.types :as types]
|
||||
[status-im.utils.utils :as utils]
|
||||
[status-im2.contexts.chat.messages.delete-message-for-me.events :as delete-for-me]
|
||||
[status-im2.contexts.chat.messages.delete-message.events :as delete-message]
|
||||
[status-im2.navigation.events :as navigation]
|
||||
[taoensso.timbre :as log]))
|
||||
|
||||
@@ -112,14 +113,14 @@
|
||||
(fn [val]
|
||||
(and (not (get-in db [:chats (:chat-id val)])) (:public? val))))
|
||||
|
||||
(rf/defn leave-removed-chat
|
||||
(fx/defn leave-removed-chat
|
||||
[{{:keys [view-id current-chat-id chats]} :db
|
||||
:as cofx}]
|
||||
(when (and (= view-id :chat)
|
||||
(not (contains? chats current-chat-id)))
|
||||
(navigation/navigate-back cofx)))
|
||||
|
||||
(rf/defn ensure-chats
|
||||
(fx/defn ensure-chats
|
||||
"Add chats to db and update"
|
||||
[{:keys [db] :as cofx} chats]
|
||||
(let [{:keys [all-chats chats-home-list removed-chats]}
|
||||
@@ -136,7 +137,7 @@
|
||||
:chats-home-list #{}
|
||||
:removed-chats #{}}
|
||||
(map (map-chats cofx) chats))]
|
||||
(rf/merge
|
||||
(fx/merge
|
||||
cofx
|
||||
(merge {:db (-> db
|
||||
(update :chats merge all-chats)
|
||||
@@ -149,7 +150,7 @@
|
||||
(get-in db [:multiaccount :remote-push-notifications-enabled?])]}))
|
||||
leave-removed-chat)))
|
||||
|
||||
(rf/defn clear-history
|
||||
(fx/defn clear-history
|
||||
"Clears history of the particular chat"
|
||||
[{:keys [db] :as cofx} chat-id remove-chat?]
|
||||
(let [{:keys [last-message public?
|
||||
@@ -175,40 +176,40 @@
|
||||
:deleted-at-clock-value last-message-clock-value})
|
||||
chats))))}))
|
||||
|
||||
(rf/defn clear-history-handler
|
||||
(fx/defn clear-history-handler
|
||||
"Clears history of the particular chat"
|
||||
{:events [:chat.ui/clear-history]}
|
||||
[{:keys [db] :as cofx} chat-id remove-chat?]
|
||||
(rf/merge cofx
|
||||
{:db db
|
||||
:json-rpc/call [{:method "wakuext_clearHistory"
|
||||
:params [{:id chat-id}]
|
||||
:on-success #(re-frame/dispatch [::history-cleared chat-id %])
|
||||
:on-error #(log/error "failed to clear history " chat-id %)}]}
|
||||
(fx/merge cofx
|
||||
{:db db
|
||||
::json-rpc/call [{:method "wakuext_clearHistory"
|
||||
:params [{:id chat-id}]
|
||||
:on-success #(re-frame/dispatch [::history-cleared chat-id %])
|
||||
:on-error #(log/error "failed to clear history " chat-id %)}]}
|
||||
(clear-history chat-id remove-chat?)))
|
||||
|
||||
(rf/defn chat-deactivated
|
||||
(fx/defn chat-deactivated
|
||||
{:events [::chat-deactivated]}
|
||||
[_ chat-id]
|
||||
(log/debug "chat deactivated" chat-id))
|
||||
|
||||
(rf/defn deactivate-chat
|
||||
(fx/defn deactivate-chat
|
||||
"Deactivate chat in db, no side effects"
|
||||
[{:keys [db now] :as cofx} chat-id]
|
||||
(rf/merge
|
||||
(fx/merge
|
||||
cofx
|
||||
{:db (-> (if (get-in db [:chats chat-id :muted])
|
||||
(assoc-in db [:chats chat-id :active] false)
|
||||
(update db :chats dissoc chat-id))
|
||||
(update :chats-home-list disj chat-id)
|
||||
(assoc :current-chat-id nil))
|
||||
:json-rpc/call [{:method "wakuext_deactivateChat"
|
||||
:params [{:id chat-id}]
|
||||
:on-success #(re-frame/dispatch [::chat-deactivated chat-id])
|
||||
:on-error #(log/error "failed to create public chat" chat-id %)}]}
|
||||
{:db (-> (if (get-in db [:chats chat-id :muted])
|
||||
(assoc-in db [:chats chat-id :active] false)
|
||||
(update db :chats dissoc chat-id))
|
||||
(update :chats-home-list disj chat-id)
|
||||
(assoc :current-chat-id nil))
|
||||
::json-rpc/call [{:method "wakuext_deactivateChat"
|
||||
:params [{:id chat-id}]
|
||||
:on-success #(re-frame/dispatch [::chat-deactivated chat-id])
|
||||
:on-error #(log/error "failed to create public chat" chat-id %)}]}
|
||||
(clear-history chat-id true)))
|
||||
|
||||
(rf/defn offload-messages
|
||||
(fx/defn offload-messages
|
||||
{:events [:offload-messages]}
|
||||
[{:keys [db]} chat-id]
|
||||
(merge {:db (-> db
|
||||
@@ -218,52 +219,52 @@
|
||||
(when (and (= chat-id constants/timeline-chat-id) (= (:view-id db) :status))
|
||||
{:dispatch [:init-timeline-chat]})))
|
||||
|
||||
(rf/defn close-chat
|
||||
(fx/defn close-chat
|
||||
{:events [:close-chat]}
|
||||
[{:keys [db] :as cofx}]
|
||||
(when-let [chat-id (:current-chat-id db)]
|
||||
(chat.state/reset-visible-item)
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
{:db (dissoc db :current-chat-id)}
|
||||
(delete-for-me/sync-all)
|
||||
(delete-message/send-all)
|
||||
(offload-messages chat-id))))
|
||||
|
||||
(rf/defn force-close-chat
|
||||
(fx/defn force-close-chat
|
||||
[{:keys [db] :as cofx} chat-id]
|
||||
(do
|
||||
(chat.state/reset-visible-item)
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
{:db (dissoc db :current-chat-id)}
|
||||
(offload-messages chat-id))))
|
||||
|
||||
(rf/defn remove-chat
|
||||
(fx/defn remove-chat
|
||||
"Removes chat completely from app, producing all necessary effects for that"
|
||||
{:events [:chat.ui/remove-chat]}
|
||||
[{:keys [db now] :as cofx} chat-id]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
{:clear-message-notifications
|
||||
[[chat-id] (get-in db [:multiaccount :remote-push-notifications-enabled?])]}
|
||||
(deactivate-chat chat-id)
|
||||
(offload-messages chat-id)))
|
||||
|
||||
(rf/defn show-more-chats
|
||||
(fx/defn show-more-chats
|
||||
{:events [:chat.ui/show-more-chats]}
|
||||
[{:keys [db]}]
|
||||
(when (< (:home-items-show-number db) (count (:chats db)))
|
||||
{:db (update db :home-items-show-number + 40)}))
|
||||
|
||||
(rf/defn preload-chat-data
|
||||
(fx/defn preload-chat-data
|
||||
"Takes chat-id and coeffects map, returns effects necessary when navigating to chat"
|
||||
{:events [:chat.ui/preload-chat-data]}
|
||||
[cofx chat-id]
|
||||
(loading/load-messages cofx chat-id))
|
||||
|
||||
(rf/defn navigate-to-chat
|
||||
(fx/defn navigate-to-chat
|
||||
"Takes coeffects map and chat-id, returns effects necessary for navigation and preloading data"
|
||||
{:events [:chat.ui/navigate-to-chat]}
|
||||
[{db :db :as cofx} chat-id]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
{:dispatch [:navigate-to :chat]}
|
||||
(navigation/change-tab :chat)
|
||||
(when-not (= (:view-id db) :community)
|
||||
@@ -276,11 +277,11 @@
|
||||
#(when (group-chat? cofx chat-id)
|
||||
(loading/load-chat % chat-id))))
|
||||
|
||||
(rf/defn navigate-to-chat-nav2
|
||||
(fx/defn navigate-to-chat-nav2
|
||||
"Takes coeffects map and chat-id, returns effects necessary for navigation and preloading data"
|
||||
{:events [:chat.ui/navigate-to-chat-nav2]}
|
||||
[{db :db :as cofx} chat-id from-shell?]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
{:dispatch [:navigate-to-nav2 :chat chat-id from-shell?]}
|
||||
(when-not (= (:view-id db) :community)
|
||||
(navigation/pop-to-root-tab :shell-stack))
|
||||
@@ -292,13 +293,13 @@
|
||||
#(when (group-chat? cofx chat-id)
|
||||
(loading/load-chat % chat-id))))
|
||||
|
||||
(rf/defn handle-clear-history-response
|
||||
(fx/defn handle-clear-history-response
|
||||
{:events [::history-cleared]}
|
||||
[{:keys [db]} chat-id response]
|
||||
(let [chat (chats-store/<-rpc (first (:chats response)))]
|
||||
{:db (assoc-in db [:chats chat-id] chat)}))
|
||||
|
||||
(rf/defn handle-one-to-one-chat-created
|
||||
(fx/defn handle-one-to-one-chat-created
|
||||
{:events [::one-to-one-chat-created]}
|
||||
[{:keys [db]} chat-id response]
|
||||
(let [chat (chats-store/<-rpc (first (:chats response)))
|
||||
@@ -313,22 +314,22 @@
|
||||
(update :chats-home-list conj chat-id))
|
||||
:dispatch [:chat.ui/navigate-to-chat chat-id]}))
|
||||
|
||||
(rf/defn navigate-to-user-pinned-messages
|
||||
(fx/defn navigate-to-user-pinned-messages
|
||||
"Takes coeffects map and chat-id, returns effects necessary for navigation and preloading data"
|
||||
{:events [:chat.ui/navigate-to-pinned-messages]}
|
||||
[cofx chat-id]
|
||||
(navigation/navigate-to cofx :chat-pinned-messages {:chat-id chat-id}))
|
||||
|
||||
(rf/defn start-chat
|
||||
(fx/defn start-chat
|
||||
"Start a chat, making sure it exists"
|
||||
{:events [:chat.ui/start-chat]}
|
||||
[{:keys [db] :as cofx} chat-id ens-name]
|
||||
;; don't allow to open chat with yourself
|
||||
(when (not= (multiaccounts.model/current-public-key cofx) chat-id)
|
||||
{:json-rpc/call [{:method "wakuext_createOneToOneChat"
|
||||
:params [{:id chat-id :ensName ens-name}]
|
||||
:on-success #(re-frame/dispatch [::one-to-one-chat-created chat-id %])
|
||||
:on-error #(log/error "failed to create one-to-on chat" chat-id %)}]}))
|
||||
{::json-rpc/call [{:method "wakuext_createOneToOneChat"
|
||||
:params [{:id chat-id :ensName ens-name}]
|
||||
:on-success #(re-frame/dispatch [::one-to-one-chat-created chat-id %])
|
||||
:on-error #(log/error "failed to create one-to-on chat" chat-id %)}]}))
|
||||
|
||||
(defn profile-chat-topic
|
||||
[public-key]
|
||||
@@ -338,7 +339,7 @@
|
||||
[db]
|
||||
(profile-chat-topic (get-in db [:multiaccount :public-key])))
|
||||
|
||||
(rf/defn handle-public-chat-created
|
||||
(fx/defn handle-public-chat-created
|
||||
{:events [::public-chat-created]}
|
||||
[{:keys [db]} chat-id response]
|
||||
{:db (-> db
|
||||
@@ -346,14 +347,14 @@
|
||||
(update :chats-home-list conj chat-id))
|
||||
:dispatch [:chat.ui/navigate-to-chat chat-id]})
|
||||
|
||||
(rf/defn create-public-chat-go
|
||||
(fx/defn create-public-chat-go
|
||||
[_ chat-id]
|
||||
{:json-rpc/call [{:method "wakuext_createPublicChat"
|
||||
:params [{:id chat-id}]
|
||||
:on-success #(re-frame/dispatch [::public-chat-created chat-id %])
|
||||
:on-error #(log/error "failed to create public chat" chat-id %)}]})
|
||||
{::json-rpc/call [{:method "wakuext_createPublicChat"
|
||||
:params [{:id chat-id}]
|
||||
:on-success #(re-frame/dispatch [::public-chat-created chat-id %])
|
||||
:on-error #(log/error "failed to create public chat" chat-id %)}]})
|
||||
|
||||
(rf/defn start-public-chat
|
||||
(fx/defn start-public-chat
|
||||
"Starts a new public chat"
|
||||
{:events [:chat.ui/start-public-chat]}
|
||||
[cofx topic]
|
||||
@@ -366,10 +367,10 @@
|
||||
{:utils/show-popup {:title (i18n/label :t/cant-open-public-chat)
|
||||
:content (i18n/label :t/invalid-public-chat-topic)}}))
|
||||
|
||||
(rf/defn profile-chat-created
|
||||
(fx/defn profile-chat-created
|
||||
{:events [::profile-chat-created]}
|
||||
[{:keys [db] :as cofx} chat-id response navigate-to?]
|
||||
(rf/merge
|
||||
(fx/merge
|
||||
cofx
|
||||
{:db db}
|
||||
#(when response
|
||||
@@ -379,19 +380,19 @@
|
||||
{:dispatch-n [[:chat.ui/preload-chat-data chat-id]
|
||||
[:open-modal :profile]]})))
|
||||
|
||||
(rf/defn start-profile-chat
|
||||
(fx/defn start-profile-chat
|
||||
"Starts a new profile chat"
|
||||
{:events [:start-profile-chat]}
|
||||
[cofx profile-public-key navigate-to?]
|
||||
(let [chat-id (profile-chat-topic profile-public-key)]
|
||||
(if (active-chat? cofx chat-id)
|
||||
{:dispatch [::profile-chat-created chat-id nil navigate-to?]}
|
||||
{:json-rpc/call [{:method "wakuext_createProfileChat"
|
||||
:params [{:id profile-public-key}]
|
||||
:on-success #(re-frame/dispatch [::profile-chat-created chat-id % navigate-to?])
|
||||
:on-error #(log/error "failed to create profile chat" chat-id %)}]})))
|
||||
{::json-rpc/call [{:method "wakuext_createProfileChat"
|
||||
:params [{:id profile-public-key}]
|
||||
:on-success #(re-frame/dispatch [::profile-chat-created chat-id % navigate-to?])
|
||||
:on-error #(log/error "failed to create profile chat" chat-id %)}]})))
|
||||
|
||||
(rf/defn disable-chat-cooldown
|
||||
(fx/defn disable-chat-cooldown
|
||||
"Turns off chat cooldown (protection against message spamming)"
|
||||
{:events [:chat/disable-cooldown]}
|
||||
[{:keys [db]}]
|
||||
@@ -405,40 +406,40 @@
|
||||
(i18n/label :cooldown/warning-message)
|
||||
#())))
|
||||
|
||||
(rf/defn mute-chat-failed
|
||||
(fx/defn mute-chat-failed
|
||||
{:events [::mute-chat-failed]}
|
||||
[{:keys [db] :as cofx} chat-id muted? error]
|
||||
(log/error "mute chat failed" chat-id error)
|
||||
{:db (assoc-in db [:chats chat-id :muted] (not muted?))})
|
||||
|
||||
(rf/defn mute-chat-toggled-successfully
|
||||
(fx/defn mute-chat-toggled-successfully
|
||||
{:events [::mute-chat-toggled-successfully]}
|
||||
[_ chat-id]
|
||||
(log/debug "muted chat successfully" chat-id))
|
||||
|
||||
(rf/defn mute-chat
|
||||
(fx/defn mute-chat
|
||||
{:events [::mute-chat-toggled]}
|
||||
[{:keys [db] :as cofx} chat-id muted?]
|
||||
(let [method (if muted? "wakuext_muteChat" "wakuext_unmuteChat")]
|
||||
{:db (assoc-in db [:chats chat-id :muted] muted?)
|
||||
:json-rpc/call [{:method method
|
||||
:params [chat-id]
|
||||
:on-error #(re-frame/dispatch [::mute-chat-failed chat-id muted? %])
|
||||
:on-success #(re-frame/dispatch [::mute-chat-toggled-successfully chat-id])}]}))
|
||||
{:db (assoc-in db [:chats chat-id :muted] muted?)
|
||||
::json-rpc/call [{:method method
|
||||
:params [chat-id]
|
||||
:on-error #(re-frame/dispatch [::mute-chat-failed chat-id muted? %])
|
||||
:on-success #(re-frame/dispatch [::mute-chat-toggled-successfully chat-id])}]}))
|
||||
|
||||
(rf/defn show-profile
|
||||
(fx/defn show-profile
|
||||
{:events [:chat.ui/show-profile]}
|
||||
[{:keys [db] :as cofx} identity ens-name]
|
||||
(let [my-public-key (get-in db [:multiaccount :public-key])]
|
||||
(when (not= my-public-key identity)
|
||||
(rf/merge
|
||||
(fx/merge
|
||||
cofx
|
||||
{:db (-> db
|
||||
(assoc :contacts/identity identity)
|
||||
(assoc :contacts/ens-name ens-name))}
|
||||
(start-profile-chat identity true)))))
|
||||
|
||||
(rf/defn clear-history-pressed
|
||||
(fx/defn clear-history-pressed
|
||||
{:events [:chat.ui/clear-history-pressed]}
|
||||
[_ chat-id]
|
||||
{:ui/show-confirmation
|
||||
@@ -449,19 +450,19 @@
|
||||
(re-frame/dispatch [:bottom-sheet/hide])
|
||||
(re-frame/dispatch [:chat.ui/clear-history chat-id false]))}})
|
||||
|
||||
(rf/defn gaps-failed
|
||||
(fx/defn gaps-failed
|
||||
{:events [::gaps-failed]}
|
||||
[{:keys [db]} chat-id gap-ids error]
|
||||
(log/error "failed to fetch gaps" chat-id gap-ids error)
|
||||
{:db (dissoc db :mailserver/fetching-gaps-in-progress)})
|
||||
|
||||
(rf/defn sync-chat-from-sync-from-failed
|
||||
(fx/defn sync-chat-from-sync-from-failed
|
||||
{:events [::sync-chat-from-sync-from-failed]}
|
||||
[{:keys [db]} chat-id error]
|
||||
(log/error "failed to sync chat" chat-id error)
|
||||
{:db (dissoc db :mailserver/fetching-gaps-in-progress)})
|
||||
|
||||
(rf/defn sync-chat-from-sync-from-success
|
||||
(fx/defn sync-chat-from-sync-from-success
|
||||
{:events [::sync-chat-from-sync-from-success]}
|
||||
[{:keys [db] :as cofx} chat-id synced-from]
|
||||
(log/debug "synced success" chat-id synced-from)
|
||||
@@ -470,44 +471,44 @@
|
||||
(assoc-in [:chats chat-id :synced-from] synced-from)
|
||||
(dissoc :mailserver/fetching-gaps-in-progress))})
|
||||
|
||||
(rf/defn gaps-filled
|
||||
(fx/defn gaps-filled
|
||||
{:events [::gaps-filled]}
|
||||
[{:keys [db] :as cofx} chat-id message-ids]
|
||||
(rf/merge
|
||||
(fx/merge
|
||||
cofx
|
||||
{:db (-> db
|
||||
(update-in [:messages chat-id] (fn [messages] (apply dissoc messages message-ids)))
|
||||
(dissoc :mailserver/fetching-gaps-in-progress))}
|
||||
(message-list/rebuild-message-list chat-id)))
|
||||
|
||||
(rf/defn fill-gaps
|
||||
(fx/defn fill-gaps
|
||||
[cofx chat-id gap-ids]
|
||||
{:json-rpc/call [{:method "wakuext_fillGaps"
|
||||
:params [chat-id gap-ids]
|
||||
:on-success #(re-frame/dispatch [::gaps-filled chat-id gap-ids %])
|
||||
:on-error #(re-frame/dispatch [::gaps-failed chat-id gap-ids %])}]})
|
||||
{::json-rpc/call [{:method "wakuext_fillGaps"
|
||||
:params [chat-id gap-ids]
|
||||
:on-success #(re-frame/dispatch [::gaps-filled chat-id gap-ids %])
|
||||
:on-error #(re-frame/dispatch [::gaps-failed chat-id gap-ids %])}]})
|
||||
|
||||
(rf/defn sync-chat-from-sync-from
|
||||
(fx/defn sync-chat-from-sync-from
|
||||
[cofx chat-id]
|
||||
(log/debug "syncing chat from sync from")
|
||||
{:json-rpc/call [{:method "wakuext_syncChatFromSyncedFrom"
|
||||
:params [chat-id]
|
||||
:on-success #(re-frame/dispatch [::sync-chat-from-sync-from-success chat-id %])
|
||||
:on-error #(re-frame/dispatch [::sync-chat-from-sync-from-failed chat-id %])}]})
|
||||
{::json-rpc/call [{:method "wakuext_syncChatFromSyncedFrom"
|
||||
:params [chat-id]
|
||||
:on-success #(re-frame/dispatch [::sync-chat-from-sync-from-success chat-id %])
|
||||
:on-error #(re-frame/dispatch [::sync-chat-from-sync-from-failed chat-id %])}]})
|
||||
|
||||
(rf/defn chat-ui-fill-gaps
|
||||
(fx/defn chat-ui-fill-gaps
|
||||
{:events [:chat.ui/fill-gaps]}
|
||||
[{:keys [db] :as cofx} chat-id gap-ids]
|
||||
(let [use-status-nodes? (mailserver/fetch-use-mailservers? {:db db})]
|
||||
(log/info "filling gaps if use-status-nodes = true" chat-id gap-ids)
|
||||
(when use-status-nodes?
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
{:db (assoc db :mailserver/fetching-gaps-in-progress gap-ids)}
|
||||
(if (= gap-ids #{:first-gap})
|
||||
(sync-chat-from-sync-from chat-id)
|
||||
(fill-gaps chat-id gap-ids))))))
|
||||
|
||||
(rf/defn chat-ui-remove-chat-pressed
|
||||
(fx/defn chat-ui-remove-chat-pressed
|
||||
{:events [:chat.ui/remove-chat-pressed]}
|
||||
[_ chat-id]
|
||||
{:ui/show-confirmation
|
||||
@@ -518,7 +519,7 @@
|
||||
(re-frame/dispatch [:bottom-sheet/hide])
|
||||
(re-frame/dispatch [:chat.ui/remove-chat chat-id]))}})
|
||||
|
||||
(rf/defn decrease-unviewed-count
|
||||
(fx/defn decrease-unviewed-count
|
||||
{:events [:chat/decrease-unviewed-count]}
|
||||
[{:keys [db]} chat-id {:keys [count countWithMentions]}]
|
||||
{:db (-> db
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
(ns status-im2.contexts.chat.messages.delete-message.events
|
||||
(:require [status-im.chat.models.message-list :as message-list]
|
||||
[utils.datetime :as datetime]
|
||||
[taoensso.timbre :as log]
|
||||
[utils.re-frame :as rf]))
|
||||
(ns status-im.chat.models.delete-message
|
||||
(:require [re-frame.core :as re-frame]
|
||||
[status-im.chat.models.message-list :as message-list]
|
||||
[status-im.ethereum.json-rpc :as json-rpc]
|
||||
[status-im.utils.datetime :as datetime]
|
||||
[status-im.utils.fx :as fx]
|
||||
[taoensso.encore :as enc]
|
||||
[taoensso.timbre :as log]))
|
||||
|
||||
(defn- update-db-clear-undo-timer
|
||||
[db chat-id message-id]
|
||||
@@ -43,7 +46,7 @@
|
||||
(when (get-in db [:messages chat-id message-id])
|
||||
(update-in db [:messages chat-id message-id] assoc :deleted? true)))
|
||||
|
||||
(rf/defn delete
|
||||
(fx/defn delete
|
||||
"Delete message now locally and broadcast after undo time limit timeout"
|
||||
{:events [:chat.ui/delete-message]}
|
||||
[{:keys [db]} {:keys [chat-id message-id]} undo-time-limit-ms]
|
||||
@@ -58,7 +61,7 @@
|
||||
:message-id message-id}]
|
||||
:ms undo-time-limit-ms}])))
|
||||
|
||||
(rf/defn undo
|
||||
(fx/defn undo
|
||||
{:events [:chat.ui/undo-delete-message]}
|
||||
[{:keys [db]} {:keys [chat-id message-id]}]
|
||||
(when (get-in db [:messages chat-id message-id])
|
||||
@@ -66,22 +69,21 @@
|
||||
{:db (update-db-undo-locally db chat-id message-id)}
|
||||
chat-id)))
|
||||
|
||||
(rf/defn delete-and-send
|
||||
(fx/defn delete-and-send
|
||||
{:events [:chat.ui/delete-message-and-send]}
|
||||
[{:keys [db]} {:keys [message-id chat-id]}]
|
||||
(when-let [message (get-in db [:messages chat-id message-id])]
|
||||
(cond-> {:db (update-db-clear-undo-timer db chat-id message-id)
|
||||
:json-rpc/call [{:method "wakuext_deleteMessageAndSend"
|
||||
:params [message-id]
|
||||
:js-response true
|
||||
:on-error #(log/error "failed to delete message "
|
||||
{:message-id message-id :error %})
|
||||
:on-success #(rf/dispatch [:sanitize-messages-and-process-response
|
||||
%])}]}
|
||||
(get-in db [:pin-messages chat-id message-id])
|
||||
(assoc :dispatch
|
||||
[:pin-message/send-pin-message
|
||||
{:chat-id chat-id :message-id message-id :pinned false}]))))
|
||||
(enc/assoc-when
|
||||
{:db (update-db-clear-undo-timer db chat-id message-id)
|
||||
::json-rpc/call [{:method "wakuext_deleteMessageAndSend"
|
||||
:params [message-id]
|
||||
:js-response true
|
||||
:on-error #(log/error "failed to delete message "
|
||||
{:message-id message-id :error %})
|
||||
:on-success #(re-frame/dispatch [:sanitize-messages-and-process-response %])}]}
|
||||
:dispatch
|
||||
(and (get-in db [:pin-messages chat-id message-id])
|
||||
[:pin-message/send-pin-message {:chat-id chat-id :message-id message-id :pinned false}]))))
|
||||
|
||||
(defn- filter-pending-send-messages
|
||||
"traverse all messages find not yet synced deleted? messages"
|
||||
@@ -91,14 +93,14 @@
|
||||
(map (fn [message] {:chat-id chat-id :message-id (first message)}))
|
||||
(concat acc)))
|
||||
|
||||
(rf/defn send-all
|
||||
(fx/defn send-all
|
||||
"Get all deleted messages that not yet synced with status-go and send them"
|
||||
{:events [:chat.ui/send-all-deleted-messages]}
|
||||
[{:keys [db] :as cofx}]
|
||||
(let [pending-send-messages (reduce-kv filter-pending-send-messages [] (:messages db))]
|
||||
(apply rf/merge cofx (map delete-and-send pending-send-messages))))
|
||||
(apply fx/merge cofx (map delete-and-send pending-send-messages))))
|
||||
|
||||
(rf/defn delete-messages-localy
|
||||
(fx/defn delete-messages-localy
|
||||
"Mark messages :deleted? localy in client"
|
||||
{:events [:chat.ui/delete-messages-localy]}
|
||||
[{:keys [db]} messages chat-id]
|
||||
@@ -1,8 +1,10 @@
|
||||
(ns status-im2.contexts.chat.messages.delete-message-for-me.events
|
||||
(:require [status-im.chat.models.message-list :as message-list]
|
||||
[utils.datetime :as datetime]
|
||||
[taoensso.timbre :as log]
|
||||
[utils.re-frame :as rf]))
|
||||
(ns status-im.chat.models.delete-message-for-me
|
||||
(:require [re-frame.core :as re-frame]
|
||||
[status-im.chat.models.message-list :as message-list]
|
||||
[status-im.ethereum.json-rpc :as json-rpc]
|
||||
[status-im.utils.datetime :as datetime]
|
||||
[status-im.utils.fx :as fx]
|
||||
[taoensso.timbre :as log]))
|
||||
|
||||
(defn- update-db-clear-undo-timer
|
||||
[db chat-id message-id]
|
||||
@@ -37,7 +39,7 @@
|
||||
:deleted-for-me-undoable-till)
|
||||
(update-db-clear-undo-timer db chat-id message-id))))
|
||||
|
||||
(rf/defn delete
|
||||
(fx/defn delete
|
||||
"Delete message for me now locally and broadcast after undo time limit timeout"
|
||||
{:events [:chat.ui/delete-message-for-me]}
|
||||
[{:keys [db]} {:keys [chat-id message-id]} undo-time-limit-ms]
|
||||
@@ -52,7 +54,7 @@
|
||||
:message-id message-id}]
|
||||
:ms undo-time-limit-ms}])))
|
||||
|
||||
(rf/defn undo
|
||||
(fx/defn undo
|
||||
{:events [:chat.ui/undo-delete-message-for-me]}
|
||||
[{:keys [db]} {:keys [chat-id message-id]}]
|
||||
(when (get-in db [:messages chat-id message-id])
|
||||
@@ -60,17 +62,17 @@
|
||||
{:db (update-db-undo-locally db chat-id message-id)}
|
||||
chat-id)))
|
||||
|
||||
(rf/defn delete-and-sync
|
||||
(fx/defn delete-and-sync
|
||||
{:events [:chat.ui/delete-message-for-me-and-sync]}
|
||||
[{:keys [db]} {:keys [message-id chat-id]}]
|
||||
(when (get-in db [:messages chat-id message-id])
|
||||
{:db (update-db-clear-undo-timer db chat-id message-id)
|
||||
:json-rpc/call [{:method "wakuext_deleteMessageForMeAndSync"
|
||||
:params [chat-id message-id]
|
||||
:js-response true
|
||||
:on-error #(log/error "failed to delete message for me, message id: "
|
||||
{:message-id message-id :error %})
|
||||
:on-success #(rf/dispatch [:sanitize-messages-and-process-response %])}]}))
|
||||
{:db (update-db-clear-undo-timer db chat-id message-id)
|
||||
::json-rpc/call [{:method "wakuext_deleteMessageForMeAndSync"
|
||||
:params [chat-id message-id]
|
||||
:js-response true
|
||||
:on-error #(log/error "failed to delete message for me, message id: "
|
||||
{:message-id message-id :error %})
|
||||
:on-success #(re-frame/dispatch [:sanitize-messages-and-process-response %])}]}))
|
||||
|
||||
(defn- filter-pending-sync-messages
|
||||
"traverse all messages find not yet synced deleted-for-me? messages"
|
||||
@@ -81,9 +83,9 @@
|
||||
(map (fn [message] {:chat-id chat-id :message-id (first message)}))
|
||||
(concat acc)))
|
||||
|
||||
(rf/defn sync-all
|
||||
(fx/defn sync-all
|
||||
"Get all deleted-for-me messages that not yet synced with status-go and sync them"
|
||||
{:events [:chat.ui/sync-all-deleted-for-me-messages]}
|
||||
[{:keys [db] :as cofx}]
|
||||
(let [pending-sync-messages (reduce-kv filter-pending-sync-messages [] (:messages db))]
|
||||
(apply rf/merge cofx (map delete-and-sync pending-sync-messages))))
|
||||
(apply fx/merge cofx (map delete-and-sync pending-sync-messages))))
|
||||
@@ -1,8 +1,7 @@
|
||||
(ns status-im2.contexts.chat.messages.delete-message-for-me.events-test
|
||||
(ns status-im.chat.models.delete-message-for-me-test
|
||||
(:require [cljs.test :refer-macros [deftest is testing]]
|
||||
[utils.datetime :as datetime]
|
||||
[status-im2.contexts.chat.messages.delete-message-for-me.events :as
|
||||
delete-message-for-me]))
|
||||
[status-im.chat.models.delete-message-for-me :as delete-message-for-me]
|
||||
[status-im.utils.datetime :as datetime]))
|
||||
|
||||
(def mid "message-id")
|
||||
(def cid "chat-id")
|
||||
@@ -63,7 +62,7 @@
|
||||
(let [expected-db {:messages {cid {mid {:id mid}}}}
|
||||
effects (delete-message-for-me/delete-and-sync {:db db} message)
|
||||
result-db (:db effects)
|
||||
rpc-calls (:json-rpc/call effects)]
|
||||
rpc-calls (:status-im.ethereum.json-rpc/call effects)]
|
||||
(is (= result-db expected-db))
|
||||
(is (= (count rpc-calls) 1))
|
||||
(is (= (-> rpc-calls
|
||||
@@ -1,7 +1,7 @@
|
||||
(ns status-im2.contexts.chat.messages.delete-message.events-test
|
||||
(ns status-im.chat.models.delete-message-test
|
||||
(:require [cljs.test :refer-macros [deftest is testing]]
|
||||
[status-im2.contexts.chat.messages.delete-message.events :as delete-message]
|
||||
[utils.datetime :as datetime]))
|
||||
[status-im.chat.models.delete-message :as delete-message]
|
||||
[status-im.utils.datetime :as datetime]))
|
||||
|
||||
(def mid "message-id")
|
||||
(def cid "chat-id")
|
||||
@@ -61,7 +61,7 @@
|
||||
(let [expected-db {:messages {cid {mid {:id mid}}}}
|
||||
effects (delete-message/delete-and-send {:db db} message)
|
||||
result-db (:db effects)
|
||||
rpc-calls (:json-rpc/call effects)]
|
||||
rpc-calls (:status-im.ethereum.json-rpc/call effects)]
|
||||
(is (= result-db expected-db))
|
||||
(is (= (count rpc-calls) 1))
|
||||
(is (= (-> rpc-calls
|
||||
@@ -4,12 +4,12 @@
|
||||
[clojure.string :as string]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.chat.models :as chat]
|
||||
[i18n.i18n :as i18n]
|
||||
[status-im.i18n.i18n :as i18n]
|
||||
[status-im.ui.components.permissions :as permissions]
|
||||
[status-im.ui.components.react :as react]
|
||||
[status-im.utils.config :as config]
|
||||
[status-im.utils.fs :as fs]
|
||||
[utils.re-frame :as rf]
|
||||
[status-im.utils.fx :as fx]
|
||||
[status-im.utils.image-processing :as image-processing]
|
||||
[status-im.utils.platform :as platform]
|
||||
[status-im.utils.types :as types]
|
||||
@@ -120,7 +120,7 @@
|
||||
(:page_info response) end-cursor])))
|
||||
(.catch #(log/warn "could not get camera roll photos"))))})))
|
||||
|
||||
(rf/defn image-captured
|
||||
(fx/defn image-captured
|
||||
{:events [:chat.ui/image-captured]}
|
||||
[{:keys [db]} chat-id uri]
|
||||
(let [current-chat-id (or chat-id (:current-chat-id db))
|
||||
@@ -129,24 +129,24 @@
|
||||
(not (get images uri)))
|
||||
{::image-selected [uri current-chat-id]})))
|
||||
|
||||
(rf/defn on-end-reached
|
||||
(fx/defn on-end-reached
|
||||
{:events [:camera-roll/on-end-reached]}
|
||||
[_ end-cursor loading? has-next-page?]
|
||||
(when (and (not loading?) has-next-page?)
|
||||
(re-frame/dispatch [:chat.ui/camera-roll-loading-more true])
|
||||
(re-frame/dispatch [:chat.ui/camera-roll-get-photos 20 end-cursor])))
|
||||
|
||||
(rf/defn camera-roll-get-photos
|
||||
(fx/defn camera-roll-get-photos
|
||||
{:events [:chat.ui/camera-roll-get-photos]}
|
||||
[_ num end-cursor]
|
||||
{::camera-roll-get-photos [num end-cursor]})
|
||||
|
||||
(rf/defn camera-roll-loading-more
|
||||
(fx/defn camera-roll-loading-more
|
||||
{:events [:chat.ui/camera-roll-loading-more]}
|
||||
[{:keys [db]} is-loading]
|
||||
{:db (assoc db :camera-roll/loading-more is-loading)})
|
||||
|
||||
(rf/defn on-camera-roll-get-photos
|
||||
(fx/defn on-camera-roll-get-photos
|
||||
{:events [:on-camera-roll-get-photos]}
|
||||
[{:keys [db] :as cofx} photos page-info end-cursor]
|
||||
(let [photos_x (when end-cursor (:camera-roll/photos db))]
|
||||
@@ -156,34 +156,34 @@
|
||||
(assoc :camera-roll/has-next-page (:has_next_page page-info))
|
||||
(assoc :camera-roll/loading-more false))}))
|
||||
|
||||
(rf/defn clear-sending-images
|
||||
(fx/defn clear-sending-images
|
||||
{:events [:chat.ui/clear-sending-images]}
|
||||
[{:keys [db]} current-chat-id]
|
||||
{:db (update-in db [:chat/inputs current-chat-id :metadata] assoc :sending-image {})})
|
||||
|
||||
(rf/defn cancel-sending-image
|
||||
(fx/defn cancel-sending-image
|
||||
{:events [:chat.ui/cancel-sending-image]}
|
||||
[{:keys [db] :as cofx} chat-id]
|
||||
(let [current-chat-id (or chat-id (:current-chat-id db))]
|
||||
(clear-sending-images cofx current-chat-id)))
|
||||
|
||||
(rf/defn cancel-sending-image-timeline
|
||||
(fx/defn cancel-sending-image-timeline
|
||||
{:events [:chat.ui/cancel-sending-image-timeline]}
|
||||
[{:keys [db] :as cofx}]
|
||||
(cancel-sending-image cofx (chat/my-profile-chat-topic db)))
|
||||
|
||||
(rf/defn image-selected
|
||||
(fx/defn image-selected
|
||||
{:events [:chat.ui/image-selected]}
|
||||
[{:keys [db]} current-chat-id original uri]
|
||||
{:db (update-in db [:chat/inputs current-chat-id :metadata :sending-image original] merge {:uri uri})})
|
||||
|
||||
(rf/defn image-unselected
|
||||
(fx/defn image-unselected
|
||||
{:events [:chat.ui/image-unselected]}
|
||||
[{:keys [db]} original]
|
||||
(let [current-chat-id (:current-chat-id db)]
|
||||
{:db (update-in db [:chat/inputs current-chat-id :metadata :sending-image] dissoc original)}))
|
||||
|
||||
(rf/defn chat-open-image-picker
|
||||
(fx/defn chat-open-image-picker
|
||||
{:events [:chat.ui/open-image-picker]}
|
||||
[{:keys [db]} chat-id]
|
||||
(let [current-chat-id (or chat-id (:current-chat-id db))
|
||||
@@ -191,12 +191,12 @@
|
||||
(when (< (count images) config/max-images-batch)
|
||||
{::chat-open-image-picker current-chat-id})))
|
||||
|
||||
(rf/defn chat-open-image-picker-timeline
|
||||
(fx/defn chat-open-image-picker-timeline
|
||||
{:events [:chat.ui/open-image-picker-timeline]}
|
||||
[{:keys [db] :as cofx}]
|
||||
(chat-open-image-picker cofx (chat/my-profile-chat-topic db)))
|
||||
|
||||
(rf/defn chat-show-image-picker-camera
|
||||
(fx/defn chat-show-image-picker-camera
|
||||
{:events [:chat.ui/show-image-picker-camera]}
|
||||
[{:keys [db]} chat-id]
|
||||
(let [current-chat-id (or chat-id (:current-chat-id db))
|
||||
@@ -204,12 +204,12 @@
|
||||
(when (< (count images) config/max-images-batch)
|
||||
{::chat-open-image-picker-camera current-chat-id})))
|
||||
|
||||
(rf/defn chat-show-image-picker-camera-timeline
|
||||
(fx/defn chat-show-image-picker-camera-timeline
|
||||
{:events [:chat.ui/show-image-picker-camera-timeline]}
|
||||
[{:keys [db] :as cofx}]
|
||||
(chat-show-image-picker-camera cofx (chat/my-profile-chat-topic db)))
|
||||
|
||||
(rf/defn camera-roll-pick
|
||||
(fx/defn camera-roll-pick
|
||||
{:events [:chat.ui/camera-roll-pick]}
|
||||
[{:keys [db]} uri chat-id]
|
||||
(let [current-chat-id (or chat-id (:current-chat-id db))
|
||||
@@ -221,12 +221,12 @@
|
||||
(not (get images uri)))
|
||||
{::image-selected [uri current-chat-id]}))))
|
||||
|
||||
(rf/defn camera-roll-pick-timeline
|
||||
(fx/defn camera-roll-pick-timeline
|
||||
{:events [:chat.ui/camera-roll-pick-timeline]}
|
||||
[{:keys [db] :as cofx} uri]
|
||||
(camera-roll-pick cofx uri (chat/my-profile-chat-topic db)))
|
||||
|
||||
(rf/defn save-image-to-gallery
|
||||
(fx/defn save-image-to-gallery
|
||||
{:events [:chat.ui/save-image-to-gallery]}
|
||||
[_ base64-uri]
|
||||
{::save-image-to-gallery base64-uri})
|
||||
|
||||
@@ -9,9 +9,10 @@
|
||||
[status-im.chat.models.message :as chat.message]
|
||||
[status-im.chat.models.message-content :as message-content]
|
||||
[status-im.constants :as constants]
|
||||
[utils.re-frame :as rf]
|
||||
[i18n.i18n :as i18n]
|
||||
[utils.datetime :as datetime]
|
||||
[status-im.ethereum.json-rpc :as json-rpc]
|
||||
[status-im.i18n.i18n :as i18n]
|
||||
[status-im.utils.datetime :as datetime]
|
||||
[status-im.utils.fx :as fx]
|
||||
[status-im.utils.utils :as utils]
|
||||
[taoensso.timbre :as log]))
|
||||
|
||||
@@ -25,7 +26,7 @@
|
||||
(.-char ^js emoji-map)
|
||||
original))))
|
||||
|
||||
(rf/defn set-chat-input-text
|
||||
(fx/defn set-chat-input-text
|
||||
"Set input text for current-chat. Takes db and input text and cofx
|
||||
as arguments and returns new fx. Always clear all validation messages."
|
||||
{:events [:chat.ui/set-chat-input-text]}
|
||||
@@ -33,21 +34,21 @@
|
||||
(let [current-chat-id (or chat-id (:current-chat-id db))]
|
||||
{:db (assoc-in db [:chat/inputs current-chat-id :input-text] (text->emoji new-input))}))
|
||||
|
||||
(rf/defn set-timeline-input-text
|
||||
(fx/defn set-timeline-input-text
|
||||
{:events [:chat.ui/set-timeline-input-text]}
|
||||
[{db :db} new-input]
|
||||
{:db (assoc-in db
|
||||
[:chat/inputs (chat/my-profile-chat-topic db) :input-text]
|
||||
(text->emoji new-input))})
|
||||
|
||||
(rf/defn select-mention
|
||||
(fx/defn select-mention
|
||||
{:events [:chat.ui/select-mention]}
|
||||
[{:keys [db] :as cofx} text-input-ref {:keys [alias name searched-text match] :as user}]
|
||||
(let [chat-id (:current-chat-id db)
|
||||
new-text (mentions/new-input-text-with-mention cofx user)
|
||||
at-sign-idx (get-in db [:chats/mentions chat-id :mentions :at-sign-idx])
|
||||
cursor (+ at-sign-idx (count name) 2)]
|
||||
(rf/merge
|
||||
(fx/merge
|
||||
cofx
|
||||
{:db (-> db
|
||||
(assoc-in [:chats/cursor chat-id] cursor)
|
||||
@@ -91,7 +92,7 @@
|
||||
:chat/spam-messages-frequency 0
|
||||
:chat/cooldown-enabled? true)})
|
||||
|
||||
(rf/defn process-cooldown
|
||||
(fx/defn process-cooldown
|
||||
"Process cooldown to protect against message spammers"
|
||||
[{{:keys [chat/last-outgoing-message-sent-at
|
||||
chat/cooldowns
|
||||
@@ -114,12 +115,12 @@
|
||||
(and spamming-fast? spamming-frequently?)
|
||||
(start-cooldown (inc cooldowns))))))
|
||||
|
||||
(rf/defn reply-to-message
|
||||
(fx/defn reply-to-message
|
||||
"Sets reference to previous chat message and focuses on input"
|
||||
{:events [:chat.ui/reply-to-message]}
|
||||
[{:keys [db] :as cofx} message]
|
||||
(let [current-chat-id (:current-chat-id db)]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
{:db (-> db
|
||||
(assoc-in [:chat/inputs current-chat-id :metadata :responding-to-message]
|
||||
message)
|
||||
@@ -128,7 +129,7 @@
|
||||
dissoc
|
||||
:sending-image))})))
|
||||
|
||||
(rf/defn edit-message
|
||||
(fx/defn edit-message
|
||||
"Sets reference to previous chat message and focuses on input"
|
||||
{:events [:chat.ui/edit-message]}
|
||||
[{:keys [db] :as cofx} message]
|
||||
@@ -144,7 +145,7 @@
|
||||
dissoc
|
||||
:sending-image))}))
|
||||
|
||||
(rf/defn show-contact-request-input
|
||||
(fx/defn show-contact-request-input
|
||||
"Sets reference to previous chat message and focuses on input"
|
||||
{:events [:chat.ui/send-contact-request]}
|
||||
[{:keys [db] :as cofx}]
|
||||
@@ -159,7 +160,7 @@
|
||||
dissoc
|
||||
:sending-image))}))
|
||||
|
||||
(rf/defn cancel-message-reply
|
||||
(fx/defn cancel-message-reply
|
||||
"Cancels stage message reply"
|
||||
{:events [:chat.ui/cancel-message-reply]}
|
||||
[{:keys [db]}]
|
||||
@@ -184,19 +185,17 @@
|
||||
|
||||
(defn build-image-messages
|
||||
[{db :db} chat-id]
|
||||
(let [images (get-in db [:chat/inputs chat-id :metadata :sending-image])
|
||||
album-id (str (random-uuid))]
|
||||
(let [images (get-in db [:chat/inputs chat-id :metadata :sending-image])]
|
||||
(mapv (fn [[_ {:keys [uri]}]]
|
||||
{:chat-id chat-id
|
||||
:album-id album-id
|
||||
:content-type constants/content-type-image
|
||||
:image-path (utils/safe-replace uri #"file://" "")
|
||||
:text (i18n/label :t/update-to-see-image {"locale" "en"})})
|
||||
images)))
|
||||
|
||||
(rf/defn clean-input
|
||||
(fx/defn clean-input
|
||||
[{:keys [db] :as cofx} current-chat-id]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
{:db (-> db
|
||||
(assoc-in [:chat/inputs current-chat-id :metadata :sending-contact-request] nil)
|
||||
(assoc-in [:chat/inputs current-chat-id :metadata :sending-image] nil)
|
||||
@@ -204,29 +203,29 @@
|
||||
(assoc-in [:chat/inputs current-chat-id :metadata :responding-to-message] nil))}
|
||||
(set-chat-input-text nil current-chat-id)))
|
||||
|
||||
(rf/defn cancel-message-edit
|
||||
(fx/defn cancel-message-edit
|
||||
"Cancels stage message edit"
|
||||
{:events [:chat.ui/cancel-message-edit]}
|
||||
[{:keys [db] :as cofx}]
|
||||
(let [current-chat-id (:current-chat-id db)]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
{:set-text-input-value [current-chat-id ""]}
|
||||
(clean-input current-chat-id)
|
||||
(mentions/clear-mentions)
|
||||
(mentions/clear-cursor))))
|
||||
|
||||
(rf/defn send-messages
|
||||
(fx/defn send-messages
|
||||
[{:keys [db] :as cofx} input-text current-chat-id]
|
||||
(let [image-messages (build-image-messages cofx current-chat-id)
|
||||
text-message (build-text-message cofx input-text current-chat-id)
|
||||
messages (keep identity (conj image-messages text-message))]
|
||||
(when (seq messages)
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
(clean-input (:current-chat-id db))
|
||||
(process-cooldown)
|
||||
(chat.message/send-messages messages)))))
|
||||
|
||||
(rf/defn send-my-status-message
|
||||
(fx/defn send-my-status-message
|
||||
"when not empty, proceed by sending text message with public key topic"
|
||||
{:events [:profile.ui/send-my-status-message]}
|
||||
[{db :db :as cofx}]
|
||||
@@ -236,11 +235,11 @@
|
||||
text-message (build-text-message cofx input-text current-chat-id)
|
||||
messages (keep identity (conj image-messages text-message))]
|
||||
(when (seq messages)
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
(clean-input current-chat-id)
|
||||
(chat.message/send-messages messages)))))
|
||||
|
||||
(rf/defn send-audio-message
|
||||
(fx/defn send-audio-message
|
||||
[cofx audio-path duration current-chat-id]
|
||||
(when-not (string/blank? audio-path)
|
||||
(chat.message/send-message
|
||||
@@ -251,7 +250,7 @@
|
||||
:audio-duration-ms duration
|
||||
:text (i18n/label :t/update-to-listen-audio {"locale" "en"})})))
|
||||
|
||||
(rf/defn send-sticker-message
|
||||
(fx/defn send-sticker-message
|
||||
[cofx {:keys [hash packID pack]} current-chat-id]
|
||||
(when-not (or (string/blank? hash) (and (string/blank? packID) (string/blank? pack)))
|
||||
(chat.message/send-message cofx
|
||||
@@ -261,44 +260,44 @@
|
||||
:pack (int (if (string/blank? packID) pack packID))}
|
||||
:text (i18n/label :t/update-to-see-sticker {"locale" "en"})})))
|
||||
|
||||
(rf/defn send-edited-message
|
||||
(fx/defn send-edited-message
|
||||
[{:keys [db] :as cofx} text {:keys [message-id quoted-message]}]
|
||||
(rf/merge
|
||||
(fx/merge
|
||||
cofx
|
||||
{:json-rpc/call [{:method "wakuext_editMessage"
|
||||
:params [{:id message-id
|
||||
:text text
|
||||
:content-type (if (message-content/emoji-only-content?
|
||||
{:text text :response-to quoted-message})
|
||||
constants/content-type-emoji
|
||||
constants/content-type-text)}]
|
||||
:js-response true
|
||||
:on-error #(log/error "failed to edit message " %)
|
||||
:on-success #(re-frame/dispatch [:sanitize-messages-and-process-response %])}]}
|
||||
{::json-rpc/call [{:method "wakuext_editMessage"
|
||||
:params [{:id message-id
|
||||
:text text
|
||||
:content-type (if (message-content/emoji-only-content?
|
||||
{:text text :response-to quoted-message})
|
||||
constants/content-type-emoji
|
||||
constants/content-type-text)}]
|
||||
:js-response true
|
||||
:on-error #(log/error "failed to edit message " %)
|
||||
:on-success #(re-frame/dispatch [:sanitize-messages-and-process-response %])}]}
|
||||
(cancel-message-edit)
|
||||
(process-cooldown)))
|
||||
|
||||
(rf/defn send-current-message
|
||||
(fx/defn send-current-message
|
||||
"Sends message from current chat input"
|
||||
{:events [:chat.ui/send-current-message]}
|
||||
[{{:keys [current-chat-id] :as db} :db :as cofx}]
|
||||
(let [{:keys [input-text metadata]} (get-in db [:chat/inputs current-chat-id])
|
||||
editing-message (:editing-message metadata)
|
||||
input-text-with-mentions (mentions/check-mentions cofx input-text)]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
(if editing-message
|
||||
(send-edited-message input-text-with-mentions editing-message)
|
||||
(send-messages input-text-with-mentions current-chat-id))
|
||||
(mentions/clear-mentions)
|
||||
(mentions/clear-cursor))))
|
||||
|
||||
(rf/defn send-contact-request
|
||||
(fx/defn send-contact-request
|
||||
{:events [:contacts/send-contact-request]}
|
||||
[{:keys [db] :as cofx} public-key message]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
{:chat.ui/clear-inputs nil
|
||||
:chat.ui/clear-inputs-old nil
|
||||
:json-rpc/call [{:method "wakuext_sendContactRequest"
|
||||
::json-rpc/call [{:method "wakuext_sendContactRequest"
|
||||
:js-response true
|
||||
:params [{:id public-key :message message}]
|
||||
:on-error #(log/warn "failed to send a contact request" %)
|
||||
@@ -308,33 +307,33 @@
|
||||
(clean-input (:current-chat-id db))
|
||||
(process-cooldown)))
|
||||
|
||||
(rf/defn cancel-contact-request
|
||||
(fx/defn cancel-contact-request
|
||||
"Cancels contact request"
|
||||
{:events [:chat.ui/cancel-contact-request]}
|
||||
[{:keys [db] :as cofx}]
|
||||
(let [current-chat-id (:current-chat-id db)]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
{:db (assoc-in db [:chat/inputs current-chat-id :metadata :sending-contact-request] nil)}
|
||||
(mentions/clear-mentions)
|
||||
(mentions/clear-cursor)
|
||||
(clean-input (:current-chat-id db))
|
||||
(process-cooldown))))
|
||||
|
||||
(rf/defn chat-send-sticker
|
||||
(fx/defn chat-send-sticker
|
||||
{:events [:chat/send-sticker]}
|
||||
[{{:keys [current-chat-id] :as db} :db :as cofx} {:keys [hash packID pack] :as sticker}]
|
||||
(rf/merge
|
||||
(fx/merge
|
||||
cofx
|
||||
{:db (update db
|
||||
:stickers/recent-stickers
|
||||
(fn [recent]
|
||||
(conj (remove #(= hash (:hash %)) recent) sticker)))
|
||||
:json-rpc/call [{:method "stickers_addRecent"
|
||||
:params [(int (if (string/blank? packID) pack packID)) hash]
|
||||
:on-success #()}]}
|
||||
{:db (update db
|
||||
:stickers/recent-stickers
|
||||
(fn [recent]
|
||||
(conj (remove #(= hash (:hash %)) recent) sticker)))
|
||||
::json-rpc/call [{:method "stickers_addRecent"
|
||||
:params [(int (if (string/blank? packID) pack packID)) hash]
|
||||
:on-success #()}]}
|
||||
(send-sticker-message sticker current-chat-id)))
|
||||
|
||||
(rf/defn chat-send-audio
|
||||
(fx/defn chat-send-audio
|
||||
{:events [:chat/send-audio]}
|
||||
[{{:keys [current-chat-id]} :db :as cofx} audio-path duration]
|
||||
(send-audio-message cofx audio-path duration current-chat-id))
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
(:require [cljs.test :refer-macros [deftest is testing]]
|
||||
[status-im.chat.constants :as constants]
|
||||
[status-im.chat.models.input :as input]
|
||||
[utils.datetime :as datetime]))
|
||||
[status-im.utils.datetime :as datetime]))
|
||||
|
||||
(deftest text->emoji
|
||||
(is (nil? (input/text->emoji nil)))
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
(ns status-im.chat.models.link-preview
|
||||
(:require [re-frame.core :as re-frame]
|
||||
[status-im.communities.core :as models.communities]
|
||||
[status-im.ethereum.json-rpc :as json-rpc]
|
||||
[status-im.multiaccounts.update.core :as multiaccounts.update]
|
||||
[utils.re-frame :as rf]
|
||||
[status-im.utils.fx :as fx]
|
||||
[taoensso.timbre :as log]))
|
||||
|
||||
(rf/defn enable
|
||||
(fx/defn enable
|
||||
{:events [::enable]}
|
||||
[{{:keys [multiaccount]} :db :as cofx} site enabled?]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
(multiaccounts.update/multiaccount-update
|
||||
:link-previews-enabled-sites
|
||||
(if enabled?
|
||||
@@ -16,10 +17,10 @@
|
||||
(disj (get multiaccount :link-previews-enabled-sites #{}) site))
|
||||
{})))
|
||||
|
||||
(rf/defn enable-all
|
||||
(fx/defn enable-all
|
||||
{:events [::enable-all]}
|
||||
[{{:keys [multiaccount]} :db :as cofx} link-previews-whitelist enabled?]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
(multiaccounts.update/multiaccount-update
|
||||
:link-previews-enabled-sites
|
||||
(if enabled?
|
||||
@@ -39,7 +40,7 @@
|
||||
[db community-id]
|
||||
(assoc-in db [:communities/resolve-community-info community-id] true))
|
||||
|
||||
(rf/defn handle-community-failed-to-resolve
|
||||
(fx/defn handle-community-failed-to-resolve
|
||||
{:events [::community-failed-to-resolve]}
|
||||
[{:keys [db]} community-id]
|
||||
{:db (community-failed-to-resolve db community-id)})
|
||||
@@ -48,10 +49,10 @@
|
||||
[id]
|
||||
(str "https://join.status.im/c/" id))
|
||||
|
||||
(rf/defn handle-community-resolved
|
||||
(fx/defn handle-community-resolved
|
||||
{:events [::community-resolved]}
|
||||
[{:keys [db] :as cofx} community-id community]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
(cond-> {:db (community-resolved db community-id)}
|
||||
(some? community)
|
||||
(assoc :dispatch
|
||||
@@ -59,29 +60,29 @@
|
||||
(community-link community-id) community]))
|
||||
(models.communities/handle-community community)))
|
||||
|
||||
(rf/defn resolve-community-info
|
||||
(fx/defn resolve-community-info
|
||||
{:events [::resolve-community-info]}
|
||||
[{:keys [db]} community-id]
|
||||
{:db (community-resolving db community-id)
|
||||
:json-rpc/call [{:method "wakuext_requestCommunityInfoFromMailserver"
|
||||
:params [community-id]
|
||||
:on-success #(re-frame/dispatch [::community-resolved community-id %])
|
||||
:on-error #(do
|
||||
(re-frame/dispatch [::community-failed-to-resolve community-id])
|
||||
(log/error "Failed to request community info from mailserver"))}]})
|
||||
{:db (community-resolving db community-id)
|
||||
::json-rpc/call [{:method "wakuext_requestCommunityInfoFromMailserver"
|
||||
:params [community-id]
|
||||
:on-success #(re-frame/dispatch [::community-resolved community-id %])
|
||||
:on-error #(do
|
||||
(re-frame/dispatch [::community-failed-to-resolve community-id])
|
||||
(log/error "Failed to request community info from mailserver"))}]})
|
||||
|
||||
(rf/defn load-link-preview-data
|
||||
(fx/defn load-link-preview-data
|
||||
{:events [::load-link-preview-data]}
|
||||
[cofx link]
|
||||
{:json-rpc/call [{:method "wakuext_getLinkPreviewData"
|
||||
:params [link]
|
||||
:on-success #(re-frame/dispatch [::cache-link-preview-data link %])
|
||||
:on-error #(re-frame/dispatch
|
||||
[::cache-link-preview-data
|
||||
link
|
||||
{:error (str "Can't get preview data for " link)}])}]})
|
||||
{::json-rpc/call [{:method "wakuext_getLinkPreviewData"
|
||||
:params [link]
|
||||
:on-success #(re-frame/dispatch [::cache-link-preview-data link %])
|
||||
:on-error #(re-frame/dispatch
|
||||
[::cache-link-preview-data
|
||||
link
|
||||
{:error (str "Can't get preview data for " link)}])}]})
|
||||
|
||||
(rf/defn cache-link-preview-data
|
||||
(fx/defn cache-link-preview-data
|
||||
{:events [::cache-link-preview-data]}
|
||||
[{{:keys [multiaccount]} :db :as cofx} site data]
|
||||
(multiaccounts.update/optimistic
|
||||
@@ -95,7 +96,7 @@
|
||||
(community-link id)
|
||||
community]))
|
||||
|
||||
(rf/defn should-suggest-link-preview
|
||||
(fx/defn should-suggest-link-preview
|
||||
{:events [::should-suggest-link-preview]}
|
||||
[{:keys [db] :as cofx} enabled?]
|
||||
(multiaccounts.update/multiaccount-update
|
||||
@@ -104,14 +105,14 @@
|
||||
(boolean enabled?)
|
||||
{}))
|
||||
|
||||
(rf/defn request-link-preview-whitelist
|
||||
(fx/defn request-link-preview-whitelist
|
||||
[_]
|
||||
{:json-rpc/call [{:method "wakuext_getLinkPreviewWhitelist"
|
||||
:params []
|
||||
:on-success #(re-frame/dispatch [::link-preview-whitelist-received %])
|
||||
:on-error #(log/error "Failed to get link preview whitelist")}]})
|
||||
{::json-rpc/call [{:method "wakuext_getLinkPreviewWhitelist"
|
||||
:params []
|
||||
:on-success #(re-frame/dispatch [::link-preview-whitelist-received %])
|
||||
:on-error #(log/error "Failed to get link preview whitelist")}]})
|
||||
|
||||
(rf/defn save-link-preview-whitelist
|
||||
(fx/defn save-link-preview-whitelist
|
||||
{:events [::link-preview-whitelist-received]}
|
||||
[{:keys [db]} whitelist]
|
||||
{:db (assoc db
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
[status-im.constants :as constants]
|
||||
[status-im.data-store.chats :as data-store.chats]
|
||||
[status-im.data-store.messages :as data-store.messages]
|
||||
[status-im.ethereum.json-rpc :as json-rpc]
|
||||
[status-im.utils.fx :as fx]
|
||||
[status-im2.contexts.activity-center.events :as activity-center]
|
||||
[taoensso.timbre :as log]
|
||||
[utils.re-frame :as rf]))
|
||||
[taoensso.timbre :as log]))
|
||||
|
||||
(defn cursor->clock-value
|
||||
[^js cursor]
|
||||
@@ -18,7 +19,7 @@
|
||||
clock-value
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000000"))
|
||||
|
||||
(rf/defn update-chats-in-app-db
|
||||
(fx/defn update-chats-in-app-db
|
||||
{:events [:chats-list/load-success]}
|
||||
[{:keys [db]} ^js new-chats-js]
|
||||
(let [{:keys [all-chats chats-home-list]}
|
||||
@@ -38,20 +39,20 @@
|
||||
:chats-home-list chats-home-list
|
||||
:chats/loading? false)}))
|
||||
|
||||
(rf/defn load-chat-success
|
||||
(fx/defn load-chat-success
|
||||
{:events [:chats-list/load-chat-success]}
|
||||
[{:keys [db]} ^js chat]
|
||||
(let [{:keys [chat-id] :as chat} (data-store.chats/<-rpc chat)]
|
||||
{:db (update-in db [:chats chat-id] merge chat)}))
|
||||
|
||||
(rf/defn load-chat
|
||||
(fx/defn load-chat
|
||||
[_ chat-id]
|
||||
{:json-rpc/call [{:method "wakuext_chat"
|
||||
:params [chat-id]
|
||||
:on-success #(re-frame/dispatch [:chats-list/load-chat-success %])
|
||||
:on-error #(log/error "failed to fetch chats" 0 -1 %)}]})
|
||||
{::json-rpc/call [{:method "wakuext_chat"
|
||||
:params [chat-id]
|
||||
:on-success #(re-frame/dispatch [:chats-list/load-chat-success %])
|
||||
:on-error #(log/error "failed to fetch chats" 0 -1 %)}]})
|
||||
|
||||
(rf/defn handle-failed-loading-messages
|
||||
(fx/defn handle-failed-loading-messages
|
||||
{:events [::failed-loading-messages]}
|
||||
[{:keys [db]} current-chat-id _ err]
|
||||
(log/error "failed loading messages" current-chat-id err)
|
||||
@@ -67,52 +68,41 @@
|
||||
:unviewed-mentions-count 0
|
||||
:highlight false))
|
||||
|
||||
(rf/defn handle-mark-all-read-successful
|
||||
(fx/defn handle-mark-all-read-successful
|
||||
{:events [::mark-all-read-successful]}
|
||||
[cofx]
|
||||
(activity-center/notifications-fetch-unread-count cofx))
|
||||
|
||||
(rf/defn handle-mark-all-read-in-community-successful
|
||||
(fx/defn handle-mark-all-read-in-community-successful
|
||||
{:events [::mark-all-read-in-community-successful]}
|
||||
[{:keys [db] :as cofx} chat-ids]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
{:db (reduce mark-chat-all-read db chat-ids)}
|
||||
(activity-center/notifications-fetch-unread-count)))
|
||||
|
||||
(rf/defn handle-mark-all-read
|
||||
(fx/defn handle-mark-all-read
|
||||
{:events [:chat.ui/mark-all-read-pressed :chat/mark-all-as-read]}
|
||||
[{db :db} chat-id]
|
||||
{:db (mark-chat-all-read db chat-id)
|
||||
:clear-message-notifications [[chat-id]
|
||||
(get-in db [:multiaccount :remote-push-notifications-enabled?])]
|
||||
:json-rpc/call [{:method "wakuext_markAllRead"
|
||||
::json-rpc/call [{:method "wakuext_markAllRead"
|
||||
:params [chat-id]
|
||||
:on-success #(re-frame/dispatch [::mark-all-read-successful])}]})
|
||||
|
||||
(rf/defn handle-mark-mark-all-read-in-community
|
||||
(fx/defn handle-mark-mark-all-read-in-community
|
||||
{:events [:chat.ui/mark-all-read-in-community-pressed]}
|
||||
[{db :db} community-id]
|
||||
(let [community-chat-ids (map #(str community-id %)
|
||||
(keys (get-in db [:communities community-id :chats])))]
|
||||
{:clear-message-notifications [community-chat-ids
|
||||
(get-in db [:multiaccount :remote-push-notifications-enabled?])]
|
||||
:json-rpc/call [{:method "wakuext_markAllReadInCommunity"
|
||||
::json-rpc/call [{:method "wakuext_markAllReadInCommunity"
|
||||
:params [community-id]
|
||||
:on-success #(re-frame/dispatch
|
||||
[::mark-all-read-in-community-successful %])}]}))
|
||||
|
||||
;; For example, when a user receives a list of 4 image messages while inside the chat screen we
|
||||
;; shouldn't group the images into albums. When the user exists the chat screen then enters the
|
||||
;; chat screen again, we now need to group the images into albums (like WhatsApp). The albumize?
|
||||
;; boolean is used to know whether we need to group these images into albums now or not. The
|
||||
;; album-id can't be used for this because it will always be there.
|
||||
(defn mark-album
|
||||
[message]
|
||||
(if (:album-id message)
|
||||
(assoc message :albumize? true)
|
||||
message))
|
||||
|
||||
(rf/defn messages-loaded
|
||||
(fx/defn messages-loaded
|
||||
"Loads more messages for current chat"
|
||||
{:events [::messages-loaded]}
|
||||
[{db :db} chat-id session-id {:keys [cursor messages]}]
|
||||
@@ -142,8 +132,8 @@
|
||||
current-clock-value (get-in db
|
||||
[:pagination-info chat-id
|
||||
:cursor-clock-value])
|
||||
clock-value (when cursor (cursor->clock-value cursor))
|
||||
new-messages (map mark-album new-messages)]
|
||||
clock-value (when cursor
|
||||
(cursor->clock-value cursor))]
|
||||
{:dispatch [:chat/add-senders-to-chat-users (vals senders)]
|
||||
:db (-> db
|
||||
(update-in [:pagination-info chat-id :cursor-clock-value]
|
||||
@@ -164,7 +154,7 @@
|
||||
(empty? cursor))
|
||||
(update :contacts/contacts merge contacts))})))
|
||||
|
||||
(rf/defn load-more-messages
|
||||
(fx/defn load-more-messages
|
||||
{:events [:chat.ui/load-more-messages]}
|
||||
[{:keys [db]} chat-id first-request]
|
||||
(when-let [session-id (get-in db [:pagination-info chat-id :messages-initialized?])]
|
||||
@@ -183,15 +173,15 @@
|
||||
#(re-frame/dispatch [::messages-loaded chat-id session-id %])
|
||||
#(re-frame/dispatch [::failed-loading-messages chat-id session-id %]))))))))
|
||||
|
||||
(rf/defn load-more-messages-for-current-chat
|
||||
(fx/defn load-more-messages-for-current-chat
|
||||
{:events [:chat.ui/load-more-messages-for-current-chat]}
|
||||
[{:keys [db] :as cofx}]
|
||||
(load-more-messages cofx (:current-chat-id db) false))
|
||||
|
||||
(rf/defn load-messages
|
||||
(fx/defn load-messages
|
||||
[{:keys [db now] :as cofx} chat-id]
|
||||
(when-not (get-in db [:pagination-info chat-id :messages-initialized?])
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
{:db (assoc-in db [:pagination-info chat-id :messages-initialized?] now)
|
||||
:utils/dispatch-later [{:ms 50 :dispatch [:chat.ui/mark-all-read-pressed chat-id]}
|
||||
(when-not (get-in cofx [:db :chats chat-id :public?])
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
[status-im.contact.db :as contact.db]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im.native-module.core :as status]
|
||||
[utils.re-frame :as rf]
|
||||
[status-im.utils.fx :as fx]
|
||||
[status-im.utils.platform :as platform]
|
||||
[status-im.utils.utils :as utils]
|
||||
[taoensso.timbre :as log]))
|
||||
@@ -526,7 +526,7 @@
|
||||
(assoc-in [last-idx :to] (dec (count text)))
|
||||
(assoc-in [last-idx :checked?] false)))))))
|
||||
|
||||
(rf/defn on-text-input
|
||||
(fx/defn on-text-input
|
||||
{:events [::on-text-input]}
|
||||
[{:keys [db]} {:keys [previous-text start end] :as args}]
|
||||
(log/debug "[mentions] on-text-input args" args)
|
||||
@@ -573,7 +573,7 @@
|
||||
[[:text (subs text 0 first-from)]]))
|
||||
idxs))))
|
||||
|
||||
(rf/defn recheck-at-idxs
|
||||
(fx/defn recheck-at-idxs
|
||||
[{:keys [db]} mentionable-users]
|
||||
(let [chat-id (:current-chat-id db)
|
||||
text (get-in db [:chat/inputs chat-id :input-text])
|
||||
@@ -592,7 +592,7 @@
|
||||
new-at-idxs)
|
||||
(assoc-in [:chat/inputs-with-mentions chat-id] calculated-input))}))
|
||||
|
||||
(rf/defn calculate-suggestions
|
||||
(fx/defn calculate-suggestions
|
||||
{:events [::calculate-suggestions]}
|
||||
[{:keys [db]} mentionable-users]
|
||||
(let [chat-id (:current-chat-id db)
|
||||
@@ -600,9 +600,9 @@
|
||||
{:keys [new-text at-idxs start end] :as state}
|
||||
(get-in db [:chats/mentions chat-id :mentions])
|
||||
new-text (or new-text text)]
|
||||
(log/debug "[mentions] calculate suggestions"
|
||||
"state"
|
||||
state)
|
||||
(log/info "[mentions] calculate suggestions"
|
||||
"state"
|
||||
state)
|
||||
(if-not (seq at-idxs)
|
||||
{:db (-> db
|
||||
(assoc-in [:chats/mention-suggestions chat-id] nil)
|
||||
@@ -659,31 +659,31 @@
|
||||
" "))
|
||||
(subs text mention-end)])))
|
||||
|
||||
(rf/defn clear-suggestions
|
||||
(fx/defn clear-suggestions
|
||||
[{:keys [db]}]
|
||||
(log/debug "[mentions] clear suggestions")
|
||||
(let [chat-id (:current-chat-id db)]
|
||||
{:db (update db :chats/mention-suggestions dissoc chat-id)}))
|
||||
|
||||
(rf/defn clear-mentions
|
||||
(fx/defn clear-mentions
|
||||
[{:keys [db] :as cofx}]
|
||||
(log/debug "[mentions] clear mentions")
|
||||
(let [chat-id (:current-chat-id db)]
|
||||
(rf/merge
|
||||
(fx/merge
|
||||
cofx
|
||||
{:db (-> db
|
||||
(update-in [:chats/mentions chat-id] dissoc :mentions)
|
||||
(update :chat/inputs-with-mentions dissoc chat-id))}
|
||||
(clear-suggestions))))
|
||||
|
||||
(rf/defn clear-cursor
|
||||
(fx/defn clear-cursor
|
||||
{:events [::clear-cursor]}
|
||||
[{:keys [db]}]
|
||||
(log/debug "[mentions] clear cursor")
|
||||
{:db
|
||||
(update db :chats/cursor dissoc (:current-chat-id db))})
|
||||
|
||||
(rf/defn check-selection
|
||||
(fx/defn check-selection
|
||||
{:events [::on-selection-change]}
|
||||
[{:keys [db] :as cofx}
|
||||
{:keys [start end] :as selection}
|
||||
@@ -698,7 +698,7 @@
|
||||
(<= (dec end) to))
|
||||
idx))
|
||||
at-idxs)
|
||||
(rf/merge
|
||||
(fx/merge
|
||||
cofx
|
||||
{:db (update-in db
|
||||
[:chats/mentions chat-id :mentions]
|
||||
@@ -717,7 +717,7 @@
|
||||
(rn/find-node-handle (react/current-ref ref))
|
||||
cursor))))
|
||||
|
||||
(rf/defn reset-text-input-cursor
|
||||
(fx/defn reset-text-input-cursor
|
||||
[_ ref cursor]
|
||||
{::reset-text-input-cursor [ref cursor]})
|
||||
|
||||
|
||||
@@ -2,18 +2,19 @@
|
||||
(:require [clojure.string :as string]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.chat.models :as chat-model]
|
||||
[status-im.chat.models.delete-message :as delete-message]
|
||||
[status-im.chat.models.loading :as chat.loading]
|
||||
[status-im.chat.models.mentions :as mentions]
|
||||
[status-im.chat.models.message-list :as message-list]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.data-store.messages :as data-store.messages]
|
||||
[status-im.ethereum.json-rpc :as json-rpc]
|
||||
[status-im.transport.message.protocol :as protocol]
|
||||
[status-im.ui.screens.chat.state :as view.state]
|
||||
[utils.re-frame :as rf]
|
||||
[status-im.utils.fx :as fx]
|
||||
[status-im.utils.gfycat.core :as gfycat]
|
||||
[status-im.utils.platform :as platform]
|
||||
[status-im.utils.types :as types]
|
||||
[status-im2.contexts.chat.messages.delete-message.events :as delete-message]
|
||||
[taoensso.timbre :as log]))
|
||||
|
||||
(defn- message-loaded?
|
||||
@@ -36,7 +37,7 @@
|
||||
;; TODO this is too expensive, probably we could mark message somehow and just hide it in the UI
|
||||
(message-list/rebuild-message-list {:db (update-in db [:messages chat-id] dissoc message-id)} chat-id))
|
||||
|
||||
(rf/defn add-senders-to-chat-users
|
||||
(fx/defn add-senders-to-chat-users
|
||||
{:events [:chat/add-senders-to-chat-users]}
|
||||
[{:keys [db]} messages]
|
||||
(reduce (fn [acc {:keys [chat-id alias name identicon from]}]
|
||||
@@ -167,42 +168,42 @@
|
||||
(update-in [:message-lists constants/timeline-chat-id] message-list/add message)))
|
||||
db)))
|
||||
|
||||
(rf/defn process-statuses
|
||||
(fx/defn process-statuses
|
||||
{:events [:process-statuses]}
|
||||
[{:keys [db]} statuses]
|
||||
{:db (reduce reduce-js-statuses db statuses)})
|
||||
|
||||
(rf/defn update-db-message-status
|
||||
(fx/defn update-db-message-status
|
||||
[{:keys [db] :as cofx} chat-id message-id status]
|
||||
(when (get-in db [:messages chat-id message-id])
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
{:db (assoc-in db
|
||||
[:messages chat-id message-id :outgoing-status]
|
||||
status)})))
|
||||
|
||||
(rf/defn update-message-status
|
||||
(fx/defn update-message-status
|
||||
[{:keys [db] :as cofx} chat-id message-id status]
|
||||
(rf/merge cofx
|
||||
(fx/merge cofx
|
||||
(update-db-message-status chat-id message-id status)))
|
||||
|
||||
(rf/defn resend-message
|
||||
(fx/defn resend-message
|
||||
[{:keys [db] :as cofx} chat-id message-id]
|
||||
(rf/merge cofx
|
||||
{:json-rpc/call [{:method "wakuext_reSendChatMessage"
|
||||
:params [message-id]
|
||||
:on-success #(log/debug "re-sent message successfully")
|
||||
:on-error #(log/error "failed to re-send message" %)}]}
|
||||
(fx/merge cofx
|
||||
{::json-rpc/call [{:method "wakuext_reSendChatMessage"
|
||||
:params [message-id]
|
||||
:on-success #(log/debug "re-sent message successfully")
|
||||
:on-error #(log/error "failed to re-send message" %)}]}
|
||||
(update-message-status chat-id message-id :sending)))
|
||||
|
||||
(rf/defn send-message
|
||||
(fx/defn send-message
|
||||
[cofx message]
|
||||
(protocol/send-chat-messages cofx [message]))
|
||||
|
||||
(rf/defn send-messages
|
||||
(fx/defn send-messages
|
||||
[cofx messages]
|
||||
(protocol/send-chat-messages cofx messages))
|
||||
|
||||
(rf/defn handle-removed-messages
|
||||
(fx/defn handle-removed-messages
|
||||
{:events [::handle-removed-messages]}
|
||||
[{:keys [db] :as cofx} removed-messages]
|
||||
(let [mark-as-deleted-fx (->> removed-messages
|
||||
@@ -222,7 +223,7 @@
|
||||
removed-messages)
|
||||
remove-messages-fx (fn [{:keys [db]}]
|
||||
{:dispatch [:activity-center.notifications/fetch-unread-count]})]
|
||||
(apply rf/merge
|
||||
(apply fx/merge
|
||||
cofx
|
||||
(-> mark-as-deleted-fx
|
||||
(concat mark-as-seen-fx)
|
||||
@@ -243,7 +244,7 @@
|
||||
(<= message-clock cleared-at))
|
||||
messages)))
|
||||
|
||||
(rf/defn handle-cleared-histories-messages
|
||||
(fx/defn handle-cleared-histories-messages
|
||||
{:events [::handle-cleared-hisotories-messages]}
|
||||
[{:keys [db]} cleared-histories]
|
||||
{:db (reduce (fn [acc current]
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
(ns status-im.chat.models.message-list
|
||||
(:require ["functional-red-black-tree" :as rb-tree]
|
||||
[status-im.constants :as constants]
|
||||
[utils.re-frame :as rf]
|
||||
[utils.datetime :as datetime]))
|
||||
[status-im.utils.datetime :as time]
|
||||
[status-im.utils.fx :as fx]))
|
||||
|
||||
(defn- add-datemark
|
||||
[{:keys [whisper-timestamp] :as msg}]
|
||||
;;TODO this is slow
|
||||
(assoc msg :datemark (datetime/day-relative whisper-timestamp)))
|
||||
(assoc msg :datemark (time/day-relative whisper-timestamp)))
|
||||
|
||||
(defn- add-timestamp
|
||||
[{:keys [whisper-timestamp] :as msg}]
|
||||
(assoc msg :timestamp-str (datetime/timestamp->time whisper-timestamp)))
|
||||
(assoc msg :timestamp-str (time/timestamp->time whisper-timestamp)))
|
||||
|
||||
(defn prepare-message
|
||||
[{:keys [message-id
|
||||
@@ -20,8 +20,7 @@
|
||||
from
|
||||
outgoing
|
||||
whisper-timestamp
|
||||
deleted-for-me?
|
||||
albumize?]}]
|
||||
deleted-for-me?]}]
|
||||
(-> {:whisper-timestamp whisper-timestamp
|
||||
:from from
|
||||
:one-to-one? (= constants/message-type-one-to-one message-type)
|
||||
@@ -33,8 +32,7 @@
|
||||
:clock-value clock-value
|
||||
:type :message
|
||||
:message-id message-id
|
||||
:outgoing (boolean outgoing)
|
||||
:albumize? albumize?}
|
||||
:outgoing (boolean outgoing)}
|
||||
add-datemark
|
||||
add-timestamp))
|
||||
|
||||
@@ -197,9 +195,8 @@
|
||||
(array-seq (.-values message-list))
|
||||
[]))
|
||||
|
||||
;; NOTE(performance): this is too expensive, probably we could mark message somehow and just hide it in
|
||||
;; the UI
|
||||
(rf/defn rebuild-message-list
|
||||
;;TODO this is too expensive, probably we could mark message somehow and just hide it in the UI
|
||||
(fx/defn rebuild-message-list
|
||||
[{:keys [db]} chat-id]
|
||||
{:db (assoc-in db
|
||||
[:message-lists chat-id]
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
[status-im.constants :as constants]
|
||||
[status-im.data-store.reactions :as data-store.reactions]
|
||||
[status-im.transport.message.protocol :as message.protocol]
|
||||
[utils.re-frame :as rf]
|
||||
[status-im.utils.fx :as fx]
|
||||
[taoensso.timbre :as log]))
|
||||
|
||||
(defn update-reaction
|
||||
@@ -40,12 +40,12 @@
|
||||
(get-in db [:chats chat-id])]
|
||||
(>= deleted-at-clock-value clock-value)))
|
||||
|
||||
(rf/defn receive-signal
|
||||
(fx/defn receive-signal
|
||||
[{:keys [db] :as cofx} reactions]
|
||||
(let [reactions (filter (partial earlier-than-deleted-at? cofx) reactions)]
|
||||
{:db (update db :reactions (process-reactions (:chats db)) reactions)}))
|
||||
|
||||
(rf/defn load-more-reactions
|
||||
(fx/defn load-more-reactions
|
||||
{:events [:load-more-reactions]}
|
||||
[{:keys [db]} cursor chat-id]
|
||||
(when-let [session-id (get-in db [:pagination-info chat-id :messages-initialized?])]
|
||||
@@ -56,7 +56,7 @@
|
||||
#(re-frame/dispatch [::reactions-loaded chat-id session-id %])
|
||||
#(log/error "failed loading reactions" chat-id %))))
|
||||
|
||||
(rf/defn reactions-loaded
|
||||
(fx/defn reactions-loaded
|
||||
{:events [::reactions-loaded]}
|
||||
[{db :db}
|
||||
chat-id
|
||||
@@ -72,19 +72,19 @@
|
||||
;; Send reactions
|
||||
|
||||
|
||||
(rf/defn send-emoji-reaction
|
||||
(fx/defn send-emoji-reaction
|
||||
{:events [:models.reactions/send-emoji-reaction]}
|
||||
[{{:keys [current-chat-id]} :db :as cofx} reaction]
|
||||
(message.protocol/send-reaction cofx
|
||||
(update reaction :chat-id #(or % current-chat-id))))
|
||||
|
||||
(rf/defn send-retract-emoji-reaction
|
||||
(fx/defn send-retract-emoji-reaction
|
||||
{:events [:models.reactions/send-emoji-reaction-retraction]}
|
||||
[{{:keys [current-chat-id]} :db :as cofx} reaction]
|
||||
(message.protocol/send-retract-reaction cofx
|
||||
(update reaction :chat-id #(or % current-chat-id))))
|
||||
|
||||
(rf/defn receive-one
|
||||
(fx/defn receive-one
|
||||
{:events [::receive-one]}
|
||||
[{:keys [db]} reaction]
|
||||
{:db (update db :reactions (process-reactions (:chats db)) [reaction])})
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
(ns status-im.chat.models.transport
|
||||
(:require [status-im.chat.models.message :as chat.message]
|
||||
[status-im.transport.message.core :as transport.message]
|
||||
[utils.re-frame :as rf]))
|
||||
[status-im.utils.fx :as fx]))
|
||||
|
||||
(rf/defn chat-ui-resend-message
|
||||
(fx/defn chat-ui-resend-message
|
||||
{:events [:chat.ui/resend-message]}
|
||||
[{:keys [db] :as cofx} chat-id message-id]
|
||||
(let [message (get-in db [:messages chat-id message-id])]
|
||||
(rf/merge
|
||||
(fx/merge
|
||||
cofx
|
||||
(transport.message/set-message-envelope-hash chat-id message-id (:message-type message))
|
||||
(chat.message/resend-message chat-id message-id))))
|
||||
(chat.message/resend-message chat-id message-id))))
|
||||
@@ -1,9 +1,10 @@
|
||||
(ns status-im.commands.core
|
||||
(:require [re-frame.core :as re-frame]
|
||||
[status-im.ethereum.core :as ethereum]
|
||||
[utils.re-frame :as rf]))
|
||||
[status-im.ethereum.json-rpc :as json-rpc]
|
||||
[status-im.utils.fx :as fx]))
|
||||
|
||||
(rf/defn handle-prepare-accept-request-address-for-transaction
|
||||
(fx/defn handle-prepare-accept-request-address-for-transaction
|
||||
{:events [::prepare-accept-request-address-for-transaction]}
|
||||
[{:keys [db]} message]
|
||||
{:db (assoc db
|
||||
@@ -12,33 +13,33 @@
|
||||
:from (ethereum/get-default-account (:multiaccount/accounts db))})
|
||||
:show-select-acc-sheet nil})
|
||||
|
||||
(rf/defn set-selected-account
|
||||
(fx/defn set-selected-account
|
||||
{:events [::set-selected-account]}
|
||||
[{:keys [db]} _ account]
|
||||
{:db (-> (assoc-in db [:commands/select-account :from] account)
|
||||
(assoc :bottom-sheet/show? false))})
|
||||
|
||||
(rf/defn handle-accept-request-address-for-transaction
|
||||
(fx/defn handle-accept-request-address-for-transaction
|
||||
{:events [::accept-request-address-for-transaction]}
|
||||
[{:keys [db]} message-id address]
|
||||
{:db (dissoc db :commands/select-account)
|
||||
:json-rpc/call [{:method "wakuext_acceptRequestAddressForTransaction"
|
||||
:params [message-id address]
|
||||
:js-response true
|
||||
:on-success #(re-frame/dispatch [:transport/message-sent %])}]})
|
||||
{:db (dissoc db :commands/select-account)
|
||||
::json-rpc/call [{:method "wakuext_acceptRequestAddressForTransaction"
|
||||
:params [message-id address]
|
||||
:js-response true
|
||||
:on-success #(re-frame/dispatch [:transport/message-sent %])}]})
|
||||
|
||||
(rf/defn handle-decline-request-address-for-transaction
|
||||
(fx/defn handle-decline-request-address-for-transaction
|
||||
{:events [::decline-request-address-for-transaction]}
|
||||
[_ message-id]
|
||||
{:json-rpc/call [{:method "wakuext_declineRequestAddressForTransaction"
|
||||
:params [message-id]
|
||||
:js-response true
|
||||
:on-success #(re-frame/dispatch [:transport/message-sent %])}]})
|
||||
{::json-rpc/call [{:method "wakuext_declineRequestAddressForTransaction"
|
||||
:params [message-id]
|
||||
:js-response true
|
||||
:on-success #(re-frame/dispatch [:transport/message-sent %])}]})
|
||||
|
||||
(rf/defn handle-decline-request-transaction
|
||||
(fx/defn handle-decline-request-transaction
|
||||
{:events [::decline-request-transaction]}
|
||||
[cofx message-id]
|
||||
{:json-rpc/call [{:method "wakuext_declineRequestTransaction"
|
||||
:params [message-id]
|
||||
:js-response true
|
||||
:on-success #(re-frame/dispatch [:transport/message-sent %])}]})
|
||||
{::json-rpc/call [{:method "wakuext_declineRequestTransaction"
|
||||
:params [message-id]
|
||||
:js-response true
|
||||
:on-success #(re-frame/dispatch [:transport/message-sent %])}]})
|
||||
|
||||