Commit Graph

88 Commits

Author SHA1 Message Date
yqrashawn bd84a36582
feat: new delete message (#14232) 2022-12-09 15:35:41 +08:00
Icaro Motta 910bafc5f4
Display contact verification requests and allow users to decline them (#14223) 2022-10-26 07:48:07 -03:00
yqrashawn bc050af9ed
feat: delete for me logic without UI (#14007) 2022-10-12 21:21:20 +08:00
Andrea Maria Piana 785386987b
[Fixes: #13416] resize image in status-go as well, alert user if fails
869942c0...ed67cc2a

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2022-06-07 16:06:54 +01:00
Brian Sztamfater 91f444ba80
Support mutual contact requests
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2022-05-31 09:23:24 +01:00
andrey 6448c24e14
call rpc cleanup
Signed-off-by: andrey <motor4ik@gmail.com>
2022-05-11 11:41:56 +02:00
Andrea Maria Piana 60cfca1107
Move mailserver logic to status-go
598b83757c...d60a6713fe
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2022-03-19 09:01:21 +00:00
Brian Sztamfater 089f42e0e9
Pinned messages in chats
Signed-off-by: Brian Sztamfater <brian@status.im>
2021-07-05 10:31:37 -03:00
Andrea Maria Piana 45b9fd4b91
[Fixes: #12607] Edit messages
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2021-06-29 13:18:52 +02:00
Andrea Maria Piana dd5c30b7a0
Move mailserver logic/gaps/ranges to status-go
This commit moves most of the mailserver logic to status-go.

- Filters are now removed and not passed to the client anymore
- Ranges have been removed
- Gaps are now messages with a different content type
- Upsert/Save chat has been removed and instead we have more specific
endpoints such as CreatePublicChat/CreateOneToOneChat/CreateProfileChat
- Creation of timeline/profile chat has been moved to status-go

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2021-05-21 07:44:21 +02:00
andrey 25d5672355
messages improvements 2021-03-12 12:07:15 +01:00
Andrea Maria Piana 2ca39daa59
Communities
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2020-12-23 17:23:11 +01:00
Roman Volosovskyi fac4f0c871
[#10798] Fix unviewed counter on receiving response 2020-11-11 15:04:17 +02:00
Volodymyr Kozieiev f99b2aa401
Link preview generation
Signed-off-by: Volodymyr Kozieiev <vkjr.sp@gmail.com>
2020-11-02 15:28:31 +02:00
Gheorghe Pinzaru 20b5ad9ebb
Always use waku
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2020-09-17 15:19:32 +02:00
Roman Volosovskyi 5aa33fc9c0
[mentions] Fix mention appearance in reply and quoted message 2020-09-10 12:51:34 +03:00
tbenr 86700f2b5c
audio messages
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2020-07-29 10:09:31 +02:00
Andrea Maria Piana 91bcd0c861
sending images over waku 2020-06-01 11:34:12 +02:00
Andrea Maria Piana 789271f179
[Fixes: #5124] Fix rtl flag
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2020-05-22 09:55:05 +02:00
yenda 1bf68094e3
add clj-kondo to linting phase
Signed-off-by: yenda <eric@status.im>
2020-05-07 10:40:30 +02:00
Andrea Maria Piana c2d129d04e
Fix mark as read for hidden messages
If a message is hidden and is not currently loaded, it will not be
marked as read, resulting in the count being always positive. To avoid this
we always mark it as read, and from the backend we return whether it has
been marked as read or was already seen.

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2020-04-07 13:27:06 +02:00
Andrea Maria Piana 619e176087
Set waku mode dynamically
This commit allows setting waku-mode and waku-bloom-filter-mode
dynamically.
It requires a relogin for the changes to take effect.

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2020-03-16 08:09:27 +01:00
Andrea Maria Piana 21ef5a68b8
Add mark all read
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2020-02-26 13:35:31 +01:00
Andrea Maria Piana a2af83f034
Add option to enable waku-mode
This commit adds an option to enable waku mode through ENV settings.

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2020-02-17 18:22:50 +01:00
Andrea Maria Piana 4734a4ee04
offload chat messages
This commit does a few things:

1) Messages are offloaded from any chat once we go back from the home.
This allows us to ignore any message that is coming in from a chat we
are not currently focused.
2) After 5 seconds of not-scrolling activity, any received message that
is not currently visible will be offloaded to the database.
3) Similarly received messages that are not visible will be offloaded to
the database directly

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2020-02-14 15:56:28 +01:00
yenda 84828891a0
Add chat commands
Signed-off-by: yenda <eric@status.im>
2020-01-10 20:13:19 +01:00
Andrea Maria Piana 78d694f52f
Move message processing to status-go and introduce protobuf
This commit moves all the processing of messages to status-go.

Messages are going arrive to status-react already saved an processed.

Receiving/sending/retrieving from db is now using the same identical
structure. The only processing left in status-react is to mark the
messages as seen and update the unviewed count locally (only
status-react knows whether the count should be updated).

Partially remove commands as well as won't be used anymore.

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2019-12-05 17:30:30 +01:00
Andrea Maria Piana 5fe385c225
Parse messages in status-go
This commit enables parsing of messages in status-go.
Currently only a few messages are supported in status-protocol-go.
For now we only enable Message types.
Status-react will conditionally use the parsed version if present.
Eventually this can be moved to a separate signal/different structure,
but for the time being is best to validate with the minimum amount of
changes.

The next step would be handle validation and processing of the field in
status-go, so we can skip saving the message from status-react.

This commit should improve performance of receiving messages from a
chat, although haven't had time to validate that.

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2019-11-06 19:30:47 +01:00
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
Andrea Maria Piana 9cd891365a
Use payload & avoid transforming in clojure objects.
This commit includes a few performance fixes:
1) Pass a string payload instead of an hex encoded string, to avoid
unecessary conversion
2) Don't js->clj on messages, as that's fairly expensive and we can get
away without
3) Don't use `pr-str` `read-string`, rather convert to json

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2019-10-23 15:52:32 +02:00
Andrea Maria Piana dcb7415208
Move messages to status-go
This commit does a few things:

1) Move messages to status-go
2) Use message-id computed from status-go
3) Remove old replies

