Commit Graph

12573 Commits

Author SHA1 Message Date
Benjamin Bouvier
57e7ae488e chore(ui): tweak the notification client logs 2025-07-02 10:52:55 +02:00
Jade Ellis
a9ffe5fd72 chore: Update rusqlite 2025-07-01 21:25:15 +02:00
Damir Jelić
59c29801e5 refactor: Remove some useless cfg guards
The whole module is behind a e2e-encryption feature guard, so those
individual ones in the module are not useful.
matrix-sdk-ffi/20250701
2025-07-01 14:32:53 +02:00
Ivan Enderlin
0a822c1a06 fix(sdk): EventCache::for_room returns an error when room isn't found.
This patch fixes `EventCache::for_room` to return an error when the room
isn't found. Additionally, it also returns an error when the `Client`
(actually the `WeakClient`) is dropped.

These errors were “hidden” behind the room version logic because of
the fallback. The code has been rewritten in a way it makes it harder to
do it again.
2025-07-01 14:31:01 +02:00
Valere Fedronic
4b5e1c6676 feat(widget): Add support for the widget to send encrypted to-device messages
This patch adds support for widgets to send encrypted to-device messages as described in MSC3819.

MSC3819: https://github.com/matrix-org/matrix-spec-proposals/pull/3819
2025-07-01 14:13:31 +02:00
Benjamin Bouvier
ecb9d4d2e8 refactor(timeline): remove fields from TimelineFocusKind that are used only to init the focus 2025-07-01 14:06:57 +02:00
Benjamin Bouvier
9ade32fcd0 refactor(timeline): remove generic from a few function signatures by using plain bools 2025-07-01 14:06:57 +02:00
Benjamin Bouvier
8b4a01ea54 refactor(timeline): pass TimelineSettings immediately when creating a Timeline 2025-07-01 14:06:57 +02:00
Benjamin Bouvier
d5d5b9ee01 refactor(timeline): move the crypto tasks spawning to decryption_retry_task too
This will make it easier to move all the code around, when needs be.
2025-07-01 14:06:57 +02:00
Benjamin Bouvier
a3dd594c9e refactor(timeline): move the crypto drop handles to their own data structure
And put it in the `decryption_retry_task`, so it can be moved
altogether, later, to the event cache or some place else.
2025-07-01 14:06:57 +02:00
Benjamin Bouvier
98c331466e doc(timeline): beef up comments for the long-lived tasks 2025-07-01 14:06:57 +02:00
Benjamin Bouvier
e8877fd987 refactor(timeline): move long-lived tasks to a new tasks mod
Only code motion.
2025-07-01 14:06:57 +02:00
Benjamin Bouvier
babf16f15a refactor(timeline): use the num_events parameter for a thread back-pagination
And not the initial `num_events` parameter used for the initial
pagination.
2025-07-01 14:06:57 +02:00
Benjamin Bouvier
000419cdf3 refactor(timeline): rename TimelineFocusData to TimelineFocusKind 2025-07-01 14:06:57 +02:00
Benjamin Bouvier
89d661ca8c refactor(timeline): get rid of TimelineFocusKind \o/ 2025-07-01 14:06:57 +02:00
Benjamin Bouvier
1624d798ee refactor(timeline): replace remaining uses of TimelineFocusKind with TimelineFocusData 2025-07-01 14:06:57 +02:00
Benjamin Bouvier
726218000a refactor(timeline): add TimelineFocusKind's fields to TimelineFocusData
This will make it possible to get rid of `TimelineFocusKind`!
2025-07-01 14:06:57 +02:00
Benjamin Bouvier
08dcb267b3 refactor(timeline): use the TimelineFocusData when processing relations 2025-07-01 14:06:57 +02:00
Benjamin Bouvier
da0a32b088 refactor(timeline): use the TimelineFocusData to update the skip count 2025-07-01 14:06:57 +02:00
Benjamin Bouvier
e22a833057 refactor(timeline): add a TimelineFocusData to TimelineState and TimelineStateTransaction 2025-07-01 14:06:57 +02:00
Benjamin Bouvier
8aba664578 refactor(timeline): get rid of internal locking for TimelineFocusData
Turns out it's not needed, because all the internal data structures
already use inner mutability patterns.
2025-07-01 14:06:57 +02:00
Benjamin Bouvier
e117a3d22f fix(sdk): use a cfg guard instead of if cfg! to avoid build failures on !test && !debug_assertions builds 2025-07-01 12:11:09 +02:00
Andy Balaam
c2f50fd8a5 doc(crypto): Attempt to explain what handle_to_device_event does and make all types explicit 2025-07-01 11:25:03 +02:00
Ivan Enderlin
dc90c77c7d feat(sdk): Introduce the LatestEvents API.
This patch is the first part of the new `LatestEvents` API. It contains
the “framework”, i.e. the structure, tasks, logic to make it work, but
no latest events are computed for the moment.

