mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-14 19:16:02 -04:00
Adds a `TimelineEventTypeFilter` enum that either returns only events whose event_type is included in a set of allowed event types, or all events but those whose event types are in a list of excluded event types. Also adds `TimelineEventTypeFilter` so the clients can use it to define those lists of event types, which are then converted to ruma `TimelineEventType` and used for filtering. --- * matrix-sdk-ui: add `TimelineEventTypeFilter` to filter timeline events by either including only those of some event types or all but the ones that match those event types. * ffi: add bindings to `TimelineEventTypeFilter` and `FilterTimelineEventType` so we can provide these event types from the FFI clients * Fix format * Fix tests * Fix format again (using nightly toolchain) * Remove `all_filter_...` functions as there is no right way to support it at the moment and they're just helpers * Improve tests * Make `TimelineEventFilterFn` public so it can be used in several layers. * Make `TimelineEventTypeFilter` a struct in the FFI layer * Add fns for creating a timeline with cache and event type filters * Remove dead code * Fix some review comments * ffi: create new timeline initialization APIs, modify existing ones. ui: make `Room::timeline()` return `None` if no timeline exists instead of lazily creating one. More details: - Added `init_timeline_with_builder` to `matrix_sdk_ui::room_list_service::Room` so a timeline can be initialized at will given a `TimelineBuilder`. - Create `is_timeline_initialized()` fns in both the ui and ffi layers to check the status of the timeline. - Make `matrix_sdk_ui::room_list_service::Room::timeline()` only return a timeline if it's already been initialized. - Create FFI functions to expose these UI ones. * Fix tests * Fix some review comments * Update bindings/matrix-sdk-ffi/src/room_list.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>