Commit Graph

9267 Commits

Author SHA1 Message Date
Benjamin Bouvier
d6300bbda7 http_client: log each attempt at sending a request, instead of a single one
When a request fails because of the exponential backoff, it won't be
re-logged again. It would be useful, for the purposes of the send queue
notably, to see when a request is re-attempted.
2024-07-04 18:32:44 +02:00
Benjamin Bouvier
b80c2f7197 timeline: use the previous content's membership info when it's missing from the current membership event
Synapse returns a bare `{ "membership": "leave" }` as the content of a
room membership event (for leave membership changes and likely others).
In this case, it'd still be nice to have some kind of display
name/avatar URL to show in UIs; it's possible to reuse information from
the previous member event, if available.
2024-07-04 17:09:34 +02:00
Jorge Martín
07b6425e10 ffi: Timeline::load_reply_details checks if the event exists locally
Before it would go fetch the event from the server using a network request.
2024-07-04 16:13:35 +02:00
Benjamin Kampmann
d49cb54b67 Allow to limit the number of concurrent requests made by the sdk (#3625)
Add a new `max_concurrent_requests` parameter in the `RequestConfig` limits the number of http(s) requests the internal sdk client issues concurrently (if > 0). The default behavior is the same as before: there is no limit on concurrent requests issued.

This is especially useful for resource constrained platforms (e.g. mobile platforms), and if your pattern might lead to issuing many requests at the same time (like downloading and caching all avatars at startup).

- [x] Public API changes documented in changelogs (optional)

Signed-off-by: Benjamin Kampmann <ben.kampmann@gmail.com>
2024-07-04 16:01:15 +02:00
Ivan Enderlin
aaccfdfea5 Merge pull request #3655 from matrix-org/jme/remove-is-encrypted-from-room-info
ffi: remove `is_encrypted` field from `RoomInfo`
2024-07-04 14:21:46 +02:00
Jorge Martín
ad4d24f7d0 ffi: remove is_encrypted field from RoomInfo
It turns out this will cause a network request if the encryption info hasn't been loaded before, which is the case for opening a client in offline mode. It will slow down displaying the room list or loading the room info in general.
2024-07-04 13:52:27 +02:00
Ivan Enderlin
66743f5e57 Merge pull request #3654 from Hywan/fix-complement-crypto
test(crypto): Restore Complement crypto since it's been updated
2024-07-04 13:34:59 +02:00
Andy Balaam
03d4a30eb4 crypto: Move device_keys to DecryptedOlmV1Event as per MSC4147 2024-07-04 11:22:38 +01:00
Ivan Enderlin
a82a1f505e test(crypto): Restore Complement crypto since it's been updated.
This patch restores Complement crypto since it's been updated to the
latest version of the Rust SDK.
2024-07-04 12:00:12 +02:00
Ivan Enderlin
9aa277405d Merge pull request #3653 from matrix-org/jme/verify-android-bindings-build-fine
ci: Verify Android bindings build fine
2024-07-04 10:02:06 +02:00
Jorge Martín
3be5311113 ci: Verify Android bindings build fine 2024-07-04 09:40:26 +02:00
Ivan Enderlin
a957e70698 Merge pull request #3646 from Hywan/feat-ui-room-list-roominfo-update
feat(ui): Trigger room list update only when necessary
2024-07-03 21:16:06 +02:00
Ivan Enderlin
77feed2447 test: Fix flakyness. 2024-07-03 20:56:23 +02:00
Benjamin Bouvier
6679caecf9 ffi: add doc comments to TracingFileConfiguration and TracingConfiguration 2024-07-03 19:14:44 +02:00
Valere
d8b2b74a2d feat(sdk-crypto): Add Identity based room key sharing strategy (#3607)
This sharing strategy is defined as part of MSC4153[1].

[1]: https://github.com/matrix-org/matrix-spec-proposals/pull/4153
2024-07-03 16:18:10 +02:00
Ivan Enderlin
76caf7ed05 feat(ui): Trigger room list update only when necessary.
This patch revisits the need to trigger a room list update for
all changes of `RoomInfo`. For the moment, it reduces the scope to
`recency_timestamp` update.

This patch comes with a test to ensure things work as expected.
2024-07-03 16:07:27 +02:00
Benjamin Bouvier
cdc3743888 timeline: when aborting fails on a local echo, retry on the matching remote echo 2024-07-03 16:03:13 +02:00
Benjamin Bouvier
9b97a2ed26 timeline: when an edit fails on a stale local echo, retry on the matching remote echo 2024-07-03 16:03:13 +02:00
Benjamin Bouvier
aff07c13fc timeline: add integration test showing the issue with editing or aborting with a stale local echo 2024-07-03 16:03:13 +02:00
Benjamin Bouvier
9260942c5d integration testing: rename reactions.rs to timeline.rs 2024-07-03 16:03:13 +02:00
Richard van der Hoff
c4413c6ac3 Merge pull request #3645 from matrix-org/rav/indexeddb_storage_efficiency
Indexeddb: more efficient serialization format
2024-07-03 14:37:05 +01:00
Richard van der Hoff
4d12a78341 indexeddb: remove redundant ? operators
Now that `deserialize_value` returns an `IndexeddbCryptoStoreError`, we don't
need these any more.
2024-07-03 14:10:57 +01:00
Richard van der Hoff
a6dce1c0d7 Merge remote-tracking branch 'origin/main' into rav/indexeddb_storage_efficiency 2024-07-03 14:10:56 +01:00
Richard van der Hoff
09d53a52ad indexeddb: changelog 2024-07-03 14:10:35 +01:00
Richard van der Hoff
6d46e35d50 indexeddb: Make serialize_value a wrapper for maybe_encrypt_value
... and make `deserialize_value` handle both the old and new formats.

`maybe_encrypt_value` uses a much more efficient representation, so let's
migrate to that.
2024-07-03 14:10:29 +01:00
Richard van der Hoff
87653da2e3 indexeddb: Inline a call to IndexeddbSerializer::serialize_value
I'm going to change the behaviour of `serialize_value`, and we want to preserve
the behaviour of this test.
2024-07-03 14:10:29 +01:00
Richard van der Hoff
a38eaf08be indexeddb: Add some tests for IndexeddbSerializer 2024-07-03 14:10:16 +01:00
Richard van der Hoff
786015f18c indexeddb: Make maybe_en/decrypt_value generic 2024-07-03 14:10:10 +01:00
Richard van der Hoff
d60ec55e30 Crypto store: clear db before integ tests (#3644)
It's currently possible for integ test results to leak from one test run to the
next (for example, the indexeddb stores hang around in the browser), causing
bad test results.

Extend the test setup routine to clear out the store before the test starts.
2024-07-03 13:39:54 +01:00
Ivan Enderlin
99e284d8b0 Merge pull request #3585 from Hywan/feat-roomlist-sorting-2
feat(ui): Client-side sorting in `RoomList`
2024-07-03 13:07:00 +02:00
Ivan Enderlin
3588b88303 chore(base): Remove LatestEvent::cached_event_origin_ts.
This patch removes the `LatestEvent::cached_event_origin_ts`.
It's no longer necessary to cache this value as the
`matrix_sdk_ui::room_list_service::sorter::recency` sorter no longer
uses it.
2024-07-03 12:23:11 +02:00
Ivan Enderlin
b4bbb10ba5 feat(ui): The recency sorter now uses recency_timestamp.
This patch changes the `recency` sorter to use `Room::recency_timestamp`
instead of `LatestEvent::event_origin_server_ts` to sort rooms.
2024-07-03 12:23:11 +02:00
Ivan Enderlin
9a02d6877f feat(base): Store the timestamp from SS in RoomInfo::recency_timestamp.
This patch adds a new field in `RoomInfo`: `recency_timestamp:
Option<MilliSecondsSinceUnixEpoch>>`. Its value comes from a Sliding
Sync Room response, that's why all this API is behind `cfg(feature =
"experimental-sliding-sync")`.
2024-07-03 12:06:08 +02:00
Benjamin Bouvier
10fd5d0ff6 sdk: don't clobber the DM list if we failed to deserialize the previous m.direct event
Report a deserialization failure and do not mark the room as a DM,
instead of incorrectly restarting from an empty DM list.

Fixes #3410.
matrix-sdk-ffi/20240704
2024-07-03 12:00:54 +02:00
Benjamin Bouvier
2be846669e multiverse: add Events view
This allows seeing the events directly from the room event cache. I'm
hoping this will give us some interesting insights about duplicates,
among other things.
2024-07-03 11:30:52 +02:00
Benjamin Bouvier
02b095491d integration tests: simplify maintaining temp directories alive 2024-07-03 11:30:42 +02:00
Benjamin Bouvier
68670baa30 integration test: common out the first bits of ClientBuilder creation in TestClientBuilder
DRY.
2024-07-03 11:30:42 +02:00
Benjamin Bouvier
664c71b822 integration tests: make randomize_username() the default
Most tests would randomize the username when creating a
`TestClientBuilder`; make it the default, since it's a sensible choice,
and avoids interference between different tests / test runs.

A single test required an actual non-randomized username, so a specific
way to opt out from this new default behavior has been introduced.
2024-07-03 11:30:42 +02:00
Richard van der Hoff
5d716f969d Stores: Remove StoreCipher::{en,de}crypt_value_[base64_]typed (#3638)
* Use `IndexeddbSerializer` more widely in test code

reuse `IndexeddbSerializer::maybe_encrypt_value` instead of re-inventing it.

* Rewrite `StoreCipher::decrypt_value_base64_typed`

Instead of un-base64-ing and calling `decrypt_value_typed` (which deserializes
the result`), call `decrypt_value_base64_data` (which un-base64s before
decrypting but does not deserialize the result), then deserialize.

This makes it more symmetrical with `encrypt_value_base64_typed`, and helps me
get rid of `decrypt_value_typed` (which is barely used.)

* Fix docs on `StoreCipher::encrypt_value_base64_typed`

looks like they got C&Ped from `encrypt_value_typed`.

* Inline `StoreCipher::{encrypt,decrypt}_value_typed`

Each of these are quite simple, are only used in two places, and their
existence melts my brain.

* Rewrite `IndexeddbSerializer::maybe_{encrypt,decrypt}_value`

... to use `en/decrypt_value_base64_data` instead of
`en/decrypt_value_base64_typed`.

We have to have the de/serialization code for the unencrypted case anyway, so
using the higher-level method isn't helping us much.

* Remove unused `StoreCipher::{en,de}crypt_value_base64_typed`

Outside of tests, these things are totally unused.
2024-07-03 09:42:45 +01:00
Ivan Enderlin
765b95468a !fixup Remove useless comment. 2024-07-03 09:54:13 +02:00
Ivan Enderlin
813ce6a14d test(ui): Assert the roominfo updates. 2024-07-03 09:54:12 +02:00
Ivan Enderlin
5d68f89372 chore(ui): Remove the RoomListService::rooms cache.
This patch removes the `RoomListService::rooms` cache, since now a
`Room` is pretty cheap to build.

This cache was also used to keep the `Timeline` alive, but it's now
recommended that the consumer of the `Room` keeps its own clone of the
`Timeline` somewhere. We may introduce a cache inside `RoomListService`
for the `Timeline` later.
2024-07-03 09:54:12 +02:00
Ivan Enderlin
b525002828 fix(ui): merge_stream_and_receiver gives priority to raw_stream.
This patch rewrites `merge_stream_and_receiver` to switch the order
of `roominfo_update_recv` and `raw_stream`. The idea is to give the
priority to `raw_stream` since it will necessarily trigger the room
items recomputation.

This patch also remove the `for` loop with `Iterator::enumerate`, to
simply use `Iterator::position`: it's more compact and it removes a
`break` (it makes the code simpler to understand).

Finally, this patch renames `merged_stream` into `merged_streams`.
2024-07-03 09:54:12 +02:00
Ivan Enderlin
ab190ad29c test: Disable Complement.
Complement uses the FFI `RoomList` API. Since the patch set modifies
this API, Complement is broken. We disable it and will re-enable it once
we have updated Complement.
2024-07-03 09:20:25 +02:00
Ivan Enderlin
76477281c2 chore(labs): multiverse uses RoomList::entries_with_dynamic_controllers. 2024-07-03 09:20:25 +02:00
Ivan Enderlin
2c25103226 chore(labs): Update multiverse to the latest RoomList version. 2024-07-03 09:20:24 +02:00
Ivan Enderlin
606a1510cf feat(ffi) Update RoomList API to the recent changes.
This patch adapts the `RoomList` FFI API to the recent changes to
suport a `Stream<Item = RoomListItem>` instead of a `Stream<Item =
RoomListEntry>`. Behind the scene, it supports client side sorting for
the rooms but this is transparent for this API.

This patch also removes the `RoomListInput` enum as no input is
supporter anymore.

The `entries` method no long returns a `RoomListEntriesResult` but
directly a `TaskHandle`. The given listener will receive the initial
entries as a `VectorDiff::Append`, which first is simpler but also fixe
a potential race condition bug.
2024-07-03 09:20:07 +02:00
Ivan Enderlin
ed086afe83 test(ui): Update tests of the RoomList with sorters.
This patch mostly tests that sorting the rooms in the room list by
recency and by name works as expected.
2024-07-03 09:20:07 +02:00
Ivan Enderlin
51ca5a7113 feat(ui) Rename RoomList' sorter or to lexicographic.
This patch renames the `or` sorter to `lexicographic` as it describes
better what it does.
2024-07-03 09:20:07 +02:00
Ivan Enderlin
ff4af894e4 feat(ui): The RoomList uses sorters!
This patch “installs” the sorters API for the `RoomList`.
2024-07-03 09:19:27 +02:00