Old message id was used for compatibility of replies with older clients.
Given that v1 is breaking, this is not needed anymore and simplifies
moving messages to status-go. No protocol/data-store change is made, to minimize
changes.

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2019-08-20 13:25:05 +02:00
yenda 04de022eae
[refactor] replace web3-prototype
- replace web3-prototype wherever possible
- currently only the money namespace is left
for future refactoring, the ideal solution
would be to use strings for big numbers all
the time and only convert for arithmetic operations
- use json-rpc call to replace trivial web3 calls

Signed-off-by: yenda <eric@status.im>
2019-06-06 15:57:34 +02:00
yenda 1ae42ea424
[perf] upgrade realm and improve schemas/queries
- upgrade to realm 2.28 to benefit from perf improvements
- remove user-statuses and replace by seen and outgoing-status fields
to get rid of a lot of bloat queries and computations
- remove unused seen message, bottom-infos
- remove unused fields in transport schema
- use objectForPrimaryKey whenever possible instead of get by field

Signed-off-by: yenda <eric@status.im>
2019-06-04 23:36:35 +02:00
yenda a1d6ead6d3
[perf] use objectForPrimaryKey instead of getByField
Signed-off-by: yenda <eric@status.im>
2019-06-03 16:36:51 +02:00
Roman Volosovskyi c7c7b50281
RAM bundle basic setup 2019-05-27 17:34:17 +03:00
yenda b80e02d8cf
[feature] add block user feature in user profile
- add block/unblock action to user profile
- blocking deletes all messages from user and ignores future messages
- unblocking stops ignoring new messages from user but doesn't recover past ones

[feature] add contact list

[tests] added scroll to BackupRecoveryPhraseButton

[tests] added scroll to public key

Signed-off-by: yenda <eric@status.im>
2019-02-05 16:29:56 +01:00
Andrea Maria Piana dfdbe1ccbc
Paginate using clock-value & message-id instead of skip/limit
Paginating using the count of loaded messages might result in some
messages being skipped and not being loaded in the database, in case of
out-of-order messages received.

