Commit Graph

8933 Commits

Author SHA1 Message Date
Damir Jelić
3dbf8a07bd bindings: Move the OIDC metadata validation method into a TryInto method 2024-05-29 08:59:23 +02:00
Benjamin Bouvier
392fd004d9 Revert "feat(sdk): Add RoomPagination::run_backwards(…, until)" 2024-05-28 18:30:43 +02:00
Ivan Enderlin
72314f1014 feat(sdk): Add RoomPagination::run_backwards(…, until)
feat(sdk): Add `RoomPagination::run_backwards(…, until)`
2024-05-28 16:03:17 +02:00
Ivan Enderlin
9a1de1d9e8 test(sdk): Improve tests around RoomPagination::run_backwards. 2024-05-28 15:43:01 +02:00
Damir Jelić
7dd08c3b81 Add an example for the QR code login 2024-05-28 12:43:49 +02:00
Damir Jelić
e6dc24a914 feat: Add support to log in using a QR code
This implements one part of MSC4108[1], it implements the case where the
new device scans the QR code.

[1]: https://github.com/matrix-org/matrix-spec-proposals/pull/4108
2024-05-28 12:43:49 +02:00
Damir Jelić
05f9f85d2d Make errors public 2024-05-28 12:43:49 +02:00
Damir Jelić
96c5515b04 Add a method to ensure device keys are uploaded 2024-05-28 12:43:49 +02:00
Damir Jelić
e94b40a75f chore: Add the import secrets bundle method 2024-05-28 12:43:49 +02:00
Damir Jelić
dc60c1ee10 chore: Allow setting a custom vodozemac account 2024-05-28 12:43:49 +02:00
Damir Jelić
3e6347cd48 chore: Create a subdirectory for authentication 2024-05-28 12:43:49 +02:00
Ivan Enderlin
7377971da8 test(sdk): Ensure that until can trigger multiple iterations.
This patch adds a test for `until` when it returns
`ControlFlow::Continue` multiple times instead of `ControlFlow::Break`
immediately.
2024-05-28 11:34:05 +02:00
Ivan Enderlin
13df5d9db8 feat(sdk): Add TimelineHasBeenResetWhilePaginating.
This patch adds a new argument to the `until` argument closure of
`RoomPagination::run_backwards`: `timeline_has_been_reset`, which
designates when the timeline has been reset.

