Commit Graph

13223 Commits

Author SHA1 Message Date
Ivan Enderlin 3547bd2f54 feat(ffi): Implement RoomList API
feat(ffi): Implement `RoomList` API
2023-06-13 01:23:24 +02:00
Ivan Enderlin 742ccea5ef doc(ffi): Fix a typo. 2023-06-13 00:37:14 +02:00
Ivan Enderlin 0233d65f02 In sliding sync, do all the same processing on an invited room as a joined one
In sliding sync, do all the same processing on an invited room as a joined one
2023-06-13 00:28:11 +02:00
Ivan Enderlin c65e98895a test(ui): Fix a test. 2023-06-13 00:27:26 +02:00
Ivan Enderlin d5211445a5 chore: Make Clippy happy. 2023-06-13 00:21:50 +02:00
Ivan Enderlin 235efaa85c fix(ffi): Do not overwrite Client's sliding_sync_proxy everytime.
The comment explains the fix correctly.
2023-06-13 00:12:41 +02:00
Ivan Enderlin b85dff347a chore(ffi): Simplify code and remove one method. 2023-06-12 23:36:35 +02:00
Ivan Enderlin dec1129106 chore(ffi): Remove Client::sliding_sync_proxy.
Instead of storing `sliding_sync_proxy` inside the `Client`, this patch
updates the code to store it inside `matrix_sdk::Client` directly.

