diff --git a/bindings/matrix-sdk-ffi/src/api.udl b/bindings/matrix-sdk-ffi/src/api.udl index 6770e7de21f..2eec1d88ce1 100644 --- a/bindings/matrix-sdk-ffi/src/api.udl +++ b/bindings/matrix-sdk-ffi/src/api.udl @@ -147,43 +147,3 @@ callback interface SessionVerificationControllerDelegate { void did_cancel(); void did_finish(); }; - -enum RoomListState { - "Init", - "FirstRooms", - "AllRooms", - "CarryOn", - "Terminated", -}; - -callback interface RoomListStateListener { - void on_update(RoomListState state); -}; - -[Enum] -interface RoomListEntriesUpdate { - Append(sequence values); - Clear(); - PushFront(RoomListEntry value); - PushBack(RoomListEntry value); - PopFront(); - PopBack(); - Insert(u32 index, RoomListEntry value); - Set(u32 index, RoomListEntry value); - Remove(u32 index); - Reset(sequence values); -}; - -callback interface RoomListEntriesListener { - void on_update(RoomListEntriesUpdate room_entries_update); -}; - -[Enum] -interface RoomListInput { - Viewport(sequence ranges); -}; - -dictionary RoomListRange { - u32 start; - u32 end_inclusive; -}; diff --git a/bindings/matrix-sdk-ffi/src/lib.rs b/bindings/matrix-sdk-ffi/src/lib.rs index 302e1cecbf5..c4761c78d72 100644 --- a/bindings/matrix-sdk-ffi/src/lib.rs +++ b/bindings/matrix-sdk-ffi/src/lib.rs @@ -41,8 +41,8 @@ use async_compat::TOKIO1 as RUNTIME; use matrix_sdk::ruma::events::room::{message::RoomMessageEventContent, MediaSource}; use self::{ - client::*, error::ClientError, event::*, notification::*, platform::*, room_list::*, - session_verification::*, sliding_sync::*, task_handle::TaskHandle, timeline::MediaSourceExt, + client::*, error::ClientError, event::*, notification::*, platform::*, session_verification::*, + sliding_sync::*, task_handle::TaskHandle, timeline::MediaSourceExt, }; uniffi::include_scaffolding!("api"); diff --git a/bindings/matrix-sdk-ffi/src/room_list.rs b/bindings/matrix-sdk-ffi/src/room_list.rs index d9d3ceedf21..14126689248 100644 --- a/bindings/matrix-sdk-ffi/src/room_list.rs +++ b/bindings/matrix-sdk-ffi/src/room_list.rs @@ -54,11 +54,13 @@ impl From for RoomListError { } } +#[derive(uniffi::Record)] pub struct RoomListRange { pub start: u32, pub end_inclusive: u32, } +#[derive(uniffi::Enum)] pub enum RoomListInput { Viewport { ranges: Vec }, } @@ -142,7 +144,7 @@ pub struct RoomListEntriesResult { pub entries_stream: Arc, } -// Also declared in the UDL file. +#[derive(uniffi::Enum)] pub enum RoomListState { Init, FirstRooms, @@ -165,11 +167,12 @@ impl From for RoomListState { } } -// Also declared in the UDL file. +#[uniffi::export(callback_interface)] pub trait RoomListStateListener: Send + Sync + Debug { fn on_update(&self, state: RoomListState); } +#[derive(uniffi::Enum)] pub enum RoomListEntriesUpdate { Append { values: Vec }, Clear, @@ -208,7 +211,7 @@ impl From> for RoomListEntriesUpdate { } } -// Also declared in the UDL file. +#[uniffi::export(callback_interface)] pub trait RoomListEntriesListener: Send + Sync + Debug { fn on_update(&self, room_entries_update: RoomListEntriesUpdate); }