Commit Graph

13223 Commits

Author SHA1 Message Date
Benjamin Bouvier
b9628301ec timeline: beef up comment around TimelineEventContext::should_add_new_items 2024-09-02 13:45:12 +02:00
Benjamin Bouvier
b4683c0ff5 timeline: reinterpret LiveTimelineUpdatesAllowed as TimelineFocusKind
It makes the code simpler to understand, in my opinion.
2024-09-02 13:45:12 +02:00
Benjamin Bouvier
cb3c5ab1ce timeline: move the decision to add a timeline item upwards
Especially for remote items, it should be in sync with `should_add` as
it's used in this method, otherwise read receipt tracking will not work
correctly.
2024-09-02 13:45:12 +02:00
Benjamin Bouvier
8c5ffc9a96 timeline: don't clear the internal counter in presence of local echoes 2024-09-02 13:21:36 +02:00
Benjamin Bouvier
9ec46ddf2c timeline(tests): use the EventFactory in more tests 2024-09-02 13:21:36 +02:00
Benjamin Bouvier
bfb04f2ddd event factory: allow having unsigned data too
And use the event factory in more timeline tests.
2024-09-02 13:21:36 +02:00
Andy Balaam
eecd00cd98 indexeddb: Pass the db transaction into do_schema_upgrade closures
For some operations (notably: adding an index to an existing object store), we
need access to the database transation during the upgrade operation.
2024-09-02 11:22:43 +01:00
Benjamin Bouvier
b8d90286aa testing: enforce a test_ prefix for tests
This will only apply to `async_test` functions, but I think this is a
win:

1. for consistency within the codebase, since I've started doing so in
many places,
2. because these function names will clearly identify these functions as
tests, in the call tree interfaces, when rendered using the LSP
show-callers/show-callees functionality.
2024-09-02 12:02:43 +02:00
Kévin Commaille
424d01d964 Revert "doc(sdk): Update CHANGELOG.md."
This reverts commit 711a753533.
2024-09-02 11:32:04 +02:00
Kévin Commaille
84e4552da7 Revert "feat(sdk): Remove NotificationSettings::subscribe_to_changes."
This reverts commit 4e291205d5.
2024-09-02 11:32:04 +02:00
Benjamin Bouvier
c4624cc863 timeline: add local echo handling for *all* timelines
Including non-live timelines (pinned event timelines and permalinked
timelines). This makes it possible to see that you're adding a reaction
etc. in real time, while it wasn't the case anymore.

Fixes #3906.
2024-09-02 11:08:25 +02:00
Benjamin Bouvier
c3973589c8 timeline(test): add an integration test for non-live timelines not handling local echoes 2024-09-02 11:08:25 +02:00
Benjamin Bouvier
224292ab3e testing: remove EventBuilder::make_sync_reaction which is unused 2024-08-29 16:21:56 +02:00
Benjamin Bouvier
0311f30182 timeline: get rid of one use of sync_timeline_event 2024-08-29 16:21:56 +02:00
Benjamin Bouvier
0877445273 timeline: add assert_let_timeout for testing purposes 2024-08-29 16:21:56 +02:00
Richard van der Hoff
7f02447c78 indexeddb: remove InboundGroupSessionIndexedDbObject::new
We're going to add some more fields soon, so a `new` method is increasingly
unhelpful.