The Latest Events API provides a lazy, reactive and efficient way to
compute the latest event for a room or a thread.

The latest event represents the last displayable and relevant event
a room or a thread has been received. It is usually displayed in a
_summary_, e.g. below the room title in a room list.

The entry point is `LatestEvents`. It is preferable to get a reference
to it from `Client::latest_events`, which already plugs everything to
build it. `LatestEvents` is using the `EventCache` and the `SendQueue`
to respectively get known remote events (i.e. synced from the server),
or local events (i.e. ones being sent).

\## Laziness

`LatestEvents` is lazy, it means that, despites `LatestEvents`
is listening to all `EventCache` or `SendQueue` updates, it will
only do something if one is expected to get the latest event for a
particular room or a particular thread. Concretely, it means that until
`LatestEvents::listen_to_room` is called for a particular room, no
latest event will ever be computed for that room (and similarly with
`LatestEvents::listen_to_thread`).

If one is no longer interested to get the latest event for a
particular room or thread, the `LatestEvents::forget_room` and
`LatestEvents::forget_thread` methods must be used.

\## Reactive

`LatestEvents` is designed to be reactive. Use
`LatestEvents::listen_and_subscribe_to_room` (same for thread) to get
a `Subscriber`.
2025-07-01 10:52:32 +02:00
Ivan Enderlin
6c9038eb4f refactor(sdk,common): Move JoinHandleExt inside matrix-sdk-common.
This patch moves the `JoinHandleExt` trait and the
`AbortOnDrop` type from `matrix_sdk::sliding_sync::utils` into
`matrix_sdk_common::executor`. This is going to be useful for other
modules.
2025-07-01 10:52:32 +02:00
dependabot[bot]
2b9b4cc589 chore(deps): bump crate-ci/typos from 1.33.1 to 1.34.0
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.33.1 to 1.34.0.
- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crate-ci/typos/compare/v1.33.1...v1.34.0)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  dependency-version: 1.34.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-01 08:32:45 +03:00
Ivan Enderlin
dd0336ee72 test(ui): Update test_sync_indicator and make it non-flaky.
This patch updates `test_sync_indicator` since the `SyncIndicator`
is shown for the `SettingUp` state. Also, this patch makes this
test non-flaky entirely by changing the `sync::mpsc::channel` to a
`sync::Barrier`.
2025-06-30 16:55:17 +02:00
Ivan Enderlin
0095912091 doc(ui): Update the documentation to be in-sync with the code. 2025-06-30 16:55:17 +02:00
Ivan Enderlin
e6774a34da feat(ui): Show the sync indicator when RoomListService is in SettingUp state.
Since `RoomListService` uses a persistent `pos` for sliding sync, the
`SyncIndicator` no longer shows its face except if the sliding sync
session doesn't exist or has expired.

