Commit Graph

30 Commits

Author SHA1 Message Date
Ivan Enderlin e62c47132e feat(ui): RoomListService::subscribe_to_rooms no longer has a settings argument.
This patch removes the `settings` argument of
`RoomListService::subscribe_to_rooms`. The settings were mostly composed
of:

* `required_state`: now shared with `all_rooms`, so that we are
  sure they are synced; except that `m.room.create` is added for
  subscriptions.
* `timeline_limit`: now defaults to 20.

This patch thus creates the `DEFAULT_REQUIRED_STATE` and
`DEFAULT_ROOM_SUBSCRIPTION_TIMELINE_LIMIT` constants.

Finally, this patch updates the tests, and updates all usages of
`subscribe_to_rooms`.
2024-10-22 14:55:10 +02:00
Benjamin Bouvier 8df5d655c0 feat(multiverse): add support to toggle a reaction on the last message of a room 2024-10-16 15:03:36 +02:00
Richard van der Hoff 4d472f6aed timeline: make SyncTimelineEvent fields private
... and add accessors instead.

I'm going to change the inner structure of `SyncTimelineEvent`, meaning that
access will have to be via an accessor in future. Let's start by making the
fields private, and use accessors where we previously used direct access.
2024-10-09 15:19:26 +01:00
Doug 93fce02606 chore: Update Ruma to add media caption methods.
fixup

fixup
2024-10-07 14:11:19 +02:00
Benjamin Bouvier 2408df8bf5 multiverse: highlight which rooms are DMs in the list 2024-09-12 14:58:59 +02:00
Ivan Enderlin be404f6666 feat(sdk): Subscribe to many rooms only via Sliding Sync.
This patch changes the `SlidingSync::subscribe_to_room` method to
`subscribe_to_rooms`. Note the plural form. It's now mandatory to
subscribe to a set of rooms. The idea is to avoid calling this method
repeatedly. Why? Because each time the method is called, it sends a
`SlidingSyncInternalMessage` of kind `SyncLoopSkipOverCurrentIteration`,
i.e. it cancels the in-flight sliding sync request, to start over with
a new one (with the new room subscription). A problem arises when the
async runtime (here, Tokio) is busy: in this case, the internal message
channel can be filled pretty easily because its size is 8. Messages
are not consumed as fast as they are inserted. By changing this API:
subscribing to multiple rooms will result in a single internal message,
instead of one per room.

Consequently, the rest of the patch moves the `subscribe` method of
`room_list_service::Room` to `room_list_service::RoomListService`
because it now concerns multiple rooms instead of a single one.
2024-08-09 11:58:59 +03:00
Ivan Enderlin ea9f79a006 feat(sdk): Remove SlidingSync::unsubscribe_from_room.
Simplified sliding sync no longer has the concept of unsubscribing from
a room. This patch removes this API.
2024-07-17 16:33:37 +02:00
Ivan Enderlin 66e02f39ef chore(sdk): Rename RoomInfoUpdate into RoomInfoNotableUpdate.
The patch renames `RoomInfoUpdate` to `RoomInfoNotableUpdate`.
The functions, methods or variables whose names start with
`roominfo_update(.*)`` are renamed `room_info_notable_update$1`.
2024-07-08 18:47:55 +02:00
Ivan Enderlin 99e284d8b0 Merge pull request #3585 from Hywan/feat-roomlist-sorting-2
feat(ui): Client-side sorting in `RoomList`
2024-07-03 13:07:00 +02:00
Benjamin Bouvier 2be846669e multiverse: add Events view
This allows seeing the events directly from the room event cache. I'm
hoping this will give us some interesting insights about duplicates,
among other things.
2024-07-03 11:30:52 +02:00
Ivan Enderlin 76477281c2 chore(labs): multiverse uses RoomList::entries_with_dynamic_controllers. 2024-07-03 09:20:25 +02:00
Ivan Enderlin 2c25103226 chore(labs): Update multiverse to the latest RoomList version. 2024-07-03 09:20:24 +02:00
Benjamin Bouvier a4098291af send queue: add a way to spawn tasks for all the rooms which had unsent events 2024-06-26 19:42:14 +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
Benjamin Bouvier 73f977986e sdk: use the cached computed display name in more places 2024-06-11 15:44:53 +02: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
Benjamin Bouvier 66330a20b3 sdk: rename "sending queue" to "send queue" 2024-06-06 17:56:17 +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 b88381a289 timeline: use the new sending queue mechanism to send and receive local echoes 2024-06-05 14:58:41 +02:00
Benjamin Bouvier bffcb26e7d multiverse: add support for sending messages and {en|dis}abling the sending queue 2024-06-03 17:42:30 +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
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
Benjamin Bouvier c8f6fe4f6d event cache/timeline: reuse the Paginator when running back-paginations (#3373)
* event cache: reuse the paginator internally

Fixes #3355.

* event cache: move the `pagination_token_notifier` into the `RoomPaginationData` as well

* event cache: introduce a `RoomPagination` API object and move code around

Only code motion. No changes in functionality.

* event cache: remove "paginate" (et al.) in `RoomPagination` method names

No changes in functionality, just renamings.

* event_cache/timeline: have the event cache handle restarting a back-pagination that failed under our feet

When a timeline reset happens while we're back-paginating, the event
cache method to run back pagination would return an success result
indicating that the pagination token disappeared. After thinking about
it, it's not the best API in the world; ideally, the backpagination
mechanism would restart automatically.

Now, this was handled in the timeline before, and the reason it was
handled there was because it was possible to back-paginate and ask for a
certain number of events. I've removed that feature, so that
back-pagination on a live timeline matches the capabilities of a
focused-timeline back-pagination: one can only ask for a given number of
*events*, not timeline items.

As a matter of fact, this simplifies the code a lot by removing many
data structures, that were also exposed (and unused, since recent
changes) in the FFI layer.

* Address review comments
2024-05-16 10:22:05 +02:00
Damir Jelić 6f2d8e0e50 chore: Fix some clippy warnings 2024-05-02 17:12:19 +02:00
Benjamin Bouvier 7856dab56d timeline: add support for a focus mode in the timeline
This introduces the `TimelineFocus`, a new enum to declare if the
timeline is "live" aka looking at events from sync and displaying them
as they come in, or focused on an event (e.g. after clicking a
permalink).

When in the second mode, the timeline can paginate forwards and
backwards, without interacting with the event cache (as this would
require some complicated reconciliation of known events with events
received from pagination, with no guarantee that those events are event
connected in whatever way).

An event-focused timeline will also show edits/reactions/redactions in
real-time (as the events are received from the sync), but will not show
new timeline items, be they for local echoes or events received from the
sync.
2024-04-23 19:02:27 +02:00
Benjamin Bouvier 7c68096237 multiverse: allow setting a proxy
This is handy when running mitmproxy on multiverse.
2024-04-11 16:45:05 +02:00
Benjamin Bouvier 4ad79d6d44 multiverse: hide the password by using rpassword to prompt it 2024-03-08 17:44:55 +01:00
Benjamin Bouvier e57a02fd91 multiverse: add support for backpagination 2024-03-08 17:37:26 +01:00
Benjamin Bouvier c41f7975b3 labs: turn rrrepl into a timeline client 2024-03-08 16:08:29 +01:00