A test has been updated accordingly.
2024-05-28 11:32:24 +02:00
Ivan Enderlin
664a64b3f3 feat(sdk): Improve RoomEventCacheUpdate (#3471)
* chore(sdk): Rename `RoomEventCacheUpdate::UpdateReadMarker`.

This patch renames `RoomEventCacheUpdate::UpdateReadMarker` to
`ReadMarker`. The `Update` prefix is already part of the enum name.

* feat(sdk): Rename `RoomEventCacheUpdate::ReadMarker::event_id` to `move_to`.

This patch renames `RoomEventCacheUpdate::ReadMarker::event_id` to
`ReadMarker::move_to` as I feel like it conveys a better semantics.

* feat(sdk): Extract `RoomEventCacheUpdate::Append::ambiguity_changes`.

This patch extracts `RoomEventCacheUpdate::Append::ambiguity_changes`
into a new variant `RoomEventCacheUpdate::Members { ambiguity_changes }
`.

This patch also creates a new private
`RoomEventCacheInner::send_grouped_updates_for_events` method to ensure
the updates are sent in a particular order.

* feat(sdk): Rename `RoomEventCacheUpdate::Append`.

This patch renames `RoomEventCacheUpdate::Append` to `SyncEvents`. The
field `events` is renamed `timeline`.

This patch also renames some variables to clarify the code and to match
the renamings in `RoomEventCacheUpdate`.

* feat(sdk): Rename `RoomEventCacheUpdate::ReadMarker` and `Members`.

This patch renames `ReadMarker { move_to: … }` to `MoveReaderMarkerTo
{ event_id: … }`.

This patch also renames `Members` to `UpdateMembers`.

Finally, this patch renames some other variables to avoid clashes with
terminology in `matrix_sdk_ui`.

* feat(sdk): Split `RoomEventCacheUpdate::SyncEvents`.

This patch splits `RoomEventCacheUpdate::SyncEvents` into 2 new variants:
`AddTimelineEvents` and `AddEphemeralEvents`.

This patch takes this opportunity to update `matrix_sdk_ui::timeline`
a little bit too. `handle_sync_events` is renamed
`handle_ephemeral_events`, and the `SyncTimelineEvent` argument is
removed: it's possible to use `add_events_at` directly to handle the
`SyncTimelineEvent`s.

* fix(sdk): Do not send `RoomEventCacheUpdate` if values are empty.

This patch prevents sending useless `RoomEventCacheUdpate` if their
respective values are empty.

* chore(ui): Update a log message.

* Apply suggestions from code review

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-05-28 09:26:38 +00:00
Ivan Enderlin
6c90f7aaff feat(sdk): Add RoomPagination::run_backwards(…, until).
This patch adds a new argument to `RoomPagination::run_backwards`:
`until`. It becomes:

    pub async fn run_backwards<F, B, Fut>(&self,
        batch_size: u16,
        mut until: F
    ) -> Result<B>
    where
        F: FnMut(BackPaginationOutcome) -> Fut,
        Fut: Future<Output = ControlFlow<B, ()>>,

The idea behind `until` is to run pagination _until_ `until` returns
`ControlFlow::Break`, otherwise it continues paginating.

This is useful is many scenearii (cf. the documentation). This is
also and primarily the first step to stop adding events directly from
the pagination, and starts adding events only and strictly only from
`event_cache::RoomEventCacheUpdate` (again, see the `TODO` in the
documentation). This is not done in this patch for the sake of ease
of review.
2024-05-28 10:55:13 +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
matrix-sdk-crypto-ffi-0.4.2
2024-05-28 10:50:27 +02:00
Valere
0e456cded2 review: cargo fmt 2024-05-27 16:14:49 +02:00
Valere
a042b3d409 FFI Bindings: Review, remove runtime block_on, use await
Co-authored-by: Ivan Enderlin <ivan@mnt.io>
Signed-off-by: Valere <bill.carson@valrsoft.com>
2024-05-27 12:49:59 +02:00
Ivan Enderlin
16891ff937 feat(sdk): Mutation-based testing and property-based testing for LinkedChunk
feat(sdk): Mutation-based testing and property-based testing for `LinkedChunk`
2024-05-27 11:35:49 +02:00
Benjamin Bouvier
70403b5d9a nit: address typo
Signed-off-by: Benjamin Bouvier <public@benj.me>
2024-05-27 10:32:19 +02:00
Benjamin Bouvier
6a8dd30f26 fixup! rooms: use the heroes names if provided to compute the display name 2024-05-27 10:32:19 +02:00
Benjamin Bouvier
75d6a048b9 room names: better handle the unfortunate case where there are no heroes 2024-05-27 10:32:19 +02:00
Benjamin Bouvier
d186e735d3 rooms: use the heroes names if provided to compute the display name 2024-05-27 10:32:19 +02:00
Benjamin Bouvier
75c4cebdb6 sliding sync: also save the heroes' names from sync 2024-05-27 10:32:19 +02:00
Benjamin Bouvier
56be9d5461 sdk-base: store heroes as OwnedUserIds in our own RoomSummary
This is the right goal, and Ruma will be updated to reflect that the
`heroes` field should contain `OwnedUserId` too in [1].

This simplifies the code a bit, and avoids a round-trip encoding
user-ids into a string then decoding them from a string later, in the
case of sliding sync and room name computation.

[1] https://github.com/ruma/ruma/pull/1822
2024-05-27 10:32:19 +02:00
Benjamin Bouvier
2851a42fed sliding sync: save UserIds in the room_summary.heroes field 2024-05-27 10:32:19 +02:00
Benjamin Bouvier
58cbc0ffaa multiverse: add support for room names
Since rendering is sync, and I want the computed display name (which
retrieval is async), I have to fetch the display name early, just after
getting the room. Oh well :)
2024-05-27 10:32:19 +02:00
Ivan Enderlin
93fa01f7f5 feat(ui): Enable include_heroes for all_rooms and visible_rooms. 2024-05-27 10:32:19 +02:00
Ivan Enderlin
4892fce37c feat(sdk): Add include_heroes as a sticky parameter for SlidingSyncList. 2024-05-27 10:32:19 +02:00
Ivan Enderlin
cedcda5372 feat(base+ffi): SlidingSync consumes heroes from a response.
This patch does 3 things:

1. It updates Ruma to the latest revision at the time of writing,
2. It updates `matrix-sdk-ffi` to provide the
   `RoomSubscription::include_heroes` field,