This patch changes that by extending the `Show` from `Init` to
`SettingUp`.
2025-06-30 16:55:17 +02:00
Kévin Commaille
8ad52e34ea refactor: Don't use AnyMessageLikeEventContent with the event factory
When we upgrade Ruma, the `EventContent` bound on `EventBuilder` will be
changed to `StaticEventContent`, which is not implemented by the
`Any*EventContent` enums.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-06-30 16:44:14 +02:00
Ivan Enderlin
60a7bf0c3f doc(sdk): Fix a typo in the documentation of EventCacheDropHandles.
This patch fix a typo in the documentation of `EventCacheDropHandles`:
`EventCache` starts the tasks, not `RoomEventCache`.
2025-06-30 16:41:40 +02:00
Benjamin Bouvier
8b31d8f6a3 test(event cache): add an integration test for the ordering of relations 2025-06-30 16:10:49 +02:00
Benjamin Bouvier
e21dd763e8 feat(event cache): return related events sorted by their position in the linked chunk 2025-06-30 16:10:49 +02:00
Benjamin Bouvier
31df84f5a1 feat(event cache): return the event's positions in find_event_relations 2025-06-30 16:10:49 +02:00
Benjamin Bouvier
e68bdf8460 refactor(linked chunk): shortcut if there's no events at the top of MemoryStore::filter_duplicate_events
And remove useless comments.
2025-06-30 16:10:49 +02:00
Benjamin Bouvier
6ca1f16f48 refactor(linked chunk): make events iteration order deterministic in the relational linked chunk 2025-06-30 16:10:49 +02:00
Benjamin Bouvier
8c5d878172 refactor(linked chunk): simplify API of RelationalLinkedChunk::items()
One must now specify the target linked chunk; both callers would filter
out items based on this after the fact, which is a bit overkill since
most items would thus be filtered out on the sinking end.
2025-06-30 16:10:49 +02:00
Benjamin Bouvier
d6239d614a refactor(test): reflect that unordered events can come, well, unordered 2025-06-30 16:10:49 +02:00
Benjamin Bouvier
5af084c8c9 refactor(test): don't make test_filter_duplicated_event rely on the position in the duplicate set 2025-06-30 16:10:49 +02:00
Benjamin Bouvier
dc450ac25a refactor(linked chunk): rejigger the relational linked chunk to include the position of items 2025-06-30 16:10:49 +02:00
Benjamin Bouvier
cf375dd753 refactor(linked chunk): don't try to find events or related events in any linked chunk, only the room one 2025-06-30 16:10:49 +02:00
Benjamin Bouvier
ff935df136 refactor(linked chunk): don't nest internal methods 2025-06-30 16:10:49 +02:00
Jonas Richard Richter
0d080935cf chore(changelog): add pull request reference for NotificationItem room topic addition 2025-06-30 11:26:17 +01:00
Jonas Richard Richter
4d140d8155 feat(notification): add room topic to NotificationItem and NotificationRoomInfo structs 2025-06-30 11:26:17 +01:00
Benjamin Bouvier
cef1f8c5cb chore(event cache): address review comments 2025-06-30 11:09:11 +02:00
Benjamin Bouvier
6a054d6c74 refactor(event cache): use the linked chunk metadata to construct the OrderTracker 2025-06-30 11:09:11 +02:00
Benjamin Bouvier
1f89efb88d feat(event cache store): add a method to return the chunks' metadata 2025-06-30 11:09:11 +02:00
Benjamin Bouvier
e83c09e425 refactor(event cache): regroup lazy-loading methods in the same impl block 2025-06-30 11:09:11 +02:00
Benjamin Bouvier
a85dac1f52 feat(event cache): introduce an OrderTracker for each room tracked by the event cache
The one hardship is that lazy-loading updates must NOT affect the order
tracker, otherwise its internal state will be incorrect (disynchronized
from the store) and thus return incorrect values upon shrink/lazy-load.

In this specific case, some updates must be ignored, the same way we do
it for the store using `let _ = store_updates().take()` in a few places.

The author considered that a right place where to flush the pending
updates was at the same time we flushed the updates-as-vector-diffs,
since they would be observable at the same time.
2025-06-30 11:09:11 +02:00
Benjamin Bouvier
a0bc9aafcf feat(linked chunk): introduce an OrderTracker to keep track of the ordering of the current items
This is a new data structure that will help figuring out a local,
absolute ordering for events in the current linked chunk. It's designed
to work even if the linked chunk is being lazily loaded, and it provides
a few high-level primitives that make it possible to work nicely with
the event cache.
2025-06-30 11:09:11 +02:00