Commit Graph

13223 Commits

Author SHA1 Message Date
Benjamin Bouvier 122349ecec feat: allow specifying a protocol along a server name 2023-07-25 18:43:35 +02:00
Benjamin Bouvier 020d5aa292 fix: use a little state machine to handle the response
and that allows to make sure that all event handlers are correctly called for all
events contained in the response.
2023-07-25 17:36:43 +02:00
Benjamin Bouvier fb5c96e380 test: add test for previous feature 2023-07-25 17:36:43 +02:00
Benjamin Bouvier 8a809dba04 feat(sliding sync): only process encryption events (resp. room events) if configured as so 2023-07-25 17:36:43 +02:00
Benjamin Bouvier da7d1b092e chore(encryption sync): lower severity of update summary logging
The proxy server can (and does) redispatch unrelated lists/rooms from other sliding sync connections,
so the encryption sync would sometimes see room events. Apparently since this is not considered a bug
in the SS proxy, so we shouldn't spam error traces every time this happens.
2023-07-25 17:36:43 +02:00
Jonas Platte 04aac7bc13 ui: Redact replied-to event inside in_reply_to in timeline 2023-07-25 15:31:14 +02:00
Jonas Platte 004a4aa765 ui: Fix redactions for state events in the timeline 2023-07-25 15:31:14 +02:00
Jonas Platte 09fea85d92 ui: Replace Message by TimelineItemContent in RepliedToEvent 2023-07-25 15:31:14 +02:00
Jonas Platte d93f4ee4cc Fix clippy lint 2023-07-25 15:31:14 +02:00
Jonas Platte eb4dab138e ffi: Spawn tokio tasks for the remaining async fns
… as a workaround for cancellation being broken in UniFFI.
2023-07-25 14:34:31 +02:00
Damir Jelić 0a361eff5c Mark our public part of the user identity as verified if we import the private part (#2298)
Co-authored-by: Denis Kasak <dkasak@termina.org.uk>
2023-07-25 12:39:06 +02:00
Jonas Platte bf26a343da ffi: Spawn tokio tasks for async code that locks async mutexes
Since we seem to have a problem with futures being leaked in Kotlin,
which can otherwise lead to deadlocks.
2023-07-24 20:01:27 +02:00
Ivan Enderlin d60a65f82b chore: Make Clippy happy. 2023-07-24 16:59:46 +02:00
Ivan Enderlin d39cbd865b feat(ffi): RoomListEntriesListener::on_update takes a Vec<_> now.
Since `RoomList::entries` returns a batch stream, the listener
now receives a `Vec<VectorDiff<RoomListEntry>>` instead of a
`VectorDiff<RoomListEntry>`.
2023-07-24 16:53:26 +02:00
Ivan Enderlin 3bcd9680fd test(ui): Test the new batch stream on entries and filtered entries.
Only updated the macro is required here. Instead of calling
`StreamExt::now_or_never` on the `$stream`, we call `Iterator::next` on
`$entries` which is a `Vec<VectorDiff<_>>` now.
2023-07-24 16:53:26 +02:00
Ivan Enderlin 1678d0754d feat(ui): Batch the stream returned by RoomList::entries and RoomList::entries_filtered.
This patch uses a newly implemented `async-rx` crate, that provides
`StreamExt`. This trait provides new features on `Stream`, like
`StreamExt::batch_with` which allows to batch values generated by a
`Stream` into a `Vec<Stream::Item>`. The batch is drained based on
another `Stream`: every time a value is produced, it drains the batch
stream.

This feature is used in `RoomList::entries` and
`RoomList::entries_filtered` to batch `Stream<Item = VectorDiff<_>>`
into `Stream<Item = Vec<VectorDiff<_>>>`.

The “drainer” is a broadcast sender, which sends an (empty) value every
time the room list service state changes, so every time something
happens during a sync. Note that it even drains when the room list
service state jumps to `Error` or `Terminated`.
2023-07-24 16:53:26 +02:00
Ivan Enderlin ac950ac253 doc(sdk): Update documentation of RoomListEntry variants. 2023-07-24 15:12:30 +02:00
Ivan Enderlin 2e265ad9bd feat(ui): Look for Room in the ring buffer from the newest instead of the oldest
feat(ui): Look for `Room` in the ring buffer from the newest instead of the oldest
2023-07-24 15:03:53 +02:00
Jonas Platte 766be8142e ffi: Make fetch_members cancellable 2023-07-24 13:59:09 +02:00
Ivan Enderlin 5dbfa89c72 feat(ui): Look for Room in the ring buffer from the newest instead of the oldest.
In `RoomListService`, there is a cache over the `Room`s to avoid re-
computing them every time the user calls `RoomListService::room`. It
also allows async operations to have time to finish while the user
jumps back to the room list and so on.

When reading this cache, which is `matrix_sdk_common::RingBuffer`,
`RingBuffer::iter` is used with `Iter::find` to find if the
`Room` exists in the cache. The cache has a size of 128 (given by
`ROOM_OBJECT_CACHE_SIZE`), which is quite large.

`Iter::find` will iterate from the oldest to the newest room in the
cache, but realistically, I reckon we need to iterate from the newest
to the oldest room. Indeed, the app user is more likely to jump between
recently opened rooms more frequently, thus saving quite a lot of
iterations for usual cases.

One may argue than in practice, a user won't open 128 rooms anyway… :-p.
2023-07-24 09:34:36 +02:00
Jonas Platte d9f3a5476e ffi: Simplify regular (non-OTLP) tracing initialization 2023-07-21 13:59:40 +02:00
Jonas Platte 0e3cca09dd ffi: Remove duplicate dependency 2023-07-21 13:59:40 +02:00
Jonas Platte 230cacaf18 ui: Add more tracing for room update handling 2023-07-21 11:06:31 +02:00
Jonas Platte 5b639903bb ui: Add more tracing for updating sender profiles 2023-07-21 11:06:31 +02:00
Jonas Platte abab1a32aa ui: Fix a typo 2023-07-21 11:06:31 +02:00
Jonas Platte 7e1f8f4923 base: Add tracing for getting a room member 2023-07-21 11:06:31 +02:00
Jonas Platte 236f6fff88 Make example dependencies less confusing 2023-07-20 13:28:14 +02:00
Jonas Platte 80fb8ff283 ffi: Don't keep timeline locked while back-paginating 2023-07-20 12:08:41 +02:00
Richard van der Hoff c6dab4088e Rename "Recovery Key" to "Backup decryption key" (#2305)
... because there are too many "recovery keys"
2023-07-20 09:49:54 +01:00
Damir Jelić 24e3ccfbb3 Add stronger typing to the return value of receive_sync_changes in the bindings (#2297) matrix-sdk-crypto-ffi-0.3.11 2023-07-19 12:43:41 +00:00
Damir Jelić 9f69c32467 Broadcast valid secrets we receive over m.secret.send
Co-authored-by: Jonas Platte <jplatte@matrix.org>
2023-07-19 14:27:18 +02:00
Damir Jelić 6ea0d886f7 Introduce a secret inbox
Up until now, users had to listen for to-device events to check for
secrets that were received as an `m.secret.send` event.

This has a bunch of shortcomings:
    1. Once the has been given to the consumer, it's gone and can't be
       retrieved anymore. Secrets may get lost if an app restart happens
       before the consumer decides what to do with it.
    2. The consumer can't be sure if the event was received in a
       secure manner.

This commit ads a inbox for our received secrets where we will long-term
store all secrets we receive until the user decides to delete them.

It's deemed fine to store all secrets, since we only accept secrets we
have requested and if they have been received from a verified device of
ours.
2023-07-19 14:27:18 +02:00
Jonas Platte 689d022b7a ui: Group timeline reaction metadata into a new struct 2023-07-19 14:01:32 +02:00
Jonas Platte 340e0b7a03 ci: Use taiki-e/install-action to install protoc 2023-07-19 10:11:21 +02:00
Jonas Platte 38a2885c10 Bump eyeball-im, enable its tracing feature 2023-07-18 16:40:47 +02:00
Jonas Platte aaa84c1489 Ensure valid room state before sending requests from Room methods 2023-07-18 15:12:03 +02:00
Jonas Platte 293cd08634 Clean up double spaces in docs 2023-07-18 15:12:03 +02:00
Jonas Platte e3ba1f1cb8 Add room API changes to changelog 2023-07-18 15:12:03 +02:00
Jonas Platte f3da79e482 Split unreleased section of changelog into sub-sections 2023-07-18 15:12:03 +02:00
Jonas Platte 92df7b22ec Rename room::Common to Room
… and export it at the matrix_sdk crate root.
2023-07-18 15:12:03 +02:00
Jonas Platte db84fcd8da Merge matrix_sdk::room::common into its parent module 2023-07-18 15:12:03 +02:00
Jonas Platte 67ef9c3fa0 Remove Room enum 2023-07-18 15:12:03 +02:00
Jonas Platte 85f66b1f96 Remove room::Joined 2023-07-18 15:12:03 +02:00
Jonas Platte fbea71aaf5 Move room::Join methods to room::Common 2023-07-18 15:12:03 +02:00
Jonas Platte 3602807641 Remove invalid reference in docs 2023-07-18 15:12:03 +02:00
Jonas Platte 6ad8086905 Move get_messages related types into a new room submodule 2023-07-18 15:12:03 +02:00
Jonas Platte 0408bd5a98 Remove room::Left 2023-07-18 15:12:03 +02:00
Jonas Platte ef00ef4158 Remove room::Joined::leave
… since room::Common::leave is now public and Joined deref's to Common.
2023-07-18 15:12:03 +02:00
Jonas Platte 9c8ed429b9 Move room::Left::forget to room::Common 2023-07-18 15:12:03 +02:00
Jonas Platte 05a817305e Remove room::Invited 2023-07-18 15:12:03 +02:00