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.
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>
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.
Go blocks parse try catch blocks and turn them into event
dispatches. This captures the original intent of the code to catch
errors and terminate the current async worker execution.
Signed-off-by: yenda <eric@status.im>
functions defined in subs need to be reusable and testable independently
from re-frame framework. they are moved into db namespace for that purpose
Signed-off-by: yenda <eric@status.im>
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>
- 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>
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>
- chat name is not updated with contact name
- when a contact adds the user and is added back by user, the name
of the chat is still the random name of the contact
- in active-chats subscriptions, replace the name of the chat by the current
name of the contact
- 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
- 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>
- move db and models ns to browser module
- remove browser navigation/preload-data
- rewrite dapp-permission logic and move code to permissions ns
- rewrite all browser events according to guidelines and move them to
`status-im.events` ns
- rewrite tests for browser and permissions
- 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>
reorganize config flags
remove offline-inbox-enabled? flag
remove universal-links-enabled flag
remove add-custom-mailservers-enabled? flag
remove spam-button-detection-enabled? flag
remove flags from config files
Signed-off-by: Eric Dvorsak <eric@dvorsak.fr>
simplified flow:
- event `:ui/login` is dispatched
- node is initialized with user config or default config
- `node.started` signal is received, applying `:login` fx
- `:callback/login` event is dispatched, account is changed
in datastore, web-data is cleared
- `:init/initialize-account` event is dispatched
replace event dispatches by function composition
fix bug in universal links where url to be processed after login
was never removed
Signed-off-by: Eric Dvorsak <eric@dvorsak.fr>
- fix contact code validation for universal links
- go to profile when following universal link pointing to
user own contact code
- fix contact code validation for add contact field
spec for validating public-key has been changed to a
regexp that only accept valid normalized public-key
Signed-off-by: Eric Dvorsak <eric@dvorsak.fr>
* Set custom sound
* Tap on notification opens chat
* Show message notifications when app in foreground
Signed-off-by: Dmitry Novotochinov <dmitry.novot@gmail.com>
Fetch transactions state from etherscan every 15 seconds
if there are any unconfirmed transactions
Signed-off-by: Dmitry Novotochinov <dmitry.novot@gmail.com>
When creating a new account / recovery we don't poll the mailserver anymore for historic messages, which solves the immediate issue of fetching only received messages
Handle messages sent from a different device in public chat / restore history. The message will be added, shown correctly as sent by the user, and the status will be set as sent ( need to check for seen race condition, as messages will now be added twice). This means that multidevice should now work for public chats.
Move contact updates to discovery topic. This is necessary as there is a pre-existing bug whereby contact updates would not work anymore after wallet recovery, as the code relies on the initial contact request being stored on the mailserver, which we cannot guarantee (we only pull 7 days of data). Not pulling history anymore exacerbate the problems but does not introduce it.
To make sure that contact updates will work after wallet recovery, we also need to consider a ContactUpdate in the same way we consider a ContactRequest (the other peer has no idea that the user has recovered the wallet). This does not change any behaviour in terms of obscurity/security as ContactRequest are automatically processed (in both case the contact will be set as pending?, not as accepted)
At this stage ContactRequest, ContactRequestConfirmed, ContactUpdate have all the same logic, i.e. update the contact information, leave the pending flag alone.
Only 1 day of history is fetched for newly joined chats, if catching up 7 days is the cap as before.
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
This handles a bug whereby we'd run receive-whisper-messages
when the user is logged out.
I could not replicate locally, but a few issues are apparent from
just inspecting the code:
1) there are some race-conditions on logout as we don't wait for all
the filters to be removed. Changing this behaviour is non trivial and
not sure if we can actually handle this completely
(status-go-has-a-message->remove-filter->logout->status-go-deliver-message).
2) no error handling is made in receive-whisper-messages.
This PR defensively handles both cases.
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>