Commit Graph

14300 Commits

Author SHA1 Message Date
Jorge Martín
59ed28d3f8 refactor(sdk): add several helper functions to the AnyPaginator wrapper, use them where needed
Move `hide_threaded_events` from `TimelineEventFocusKind::Event` to `AnyPaginator::Unthreaded`
2025-09-23 14:13:34 +02:00
Jorge Martín
a0eecac8e0 chore(doc): Fix ThreadedEventsLoader::paginate_forwards docs 2025-09-23 14:13:34 +02:00
Jorge Martín
27ba6d070b feat(ffi): Expose TimelineEvent::thread_root_event_id 2025-09-23 14:13:34 +02:00
Jorge Martín
14ca34b09b feat(ffi): Add Room::load_or_fetch_event to the FFI layer
This way we can retrieve random events in a room and check their properties - this is needed to decide whether a permalink for an event should open in a thread or not
2025-09-23 14:13:34 +02:00
Jorge Martín
2166de7b0d refactor(sdk+ui): Make TimelineFocus::Event { paginator } generic
This way we can have the same focus handling both the focused event pagination in the main timeline with the `Paginator` and the focused event pagination in a thread with `EventThreadsLoader`.

The actual paginator is populated in `TimelineController::init_focus` after we call `/context` and can check if the event is part of a thread.
2025-09-23 14:13:34 +02:00
Jorge Martín
fd66ae9226 feat(sdk): Add forwards pagination to ThreadEventsLoader
Make the existing `token` field a new `tokens` one with `PaginationTokens` type.

# Conflicts:
#	crates/matrix-sdk/src/paginators/thread.rs
2025-09-23 14:13:34 +02:00
Shrey Patel
56100dfa00 chore(search): Update README. 2025-09-23 11:27:55 +02:00
Benjamin Bouvier
2b567e18bc refactor(timeline): don't require an ExactSizeIterator on replace_with_initial_remote_events
This is only used to know if the new events list is empty or not, which
we can figure thanks to a peekable iterator.
2025-09-22 15:31:02 +02:00
Benjamin Bouvier
a5e84230c7 chore(ffi): rejigger recent emoji code around so as to work with default features disabled
For some reason, running `cargo xtask ci clippy` locally would now fail,
complaining that the recent emoji functions didn't exist, in the FFI
layer. I suspect it's because some of the uniffi derive macro to export
functions incorrectly propagates the `cfg` guards; so a solution is to
move all this code under a new mod, that's enabled if and only if the
feature's enabled.
2025-09-22 11:42:10 +02:00
Benjamin Bouvier
bf4a46e8de chore: rename a few badly named variables in the sql event cache store 2025-09-22 11:20:49 +02:00
Ivan Enderlin
659ae57218 fix(ui): room_list::sorters::recency is no longer based on 2 data.
This patch fixes an issue where the `recency` sorter is based on either
the latest event's timestamp, or the room recency stamp. This cannot
work with a sort algorithm as the position of a particular room can
be different based on what it is compared to (i.e. if the rooms have a
latest event value or not).

This patch updates the `recency` sorter to only use the recency stamp
for now, as the latest event is not yet computed for all rooms.
sdk-ffi/20250923
2025-09-19 17:39:05 +02:00
Shrey Patel
dff6cb4414 refactor(search): Move RoomIndexBuilder into a submodule of index. 2025-09-19 16:37:09 +02:00
Shrey Patel
76348977d4 feat(search): Add encrypted search index support. 2025-09-19 16:37:09 +02:00
Shrey Patel
a66e6822ed refactor(search): Add RoomIndexBuilder to create RoomIndex. 2025-09-19 16:37:09 +02:00
Shrey Patel
b494303c07 feat(search): Implement an encrypted wrapper for a tantivy::directory::MmapDirectory. 2025-09-19 16:37:09 +02:00
Ivan Enderlin
0f0e37b677 chore: Update eyeball-im, eyeball-im-util and imbl.
This patch updates `eyeball-im` to 0.8.0, `eyeball-im-util` to 0.10.0
and `imbl` to 6.1.0.