Replace it with a helper for the tests.
2024-08-29 11:11:07 +01:00
Richard van der Hoff
308d658224 indexeddb: add InboundGroupSessionIndexedDbObject::from_session
factor out the two copies of this code into a common function, and inline the
call to `new` while we're there
2024-08-29 11:11:07 +01:00
Richard van der Hoff
9808ad7d16 indexeddb: fix a typo in a comment 2024-08-29 11:11:07 +01:00
Benjamin Bouvier
06fc220268 ffi: use the send queue when sending an edit with Room::edit
This will make it possible to send updates to observers, update local
echoes, and so on, making it closer to the edit functions from the
timeline.
2024-08-29 09:34:31 +03:00
Benjamin Bouvier
f399f229ae send queue: remove outdated comment
The future is now, and has been for quite a while, in fact.
2024-08-29 09:34:31 +03:00
Kévin Commaille
a8b38d271e sqlite: Merge init and run_migrations for SqliteEventCacheStore
This was copied from SqliteStateStore, but the reason
that they are separated there is because some migrations
require the store cipher.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-08-29 09:31:40 +03:00
Kévin Commaille
66e901bb9b sqlite: Make migrations atomic
Setting the version number only when all migrations are done
means that the version will be wrong if a migration fails.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-08-29 09:31:40 +03:00
Benjamin Bouvier
9edca06d3b http client: don't infinitely retry network failures if there's no retry limit
Otherwise, this would mean that logged out clients would infinitely
repeat network requests failing in the background.

Without this fix, the added test will time out, endlessly reattempting
network requests.
2024-08-28 17:26:16 +02:00
Benjamin Bouvier
47444cc671 sdk-base: hack to avoid over-recursion when evaluating Send/Sync bounds in rustc
See
https://github.com/matrix-org/matrix-rust-sdk/pull/3749#issuecomment-2312939823
for the gory details.
2024-08-28 16:49:46 +02:00
Benjamin Bouvier
e1fe1ca129 timeline: add support for local reactions to local echoes 2024-08-28 16:49:46 +02:00
Benjamin Bouvier
6181387776 timeline: allow reactions in local|remote event timeline items 2024-08-28 16:49:46 +02:00
Benjamin Bouvier
81a75508dc send queue: early return if there are no dependent events to handle 2024-08-28 16:49:46 +02:00
Benjamin Bouvier
f6faf6267e send queue: add integration test for sending and aborting reactions 2024-08-28 16:49:46 +02:00
Benjamin Bouvier
25db0b2cc0 send queue: handle reactions in the send queue 2024-08-28 16:49:46 +02:00
Benjamin Bouvier
2d6aec7319 send queue: put a LocalEcho's event content into a new enum 2024-08-28 16:49:46 +02:00
Kévin Commaille
d17a49e827 sqlite: Add more methods to SqliteKeyValueStoreAsyncConnExt
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-08-28 15:45:12 +02:00
Kévin Commaille
1321e92b30 sqlite: Rename SqliteObjectStoreExt to SqliteKeyValueStoreAsyncConnExt
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-08-28 15:45:12 +02:00
Kévin Commaille
6e62f8b269 sqlite: Rename utils::ConnectionExt to SqliteKeyValueStoreConnExt
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-08-28 15:45:12 +02:00
Kévin Commaille
6e369aecc9 sqlite: Rename SqliteConn to SqliteAsyncConn and SqliteObjectExt to SqliteAsyncConnExt
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-08-28 15:45:12 +02:00
Richard van der Hoff
ece33059e1 indexeddb: Reinstate crypto store integration tests
We are no longer running the cryptostore integration tests for indexeddb
without encryption. I think this was accidentally removed in 96b615ba.
2024-08-28 11:49:22 +02:00
Benjamin Bouvier
468ee53644 sliding sync version(chore): address review comments 2024-08-27 17:25:12 +02:00
Ivan Enderlin
067b1e0020 feat(ffi): Add Client::available_sliding_sync_versions.
This patch adds bindings to `Client::available_sliding_sync_versions`
to `matrix-sdk-ffi`.

