Commit Graph

13223 Commits

Author SHA1 Message Date
Ivan Enderlin
c0d6e87c99 task(base): Fix conflicts with a previous patch. 2025-05-16 14:43:45 +02:00
Ivan Enderlin
6162600bda refactor(base): Remove &mut Context argument from response processors when unused.
This patch removes the `_context: &mut Context` argument from response
processors when it's unused.
2025-05-16 14:43:45 +02:00
Ivan Enderlin
1187539ea4 chore(base): Remove the useless PreviousEventsProvider. 2025-05-16 14:43:45 +02:00
Ivan Enderlin
2649587d2f refactor(sdk): Use the Event Cache for read_receipts::compute_unread_counts.
The `read_receipts::compute_unread_counts` function needs the _previous
events_ to compute the read receipt correctly. These previous events
were store in `SlidingSyncRoom::timeline_queue`. Since the removal of
`timeline_queue` in the previous patches, this patch uses the Event
Cache to fetch them. It only uses events that are loaded in memory.
This is as correct as the prior behaviour, even this is still incorrect
since it doesn't back-paginate to get a better view. This is for
later. The goal of this patch is to restore the same behaviour, without
`timeline_queue`.

The main problem is that read receipts are computed in
`matrix-sdk-base`, and that the Event Cache lives in `matrix-sdk`. Thus,
we change the `SlidingSyncResponseProcessor` to handle read receipt
in particular.

The
`matrix_sdk_base::response_processors::rooms::msc4186::extensions::dispa
tch_ephemeral_events` function has been split in
two methods `dispatch_typing_ephemeral_events`, and
`dispatch_receipt_ephemeral_event_for_room`. The workflow has been a
little bit redesigned to fit in the new `SlidingSyncResponseProcessor`
constraints.

This patch moves one test from `matrix-sdk-base` into `matrix-sdk`,
because to compute the read receipt, the Event Cache must be
enabled/listening to sync updates.
2025-05-16 14:43:45 +02:00
Ivan Enderlin
68651aac1f feat(sdk): Add RoomEventCache::events to avoid ::subscribe.
`RoomEventCache::subscribe` returns the set of events + the
`RoomEventCacheListener`. However, creating this listener isn't
cheap, especially dropping it. That's why this patch creates
`RoomEventCache::events` to replace `subscribe` when the listener is
not necessary.
2025-05-16 14:43:45 +02:00
Ivan Enderlin
2c8f48fabb doc(base): Fix inline comment typos. 2025-05-16 14:43:45 +02:00
Ivan Enderlin
c426c03624 refactor(sdk): Remove timeline and prev_batch from SlidingSyncRoom. 2025-05-16 14:43:45 +02:00
Ivan Enderlin
eeaa091024 chore(ffi): Justify the allow(clippy::large_enum_variant). 2025-05-16 14:27:49 +02:00
Ivan Enderlin
7ef962f931 chore(labs): Allow clippy::large_enum_variant in multiverse.
This is development-, debug-oriented tool. Let's allow
`clippy::large_enum_variant` for the moment.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
8480e0fc55 chore(ui): Allow clippy::large_enum_variant on TimelineAction.
This enum is large, but it's used in a short period of time, not
collected somewhere, so it's safe to accept a large size here.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
bf5e0124ab refactor(ui): Reduce the size of NotificationEvent.
This patch reduces the size of `NotificationEvent` from 576 bytes to
16 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
d56ad64cc2 refactor(ui): Reduce the size of NotificationStatus.
This patch reduces the size of `NotificationStatus` from 216 bytes to
16 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
ab3f22c212 refactor(sdk): Reduce the output size of get_header.
This patch reduces the size of the output's `Result::Err` variant of
`get_header` from 160 bytes to 8 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
e41dbd6300 refactor(sdk): Reduce size of HttpError.
This patch reduces the size of `HttpError` from 160 bytes to 24 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
29a8556f10 refactor(sdk): Reduce size of ReplyContent.
This patch reduces the size of `ReplyContent` from 448 bytes to
16 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
8d0d920808 refactor(sdk): Replace iter().any() by contains().
This is faster for scalars, but it falls back to a regualar
`iter().any()` for other types. It's the same, but at least Clippy
doesn't complain.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
1cdc9ff6e4 refactor(sdk): Use IoError::other.
This patch replaces `IoError::new(IoErrorKind::Other, …)` by
`IoError::other(…)`.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
9541123fcf refactor(crypto): Reduce the size of SasState.
This patch reduces the size of `SasState` from 288 bytes to 88 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
ed4b789f87 refactor(crypto): Reduce the size of OutgoingContent.
This patch reduces the size of `OutgoingContent` from 160 bytes to
24 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
18a3c37554 refactor(crypto): Reduce sizes of Verification and VerificationRequestState.
This patch reduces the sizes of `Verification` from 376 bytes to
16 bytes, and `VerificationRequestState` from 424 bytes to 96 bytes.

