Commit Graph

45 Commits

Author SHA1 Message Date
Andrea Maria Piana c69863cda2
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-11-01 23:59:26 +01:00
yenda 7bb45fdd8f
remove firebase
Signed-off-by: yenda <eric@status.im>
2019-10-29 15:03:58 +01:00
Volodymyr Kozieiev ace4b5a161
Desktop works with react-navigation v3
Signed-off-by: Volodymyr Kozieiev <vkjr.sp@gmail.com>
2019-10-02 10:19:37 +03:00
Andrea Maria Piana acd7e56d1d
Add gfycat/identicon from status-go
Signed-off-by: yenda <eric@status.im>
2019-09-26 14:12:43 +02:00
yenda 5db0a58ab8
remove unused deps and document the others
Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
2019-09-12 16:12:46 +02:00
yenda f538cfe848
remove web3 dependency 2019-09-12 15:51:57 +02:00
yenda 69819df39a
fix dependencies and remove js-sha3 2019-09-12 15:51:57 +02:00
yenda c3dd950286
remove realm
Signed-off-by: yenda <eric@status.im>
2019-09-09 18:40:15 +02:00
Pedro Pombeiro 66b982c3fb
Use react-native net-info community package
Signed-off-by: yenda <eric@status.im>
2019-09-05 14:16:28 +02:00
Pedro Pombeiro 58d310ffce
Remove RAM bundle support 2019-08-30 17:13:35 +02:00
Andrey Shovkoplyas 0288d617cb
[#8849] Use node-qrcode instead of react-native-qrcode 2019-08-29 15:53:44 +02:00
Andrey Shovkoplyas 2e06dd36da
remove unused resources
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
2019-08-22 18:27:06 +03:00
Volodymyr Kozieiev ea8bf402d7
Two pane ui on large screens
Signed-off-by: Volodymyr Kozieiev <vkjr.sp@gmail.com>
2019-07-05 13:03:21 +03:00
Vitaliy Vlasov 4f6e06bf59
Use react-native-screens
Signed-off-by: Vitaliy Vlasov <siphiuel@gmail.com>
2019-07-01 09:30:19 +03:00
Roman Volosovskyi 632bbf3bc1
[perf] Move translation to node_modules in release build 2019-06-05 18:40:53 +03:00
tbenr 090a4e7c76
fixes #6573
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
2019-05-31 10:25:24 +02:00
Roman Volosovskyi c7c7b50281
RAM bundle basic setup 2019-05-27 17:34:17 +03:00
Roman Volosovskyi b0be9ee976
Send logs on shaking device 2019-05-24 13:35:04 +03:00
Roman Volosovskyi ff39426e56
[android] send logs to error-reports@status.im 2019-05-10 17:02:58 +03:00
Volodymyr Kozieiev 32f7f91e32
Mobile UI on desktop can be enabled in .env file
Signed-off-by: Volodymyr Kozieiev <vkjr.sp@gmail.com>
2019-05-03 18:11:09 +03:00
Volodymyr Kozieiev cb4dc876f1
Removed react-native-webview from clj-rn.conf.edn
Signed-off-by: Volodymyr Kozieiev <vkjr.sp@gmail.com>
2019-03-15 16:25:52 +02:00
tbenr b1331378d5
fixes #6597
Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
2019-03-06 17:09:58 +01:00
Roman Volosovskyi 73668d2e53
Add components/src to source-paths
Otherwise changes in this ns are not loaded by figwheel during development
2019-03-05 10:00:56 +02:00
kn 6988950ea8
[#6973] Replace react-native-i18n with react-native-languages 2019-02-09 23:27:46 -08:00
Andrey Shovkoplyas 0ec88fdba8
fixed desktop build and tests
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
2019-02-06 09:46:50 +01:00
Andrey Shovkoplyas 5fe9e3d156
[#6587] IPFS hosted apps should not share cookies/etc
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
2019-02-05 18:49:25 +01:00
Vitaliy Vlasov c8e5fd6a9c
Add desktop keyboard shortcuts
Signed-off-by: Vitaliy Vlasov <siphiuel@gmail.com>
2019-01-04 00:30:19 +02:00
Dmitry Novotochinov 962c49e345
add keycard installation
Signed-off-by: Dmitry Novotochinov <dmitry.novot@gmail.com>
2018-12-20 15:43:37 +03:00
Vitaliy Vlasov 9bc98405a0
Add react-native-desktop-config
Add section separator for logging-display

Refactor user-login-callback

Add comment to AppConfig class definition

Fix mobile compilation error

Use reference in AppConfig singleton; remove obsolete CMake directives

Styling changes

Disable status-go logs by default on desktop

Signed-off-by: Vitaliy Vlasov <siphiuel@gmail.com>
2018-12-18 14:31:40 +02:00
Vitaliy Vlasov dc4841f041
Add react-native-desktop-menu native module
Signed-off-by: Vitaliy Vlasov <siphiuel@gmail.com>
2018-12-01 02:03:06 +02:00
Dmitry Novotochinov 6d0a7219ae
fix typo in clj-rn conf
Signed-off-by: Dmitry Novotochinov <dmitry.novot@gmail.com>
2018-10-24 17:35:59 +03:00
Dmitry Novotochinov 40914a1431
[#5339] switch Desktop to clj-rn
Signed-off-by: Dmitry Novotochinov <dmitry.novot@gmail.com>
2018-10-24 15:48:08 +03:00
Andrea Maria Piana 9629983f7f
Remove instabug 2018-10-19 09:18:22 +03:00
Roman Volosovskyi c338896018
[#6330] remove testfairy 2018-10-16 20:46:43 +03:00
Eric Dvorsak 21cc106ed3
cljs implementation of abi-spec
Signed-off-by: yenda <eric@status.im>
2018-09-26 21:58:14 +02:00
Dmitry Novotochinov 60cb0eb36c
[#5825] add hardwallet auth method and connect screens
* add react-native-nfc-manager to detect NFC support
* add "Choose auth method" screen https://www.figma.com/file/UfQjpWl1hmRchHIyY3Wvu2nW/Hardwallet-light-flows?node-id=259%3A29
* add "Hardwallet connect" screen https://www.figma.com/file/UfQjpWl1hmRchHIyY3Wvu2nW/Hardwallet-light-flows?node-id=258%3A594

Signed-off-by: Dmitry Novotochinov <dmitry.novot@gmail.com>
2018-09-20 12:30:47 +03:00
Aleksandr Pantiukhov eda73bf8ef
[#5583]: Stronger security checks in browser; Metamask phishing detector
Signed-off-by: Aleksandr Pantiukhov <alwxndr@gmail.com>
2018-09-18 17:54:42 +02:00
Roman Volosovskyi 6438a1387b
[#4866] intagrate react-navigation 2018-09-18 14:21:32 +03:00
Eric Dvorsak ccbc0baffb
update developer dependencies
Signed-off-by: Eric Dvorsak <eric@dvorsak.fr>
2018-09-17 10:31:30 +02:00
Roman Volosovskyi c61200f9ae
[#5180] Encrypt account's db with password 2018-09-13 12:20:13 +03:00
Eric Dvorsak 8eb5047d7a
[fix #4819] update react-native to 0.56
Fix figwheel-bridge path in clj-rn.conf.edn
update SplashScreen
update ios to 9.0
updated Podfile.lock
downgrade cocoapods to 1.5.2
update package-lock.json
update pod repo when installing
update appcompat to v27

Signed-off-by: Dmitry Novotochinov <dmitry.novot@gmail.com>
2018-09-05 21:27:46 +03:00
Dmitry Novotochinov a4541c8af3
[#3352] Improve new message notifications
* Set custom sound
* Tap on notification opens chat
* Show message notifications when app in foreground

Signed-off-by: Dmitry Novotochinov <dmitry.novot@gmail.com>
2018-08-10 13:48:37 +03:00
Roman Volosovskyi 6dd4064b70
remove nfc-react-native module 2018-08-02 11:10:53 +03:00
endenwer bb729c6c81
Use clj-rn for development
Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
2018-07-31 09:26:37 +02:00
psdp 25aa55f373
[#3398] Replace re-natal with features added in build.clj script
get rid of build-conf.edn

Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
2018-05-15 18:09:38 +02:00