Commit Graph

2231 Commits

Author SHA1 Message Date
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
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
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
Benjamin Bouvier
96824055f8 ffi: add new method to retrieve a timeline item by transaction id 2024-06-05 14:58:41 +02:00
Benjamin Bouvier
04befa3ab5 timeline: get rid of the Cancelled state
It was used after a previous local echo couldn't be sent (i.e. the
sending queue failed to send it). However, it was slightly incorrect to
mark those as cancelled, since those local echoes would still have
corresponding items in the sending queue, and would be retried as soon
as the sending queue was reenabled and could send events.

Instead, this is removed: it means that previously cancelled events
would be in the NotSentYet state, which is correct. (At the limit, we
could even get rid of the SendingFailed variant, since the sending queue
will automatically retry as soon as possible.)
2024-06-05 14:58:41 +02:00
Benjamin Bouvier
fd15333ba2 timeline: add a redact method to get rid of local or remote events 2024-06-05 14:58:41 +02:00
Benjamin Bouvier
fd9266e960 ffi: expose the abort handle after sending an event 2024-06-05 14:58:41 +02:00
Benjamin Bouvier
5ea7ef01e5 ffi: expose the global sending queue primitives 2024-06-05 14:58:41 +02:00
Benjamin Bouvier
b88381a289 timeline: use the new sending queue mechanism to send and receive local echoes 2024-06-05 14:58:41 +02:00
Benjamin Bouvier
3917ba67c9 ffi: add a reference to the FFI Client to the Encryption API object
By keeping a reference to the FFI Client, we make sure that the SDK
Client is dropped while in a tokio runtime context. This makes it
possible for an `Encryption` (FFI) object to outlive the `Client` (FFI)
object without crashing (because deadpool requires to be in a tokio
runtime context when dropping).
2024-06-05 13:48:39 +02:00
Benjamin Bouvier
c1030562c3 authentication service: inline details_from_client() 2024-06-05 13:48:39 +02:00
Benjamin Bouvier
e6185b3827 authentication service(ffi): don't set the base_path for the temporary discovery client
Following https://github.com/matrix-org/matrix-rust-sdk/pull/3473, we
made it so that if there's a base-path but no username, then we'll
create a sqlite database.

Unfortunately, this introduced a bad side-effect: for the temporary
client used during homeserver resolution, this would create a temporary
sqlite database.

The "fix" is to not set the base path for the temporary client, and only
for the other caller of `new_client_builder()`, manually. The long term
fix is to get rid of the `AuthenticationService` so we can test it
properly.
2024-06-05 13:48:39 +02:00
Benjamin Bouvier
13df762dc1 ffi: add more logs related to the path in the client builder 2024-06-05 13:48:39 +02:00
Benjamin Bouvier
9d46da9f11 clippy: fix additional errors
We should investigate why some errors were not found in CI tasks,
though.
2024-06-05 09:34:31 +02:00
Marco Antonio Alvarez
dadca42776 expose sticker source field
Signed-off-by: Marco Antonio Alvarez <surakin@gmail.com>

go back to old ruma rev
2024-06-04 15:18:04 +02:00
Benjamin Bouvier
4ec34ad25d ffi: get rid of get_timeline_event_content_by_event_id
This can be equivalently retrieved using:

`get_timeline_event_by_event_id(event_id).content().as_message()?.content()`

As per the commit date, this is used in one place in both EXA and EXI,
so it seems fine to change the caller's call sites.

And this avoids one explicit call site of
`Timeline::item_by_event_id()`.
2024-06-03 15:28:17 +02:00
Benjamin Bouvier
6012c7d98b chore: remove unused dependencies
Thanks cargo-machete.
2024-05-31 17:26:57 +02:00
Stefan Ceriu
61440c3561 ffi: enable panic logging for all supported platforms not only android 2024-05-31 09:06:24 +02:00
Kévin Commaille
0db486b511 crypto: Add SasState::Created variant
To differentiate the SAS state between the party
that sent the verification start and the party that received it.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-05-30 12:09:46 +02:00
Stefan Ceriu
7551d87384 feat: add support for m.call.notify events in the timeline and as a last room message 2024-05-30 11:27:30 +02:00
Damir Jelić
3ac598666a bindings: Remove the InvalidQrCode error variant for the QR login error type. (#3481)
We have a separate error for the QR code decoding method.
2024-05-29 14:40:22 +02:00
Damir Jelić
1380af4f00 bindings: Even more precise errors for the QR code login 2024-05-29 13:45:55 +02:00
Damir Jelić
ab08f5e095 bindings(qr): Add an error variant for when the other device is not signed in 2024-05-29 13:45:55 +02:00
Damir Jelić
59d1f349b5 bindings: Expose the method to log in the client using a QR code
Co-authored-by: Benjamin Bouvier <public@benj.me>
2024-05-29 08:59:23 +02:00
Damir Jelić
3dbf8a07bd bindings: Move the OIDC metadata validation method into a TryInto method 2024-05-29 08:59:23 +02:00
Ivan Enderlin
eddaf961a1 Merge pull request #3462 from matrix-org/valere/binding_ffi_crypto_expose_clear_caches
FFI Bindings: Expose CryptoStore clear caches
2024-05-28 10:50:27 +02:00