This commit changes the behavior to sort by `clock-value` and
`message-id`, which gives a consistent sorting.

The initial idea was to use a cursor `clock-value-message-id` and
iterate on that, but realm does not support filtering on string (</>),
so instead we keep track of messages with identical clock-value and
exclude those in the next page query.

The change might result in pages that have duplicates (so messages needs
to be deduped), but won't result in skipped messages.
2018-12-24 18:12:50 +01:00
Roman Volosovskyi 8f48dc8df6
Safe deserialization of the last message's content
The issue was fixed in #7085 but reintroduced in #7055.
2018-12-24 18:09:59 +02:00
Roman Volosovskyi c440b7a3a7
[slow sign in] Denorlmalize last message
The last messages of the chats are necessary to properly show the chat
list, which is shown right after signing in. Before this commit, the
last message was retrieved as one of 20 last messages fetched for each
chat.

Implementation:
- `:last-message-content` and `:last-message-type` fields were added to
  `chat` entity
- both fields are updated when messages are received/sent
- loading of the last 20 messages for each chat was removed as
  initialization step
2018-12-17 13:29:10 +02:00
Andrea Maria Piana 54b9ba5a2e
Dont choke on wrongly serialized messages
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2018-12-14 16:59:34 +01:00
Roman Volosovskyi e7d0312d25
[#6903] fix replies compatibility
Issue was caused by https://github.com/status-im/status-react/pull/6722

Implementation:
1. `old-message-id` field (indexed) was introduced in `message` entity
   and is calculated as `message-id` was calculated in `0.9.31`
```clojure
(defn old-message-id
  [message]
  (sha3 (pr-str message)))
```
2. When a reply message is sent from the PR version of app both `response-to`
   and `response-to-v2` fields are sent as a part of `message`'s `content`
   field, so that it can be recognized by `0.9.31`.
3. When PR version of app receives reply from `0.9.31` we check whether
   message's `content` contains `response-to` but doesn't contain
   `response-to-v2`, and if so we check whether DB contains message with
   `old-message-id=response-to`. If such message has been found we assoc
   `response-to-v2` to content.
4. If message from DB contains only `response-to` but not `response-to-v2`
   attempt to fetch the message by `old-message-id` is done.
2018-12-05 07:22:40 +02:00
Roman Volosovskyi 5d5847e4b9
[slow sign in] Add unviewed messages counter to chat entity.
Before we fetched ALL user-statuses with `status=received` (which means that
a message hasn't been seen), iterated them, grouped by chat and then stored
`message-ids` of these `user-statuses` in chat's `:unviewed-messages` key.

This commit introduces :unviewed-messages-count field in chat entity.
That means that there is no need to iterate `user-statuses` in order to count
a total number of unviewed messages, it is always stored along with chat.
In the rest of it, the difference is only that chat's db record should be
updated each time when unviewed messages are seen.
2018-11-23 17:08:48 +02:00
Roman Volosovskyi d66198a420
[slow sign in]
fix iterating over all messages from realm db (was done for deduplication)
async loading of chats (:init-chats event)
2018-11-21 18:21:52 +02:00
Roman Volosovskyi 1dcc7727f1
[slow sign in] faster :get-referenced-messages 2018-11-21 10:50:45 +02:00
Roman Volosovskyi b792ab5cf3
[slow sign in] faster get-unviewed-messages 2018-11-21 08:04:33 +02:00
Eric Dvorsak f8f499d9b0
[refactor] rename whisper-id and whisper-identity to public-key 2018-11-09 11:16:27 +01:00
Andrea Maria Piana 7aa597517e
Add system messages to group chats
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2018-11-05 14:54:43 +01:00
janherich 76165cc7cb
[#6460] [#6438] Deduplication-ids 2018-10-24 09:43:52 +02:00
janherich 99d33ebbc9
Always load messages referenced in responses 2018-10-11 11:21:34 +02:00
janherich 44fbe62773
Chat replies + refactoring 2018-09-28 16:15:47 +02:00