2016-02-22 22:04:42 +00:00
|
|
|
{
|
2019-09-12 12:38:16 +00:00
|
|
|
"name": "StatusIm-Mobile",
|
2016-02-22 22:04:42 +00:00
|
|
|
"version": "0.0.1",
|
2022-05-19 15:50:41 +00:00
|
|
|
"main": "modules/react-native-status/nodejs/bindings.js",
|
2016-02-22 22:04:42 +00:00
|
|
|
"private": true,
|
|
|
|
"scripts": {
|
2023-10-17 18:05:58 +00:00
|
|
|
"_comment": "This also prevents 'yarn install' from running outside of nix.",
|
|
|
|
"preinstall": "scripts/check-nix-shell.sh && make status-go-library"
|
2016-02-22 22:04:42 +00:00
|
|
|
},
|
|
|
|
"dependencies": {
|
2024-05-08 08:51:45 +00:00
|
|
|
"@ethersproject/shims": "^5.7.0",
|
|
|
|
"@json-rpc-tools/utils": "^1.7.6",
|
2023-12-11 15:52:23 +00:00
|
|
|
"@react-native-async-storage/async-storage": "1.19.3",
|
2024-04-17 15:14:18 +00:00
|
|
|
"@react-native-camera-roll/camera-roll": "7.5.2",
|
2024-03-22 14:21:44 +00:00
|
|
|
"@react-native-clipboard/clipboard": "1.13.2",
|
2022-01-05 13:32:02 +00:00
|
|
|
"@react-native-community/audio-toolkit": "git+https://github.com/tbenr/react-native-audio-toolkit.git#refs/tags/v2.0.3-status-v6",
|
2024-08-29 15:43:40 +00:00
|
|
|
"@react-native-community/blur": "4.4.1",
|
2023-05-19 10:31:57 +00:00
|
|
|
"@react-native-community/hooks": "^3.0.0",
|
2020-02-25 11:31:04 +00:00
|
|
|
"@react-native-community/masked-view": "^0.1.6",
|
2019-10-14 05:24:35 +00:00
|
|
|
"@react-native-community/netinfo": "^4.4.0",
|
2020-06-12 08:54:28 +00:00
|
|
|
"@react-native-community/push-notification-ios": "^1.4.1",
|
2020-07-28 11:06:58 +00:00
|
|
|
"@react-native-community/slider": "^3.0.0",
|
2024-12-24 10:13:52 +00:00
|
|
|
"@walletconnect/react-native-compat": "2.17.3",
|
|
|
|
"@reown/walletkit": "^1.0.0",
|
2023-06-14 01:47:41 +00:00
|
|
|
"base-64": "^1.0.0",
|
2024-07-01 12:31:58 +00:00
|
|
|
"big-integer": "1.6.51",
|
2022-01-05 13:32:02 +00:00
|
|
|
"bignumber.js": "git+https://github.com/status-im/bignumber.js.git#refs/tags/v4.0.2-status",
|
2019-09-06 10:05:26 +00:00
|
|
|
"chance": "^1.1.0",
|
|
|
|
"emojilib": "^2.4.0",
|
2022-10-11 10:20:37 +00:00
|
|
|
"eth-phishing-detect": "^1.2.0",
|
2024-05-08 08:51:45 +00:00
|
|
|
"ethers": "5.7.2",
|
|
|
|
"fast-text-encoding": "^1.0.6",
|
2023-12-26 10:38:46 +00:00
|
|
|
"form-data": "^4.0.0",
|
Fix message ordering and improve performance rec. messages
This commit does a few things:
==== Ordering of messages ====
Change the ordering of messages from a mixture of timestamp/clock-value to use
only clock-value.
Datemarks are now not used for sorting anymore, which means that the
order of messages is always causally related (not the case before, as we
were breaking this property by sorting by datemark), but datemark
calculation is unreliable (a reply to a message might have a timestamp <
then the message that is replied to).
So for timestamp calculation we
naively group them ignoring "out-of-order timestamp" messages, although
there's much to improve.
It fixes an issue whereby the user would change their time and the
message will be displayed in the past, although it is still possible to
craft a message with a lower clock value and order it in the past
(there's no way we can prevent this to some extent, but there are ways
to mitigate, but outside the scope of this PR).
==== Performance of receiving messages ====
The app would freeze on pulling messages from a mailserver (100 or so).
This is due to the JS Thread being hogged by CPU calculation, coupled
with the fact that we always tried to process messages all in one go.
This strategy can't scale, and given x is big enough (200,300,1000) the
UI will freeze.
Instead, each message is now processed separately, and we leave a gap
between processing each message for the UI to respond to user input
(otherwise the app freezes again).
Pulling messages will be longer overall, but the app will be usuable
while this happen (albeit it might slow down).
Other strategies are possible (calculate off-db and do a big swap,
avoiding many re-renders etc), but this is the reccommended strategy by
re-frame author (Solving the CPU Hog problem), so sounds like a safe
base point.
The underlying data structure for holding messages was also changed, we
used an immutable Red and Black Tree, same as a sorted map for clojure, but we use
a js library as is twice as performing then clojure sorted map.
We also don't sort messages again each time we receive them O(nlogn), but we
insert them in order O(logn).
Other data structures considered but discarded:
1) Plain vector, but performance prepending/insertion in the middle
(both O(n)) were not great, as not really suited for these operations.
2) Linked list, appealing as append/prepend is O(1), while insertion is
O(n). This is probably acceptable as messages tend to come in order
(from the db, so adding N messages is O(n)), or the network (most of
them prepends, or close to the head), while mailserver would not follow this path.
An implementation of a linked list was built, which performed roughtly the
same as a clojure sorted-map (although faster append/prepend), but not
worth the complexity of having our own implementation.
3) Clojure sorted-map, probably the most versatile, performance were
acceptable, but nowhere near the javascript implementation we decided on
4) Priority map, much slower than a sorted map (twice as slow)
5) Mutable sorted map, js implementation, (bintrees), not explored this very much, but from
just a quick benchmark, performance were much worse that clojure
immutable sorted map
Given that each message is now processed separately, saving the chat /
messages is also debounced to avoid spamming status-go with network
requests. This is a temporary measure for now until that's done directly
in status-go, without having to ping-pong with status-react.
Next steps performance wise is to move stuff to status-go, parsing of
transit, validation, which is heavy, at which point we can re-consider
performance and how to handle messages.
Fixes also an issue with the last message in the chat, we were using the
last message in the chat list, which might not necessarely be the last
message the chat has seen, in case messages were not loaded and a more
recent message is the database (say you fetch historical messages for
1-to-1 A, you don't have any messages in 1-to-1 chat B loaded, you receive an
historical message for chat B, it sets it as last message).
Also use clj beans instead of js->clj for type conversion
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2019-10-24 14:23:20 +00:00
|
|
|
"functional-red-black-tree": "^1.0.1",
|
2019-09-06 10:05:26 +00:00
|
|
|
"i18n-js": "^3.3.0",
|
2023-12-11 15:52:23 +00:00
|
|
|
"jsc-android": "^250231.0.0",
|
2021-11-15 04:42:11 +00:00
|
|
|
"node-libs-react-native": "^1.2.1",
|
2023-12-11 15:52:23 +00:00
|
|
|
"react": "18.2.0",
|
2023-06-23 12:11:50 +00:00
|
|
|
"react-dom": "18.0.0",
|
2024-03-22 14:21:44 +00:00
|
|
|
"react-native": "0.73.5",
|
2019-09-06 10:05:26 +00:00
|
|
|
"react-native-background-timer": "^2.1.1",
|
2024-01-29 11:33:46 +00:00
|
|
|
"react-native-biometrics": "^3.0.1",
|
2022-03-04 14:04:17 +00:00
|
|
|
"react-native-blob-util": "^0.13.18",
|
2024-07-31 20:54:21 +00:00
|
|
|
"react-native-camera-kit": "git+https://github.com/status-im/react-native-camera-kit.git#refs/tags/v14.0.0-beta15-status-v1",
|
2023-04-12 09:55:19 +00:00
|
|
|
"react-native-config": "^1.5.0",
|
2024-03-22 14:21:44 +00:00
|
|
|
"react-native-dialogs": "1.1.2",
|
2023-12-11 15:52:23 +00:00
|
|
|
"react-native-draggable-flatlist": "4.0.1",
|
2022-01-24 13:18:01 +00:00
|
|
|
"react-native-fast-image": "^8.5.11",
|
2019-10-03 10:07:14 +00:00
|
|
|
"react-native-fs": "^2.14.1",
|
2024-03-22 14:21:44 +00:00
|
|
|
"react-native-gesture-handler": "2.14.1",
|
2024-05-08 08:51:45 +00:00
|
|
|
"react-native-get-random-values": "^1.11.0",
|
2023-12-11 15:52:23 +00:00
|
|
|
"react-native-gifted-charts": "^1.3.2",
|
2024-03-22 14:21:44 +00:00
|
|
|
"react-native-hole-view": "^3.0.0-alpha4",
|
2023-12-11 15:52:23 +00:00
|
|
|
"react-native-image-crop-picker": "0.40.0",
|
2020-07-17 14:09:36 +00:00
|
|
|
"react-native-image-resizer": "^1.2.3",
|
2023-12-11 15:52:23 +00:00
|
|
|
"react-native-keychain": "8.1.2",
|
2024-06-12 08:13:26 +00:00
|
|
|
"react-native-linear-gradient": "3.0.0-alpha.1",
|
2022-08-02 10:48:12 +00:00
|
|
|
"react-native-lottie-splash-screen": "^1.0.1",
|
2024-05-20 14:51:49 +00:00
|
|
|
"react-native-navigation": "7.39.0",
|
2023-03-03 12:33:28 +00:00
|
|
|
"react-native-orientation-locker": "^1.5.0",
|
2024-10-18 11:20:21 +00:00
|
|
|
"react-native-pdf": "^6.7.5",
|
2024-04-22 16:01:45 +00:00
|
|
|
"react-native-permissions": "4.1.5",
|
2023-12-18 04:14:53 +00:00
|
|
|
"react-native-reanimated": "3.6.1",
|
2023-12-11 15:52:23 +00:00
|
|
|
"react-native-redash": "18.1.0",
|
2024-04-08 14:14:07 +00:00
|
|
|
"react-native-shadow-2": "^7.0.8",
|
2019-05-07 06:37:43 +00:00
|
|
|
"react-native-shake": "^3.3.1",
|
2024-03-22 14:21:44 +00:00
|
|
|
"react-native-share": "10.0.2",
|
2023-04-25 13:13:14 +00:00
|
|
|
"react-native-static-safe-area-insets": "^2.2.0",
|
2024-12-13 18:57:26 +00:00
|
|
|
"react-native-status-keycard": "git+https://github.com/status-im/react-native-status-keycard.git#refs/tags/v2.6.4",
|
2023-08-21 08:49:41 +00:00
|
|
|
"react-native-svg": "13.10.0",
|
2023-12-27 03:43:29 +00:00
|
|
|
"react-native-webview": "13.6.3",
|
2024-04-02 11:02:54 +00:00
|
|
|
"react-syntax-highlighter": "^15.5.0"
|
2019-07-03 19:00:51 +00:00
|
|
|
},
|
|
|
|
"devDependencies": {
|
2023-12-11 15:52:23 +00:00
|
|
|
"@babel/core": "^7.20.0",
|
|
|
|
"@babel/generator": "^7.20.0",
|
|
|
|
"@babel/helper-builder-react-jsx": "^7.20.0",
|
|
|
|
"@babel/plugin-transform-block-scoping": "^7.20.0",
|
|
|
|
"@babel/preset-env": "^7.20.0",
|
2022-11-23 13:59:18 +00:00
|
|
|
"@babel/preset-react": "^7.18.6",
|
2019-08-06 14:00:51 +00:00
|
|
|
"@babel/register": "7.0.0",
|
2022-11-23 13:59:18 +00:00
|
|
|
"@jest/globals": "^25.1.0",
|
2022-06-28 17:27:14 +00:00
|
|
|
"@mapbox/node-pre-gyp": "^1.0.9",
|
2024-03-22 14:21:44 +00:00
|
|
|
"@react-native/babel-preset": "0.73.21",
|
|
|
|
"@react-native/codegen": "0.73.2",
|
|
|
|
"@react-native/gradle-plugin": "0.73.4",
|
|
|
|
"@react-native/metro-config": "0.73.5",
|
Fix component tests, upgrade Jest & friends, and a few other goodies (#18276)
Fix all component tests after the latest RN upgrade.
Fixes https://github.com/status-im/status-mobile/issues/18157
Closes https://github.com/status-im/status-mobile/pull/18235
Dependency changes
- Upgraded Jest: from 26.6.3 to latest 29.7.0.
- Upgraded @testing-library/jest-native: from 5.3.0 to latest 5.4.3
- Upgraded @testing-library/react-native: from 11.5.4 to 12.4.2
- Removed explicit dependency on jest-circus, this is now the default test
runner.
- Removed explicit dependency on jest-environment-node. This is handled by the
package manager.
- Added jest-silent-reporter at version 0.5.0.
### Why component tests were failing?
Many tests were failing because we were using RN Testing Library (RNTL) in an
unreliable fashion. With the recent library upgrades, the unreliability was
excerbated. Other times, the tests were incorrectly arranging data.
### with-redefs does not work with async code
Generally speaking, with-redefs should not be used with async code, assume the
worst. The scope of the macro will cease to exist by the time the async code
runs. In many tests we were using with-redefs, then calling render, but for some
components that use use-effect, JS timers, animations, etc it's unreliable and
were the reason for failures.
It's easy to reproduce too:
```clojure
(defn foo []
:foo)
(foo)
;; => :foo
(with-redefs [foo (constantly :bar)]
(foo))
;; => :bar
(js/setTimeout
(fn []
(tap> [:calling-foo (foo)]))
100)
;; Taps [:calling-foo :foo]
;; As you would expect, when running without with-redefs, it prints :foo.
;; So far so good, but whatch what happens with async code:
(with-redefs [foo (constantly :bar)]
(js/setTimeout
(fn []
(tap> [:calling-foo (foo)]))
100))
;; Taps [:calling-foo :foo]
;; ====> PROBLEM: Taps :foo, not :bar as one might expect
```
### Not waiting on wait-for
When test-helpers.component/wait-for is used, subsequent assertions/etc should
be done after the promise returned by wait-for is resolved. But remember to not
perform side-effects inside the wait-for callback (check out the docs
https://callstack.github.io/react-native-testing-library/docs/api#waitfor).
Most, if not all of our usages of wait-for were not waiting.
#### Improvement 1 - Silence Jest on demand
If you need to re-run component tests frequently, you may want to reduce the
output verbosity. By passing JEST_USE_SILENT_REPORTER=true to make
component-test or make component-test-watch you will see a lot less noise and be
able to focus on what really matters to you.
#### Improvement 2 - Selectively focus/disable tests
Because of our need to first compile CLJS to JS before running tests via Jest,
we couldn't easily skip or focus on specific tests. From this commit onwards, we
should never again have to change the list of requires in files core_spec.cljs.
Commenting out required namespaces gives a bad DX because it causes constant
rebasing issues.
#### Improvement 3 - Translations now work as in prod code (but only English)
Translations performed by *-by-translation-text can be done now without any
workaround under the hood. The query functions are now linted just like
i18n/label, which means static translation keywords must be qualified with :t/,
which is good for consistency.
2023-12-26 14:58:23 +00:00
|
|
|
"@testing-library/jest-native": "^5.4.3",
|
|
|
|
"@testing-library/react-native": "^12.4.2",
|
2023-12-11 15:52:23 +00:00
|
|
|
"@tsconfig/react-native": "^3.0.0",
|
2022-11-20 23:46:04 +00:00
|
|
|
"@types/jest": "^28.1.6",
|
2024-03-22 14:21:44 +00:00
|
|
|
"@types/react": "^18.2.6",
|
2023-12-11 15:52:23 +00:00
|
|
|
"@types/react-test-renderer": "^18.0.0",
|
2024-03-22 14:21:44 +00:00
|
|
|
"babel-jest": "^29.6.3",
|
2022-12-20 12:07:00 +00:00
|
|
|
"concurrently": "^7.6.0",
|
Fix component tests, upgrade Jest & friends, and a few other goodies (#18276)
Fix all component tests after the latest RN upgrade.
Fixes https://github.com/status-im/status-mobile/issues/18157
Closes https://github.com/status-im/status-mobile/pull/18235
Dependency changes
- Upgraded Jest: from 26.6.3 to latest 29.7.0.
- Upgraded @testing-library/jest-native: from 5.3.0 to latest 5.4.3
- Upgraded @testing-library/react-native: from 11.5.4 to 12.4.2
- Removed explicit dependency on jest-circus, this is now the default test
runner.
- Removed explicit dependency on jest-environment-node. This is handled by the
package manager.
- Added jest-silent-reporter at version 0.5.0.
### Why component tests were failing?
Many tests were failing because we were using RN Testing Library (RNTL) in an
unreliable fashion. With the recent library upgrades, the unreliability was
excerbated. Other times, the tests were incorrectly arranging data.
### with-redefs does not work with async code
Generally speaking, with-redefs should not be used with async code, assume the
worst. The scope of the macro will cease to exist by the time the async code
runs. In many tests we were using with-redefs, then calling render, but for some
components that use use-effect, JS timers, animations, etc it's unreliable and
were the reason for failures.
It's easy to reproduce too:
```clojure
(defn foo []
:foo)
(foo)
;; => :foo
(with-redefs [foo (constantly :bar)]
(foo))
;; => :bar
(js/setTimeout
(fn []
(tap> [:calling-foo (foo)]))
100)
;; Taps [:calling-foo :foo]
;; As you would expect, when running without with-redefs, it prints :foo.
;; So far so good, but whatch what happens with async code:
(with-redefs [foo (constantly :bar)]
(js/setTimeout
(fn []
(tap> [:calling-foo (foo)]))
100))
;; Taps [:calling-foo :foo]
;; ====> PROBLEM: Taps :foo, not :bar as one might expect
```
### Not waiting on wait-for
When test-helpers.component/wait-for is used, subsequent assertions/etc should
be done after the promise returned by wait-for is resolved. But remember to not
perform side-effects inside the wait-for callback (check out the docs
https://callstack.github.io/react-native-testing-library/docs/api#waitfor).
Most, if not all of our usages of wait-for were not waiting.
#### Improvement 1 - Silence Jest on demand
If you need to re-run component tests frequently, you may want to reduce the
output verbosity. By passing JEST_USE_SILENT_REPORTER=true to make
component-test or make component-test-watch you will see a lot less noise and be
able to focus on what really matters to you.
#### Improvement 2 - Selectively focus/disable tests
Because of our need to first compile CLJS to JS before running tests via Jest,
we couldn't easily skip or focus on specific tests. From this commit onwards, we
should never again have to change the list of requires in files core_spec.cljs.
Commenting out required namespaces gives a bad DX because it causes constant
rebasing issues.
#### Improvement 3 - Translations now work as in prod code (but only English)
Translations performed by *-by-translation-text can be done now without any
workaround under the hood. The query functions are now linted just like
i18n/label, which means static translation keywords must be qualified with :t/,
which is good for consistency.
2023-12-26 14:58:23 +00:00
|
|
|
"jest": "^29.7.0",
|
2022-11-20 23:46:04 +00:00
|
|
|
"jest-image-snapshot": "^5.1.0",
|
Fix component tests, upgrade Jest & friends, and a few other goodies (#18276)
Fix all component tests after the latest RN upgrade.
Fixes https://github.com/status-im/status-mobile/issues/18157
Closes https://github.com/status-im/status-mobile/pull/18235
Dependency changes
- Upgraded Jest: from 26.6.3 to latest 29.7.0.
- Upgraded @testing-library/jest-native: from 5.3.0 to latest 5.4.3
- Upgraded @testing-library/react-native: from 11.5.4 to 12.4.2
- Removed explicit dependency on jest-circus, this is now the default test
runner.
- Removed explicit dependency on jest-environment-node. This is handled by the
package manager.
- Added jest-silent-reporter at version 0.5.0.
### Why component tests were failing?
Many tests were failing because we were using RN Testing Library (RNTL) in an
unreliable fashion. With the recent library upgrades, the unreliability was
excerbated. Other times, the tests were incorrectly arranging data.
### with-redefs does not work with async code
Generally speaking, with-redefs should not be used with async code, assume the
worst. The scope of the macro will cease to exist by the time the async code
runs. In many tests we were using with-redefs, then calling render, but for some
components that use use-effect, JS timers, animations, etc it's unreliable and
were the reason for failures.
It's easy to reproduce too:
```clojure
(defn foo []
:foo)
(foo)
;; => :foo
(with-redefs [foo (constantly :bar)]
(foo))
;; => :bar
(js/setTimeout
(fn []
(tap> [:calling-foo (foo)]))
100)
;; Taps [:calling-foo :foo]
;; As you would expect, when running without with-redefs, it prints :foo.
;; So far so good, but whatch what happens with async code:
(with-redefs [foo (constantly :bar)]
(js/setTimeout
(fn []
(tap> [:calling-foo (foo)]))
100))
;; Taps [:calling-foo :foo]
;; ====> PROBLEM: Taps :foo, not :bar as one might expect
```
### Not waiting on wait-for
When test-helpers.component/wait-for is used, subsequent assertions/etc should
be done after the promise returned by wait-for is resolved. But remember to not
perform side-effects inside the wait-for callback (check out the docs
https://callstack.github.io/react-native-testing-library/docs/api#waitfor).
Most, if not all of our usages of wait-for were not waiting.
#### Improvement 1 - Silence Jest on demand
If you need to re-run component tests frequently, you may want to reduce the
output verbosity. By passing JEST_USE_SILENT_REPORTER=true to make
component-test or make component-test-watch you will see a lot less noise and be
able to focus on what really matters to you.
#### Improvement 2 - Selectively focus/disable tests
Because of our need to first compile CLJS to JS before running tests via Jest,
we couldn't easily skip or focus on specific tests. From this commit onwards, we
should never again have to change the list of requires in files core_spec.cljs.
Commenting out required namespaces gives a bad DX because it causes constant
rebasing issues.
#### Improvement 3 - Translations now work as in prod code (but only English)
Translations performed by *-by-translation-text can be done now without any
workaround under the hood. The query functions are now linted just like
i18n/label, which means static translation keywords must be qualified with :t/,
which is good for consistency.
2023-12-26 14:58:23 +00:00
|
|
|
"jest-silent-reporter": "^0.5.0",
|
2022-05-27 08:35:43 +00:00
|
|
|
"nodemon": "^2.0.16",
|
2019-08-06 14:00:51 +00:00
|
|
|
"nyc": "^14.1.1",
|
2024-07-22 01:39:50 +00:00
|
|
|
"prettier": "^3.3.3",
|
|
|
|
"prettier-plugin-sort-json": "^4.0.0",
|
2019-08-29 11:11:46 +00:00
|
|
|
"process": "0.11.10",
|
2023-12-11 15:52:23 +00:00
|
|
|
"react-test-renderer": "18.1.0",
|
2024-06-03 22:47:10 +00:00
|
|
|
"shadow-cljs": "2.26.2",
|
|
|
|
"websocket": "^1.0.35"
|
2022-05-19 15:50:41 +00:00
|
|
|
},
|
|
|
|
"binary": {
|
|
|
|
"module_name": "status_nodejs_addon",
|
|
|
|
"module_path": "./lib/binding/",
|
2022-07-17 12:37:46 +00:00
|
|
|
"host": "https://github.com/status-im/status-mobile/releases/download/",
|
2022-05-19 15:50:41 +00:00
|
|
|
"remote_path": "{version}"
|
2023-12-11 15:52:23 +00:00
|
|
|
},
|
|
|
|
"engines": {
|
2024-03-22 14:21:44 +00:00
|
|
|
"node": ">=18"
|
2016-02-22 22:04:42 +00:00
|
|
|
}
|
2016-07-22 08:53:12 +00:00
|
|
|
}
|