The idea is to fix this bug https://github.com/jplatte/eyeball/pull/80.
2025-09-19 16:17:31 +02:00
Ivan Enderlin
fc12a7340f chore(ui): Add a temporary entries_with_dynamic_adapters_with.
This patch adds a temporary
`RoomList::entries_with_dynamic_adapters_with` method to help debug an
issue in Element X.
2025-09-19 15:55:57 +02:00
Shrey Patel
80390346b1 feat(multiverse): Add search indexing at startup. 2025-09-19 14:25:02 +02:00
Shrey Patel
4b87dfea0b feat(sdk): Lazily create RoomIndex on search. 2025-09-19 14:25:02 +02:00
Shrey Patel
79aa0ab60d feat(search): Add bulk processing. 2025-09-19 14:25:02 +02:00
Shrey Patel
a8ef44306a refactor(sdk): Move search index related code into its own module. 2025-09-19 14:25:02 +02:00
Shrey Patel
b929f3e569 fix(search): Remove unused IndexError variants. 2025-09-19 14:25:02 +02:00
Ivan Enderlin
1c737e6569 bench: Run the room_list benchmark in the CI. 2025-09-19 11:06:45 +02:00
Benjamin Bouvier
8ae88e1e45 refactor(sdk): make the update_in_memory_caches method infallible 2025-09-18 18:00:27 +02:00
Benjamin Bouvier
768f9bfdb6 doc: fix a typo in a doc comment of invite_acceptance_details 2025-09-18 18:00:27 +02:00
Benjamin Bouvier
864d6c1a43 perf: avoid recomputing room notification modes on every sync
Some background knowledge: the room notification modes are functions of
the push rules events, and they will only change when the push rules
event changes. As a result, there are only two cases where we need to
recompute them:

- when the push rules event changed, we need to recompute all the room
notification modes, in case one has changed;
- when we run into a new room, we need to compute an initial value for
its room notification modes.

Based on these observations, this improves the code to avoid recomputing
the room notification mode on every single sync response. Instead,
they're computed if and only if the push rules event has changed, or for
new rooms only.

Also, this avoids reconstructing one `NotificationSettings` object per
room, since this would load from the database each time. Instead, a
single object is created (at most), and its `Rules` object is directly
accessed, to avoid repeatedly taking the lock on its internal `rules`
field.

This makes it so that the time spent under this method from tens of
milliseconds to less than 1 millisecond, in testing. See the pull
request initial post for more numbers.
2025-09-18 18:00:27 +02:00
Benjamin Bouvier
da70aea5b0 feat(multiverse): allow not sharing pos at start
This is helpful to reproduce an initial sync response, and observe how
long it takes to process.
2025-09-18 18:00:27 +02:00
Benjamin Bouvier
1a9c7d5e2f test: add regression test that even if a room isn't in a sync response, its notification mode may be updated 2025-09-18 18:00:27 +02:00
Doug
9cd7760858 ffi: Expose is_direct on SpaceRoom. 2025-09-18 18:56:03 +03:00
Benjamin Bouvier
8575ed3f64 chore: define FrozenSlidingSyncPos only if the e2e-encryption feature is enabled
This caused compilation errors in other PRs, since the introduction of
Rust 1.90, which was able to detect this was unused otherwise.
2025-09-18 17:27:25 +02:00
Ivan Enderlin
1834f36136 doc(ui): Update the CHANGELOG.md file. 2025-09-18 15:38:16 +02:00
Ivan Enderlin
0bbefa000b chore(ui): Rename room_list_service::Room to RoomListItem.
This patch renames the `Room` type in `room_list_service` to
`RoomListItem` to avoid confusion with `matrix_sdk::Room`.
2025-09-18 15:38:16 +02:00
Ivan Enderlin
a84c97b292 feat(ui): Introduce room_list_service::Room to cache data.
This patch improves throughput by +710% in `room_list_service` sorters
and filters. It introduces a new `room_list_service::Room` type that
derefs to `matrix_sdk::Room`. However, it **caches** some data from
`matrix_sdk::Room`. Why doing so? Because filters, but more specifically
sorters!, are calling methods on `matrix_sdk::Room`, so likely on
`matrix_sdk::RoomInfo`, quite intensively. `RoomInfo` is behind a
`SharedObservable`, which means it's behind a lock. Each time a sorter
sorts 2 rooms, the lock on `RoomInfo` can be called twice or more.

