Commit Graph

107 Commits

Author SHA1 Message Date
Igor Mandrigin e8de37f5ef
Report messages as "processed" to status-go only after they were successfully stored in the DB.
Signed-off-by: Igor Mandrigin <i@mandrigin.ru>
2019-01-14 19:12:26 +01:00
Roman Volosovskyi aceea457ce
[slow sign in] Chats preloading
10 last chats are loaded to `app-db` before showing `:home` screen, in
result a user will not see two consequent activity indicators. In this
case opening of `:home` screen is a bit slower but looks better from
UI/UX pov. As it is limited to 10 chats on initialization, the time
necessary for opening `:home` screen will not depend on a total number
of chats in `app-db` if an account contains 10+ chats.

Signed-off-by: Igor Mandrigin <i@mandrigin.ru>
2019-01-09 16:03:21 +01:00
Andrea Maria Piana b56fd2e29f
Show popup when device is not targeted.
When someone is sending a pfs message to us but did not include our own
device, a pop up is shown propmting the user to connect with the user.

The reason for receiving messages that are not targeting our devices are
various:

1) The account was just recovered (which means it is a new installation
id)
2) More than 3 devices are in use (we only keep max 3 devices in sync)
3) The sender has used an old bundle which does not include the current
device

Eventually we will reduce the likelihood of this scenario happening, but
we can't dismiss it completely.

It's only enabled when PFS is enabled.

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2019-01-09 09:36:36 +01:00
Andrea Maria Piana ad99ed2a28
Allow toggling pfs in dev-mode
This commits allow users to toggle pfs in dev-mode (it is already used
for pairing and group chats).

Once enabled direct and public messages sent will only be received by
users running >= 0.9.32.

Also this does not guarantee PFS (both devices need to have it enabled
it), and there still some UX work to do to ensure that, but it is useful
for testing.

A warning is displayed explaining the limitations when enabling.
2019-01-09 09:34:51 +01:00
Andrea Maria Piana 3e761c3b85
Extend message hash confirmation for group chats
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2019-01-08 13:59:30 +01:00
Andrea Maria Piana e8069f523d
Move group chats to their own topic
This commit moves group chats to their own topic, based on the randomly
generated chat-id. It falls back on the discovery topic for those peers
who we can't fingerprint the version, for backward compatibility.
2019-01-08 13:58:41 +01:00
Roman Volosovskyi e3cc50c7d7
[slow sign in] Adding symkeys and filters in batch
This commit changes the way how keys are restored:
1. batch of `ssh.addSymKey` requests for all sym keys is sent at once
2. `:status-im.transport.core/sym-keys-added` event is dispatched with
   results of all successful `ssh.addSymKey` calls
3. filter is created via `ssh.newMessageFilter`
4. `:shh.callback/filters-added` event is dispatched with all added
   filters as a parameter
5. profit

In ideal case only 2 `re-frame` events are dispatched.
2018-12-27 11:49:50 +02:00
Andrea Maria Piana 5f910a0bec
Sync public chats
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2018-12-24 14:35:17 +01:00
Roman Volosovskyi dd2ff11216
[#7139] Fix crash on logout
The crash was caused by RPC calls which happened after `StopNode` call.

Implementation:
- The first suggestion was to `StopNode` only after all `.stopWatching`
  calls are done, but this only lowered probability of the crash,
  but did not fix the issue.
- Another suggestion was to prevent RPC calls after `StopNode` call,
  but it also only lowered probability of the crash.
- So the last resort was a fix on `status-go` side
  https://github.com/status-im/status-go/pull/1329,
  and it actually worked.
- Advanced settings are hidden until `Statusgo.Login` is finished
2018-12-20 21:35:09 +02:00
Andrea Maria Piana 8be8f0b5c8
Adjust from value to accomodate for late-comers
Signed-off-by: Igor Mandrigin <i@mandrigin.ru>
2018-12-17 14:57:49 +01:00
Roman Volosovskyi 50a70f6e57
[#6956] store :raw-payload-hash in message (upgradable message-ids)
Currently, we calculate `message-id` as `sha3(from + raw_payload)`,
but we do not store `raw_payload` and it might be problematic
to restore it from DB because:
1) `content` field might be changed and so `Message` record
   will differ from the original one
2) it is even more problematic for `GroupMembershipUpdate`
   message because we don't save it in DB

