Commit Graph

6089 Commits

Author SHA1 Message Date
Ivan Enderlin
537f95b683 feat(sdk): SlidingSync::get_rooms? are now async. 2023-06-02 20:59:26 +02:00
Ivan Enderlin
dcad897084 test(ui): Ensure the timeline_limit is not reset. 2023-06-02 20:49:33 +02:00
Ivan Enderlin
e18728aa5f feat(ui): Set timeline_limit for all_rooms and visible_rooms. 2023-06-02 20:06:50 +02:00
Ivan Enderlin
8ee84be839 doc(ui): Write documentation for RoomList. 2023-06-02 20:06:31 +02:00
Ivan Enderlin
2f68c86796 feat(ui): Add the RoomList Input API.
This patch lands the first design of the `Input` API. An `Input` is
something external that can be understood by the `RoomList` state
machine. The first inpuput is `Viewport` to change the “viewport” of the
`RoomList`, which translates to the change of the ranges of one specific
Sliding Sync list.
2023-06-01 16:55:29 +02:00
Ivan Enderlin
13d38993f8 feat(sdk): Expose the Range and Ranges type in matrix_sdk::sliding_sync. 2023-06-01 16:52:16 +02:00
Ivan Enderlin
e2d2cf787d test(sdk): Fix according to previous commits. 2023-06-01 16:52:09 +02:00
Ivan Enderlin
f5c950c54a fix(ffi): Update according to last commits. 2023-06-01 15:58:58 +02:00
Ivan Enderlin
c2d082ca8d test(ui): Update the tests according to previous commits. 2023-06-01 15:58:12 +02:00
Ivan Enderlin
553b5c6db3 Merge pull request #1 from matrix-org/feat-ui-roomlist
Feat UI roomlist
2023-06-01 15:46:00 +02:00
Jonas Platte
5106255911 On-demand stream creation 2023-06-01 15:40:39 +02:00
Jonas Platte
58e8c0a7ac Fix warning 2023-06-01 15:34:13 +02:00
Jonas Platte
db0217d093 Box internally 2023-06-01 15:34:07 +02:00
Ivan Enderlin
048b054a65 feat(ui): Implement RoomList::update_entries_stream_filter.
This patch implements `RoomList::update_entries_stream_filter` which
allows to… change the… entries stream filter. This patch also provides a
test for that. How nice it is.
2023-06-01 14:55:53 +02:00
Ivan Enderlin
0a1c0547b4 test(ui): Add test to ensure RoomList::sync resumes from current state. 2023-06-01 14:18:47 +02:00
Ivan Enderlin
fbe1603190 feat(ui): Rethink the state machine of RoomList. 2023-06-01 14:06:02 +02:00
Ivan Enderlin
a090a070ee chore(cargo): Add missing EOF. 2023-06-01 10:08:59 +02:00
Ivan Enderlin
697c92beb1 test(ui): Test RoomList::entries_stream with more cases. 2023-06-01 09:48:54 +02:00
Ivan Enderlin
954d798ac3 test(ui): Write an assert_entries_stream macro. 2023-06-01 09:48:54 +02:00
Ivan Enderlin
a3c96dcb62 feat(ui): Implement RoomList::entries_stream. 2023-06-01 09:48:53 +02:00
Ivan Enderlin
1caa8b1aa6 chore(ui): Polish after the rebase. 2023-06-01 09:48:53 +02:00
Ivan Enderlin
4557c2a7b2 feat(ui): Add RoomList::entries.
This patch implements the `RoomList::entries` method, which allows
to get a stream of `VectorDiff` over the room list, and that can be
filtered.
2023-06-01 09:48:53 +02:00
Ivan Enderlin
f058c59582 feat(sdk): Add SlidingSyncList::room_list_filtered_stream.
This patch adds a new method on `SlidingSyncList` named
`room_list_filtered_stream`, which uses the new `eyeball-im-util` crate
with its new `FilteredSubscriber` type.
2023-06-01 09:48:53 +02:00
Ivan Enderlin
aa70c85e02 test(ui): Test RoomList sync from Init to Enjoy. 2023-06-01 09:48:53 +02:00
Ivan Enderlin
1173636b35 feat(ui): Add room_list::Error. 2023-06-01 09:48:53 +02:00
Ivan Enderlin
61f903a5a9 test(ui): Clean up a test. 2023-06-01 09:48:53 +02:00
Ivan Enderlin
4d6a6ac17f feat(ui) Add State::Terminated in RoomList. 2023-06-01 09:48:53 +02:00
Ivan Enderlin
26a764d9dd test(ui): Test all RoomList actions. 2023-06-01 09:48:53 +02:00
Ivan Enderlin
bd175d9f66 test(sdk): Store the sync-mode in SlidingSyncListInner only for tests. 2023-06-01 09:48:53 +02:00
Ivan Enderlin
f89060bbe9 chore(ui): Update after the rebase. 2023-06-01 09:48:53 +02:00
Ivan Enderlin
01366a08df !foo 2023-06-01 09:48:53 +02:00
Ivan Enderlin
4e07ac1c76 test(ui): Improve testability of RoomList. 2023-06-01 09:48:53 +02:00
Ivan Enderlin
d1708ececf feat(ui): Update according to the last patch. 2023-06-01 09:48:53 +02:00
Ivan Enderlin
4fa38d23d4 feat(sdk): SlidingSync has more non-blocking API.
This patch does several things.