It also reduces the size of a couple of other types in the same vain.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
92b4b03a8d refactor(crypto): Reduce the size of OutgoingContent and RoomMessageRequest.
This patch reduces the sizes of `OutgoingContent` from 464 bytes to
160 bytes, and `RoomMessageRequest` from 480 bytes to 40 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
192c50dcad refactor(crypto): Reduce the size of OutgoingVerificationRequest.
This patch reduces the size of `OutgoingVerificationRequest` from
480 bytes to 64 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
7b34eaabe5 refactor(crypto): Reduce the size of AnyOutgoingRequest.
This patch reduces the size of `AnyOutgoingRequest` from 488 bytes to
72 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
2eb4278835 refactor(crypto): Reduce the size of RoomIdentityChange.
This patch reduces the size of `RoomIdentityChange` from 576 bytes to
72 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
293d4ee08c refactor(crypto): Reduce the size of MaybeEncryptedRoomKey.
This patch reduces the size of `MaybeEncryptedRoomKey` from 336 bytes
to 32 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
87066a127e refactor(crypto): Use IoError::other.
This patch uses `IoError::other(…)` as a shortcut of
`IoError::new(ErrorKind::Other, …)`.
2025-05-16 14:27:49 +02:00
Kévin Commaille
4847a3135b feat(base-sdk): Ignore marked_unread room account data with unstable prefix after seeing one with stable prefix
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-05-16 09:55:02 +02:00
Kévin Commaille
af02e0c472 feat(sdk): Send stable m.marked_unread room account data
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-05-16 09:55:02 +02:00
Stefan Ceriu
da2dda0e45 fix(ui): populate the thread_root and in_reply_to fields for stickers and polls
They have never been set and there was no way of telling if stickers and polls belong on a thread or come in reply of any other message.