By caching the data, `RoomInfo` is reached once per refresh data, but
not during the filtering nor the sorting. It greatly reduces contention
on the `RoomInfo` lock, which improves the throughput by +710%, and the
time by -87%.

The cached data are refreshed in `merge_stream_and_receiver` when
(i) the stream of `Room` is updated, or when (ii) the stream of
`RoomInfoNotableUpdate` is updated. It's a central place it happens,
which isolates the behaviour.
2025-09-18 15:38:16 +02:00
Ivan Enderlin
94267d9597 chore(base): Rename Room::inner to Room::info.
This patch renames the `Room::inner` containing the `RoomInfo` to
`Room::info`.
2025-09-18 15:38:16 +02:00
Ivan Enderlin
62eb1996d9 feat(base): Add new_latest_event_timestamp and new_latest_event_is_local.
This patch adds 2 methods on `RoomInfo`: `new_latest_event_timestamp`
and `new_latest_event_is_local`, which respectively returns
`LatestEventValue::timestamp` and `LatestEventValue::is_local`. The goal
is to avoid cloning a `LatestEventValue` when it's useless. For example,
in the room list sorters!

This patch also updates the room list sorters `recency` and
`latest_event` to use these new methods. It improves the speed and
throughput by 18%.
2025-09-18 15:38:16 +02:00
Ivan Enderlin
ec5c31a19d chore(bench): Add the room_list benchmark.
This patch adds the `room_list` benchmark. The goal is to measure
the time it takes to create a room list, to sort it, to filter and to
“display” it.
2025-09-18 15:38:16 +02:00
Jorge Martín
7e474c3a52 refactor(sdk): Remove UpdateGlobalAccountDataEndpoint and GlobalAccountDataEndpoint
These are meant to be replaced with specific endpoints for each case.

Added the `global_account_data_mock_builder` helper function to make building these mock endpoints a bit easier.
2025-09-18 13:12:49 +02:00
Jorge Martín
8706ad74b3 refactor(sdk): Immediately truncate the recent emoji list
This way we'll always work with a list of at most `MAX_RECENT_EMOJI_COUNT` items, which should ensure performance is good enough.
2025-09-18 13:12:49 +02:00
Jorge Martín
3cc88e5008 test(sdk): Redo matching the request body for the update recent emoji endpoint 2025-09-18 13:12:49 +02:00
Jorge Martín
a937780623 fix(sdk): Use a max recent emoji count of 100
This prevents the account data from growing indefinitely and makes sure values that aren't recently used can be forgotten.
2025-09-18 13:12:49 +02:00
Benjamin Bouvier
9dc27698dd chore: address new clippy recommendations 2025-09-18 12:01:48 +02:00
Benjamin Bouvier
49d72cd992 chore: run rustfmt after moving to the next edition of matrix-sdk 2025-09-18 12:01:48 +02:00
Benjamin Bouvier
98e799da80 chore: remove unnecessary bindings modifiers
match ergonomics ftw! in the 2024 edition, these are necessary only when
the capturing mode is `move`.
2025-09-18 12:01:48 +02:00
Benjamin Bouvier
ea386c9e64 chore: specify explicitly that some stream/futures don't capture any lifetime 2025-09-18 12:01:48 +02:00
Benjamin Bouvier
bba2af9882 refactor: don't use the reserved keyword gen in tests
I *think* these compare a generated URL against an expected one, but the
naming is a bit strange in those tests. It's just tests, after all.
2025-09-18 12:01:48 +02:00
Benjamin Bouvier
51934dd249 test: stop using the unit never type fallback
By making it explicit that the async closures return a unit type, we can
get rid of these two allow lines, and prepare for migrating this code to
the 2024 edition.
2025-09-18 12:01:48 +02:00
Benjamin Bouvier
07924ad4e4 chore: bump matrix-sdk to edition 2024 2025-09-18 12:01:48 +02:00
Michael Goldenberg
1312a27597 feat(indexeddb): add IndexedDB-backed impls for getting, adding, replacing, and removing media
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-09-17 17:03:39 +02:00
Michael Goldenberg
038207870a refactor(indexeddb): add media-related functions to media store transaction type
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-09-17 17:03:39 +02:00
Michael Goldenberg
eb62ac9fad refactor(indexeddb): use UnixTime type to represent Media::last_access
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-09-17 17:03:39 +02:00