Commit Graph

14300 Commits

Author SHA1 Message Date
Damir Jelić 9b05d0d822 crypto: Use the server name in the QR code login data (#3537)
Using the resolved homeserver URL causes problems if we need to inspect
the well-known configuration of the homeserver, for example, if the
server name is matrix.org, but the homeserver URL is server.matrix.org,
the well-known might be only available for the former.

This is why we also need to receive the former, i.e. the server name in
the QR code data.
2024-06-13 14:16:48 +02:00
Ivan Enderlin 01a36c90c3 chore(ffi): Remove RoomInfo::latest_event.
This patch removes `RoomInfo::latest_event`. To get the latest event,
one has to use `RoomListItem::latest_event` because it supports
local events and remote events. It was supposed to be the case of
`Room::room_info` too, but only when the method was called: Once the
`RoomInfo` was created, the latest event inside `RoomInfo`
was static, not dynamic. Also, this code wasn't tested
contrary to `RoomListItem::latest_event` which uses
`matrix_sdk_ui::room_list_service::Room::latest_event` which is itself
tested.
2024-06-13 14:13:48 +02:00
Ivan Enderlin 6da17b3f02 Merge pull request #3540 from Hywan/fix-ui-roomlist-latest-event
chore(ui): `room_list_service::Room::latest_event` no longer uses `SlidingSyncRoom` (+ drop `SlidingSyncRoomExt`)
2024-06-13 14:08:27 +02:00
Ivan Enderlin 15ed91e047 fix(ui): Change the behaviour when a duplicated event is received by Timeline.
This patch changes the behaviour of the `Timeline` when a duplicated
event is received. Prior to this patch, the old event was removed, and
the one was added. With this patch, the old event is kept, and the new
one is skipped.

This is important for https://github.com/matrix-org/matrix-rust-sdk/pull/3512
where events are mapped to the timeline item indices. When an event is
removed, it becomes difficult to keep the mapping correct.

This patch also adds duplication detection for pagination (with
`TimelineItemPosition::Start`).
2024-06-13 14:05:22 +02:00
Ivan Enderlin 6d1289482a chore(ui): Remove SlidingSyncRoomExt.
This patch removes the `matrix_sdk_ui::timeline::SlidingSyncRoomExt`
trait as it's no longer necessary since `room_list::Room::latest_event`
no longer uses `SlidingSyncRoom` to fetch the latest event.
2024-06-13 13:47:42 +02:00
Ivan Enderlin 8021d72389 feat(ui): Fetch the latest event from Room instead of SlidingSyncRoom in room_list::Room.
This patch updates `matrix_sdk_ui::room_list::Room::latest_event`
to fetch the latest event from `matrix_sdk::Room` instead of
`matrix_sdk::sliding_sync::SlidingSyncRoom`. It removes one dependency
to `SlidingSyncRoom` and it simplifies the code.
2024-06-13 12:00:22 +02:00
Johannes Marbach f770248b24 fix(bindings): use the same library name for all platforms in the xcframework
Fixes: #3528
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2024-06-12 17:17:36 +02:00
Benjamin Bouvier 2a79956caa ffi: call the initial events in the same task that listens to updates
This avoids a race condition where the caller hasn't set up the initial
items or the listener, and the listener is called *before* the initial
items have been used.
2024-06-12 16:16:41 +02:00
Mauro 871116eee9 feat (bindings): added an API to retrieve a loaded reply (#3534)
second part of the #3439 breakdown

The context for this API, is for the composer preview an reply without the need of it being actively in the timeline.
2024-06-12 14:00:50 +00:00
Benjamin Bouvier 03c16cb9f6 deduplicating handler: rename NotFinishedYet to Cancelled and add a few comments around the code future 2024-06-12 15:39:21 +02:00
Benjamin Bouvier 34a9289978 deduplicating handler: add a regression test for cancellation of a deduplicated query 2024-06-12 15:39:21 +02:00
Benjamin Bouvier ad63d28cfa deduplicating handler: use a new QueryState data structure 2024-06-12 15:39:21 +02:00
Benjamin Bouvier ac0992953e deduplicating handler: repeat request until it's performed at least once 2024-06-12 15:39:21 +02:00
Mauro d035eb1d90 feat (bindings): added APIs to save and load composer drafts (#3531)
This PR is the first piece of the breakdown of the following PR: https://github.com/matrix-org/matrix-rust-sdk/pull/3439 where only the core functionalities of the feature are implemented, without addressing the issue of editing and replying to events that have not yet been paginated.
2024-06-11 15:32:07 +00:00
Benjamin Bouvier 0ec90c23da base: move the initial filling of the display name cache into the sync methods
It's not perfect, but it's honest work.
2024-06-11 15:44:53 +02:00
Benjamin Bouvier c72384f7d4 base: don't regenerate the display name when creating a room, store the cached display name in RoomInfo
So revert a few changes to make some functions async, etc.
2024-06-11 15:44:53 +02:00
Benjamin Bouvier 5a5a5797e9 ci: fix flakeyness of test_room_notification_count in an innovative way
The test looks at updates of `RoomInfo`s, but these depends on external
factors like the server sending them in one part or multiple ones.

Instead of trying to figure out which partial updates the server sent,
wait for the stream of `RoomInfo`s to stabilize by trying to get the
latest item from the stream, then wait up to N seconds for another item
to show up, and continue as long as items come in.

This should allow us to get rid of some code that was required to
prevent flakey updates.
2024-06-11 15:44:53 +02:00
Benjamin Bouvier e22162a23a base: rename computed_display_name to compute_display_name and remove computed_ in the cached one 2024-06-11 15:44:53 +02:00
Benjamin Bouvier 73f977986e sdk: use the cached computed display name in more places 2024-06-11 15:44:53 +02:00
Benjamin Bouvier 2d444284cc base: rename calculate_room_name to compute_display_name_from_heroes 2024-06-11 15:44:53 +02:00
Benjamin Bouvier c0c9d16412 ui: make use of the cached computed display name in the room name matchers 2024-06-11 15:44:53 +02:00
Benjamin Bouvier 78a1634341 base: add a cache to the computed display name 2024-06-11 15:44:53 +02:00
Benjamin Bouvier 78e2ab9d99 base: make get_or_create_room async
Since this is a good place where to recompute the cached display name at
start.
2024-06-11 15:44:53 +02:00
Benjamin Bouvier f1553ae7f8 sliding sync: add some simple positive tests for room names too 2024-06-11 15:44:53 +02:00
Benjamin Bouvier 9a1a3e67c3 base(code motion): move calculate_room_name into the one file where it's used 2024-06-11 15:44:53 +02:00
Benjamin Bouvier 82ae74fee9 base: get rid of intermediate calculate_name() function 2024-06-11 15:44:53 +02:00
Benjamin Bouvier 8d66d1bab0 base: fix guessed number of members as it should relate to joined users, not joined+invited
The previous code would use `ACTIVE` which means "either joined or
invited" members, but the code thereafter considered this to be the
number of joined members.

Also replaced a call to `self.members()` (which does a lot of work under
the hood) with a call to `self.joined_user_ids()`, since we only
retrieve the `.len()` of the resulting vector.
2024-06-11 15:44:53 +02:00
Benjamin Bouvier 66d43c1088 base: directly call calculate_room_name since it's a free-function
Instead of calling it through `BaseRoomInfo::calculate_room_name`.
2024-06-11 15:44:53 +02:00
Denis Kasak ad79f9c0ac docs: Update message key forwarding algorithm model.
- Change incorrect "key sharing" references to "key forwarding".
- Explain that this is a feature that needs to be enabled.
- Regenerate the key forwarding algorithm diagram.
- Provide a spec link and mention alternative names.
2024-06-11 14:51:32 +02:00
Richard van der Hoff 1510f87fa0 UTD hook: stop re-reporting of UTDs on app relaunch (#3519)
Use a Bloom filter to keep track of which events we have already reported to the parent UTD hook.
We load the data from database on startup, and flush it out immediately on every update.
2024-06-10 18:56:35 +01:00
Ivan Enderlin a2f868d1a7 Merge pull request #3527 from Hywan/chore-ui-timeline-event-handler-add
chore(ui): Rewrite a bit `TimelineEventHandler::add`
2024-06-10 18:31:51 +02:00
Ivan Enderlin 17befab414 chore(ui): Rewrite a bit TimelineEventHandler::add.
This patch renames `TimelineEventHandler::add` to `add_item`.

This patch also removes the `should_add` argument. The `add_item`
is called conditionally everytime. I believe this is much cleaner.
Otherwise the method should have been called `maybe_add_item` with a
return type or something that indicates whether the item is added. This
patch makes it clear and remove one possible state in `add_item`.
2024-06-10 18:18:05 +02:00
Ivan Enderlin abda959796 chore(ui): Make TimelineInnerMetadata::next_internal_id private
chore(ui): Make `TimelineInnerMetadata::next_internal_id` private
2024-06-10 10:21:54 +02:00
Ivan Enderlin 1a343d93e7 chore(ui): Remove a useless clone
chore(ui): Remove a useless clone
2024-06-10 10:19:45 +02:00
Ivan Enderlin 2a70587dda chore(ui): Make TimelineInnerMetadata::next_internal_id private.
This patch updates `TimelineEventHandler` to re-use the public API and
avoid using `TimelineInnerMeta::next_internal_id`. The consequence is
that `next_internal_id` can now be private instead of public. It's
better to have isolated API in this code.
2024-06-10 10:06:08 +02:00
Ivan Enderlin d403c12464 chore(ui): Remove a useless clone.
This patch removes a useless clone of `TimelineInner::items`. This clone
was technically cheap because it's a `Vector` behind the scene, which is
cheap to clone, but still, it's not necessary at all to clone it.
2024-06-10 10:03:49 +02:00
Benjamin Bouvier e5487da160 send queue: control enabled on a per-room basis in addition to globally 2024-06-10 09:44:44 +02:00
Benjamin Bouvier 9c1d62a039 sdk: finish renaming "sending queue" to "send queue" 2024-06-10 09:21:35 +02:00
Ivan Enderlin 1c9171d917 Merge pull request #3515 from Hywan/doc-sdk-sliding-sync-mode-typo 2024-06-10 07:13:27 +02:00
Timo 931c564942 widget API(ffi): Add StateEventType::RoomEncryption to capabilities (#3506)
also add TODO comment to remove `org.matrix.msc3401.call` once possible.
2024-06-06 19:31:56 +02:00
Benjamin Bouvier 632de475a1 send queue: try to avoid a race when disabling then aborting a send 2024-06-06 18:30:15 +02:00
Benjamin Bouvier a21ea06bed day dividers: demote an assert to an error message
Because of the task cancellation that can happen at any place in the
code base, it's really hard to predict in which situation a
day-divider-adjuster should have run or not, so just demote the assert
to an error. The intent is that, if we see errors with day dividers in
the future, they'll be reported along rageshakes and we'll notice this
in the logs.
2024-06-06 18:05:21 +02:00
Benjamin Bouvier 66330a20b3 sdk: rename "sending queue" to "send queue" 2024-06-06 17:56:17 +02:00
Doug 3f272a72c4 chore: Update some docs on the authentication service. 2024-06-06 17:01:46 +02:00
Doug 81b55a4ca8 ffi: Use a single client in the authentication service.
We no longer need the in-memory store as we provide a path for the new session.
2024-06-06 17:01:46 +02:00
Doug d43812ac04 ffi: Replace the Client's base_path with a session_path.
The SDK no longer handles subdirectories for the user, this becomes the app's responsibility.
2024-06-06 17:01:46 +02:00
Doug 2c87333106 oidc: Supply a direct path to the registrations file instead of a base path. 2024-06-06 17:01:46 +02:00
Ivan Enderlin 1aacbaf681 doc(sdk): Fix a formatting typo. 2024-06-06 11:34:38 +02:00
Benjamin Bouvier 5093af87b1 clippy: disallow useless asyncs (#3513)
Using async when not required will increase compile times, and propagate async-ness to the callers, transitively.

See also the [lint description](https://rust-lang.github.io/rust-clippy/master/#/unused_async).

Since we only had a few false positives, I've enabled it by default.
2024-06-05 17:13:10 +02:00
Benjamin Bouvier 23cc1e31c1 ffi: make more methods async, rename a few variables/functions, etc. 2024-06-05 14:58:41 +02:00