This patch also exposes methods for setting these relations on the event factory level.
2025-05-15 16:45:34 +03:00
Benjamin Bouvier
69b8878890 fix(sdk): mark rooms joined with join_room_by_id or join_room_by_id_or_alias as DMs if needs be
This moves the logic from `Room::join()` to these two methods. This is
isofunctional, because `Room::join()` does call into
`Client::join_room_by_id()` internally.
2025-05-15 14:19:31 +02:00
Damir Jelić
7893e55a8d refactor(crypto): Make the room key importing logic more generic 2025-05-15 12:23:23 +02:00
Damir Jelić
c0e45a2e0f refactor(widgets): Rename the then() function into add_response_handler() (#5037)
The then() function can be used with booleans and futures to execute a
piece of code if the boolean is true or once the future is completed.

In contrast, the then() function in the widget driver is not executed
immediately. Instead it only adds a callback that is later on executed
by the widget driver.
2025-05-14 16:16:04 +02:00
Stefan Ceriu
13a65c8dfe feat(ui): add new Thread timeline focus mode and associated events loader (#5032)
… that allows building a timeline instance specific to a particular
thread root.

Creating a timeline in this mode will start by backpaginating root event
relations with `num_events` and automatically insert the thread root
event when reaching the end. It will include
`RelationsOfType(RelationType::Thread)` but also recurse over the
retrieved events to fetch reactions.
It will not however react to new events received over sync or that the
user sends (for now).

This patch will also help incrementally deliver the upstream client
support for creating such a timeline.

Part of #4833 (meta #4869).
2025-05-14 14:14:29 +00:00
Kévin Commaille
36667c1298 chore: Get rid of cargo-deny errors due to new advisories
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-05-14 15:42:46 +02:00
Benjamin Bouvier
e4f2299785 refactor(timeline): get rid of FullEventMeta and replace it with EventMeta + function parameters 2025-05-14 13:30:24 +02:00
Benjamin Bouvier
81a2679bb8 refactor(timeline): only compute the TimelineEventContext when it's needed 2025-05-14 13:30:24 +02:00
Benjamin Bouvier
9087263da4 refactor(timeline): rewrite how failed-to-parse items are added 2025-05-14 13:30:24 +02:00
Benjamin Bouvier
d58111fa04 refactor(timeline): isolate computation of should_add in its own function 2025-05-14 13:30:24 +02:00
Benjamin Bouvier
ab87ea5770 refactor(timeline): simplify computation of should_add a bit 2025-05-14 13:30:24 +02:00
Benjamin Bouvier
6b62b41a60 refactor(timeline): get rid of the return value of find_item_and_apply_aggregation
As it's now unused.
2025-05-14 13:30:24 +02:00
Benjamin Bouvier
b1f088277d refactor(timeline): get rid of HandleEventResult 2025-05-14 13:30:24 +02:00
Benjamin Bouvier
277eae75d9 refactor(timeline): make item_added a local variable instead of deeply-stored context 2025-05-14 13:30:24 +02:00
Benjamin Bouvier
20559e3f2c refactor(timeline): get rid of unused HandleEventResult::items_updated 2025-05-14 13:30:24 +02:00
Benjamin Bouvier
341f9c267d feat(state store): enable the busy timeout to automatically retry operations on busy dbs
Under some very particular circumstances, the "database is locked" error
can still happen, even in WAL mode, even if the database connection is
not being upgraded from a read transaction to a write transaction.

We *think* this might be the reason behind errors like
github.com/element-hq/element-x-ios/issues/3582, so we're enabling the
sqlite busy_timeout, which will retry the operation after a short sleep,
until the busy timeout is being hit.
2025-05-14 13:27:54 +02:00
Timo
af3039abde docs(WidgetDriver): Add module documentation
Co-authored-by: Robin <robin@robin.town>
Signed-off-by: Damir Jelić <poljar@termina.org.uk>
2025-05-14 11:42:55 +02:00
Benjamin Bouvier
4d027ec405 doc: add a changelog entry for the persistent storage of the event cache 2025-05-13 15:50:21 +02:00
dependabot[bot]
3cd64ac03b chore(deps): Bump tokio from 1.43.0 to 1.43.1
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.43.0 to 1.43.1.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.43.0...tokio-1.43.1)

---
updated-dependencies:
- dependency-name: tokio
  dependency-version: 1.43.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-13 14:58:30 +02:00
Jorge Martín
44e103c0e3 feat(ffi): expose ffi::RoomInfo::tombstone
This replaces `ffi::RoomInfo::is_tombstoned`, including the needed extra info for the migration UI.
2025-05-13 14:41:41 +02:00
dependabot[bot]
7d992d1af8 chore(deps): Bump ring from 0.17.8 to 0.17.14
Bumps [ring](https://github.com/briansmith/ring) from 0.17.8 to 0.17.14.
- [Changelog](https://github.com/briansmith/ring/blob/main/RELEASES.md)
- [Commits](https://github.com/briansmith/ring/commits)

---
updated-dependencies:
- dependency-name: ring
  dependency-version: 0.17.14
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-13 14:37:12 +02:00
Benjamin Bouvier
ac42953524 doc(timeline): add extra documentation for HandleAggregationKind 2025-05-13 14:15:00 +02:00