First, `SlidingSync::on_list` is now async, and accept async closures.

Second, `SlidingSync::lists` and `::rooms` are behind an `AsyncRwLock`
instead of a `StdRwLock`. The rest of the patch updates the consequence
of this.
2023-06-01 09:48:53 +02:00
Ivan Enderlin
5f81d829c4 feat(ui): Create an Init state, and add state observer for RoomList. 2023-06-01 09:48:52 +02:00
Ivan Enderlin
92c3003535 !baz 2023-06-01 09:48:52 +02:00
Ivan Enderlin
f47c2ba125 !bar 2023-06-01 09:48:52 +02:00
Ivan Enderlin
7706b0096b !foo 2023-06-01 09:48:52 +02:00
Ivan Enderlin
5f58438389 feat(ui): Oh, a roomlist module. 2023-06-01 09:48:51 +02:00
Ivan Enderlin
81d158889a fix(sdk): Replace a panic by a log in Sliding Sync
fix(sdk): Replace a panic by a log in Sliding Sync
2023-06-01 09:47:50 +02:00
Ivan Enderlin
29346b11f3 test(ui): Use FutureExt::now_or_never instead of .await
test(ui): Use `FutureExt::now_or_never` instead of `.await`
2023-06-01 09:41:56 +02:00
Damir Jelić
036d9bf261 Add a test to check that the backup decryption works 2023-06-01 09:31:31 +02:00
Damir Jelić
811369ba28 Fix the argument order when decoding a PkMessage 2023-06-01 09:31:31 +02:00
Ivan Enderlin
06680a284a fix(sdk): Replace a panic by a log in Sliding Sync.
This patch replaces a panic (`Option::expect`) by a `tracing::error`
log.

Imagine the Sliding Sync proxy responds with the following payload:

```json
{
    "pos": …,
    "lists": {
        …: {
            "count": …,
            "ops": [
                {
                    "op": "INSERT",
                    "index": 0,
                    "room_id": !foo:bar.org",
                }
            ]
        }
    },
    "rooms": []
}
```

It's an invalid response, as it will update the room list entry (because
it's present in `lists.$list.ops`), but the room won't be created (it's
absent in the `rooms`).

This situation creates a panic in the patched code. We don't want to
crash if the server replies with invalid data.

Ultimately, we should check that the sync operations are valid regarding
the rooms' updates.
2023-06-01 09:18:20 +02:00
Ivan Enderlin
fbe8826159 test(ui): Use FutureExt::now_or_never instead of .await.
This patch uses `FutureExt::now_or_never` so that we don't wait on the
future to be resolved to get a result. If we have a bug in our code and
the test expects a value, the test will hang forever, which is not a
desired behavior. With `now_or_never`, this situation cannot happen.
2023-06-01 08:39:44 +02:00
Ivan Enderlin
c82c0e46be feat(sdk): Ensure SlidingSync::sync “drains” its internal channel
feat(sdk): Ensure `SlidingSync::sync` “drains” its internal channel
2023-05-31 18:08:06 +02:00
Ivan Enderlin
ae25ad557a Merge branch 'main' into fix-sdk-sliding-sync-drain-internal-channel 2023-05-31 17:34:48 +02:00
Jonas Platte
d27ae257ec ffi: Remove unnecessary Deref implementations 2023-05-31 17:32:46 +02:00
Ivan Enderlin
f9322c5de8 test(sdk): Ensure SlidingSync starts after it has been stopped manually
test(sdk): Ensure `SlidingSync` starts after it has been stopped manually
2023-05-31 17:30:56 +02:00
Ivan Enderlin
d0d23afa5c feat(sdk): Introduce SlidingSync::internal_channel_send_if_possible.
The only reason why a sender can fail to send a message is because there
is no receiver. In the current design of `SlidingSync`, there is only
one receiver active per sync-loop. Thus, calling `SlidingSync::add_list`
may fail if `sync` has not been started. Hence the need for a new
`internal_channel_send_if_possible` method which will never fail: it
will send a message is possible, otherwise it won't do anything.

This turns more functions infallible.
2023-05-31 16:53:03 +02:00