Commit Graph

1560 Commits

Author SHA1 Message Date
Ivan Enderlin
7aa7d1ca53 feat(ui): Remove visible_rooms from RoomListService.
This patch removes the `visible_rooms` sliding sync list from
`RoomListService`. As we are taking the path of doing client-side
sorting, the ordering of the server-side will most likely always
mismatch the ordering of the client-side, thus using `visible_rooms`
with room indices make no sense (indices from server-side won't map
indices on the client-side, so room ranges from client-side won't map
what the server knows).

We used to use `visible_rooms` to “preload” the timeline of rooms in
the user app viewport, with a `timeline_limit` of 20. This should be
replaced by room subscriptions starting from now. For the moment, the
user of `RoomListService` is responsible to do that manually. Maybe
`RoomListService` will handle that automatically in the future.
2024-07-03 09:17:28 +02:00
Stefan Ceriu
38a18c3c8e feat(ffi): add Element specific well known struct and a way to deserialize it from external clients 2024-06-28 16:58:55 +02:00
Stefan Ceriu
70fddc0e1b feat(ffi): expose method for reading the server name part of the current user's identifier. 2024-06-28 16:58:55 +02:00
Stefan Ceriu
84796ab32a feat(ffi): expose method for sending generic GET requests through the SDK's inner HTTP client. 2024-06-28 16:58:55 +02:00
Andy Balaam
6464d21813 crypto: Storage changes for keeping sender data with InboundGroupSessions (#3556)
Signed-off-by: Andy Balaam <mail@artificialworlds.net>
Co-authored-by: Damir Jelić <poljar@termina.org.uk>
2024-06-28 14:14:55 +02:00
Benjamin Bouvier
1c92633a23 ffi: add new error conversions into ClientError
*sigh*
2024-06-27 18:53:00 +02:00
Benjamin Bouvier
c3cdc4526e ffi: rename Timeline::edit to Timeline::edit_by_event_id, and introduce a more general Timeline::edit 2024-06-27 18:53:00 +02:00
Benjamin Bouvier
394effbc72 send queue: rename AbortSendHandle to SendHandle 2024-06-27 18:53:00 +02:00
Hubert Chathi
d41af396cc Embed device keys in Olm-encrypted messages (#3517)
This patch implements MSC4147[1].

Signed-off-by: Hubert Chathi <hubertc@matrix.org>

[1]: https://github.com/matrix-org/matrix-spec-proposals/pull/4147
2024-06-27 12:18:52 +02:00
Benjamin Bouvier
7f0b035e86 ffi: respawn send queue tasks just before subscribing to the client-wide send q errors 2024-06-26 19:42:14 +02:00
Kévin Commaille
eaf7a9e350 chore: rustfmt fixes
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-06-26 14:10:36 +02:00
Kévin Commaille
0cc7103fd9 docs: Fix indentation of list items paragraphs
Thanks to the new doc_lazy_continuation clippy lint in nightly.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-06-26 14:10:36 +02:00
Damir Jelić
3be84a5a30 refactor(sdk-crypto): Room key sharing, introduce extensible strategy
This patch set does two things:

1. Extracted the logic to collect the devices that should receive a room key.
2. Introduce a new CollectStrategy enum which defines which rules are
   used to collect recipient devices for a room key. Currently only the
   existing rules have beenmoved under this enum.
2024-06-25 16:54:25 +02:00
Jorge Martín
0162f6ba49 Add doc clarification for ffi::room_list_item.is_encrypted() 2024-06-25 12:42:59 +02:00
Valere
d6e523c1d1 refactor(sdk-crypto) - RoomKey Sharing | add settings for strategy 2024-06-25 11:16:24 +02:00
Jorge Martín
912e75c1f8 ffi: add RoomListItem::is_encrypted() function. 2024-06-24 16:01:19 +02:00
Jorge Martín
004941b6b4 ffi: add encryption info to RoomInfo 2024-06-24 16:00:29 +02:00
Benjamin Bouvier
90f73195b1 send queue: introduce fallible fake state store in the send queue code 2024-06-24 13:56:10 +02:00
Doug
e89659b69d ffi: Tidy up authentication.rs file.
(Nothing changed, just moving things around)
2024-06-24 10:56:04 +02:00
Doug
6d728be32d ffi: Split up AuthenticationError between ClientBuildError and a new OidcError. 2024-06-24 10:56:04 +02:00
Doug
5cbc803347 ffi: Refactor authentication_service.rs to authentication.rs 2024-06-24 10:56:04 +02:00
Doug
2d479e0177 ffi: Remove the AuthenticationService 2024-06-24 10:56:04 +02:00
Kévin Commaille
730c287201 chore: Fix new clippy nightly lints
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-06-23 20:20:09 +02:00
Andy Balaam
2b1bddb2f0 Merge pull request #3587 from matrix-org/doug/client-oidc-helpers
sdk: Move the OIDC helper methods from the FFI's `AuthenticationService` into `Client`
2024-06-21 10:14:35 +01:00
Doug
837cfaed48 sdk: Clarify InvalidState OIDC check and prepare abort method for the FFI. 2024-06-20 15:54:06 +01:00
Doug
655ced2c81 docs: Clarify some of the OIDC helper methods more. 2024-06-20 15:54:06 +01:00
Doug
748f40c250 sdk: Add ClientBuilder::requires_sliding_sync method. 2024-06-20 14:27:55 +02:00
Doug
8bf104c55e ffi: Add ClientBuilder::requires_sliding_sync method. 2024-06-20 14:27:55 +02:00
Doug
082dda0b24 sdk: Add the OIDC helper methods from the FFI. 2024-06-20 12:05:23 +01:00
Doug
735ae1ce75 ffi: Move OIDC logic into Client. 2024-06-19 18:17:27 +01:00
Mauro
306a9f7d3b Allow edit and reply to work also for events that have not yet been paginated (#3553)
Fixes #3538 

The current implementation for send_reply and edit only work with timeline items that have already been paginated.
However given the fact that by restoring drafts, we may restore a reply to an event for timeline where such event has not been paginated, sending such reply would fail (same for the edit event).

So I reworked a bit the code here to use. only the event id, and reuse the existing timeline if available, otherwise we can fetch the event and synthethise the content and still be able to successfully send the event.

This is the third part of the breakdown of the following PR: https://github.com/matrix-org/matrix-rust-sdk/pull/3439
2024-06-19 11:58:57 +02:00
Doug
304350ffd4 ffi: Expose room heroes (adding support for avatars). (#3503)
This PR makes 2 changes:
- Updates the storage of room heroes to be a single array containing the user's complete profile.
- Exposes these to the FFI so that client apps can use these for avatar colours/clusters.

Closes #2702 (again, now with avatars 🖼️)

---

* rooms: Store heroes as a complete user profile.

* ffi: Expose room heroes on Room and RoomInfo.

* chore: Remove TODO comment.

* Update crates/matrix-sdk-base/src/rooms/normal.rs

Signed-off-by: Benjamin Bouvier <public@benj.me>

---------

Signed-off-by: Benjamin Bouvier <public@benj.me>
Co-authored-by: Benjamin Bouvier <public@benj.me>
2024-06-18 10:10:09 +00:00
Benjamin Bouvier
f45098a61d send queue: flag unrecoverable errors, and don't block the queue on those 2024-06-17 17:15:07 +02:00
Timo
cb7814b362 MatrixRTC: bump ruma to be compatible with MSC4143.
Adapt types for the new ruma version.
2024-06-17 14:21:22 +02:00
Benjamin Bouvier
b1c09ed61b ffi: get rid of Timeline::latest_event()
It's unlikely to be useful as per the `Timeline` object: rather, callers
should make use of `Room::latest_event()`.
2024-06-13 16:28:40 +02:00
Ivan Enderlin
5178cbbfc7 Merge pull request #3551 from Hywan/fix-ui-roomlist-slidingsyncroom
feat(ui): `RoomListService::room` is no longer async!
2024-06-13 15:20:47 +02:00
Ivan Enderlin
edec6e7558 feat(ui): RoomListService::room is no longer async.
This patch makes `RoomListService::room` synchronous. It no longer reads
a `SlidingSyncRoom` from `SlidingSync`, then it not needs to be async
anymore. This patch replaces the `RwLock` of `RoomListService::rooms`
from `tokio::sync` to `std::sync`.

The patch updates all calls to `RoomListService::room` to remove the
`.await` point.
2024-06-13 14:47:43 +02:00
Ivan Enderlin
de5d80547b Merge pull request #3541 from Hywan/chore-ffi-roominfo-latest-event
chore(ffi): Remove `RoomInfo::latest_event`
2024-06-13 14:40:38 +02:00
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
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
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
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
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
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
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
66330a20b3 sdk: rename "sending queue" to "send queue" 2024-06-06 17:56:17 +02:00