That way, there is unique place where to store the sliding sync proxy
URL.
2023-06-12 23:29:23 +02:00
Ivan Enderlin 9bcc50fe2f feat(sdk): Client::sliding_sync_proxy is a StdRwLock.
This patch changes `matrix_sdk::Client::sliding_sync_proxy` to be a
`std::sync::RwLock<Option<Url>>` instead of `tokio::sync::RwLock<_>`.
It means that all methods reading or writing this field are sync instead
of async, which makes the code a lot more easier. Having an async-aware
lock wasn't necessary here.
2023-06-12 23:15:03 +02:00
Ivan Enderlin 7636a069b7 fix(ffi): Rollback how Sliding Sync proxy URL is computed.
I guess I know what's happening but I rollback some previous commits to
be sure it comes back on track.
2023-06-12 17:07:59 +02:00
Ivan Enderlin 8f102af801 chore: Make Clippy happy. 2023-06-12 16:47:22 +02:00
Ivan Enderlin 069743f3e1 feat(sdk): Change how Client::sliding_sync_proxy is represented. 2023-06-12 16:47:22 +02:00
Ivan Enderlin 38f8ebb6b9 feat(ffi): Add ability to force a Sliding Sync proxy URL from a restored session. 2023-06-12 16:47:22 +02:00
Andy Balaam f6d707cce8 Merge main into andybalaam/sliding-sync-process-unify-invited (using imerge) 2023-06-12 13:40:07 +01:00
Jonas Platte f883826db0 ffi: Add Room::cancel_send 2023-06-12 14:20:51 +02:00
Jonas Platte 4541ef6b90 sdk: Add Timeline::cancel_send 2023-06-12 14:20:51 +02:00
Benjamin Bouvier 29ddeb45d9 feat(sdk): implement sticky parameters (#1948)
* chore: add comments explaining what the position markers are
* feat(sdk): add scaffolding for sticky parameters
* test(sdk): add tests for the sticky parameters API
* feat(sdk): include the bump_event_types in the sticky parameters
* WIP: add TODO comments for deeply nested sticky parameters
* test(sdk): add extra test for sticky parameters
* feat: add extensions in the sticky parameters + test request generation + test since token
* chore: fix merge + get rid of unused inner extensions
* feat: use sticky parameters for lists too
* chore: Introduce the StickyManager, a reusable way to manage per-data sticky parameters
* chore: move the sticky scaffolding to its own module
* chore: clippy + fmt
* chore: get rid of `update_to_device_token`
* review: append SlidingSync prefix to Stick* data structures
* address review comments
* Replace nbsp with regular space
* Get rid of a write-access to a lock (because thanks inner mutability!)
* Add an integration test when losing `pos` in sticky parameters, and avoid `block_on`

Signed-off-by: Benjamin Bouvier <public@benj.me>
2023-06-12 10:46:13 +00:00
Ivan Enderlin 790dc47fca feat(ffi): Make RoomList.room non-async. 2023-06-12 12:41:12 +02:00
Ivan Enderlin 199f5708c0 chore(sdk): Tidy sliding sync processing code
Tidy sliding sync processing code
2023-06-12 11:37:40 +02:00
Andy Balaam f4aed74fb1 Fix formatting 2023-06-12 09:50:04 +01:00
Andy Balaam 323aaffe34 Merge main into andybalaam/sliding-sync-process-tidy (using imerge) 2023-06-12 09:37:37 +01:00
Andy Balaam 9a5291b2a9 Test canonical aliases in invited rooms via sliding sync 2023-06-12 10:34:04 +02:00
Andy Balaam 1e24542dd3 Handle required state in invited rooms as well as normal 2023-06-12 10:34:04 +02:00
Andy Balaam dcd5a27a2f Rename room_to_add->room_to_store 2023-06-12 10:34:04 +02:00
Andy Balaam dafee483fa Refactor process_sliding_sync to extract a method for dealing with rooms 2023-06-12 10:34:04 +02:00
Andy Balaam 0b4fba81d8 Test for adding an invited room to the client and invite list 2023-06-12 10:34:04 +02:00
Andy Balaam 34a56a70a0 Test for finding avatars in invite rooms 2023-06-12 10:34:04 +02:00
Andy Balaam 76a7ad0cbf Test for finding an avatar in a room via sliding sync 2023-06-12 10:34:04 +02:00
Ivan Enderlin 81628d15b8 doc(ffi): Fix a link. 2023-06-12 10:06:57 +02:00
Ivan Enderlin 39a4d039dd chore(ffi): Remove ability to use a custom sliding sync proxy URL. 2023-06-12 09:58:33 +02:00
Ivan Enderlin d24a1d8d6d feat(ui): Update the Sliding Sync proxy URL when creating RoomList. 2023-06-12 09:21:08 +02:00
Ivan Enderlin 2f433138dd chore(ffi): Make Clippy happy. 2023-06-12 09:07:39 +02:00
Ivan Enderlin 6301f32ee5 chore(ffi): Rename RoomListRoom to RoomListItem. 2023-06-12 09:07:39 +02:00
Ivan Enderlin 7ae8ee14eb feat(ffi): RoomListRoom::name and ::latest_event are non-async. 2023-06-12 09:07:39 +02:00
Ivan Enderlin 070965fc87 feat(ffi): Implement RoomList::rooms.
This patch implements `RoomList::rooms` to fetch one room. The type
name is `RoomListRoom` to avoid any collision with an existing `Room`
type already.

`RoomListRoom` implements `name`, `timeline` and `latest_event`.
2023-06-12 09:07:39 +02:00
Ivan Enderlin e2480be47f feat(ffi): Make RoomList::entries async.
Because we can!
2023-06-12 09:07:39 +02:00
Ivan Enderlin cb51c766a8 feat(ffi): Rename “observer” to “listener”. 2023-06-12 09:07:39 +02:00
Ivan Enderlin 68c19f4129 feat(ffi): First step for RoomList in FFI bindings. 2023-06-12 09:07:39 +02:00
Ivan Enderlin 5416ba06f5 feat(ui): Merge RoomList::state and RoomList::state_stream.
By returning a `Subscriber`, one can call `Subscriber::get` to get the
inner value. Thus, having `state` and `state_stream` is useless. It's
possible to return have `state` which returns `Subscriber`, and we get
one value for two usages.
2023-06-12 09:07:39 +02:00
Ivan Enderlin 623332b931 feat(ffi): Extract TaskHandle into itw own module. 2023-06-12 09:07:39 +02:00
Ivan Enderlin d4e983e559 feat(ui): Rename State::Enjoy to State::CarryOn. 2023-06-12 09:07:39 +02:00
Mauro 6444848511 docs: updated readme - rust version (#2047)
* docs: update readme
* removing error
2023-06-09 13:16:09 +00:00
Andy Balaam 11adcf425c In sliding sync, do all the same processing on an invited room as a joined one
The example in MSC3575 shows a room with invite_state property, but also
timeline, joined_count etc. properties. That may or may not be very
likely in practice, but I think it makes sense to check for all these
properties even when the room is an invite, and use them if they are
present.
2023-06-09 13:25:04 +01:00
Andy Balaam 7e197ec8d4 Simplify invited room sliding sync processing
Added some comments based on my understanding of MSC3575. Previously we
had a FIXME about how we were setting the room state to invite or join
based on the presence or absence of the invite_state property. I think
this behaviour is correct, so I added some comments explaining why.

The functional change here is to note that we call
store.get_or_create_stripped_room to find/create the stripped room, and
this actually deletes any room of this ID that is in the store, so our
later call to store.get_room would always fall back to getting the
stripped room, which we already have, so there was no need to do the
get_room call at all.
2023-06-09 13:14:58 +01:00
Andy Balaam 9d943e7c62 Clarify in tests that invite_state contains very minimal JSON 2023-06-09 13:14:58 +01:00
Andy Balaam 8c2cc522bc Test canonical aliases in invited rooms via sliding sync 2023-06-09 12:54:43 +01:00
Andy Balaam 4a04c70c45 Handle required state in invited rooms as well as normal 2023-06-09 12:54:43 +01:00
Andy Balaam ee8f94cb95 Rename room_to_add->room_to_store 2023-06-09 12:54:43 +01:00
Andy Balaam 24ff62befc Refactor process_sliding_sync to extract a method for dealing with rooms 2023-06-09 12:54:43 +01:00
Andy Balaam a85c481368 Test for adding an invited room to the client and invite list 2023-06-09 12:52:26 +01:00