This patch also moves `Client::sliding_sync_version` from “private” to
“public” FFI API, in thee sense that this method is now exported with
UniFFI.
2024-08-27 17:25:12 +02:00
Ivan Enderlin
96c7f36d75 feat(sdk): Add Client::available_sliding_sync_versions.
Previous patches have unified all sliding sync versions behind a
single type: `Version`. More recent previous patches have introduced
`VersionBuilder` so that a `ClientBuilder` can use them to coerce or
find the best `Version` possible. This patch implements a last missing
piece: `Client::available_sliding_sync_versions` will report all
available `Version`s at a given time. This is useful when a `Client`
is already built, and a session has been opened/a user is logged,
but someone has to take the decision whether it's useful to switch to
another sliding sync version or not.
2024-08-27 17:25:12 +02:00
Ivan Enderlin
01f88f1c4b test: Disable Complement Crypto for a short period. 2024-08-27 17:25:12 +02:00
Ivan Enderlin
9e5b06902d test(sdk): Add 2 more tests for auto-discovery of sliding sync. 2024-08-27 17:25:12 +02:00
Ivan Enderlin
245f011fb6 test(sdk): Restore disabled tests. 2024-08-27 17:25:12 +02:00
Ivan Enderlin
e1f623cf56 feat: Use the new sliding_sync::VersionBuilder. 2024-08-27 17:25:12 +02:00
Ivan Enderlin
01fd365f67 feat(sdk): Add sliding_sync::VersionBuilder.
This patch adds a builder for `sliding_sync::Version`. It is a similar
enum except that it has `DiscoverProxy` and `DiscoverNative` to
automatically configure `Version::Proxy` or `Version::Native`.
2024-08-27 17:25:12 +02:00
Ivan Enderlin
875f59133b feat(sdk): ClientBuilder extracts get_supported_versions.
This patch changes the type of
`discover_homeserver_from_server_name_or_url`. It now returns a `Url`
instead of a `String` for the homeserver URL. It also returns an
`Option<get_supported_versions::Response>` in addition to the other
values.

The change from `String` to `Url` is necessary to avoid a
double-parsing. It was parsed in `build()` but previously in
`discover_homeserver_from_server_name_or_url` in the last branch.

The addition of `get_supported_versions::Response` is necessary for the
next patch. It's going to be helpful to auto-discover sliding sync in
Synapse. The change happens here because
`get_supported_versions::Response` is already received in
`discover_homeserver_from_server_name_or_url`. This patch makes it easy
to re-use it so that the request is sent only once.

This patch therefore changes `check_is_homeserver` a little bit to
become `get_supported_versions`, and inlines its previous call inside
`discover_homeserver_from_server_name_or_url`.
2024-08-27 17:25:12 +02:00
Ivan Enderlin
de8537f8b0 feat: Use sliding_sync::Version everywhere.
This patch replaces all the API using simplified sliding sync, or
sliding sync proxy, by a unified `sliding_sync::Version` type!

This patch disables auto-discovery for the moment. It will be re-enable
with the next patches.
2024-08-27 17:25:12 +02:00
Ivan Enderlin
d9ffe2867f feat(sdk): Add sliding_sync::Version. 2024-08-27 17:25:12 +02:00
Daniel Salinas
b908fa78b9 The length param from Truncate was not being exposed 2024-08-27 15:17:37 +02:00
Kévin Commaille
f568e8c4d3 sdk: Handle a clippy warning
On my version of clippy nightly, these lines triggered the
`filter_map_bool_then` lint.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-08-27 14:10:20 +03:00
Richard van der Hoff
8005515ec5 common: generate wasm bindings for ShieldStateCode on wasm architectures (#3888)
If we're building for the wasm architecture, jump through the hoops to
tell wasm_bindgen about `ShieldStateCode`. This solves the need to 
declare an identical copy of `ShieldStateCode` in the wasm bindings.
2024-08-27 11:02:37 +00:00
Hubert Chathi
758171931d refactor collect_session_recipients in advance of some behavioural changes (#3884)
This is part of https://github.com/matrix-org/matrix-rust-sdk/pull/3662,
pulled out to into a separate PR. Recent changes in `main` made it
pretty much impossible to merge this section of code from `main` into
that PR, and Rich wanted to see the refactoring bits separate from the
behavioural changes. So I've re-written the refactoring.

Pulls the `match` on `sharing_strategy` outside of the `for` loop, and
moves any code that is specific to one strategy into the appropriate
branch.
2024-08-27 11:59:38 +01:00