Commit Graph

8277 Commits

Author SHA1 Message Date
Ivan Enderlin
814d78708e feat(sdk): EventCache uses matrix_sdk_common::executor::spawn.
This patch imports the `spawn` function from
`matrix_sdk_common::executor` instead of `tokio`.
`matrix_sdk_common::executor` adds support for WebAssembly.
2024-02-19 16:40:11 +01:00
Ivan Enderlin
88d7a2fe28 feat(ui,ffi): Add the favourite room list filter
feat(ui,ffi): Add the `favourite` room list filter
2024-02-19 13:45:37 +01:00
Benjamin Bouvier
5386e9e838 event cache: have a single EventCache instance per Client, at most (#3136)
* event cache: move it to the main SDK crate

* event cache: add requested Debug impl to `RoomEventCacheUpdate`

Somehow the compiler asked for it now...

* event cache: add missing copyright notice to store file

* event cache: use a weak reference to the client internally

This will make it possible to have the `Client` own an `EventCache` without a reference
cycle.

* event cache: move the spawned task to its own function

* event cache: move RwLock from EventCache::inner to the only mutable field inside EventCacheInner

* event cache: have the Client own *the* event cache

The goal is to have a unique EventCache instance overall, that's available from everywhere in
the SDK, notably when creating timelines for rooms.

Because the event cache only owns a weak reference to the client, it means the Client still
can be dropped, In turn, this will close its sender of `RoomUpdates`, which will gracefully
close the task spawned in `EventCache::new` after it's done handling the latest updates.

* event cache: process room updates one at a time

* timeline: use the client-wide event cache instead of spawning one per timeline

This now means that we're passing the "initial events" to the event cache just before initializing
the timeline. As a result, there might be previous events that the event cache saw (coming from
sync), but now we can't decide where to put them; drop previously known events in that case.

* event cache: hey, turns out we don't even need the weak back-link

Keeping it as a separate commit, to make it easier to revert later.

* event cache: remove unused errors

Keeping the error type and results, though, because we might have store errors soonish.

* fixup! event cache: move the spawned task to its own function

* event cache: manually subscribe to the event cache

It was a bad idea to have it enabled by default, since some users may not be interested in all
updates for all rooms (e.g. bots). Instead, we make it so that the event cache must be
explicitly subscribed to, and we do it in two cases:

- in the UI `TimelineBuilder::build` method, because we're interested in updates to the current
  room,
- in the `RoomListService`, because we *will* be interested in updates to room derived data (e.g.
  unread counts, read receipts, and so on).

This avoids a bit of fiddling when creating the event cache in the client.

This is resilient when a parent Client is forked into a child Client, because the child
`EventCache` share the same subscription as the parent's.
2024-02-19 12:39:31 +00:00
Ivan Enderlin
9e6252cb2d doc(ui): Add missing copyright headers. 2024-02-19 13:33:11 +01:00
Ivan Enderlin
12d5f51051 feat(ffi): Add the favourite room list filter.
This patch implements the `RoomListEntriesDynamicFilterKind::Favourite`
variant.
2024-02-19 13:29:56 +01:00
Ivan Enderlin
c7d34bd65e doc(ui): Add documentation for matrix_sdk_ui::room_list_service::filters.
This patch adds missing documentation for the `filters` module.
2024-02-19 13:29:56 +01:00
Ivan Enderlin
900a6d1382 feat(ui): Add the favourite filter.
This patch adds the `favourite` filter, to filter out rooms that are not
marked as favourite.
2024-02-19 13:29:56 +01:00
Doug
9228ad2f59 chore: Update changelog 2024-02-16 14:57:12 +01:00
Doug
7d9ee71245 More rusty 🦀 2024-02-16 14:57:12 +01:00
Doug
c1c8bfda4e Fix: Feature flags on CI 2024-02-16 14:57:12 +01:00
Doug
1fb717968e fix: Store the details and the error separately. 2024-02-16 14:57:12 +01:00
Doug
e69591dad3 fix: Address PR comments. 2024-02-16 14:57:12 +01:00
Doug
ee8e9ef528 sdk: Add tests for server_name_or_homeserver_url 2024-02-16 14:57:12 +01:00
Doug
7cbc3e587d sdk: Add server_name_or_homeserver_url to ClientBuilder 2024-02-16 14:57:12 +01:00
maan2003
aeba46a0eb indexeddb: fix incorrect key used for next batch token
Signed-off-by: maan2003 <manmeetmann2003@gmail.com>
2024-02-16 14:45:21 +01:00
Benjamin Bouvier
11074d8f4d event cache: listen to all the room updates at once! 2024-02-15 18:22:11 +01:00
Benjamin Bouvier
a6c133369f sdk: add a mechanism to get all room updates at once
(instead of having to subscribe to a single room in the event cache)
2024-02-15 18:22:11 +01:00
Benjamin Bouvier
6a81ceced0 event cache: move store trait and memory impl to a new store file 2024-02-15 18:22:11 +01:00
Benjamin Bouvier
ffc7648ce6 ui: rename "event graph" to "event cache" 2024-02-15 18:22:11 +01:00
Benjamin Bouvier
fd395a82c5 sdk: add docs for the DeduplicatingHandler data structure 2024-02-15 18:10:34 +01:00
Benjamin Bouvier
15afd1f690 sdk: deduplicate requests to send a read receipt 2024-02-15 18:10:34 +01:00
Benjamin Bouvier
1e24fbc72d rrrepl: use Timeline::mark_as_read there too 2024-02-15 18:09:57 +01:00
Damir Jelić
32afc56005 ffi: Expose the method to add additional certs in the bindings 2024-02-15 16:19:20 +01:00
Damir Jelić
7e61a6dd31 sdk: Re-expose the reqwest method to add certs through the ClientBuilder 2024-02-15 16:19:20 +01:00
Doug
cae3b38c35 ffi: Expose the suggested role constructor. 2024-02-15 11:31:36 +01:00
Doug
c36cb1b424 ffi: Include users in the RoomPowerLevels state 2024-02-15 11:31:36 +01:00
Damir Jelić
315a29f568 Reneable the correct backup download strategy for the bindings 2024-02-15 09:19:14 +01:00
ganfra
74931768e5 ffi : expose room_info is_favourite 2024-02-13 16:47:26 +01:00
Benjamin Bouvier
7eb3c30a3c timeline: remove the thread parameter from mark_as_read
It doesn't make sense to set a thread identifier for the receipt of the latest event: the event might not belong to that thread, and the SDK would need to check that,
since the latest event isn't reachable from the outside world (the reason why `mark_as_read` had been introduced). So let's remove it for now, and
add comments related to threaded receipts.
2024-02-13 16:03:49 +01:00
Benjamin Bouvier
7e99e812dd ffi/sdk: rename mark_read into set_unread_flag
This slightly changes the API when interacting from the FFI layer:

- instead of `mark_as_unread` and `mark_as_read`, there's now a single method `set_unread_flag(bool)`, which callers may call with true (i.e. unread) or false (i.e. not unread).
- there's a new method `mark_as_read` which sends a read receipt to the latest event in the timeline, using other commits from the same PR,
- forcing a room as read requires calling first `set_unread_flag(false)` then `mark_as_read()`
2024-02-13 16:03:49 +01:00
Benjamin Bouvier
e97b7838c5 ffi: use the Timeline::mark_as_read function in mark_as_read_and_send_read_receipt 2024-02-13 16:03:49 +01:00
Benjamin Bouvier
8eb3fdc9e4 timeline: add a test that sending a reaction to the latest timeline event item isn't the same as marking as read 2024-02-13 16:03:49 +01:00
Benjamin Bouvier
8536e2b2a3 timeline: add a mark_as_read function to send a read receipt for the actual latest event 2024-02-13 16:03:49 +01:00
Benjamin Bouvier
060eaeffc0 key backup: test that the upload moves from the error state back to the idle state immediately 2024-02-12 19:38:03 +01:00
Benjamin Bouvier
b177bd9783 sdk: put all the e2ee-related Client fields under a new EncryptionData struct 2024-02-12 19:38:03 +01:00
Benjamin Bouvier
6fa487fad8 sdk: comment each sub-field of ClientInner
and make the code breath a bit more
2024-02-12 19:38:03 +01:00
Denis Kasak
12444d3dc1 docs: Clarify some doc comments. 2024-02-12 17:32:37 +01:00
Denis Kasak
ed5d97e052 docs: Fix doc comment for Account::signed_one_time_keys.
It talks about generating OTKs, but that is no longer true since
1c6d85935.
2024-02-12 17:32:37 +01:00
kegsay
cff844ac74 Add debug logging when sessions get rotated (#3106)
Critically, explain why the session is being rotated.

Signed-off-by: kegsay <7190048+kegsay@users.noreply.github.com>
Co-authored-by: Damir Jelić <poljar@termina.org.uk>
2024-02-12 17:31:41 +01:00
Benjamin Bouvier
70e38755fa recovery: comment and simplify all_known_secrets_available 2024-02-12 17:28:40 +01:00
Benjamin Bouvier
c20e6aeca7 ffi: configure encryption settings only when it's needed
It's wrong that the first client, used only to determine how to log in and find the user id, try to run the encryption initialization tasks.
In particular, it should not even try to bootstrap the account, as this may send OTKs to the server, which the client will forget about as soon
as it's respawned as a database-backed client.
2024-02-12 17:28:40 +01:00
Benjamin Bouvier
53d723d149 ffi: avoid having two clients alive at the same time 2024-02-12 17:28:40 +01:00
Timo Kösters
5cb587a60b sliding_sync: Use assert_next_eq for tests
Signed-off-by: Timo Kösters <timo@koesters.xyz>
2024-02-12 14:48:35 +01:00
Benjamin Bouvier
354f9de257 test: refactor integration test code to avoid Box::leak 2024-02-12 14:48:35 +01:00
Timo Kösters
9d04b23f45 sliding_sync: Refactor for code review
Signed-off-by: Timo Kösters <timo@koesters.xyz>
2024-02-12 14:48:35 +01:00
Timo Kösters
73edf6b734 sliding_sync: Documentation for RoomInfoUpdate and cargo fmt
Signed-off-by: Timo Kösters <timo@koesters.xyz>
2024-02-12 14:48:35 +01:00
Timo Kösters
5114474829 sliding_sync: Only emit manual room list update when late decryption happens
Previously, there were duplicate updates.

Signed-off-by: Timo Kösters <timo@koesters.xyz>
2024-02-12 14:48:35 +01:00
Timo Kösters
91331bea51 sliding_sync: More documentation for roominfo sender/receiver
Signed-off-by: Timo Kösters <timo@koesters.xyz>
2024-02-12 14:48:35 +01:00
Timo Kösters
79f97504f8 sliding_sync: Refactor delayed decryption test
Signed-off-by: Timo Kösters <timo@koesters.xyz>
2024-02-12 14:48:35 +01:00
Timo Kösters
50ed681a4e sliding_sync: Refactor roominfo sender/receiver code
Signed-off-by: Timo Kösters <timo@koesters.xyz>
2024-02-12 14:48:35 +01:00