In order to handle this, we can store `sha3(raw_payload)` as `raw-payload-hash`
prop of `message` entity and use it in case of emergency :)

`message-id` will be calculated as `sha3(from + sha3(raw_payload))`
2018-12-05 13:29:01 +02:00
Roman Volosovskyi b6e515618b
[#6956] upgradable `message-id`
Implementation:
1. `transport.utils/message-id` function is called only in three places now
   and accepts `from` and  `raw_payload` as parameters.
   ID is calculated as `sha3(from + raw_payload)`.
2. This means that for wrapped private group chat message
   the raw payload of `GroupMembershipUpdate` is used.
2018-12-05 11:22:43 +02: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
Andrea Maria Piana 08291a8396
Keep username/photo-path synced across devices
We add syncing of account fields in pairing messages (only photo-path &
name for now). Also a sync message is sent each time we send a
contact-update, to keep other devices in sync. The change is compatible
with previous clients as it's just an accretion of transit.

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2018-11-29 11:37:14 +01: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
Andrea Maria Piana 1104becfba
Enable syncing of contacts & style pairing section
Everytime a contact request is sent/confirmed a sync message is also
sent to other devices so the contact is kept in sync.

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2018-11-14 13:21:14 +01:00
Eric Dvorsak 548162f733
[refactor] remove current-public-key 2018-11-09 11:16:27 +01:00
Eric Dvorsak f8f499d9b0
[refactor] rename whisper-id and whisper-identity to public-key 2018-11-09 11:16:27 +01:00
yenda a3b2bc1b87
[fix #3913] do not logout when changing mailserver
- do not logout and remove previous mailserver
from peers when changing mailserver
- rename wnode mailserver
- move transport.inbox to mailserver.core
- fix all subs and db keys

Signed-off-by: yenda <eric@status.im>
2018-11-07 17:10:18 +01:00
Andrea Maria Piana 693eae9cf9
Send your own messages
Adds a `chat-id` field in `content` map.

The reason it has been added to the map instead of augmenting transit is
that it would simplify the calculation of `message-id`, which in this
case is consistent for both old & new clients.

`chat-id` also represents the `chat-id` with respect of the sender, as
in 1-to-1 chats that is asymmetric.

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2018-11-06 21:19:50 +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
Andrea Maria Piana 073dddcee0
Add pairing
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2018-10-27 20:43:53 +02:00
janherich 76165cc7cb
[#6460] [#6438] Deduplication-ids 2018-10-24 09:43:52 +02:00
yenda 6b1c6c7d0a
[fix 6410] error when fetching history on certain accounts
- 1-1 chats don't have a topic anymore because they only use the
discovery topic so topic is nil for these chat
- this was causing an error when initializing whisper because the app
was trying to start a filter for each of the chat including the 1-1 with
no topic
- we now filter the transport/chats to only recover sym-key and start filter
for those with a topic
2018-10-22 19:10:34 +02:00
Andrea Maria Piana 22c8999eca
Send seen with pubkey
Signed-off-by: yenda <eric@status.im>
2018-10-17 15:25:47 +02:00
Roman Volosovskyi 99162fa971
[#6307] fix each message sent before upgrade is shown twice after upgrade from 0.9.29 2018-10-17 15:00:14 +03:00
yenda 69fe9dc582
[fix 6334] request multiple topics at once
- group requests by last-request to request multiple topic at once
- fix bug where fetching popup was shown when the app was actually in error
state

Signed-off-by: yenda <eric@status.im>
2018-10-16 17:13:47 +02:00
Roman Volosovskyi 7bab525202
request only one day history from mailserver 2018-10-16 14:33:51 +03:00
yenda d09a2956c3
increase request timeout
- give more time for requests to complete
- change mailserver everytime a request time out

Signed-off-by: yenda <eric@status.im>
2018-10-16 01:16:48 +02:00
yenda 660bd2d1bd
request 7 days of history
- fetch 7 days of history when joining a chat
- make 7 24h requests to request 7 days because mailservers
ignores requests for a timespan > 24h
- make requests sequentially to avoid timeouts
- change mailserver after 3 timeouts on a request

Signed-off-by: yenda <eric@status.im>
2018-10-15 17:18:59 +02:00
yenda 1a2fcdfe3a
refactor contact models
- move models.contact and models.contacts to contact.core
- add tags field to contact and chat

Signed-off-by: yenda <eric@status.im>
2018-10-15 11:57:48 +02:00
yenda efdd76b364
refactor inbox
Signed-off-by: yenda <eric@status.im>
2018-10-11 14:47:04 +02:00
Andrea Maria Piana 84151ea996
Ignore messages with too high clock-value and prevent stored messages to pollute the database
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2018-10-09 14:34:29 +02:00
Andrea Maria Piana 78b6d67d79
Allow to edit group membership
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2018-10-09 10:40:13 +02:00
janherich 66ef32d3b9
Move all the legacy handling into transit 2018-10-08 21:00:59 +02:00
yenda 0caab1f7ce
Fixup command validation
Signed-off-by: yenda <eric@status.im>
2018-10-03 00:05:19 +02:00
yenda 81b2afebc1
validate incoming message
- add validate method to StatusMessage protocol
- spec all message types for use in validate method
- use valid method after transit/decode step to reject
invalid messages

Signed-off-by: yenda <eric@status.im>
2018-10-02 20:52:04 +02:00
janherich 12021554f3
Ensure version compatibility 2018-10-02 16:04:05 +02:00
yenda f6a50b2799
[fix 6051] log error during connexion and pass cofx
Signed-off-by: yenda <eric@status.im>
2018-10-02 14:11:05 +02:00
Andrea Maria Piana 165f1a46c7
Propagate signed membership information
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2018-10-02 12:06:28 +02:00
yenda c9e4a11487
[fix 6052] check empty filters
Signed-off-by: yenda <eric@status.im>
2018-10-01 13:12:34 +02:00
janherich 44fbe62773
Chat replies + refactoring 2018-09-28 16:15:47 +02:00
Andrea Maria Piana 0c48d09c71
Add back group chats messages
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2018-09-26 20:58:03 +02:00
yenda e9149786c5
remove usage of merge-effects macro and handlers-macro ns
Signed-off-by: yenda <eric@status.im>
2018-09-25 20:05:52 +02:00
yenda 4bd5d986b0
remove merge-fx macro
Signed-off-by: yenda <eric@status.im>
2018-09-25 15:18:44 +02:00
yenda d422a40fc6
fix event vector
Signed-off-by: yenda <eric@status.im>
2018-09-20 17:07:57 +02:00
yenda b71005d2fa
replace all register-event-db by fx and remove trim-v interceptor
Signed-off-by: yenda <eric@status.im>
2018-09-20 13:37:31 +02:00
Eric Dvorsak 8dc9af8917
refactoring of events into status-im.events
Signed-off-by: Eric Dvorsak <eric@dvorsak.fr>
2018-09-11 15:09:54 +02:00
Eric Dvorsak 80aa0e9286
[feature #5213] allow user to select fleet in settings
- get wnodes from resources/config/fleets.json which is taken from
fleets.status.im
- store wnodes by fleet and not by network since they are always the same
- reset wnodes settings during migration
- add option in developper menu to select fleet
- mailservers are now presented by their real name

Signed-off-by: Igor Mandrigin <i@mandrigin.ru>
2018-09-07 15:33:29 +02:00
Eric Dvorsak 02191f0380
[fix 5715] make generate-sym-key-from-password mergeable
Signed-off-by: Eric Dvorsak <eric@dvorsak.fr>
2018-09-03 19:05:53 +02:00