3. It updates `matrix-sdk-base` so that SlidingSync consumes `heroes`
   from the response and update the `RoomSummary` accordingly.

A test has been added to ensure the `RoomSummary` is updated as expected.
2024-05-27 10:32:19 +02:00
Ivan Enderlin
78433d3dc7 test(sdk): Do not run proptest on wasm32. 2024-05-27 10:05:43 +02:00
Ivan Enderlin
db9e6518ed Merge pull request #3463 from matrix-org/valere/fix_up_crypto_0.7.1_release_branch_not_merged
chore(crypto): Fixup version and changelog from patch release
2024-05-27 09:44:01 +02:00
Ivan Enderlin
4c9398f6bd test(sdk): Use property-based testing to test AsVector.
This patch adds property-based testing to test `AsVector`. In this case
it works pretty well.
2024-05-27 09:21:43 +02:00
Ivan Enderlin
3ef8cb2f92 chore(sdk): Add missing derive(Debug). 2024-05-27 09:21:43 +02:00
Ivan Enderlin
bbe9d75bd6 fix(sdk): Drain Updates when building AsVector.
This patch fixes a bug found with the `as_vector` fuzz test where the
`Updates` weren't drained when building `AsVector`.
2024-05-27 09:21:43 +02:00
Ivan Enderlin
8d6f88f612 test(sdk) Add a test for Chunk::is_first_chunk and Chunk::is_last_chunk.
This patch is testing two more methods on `Chunk`: `is_first_chunk` and
`is_last_chunk`. It's been detected by a mutant with `cargo-mutants`.
2024-05-27 09:21:40 +02:00
Valere
8cf52972bb ffi-crypto-bindings: Improve comments 2024-05-24 16:13:31 +02:00
Valere
e99b67c281 chore(crypto): Fixup version and changelog from patch release 2024-05-24 16:03:03 +02:00
Valere
1985eede8f Changelog: Update crypto crate changelog 2024-05-24 15:09:31 +02:00
Valere
0f5f71f07a FFI Bindings: Expose CryptoStore clear caches 2024-05-24 14:59:35 +02:00
Richard van der Hoff
1dc370942b Merge pull request #3456 from matrix-org/rav/fix_fix_backup_import
crypto: Wire up `save_inbound_group_sessions` to `room_keys_received` stream
2024-05-24 10:32:49 +01:00
Benjamin Bouvier
e0d7f4d9c6 timeline: make live_back_pagination_status available only on live timelines
It doesn't make sense to expose it for a focused timeline.

Note there's no way for timeline to change focus, at the moment; this
would require special handling here, because one could subscribe to the
back pagination status on a live timeline first, then switch the
timeline to the focus mode. The stream wrapper could then observe other
states that aren't expected by the converter method.
2024-05-24 11:21:34 +02:00
Benjamin Bouvier
aebfaf58a3 timeline: reintroduce a custom pagination status that indicates if we've hit the timeline start
This is actually required for one use case: if the event cache triggers
back-pagination in the background *before* a timeline is opened, it's
possible the timeline observes pagination is running at the beginning,
and doesn't know if more back-pagination is required or not.

This wraps the `Paginator::status` stream by reading the
hit_timeline_start() from the room pagination and adding it to the
`Idle` state.
2024-05-24 11:21:34 +02:00
Benjamin Bouvier
0d4c5c7f49 paginator: add a method to retrieve the current pagination status
i.e. did we hit the timeline start/end, after paginating sufficiently?
2024-05-24 11:21:34 +02:00
Damir Jelić
2de2bc658c feat(sdk): Return the Curve25519Public key type instead of a string (#3450) 2024-05-24 11:17:56 +02:00
Damir Jelić
15c4ba2fb9 feat(crypto): Allow the explicit upload of the device keys (#3457) 2024-05-24 11:15:33 +02:00
Damir Jelić
bb05b904cf feat(crypto): Allow the creation of an OlmMachine using a custom Account (#3451) 2024-05-24 10:54:21 +02:00
Damir Jelić
110d67cc62 feat(crypto): If available, sign the new device keys using the cross-signing keys (#3453) 2024-05-24 10:38:43 +02:00
Stefan Ceriu
03069f7acf fix: fix what permissions get_element_call_required_permissions returns and have them match what Element Call actually expects 2024-05-24 10:25:04 +02:00
Johannes Marbach
f7aee0ee36 Update JS bindings link
Signed-off-by: Johannes Marbach <johannesm@element.io>
2024-05-23 19:54:47 +02:00