Skip to content

Commit

Permalink
ffi: Remove room list from UDL
Browse files Browse the repository at this point in the history
  • Loading branch information
jplatte committed Jun 15, 2023
1 parent 53ae436 commit daf5935
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 45 deletions.
40 changes: 0 additions & 40 deletions bindings/matrix-sdk-ffi/src/api.udl
Original file line number Diff line number Diff line change
Expand Up @@ -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<RoomListEntry> 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<RoomListEntry> values);
};

callback interface RoomListEntriesListener {
void on_update(RoomListEntriesUpdate room_entries_update);
};

[Enum]
interface RoomListInput {
Viewport(sequence<RoomListRange> ranges);
};

dictionary RoomListRange {
u32 start;
u32 end_inclusive;
};
4 changes: 2 additions & 2 deletions bindings/matrix-sdk-ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
9 changes: 6 additions & 3 deletions bindings/matrix-sdk-ffi/src/room_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ impl From<ruma::IdParseError> for RoomListError {
}
}

#[derive(uniffi::Record)]
pub struct RoomListRange {
pub start: u32,
pub end_inclusive: u32,
}

#[derive(uniffi::Enum)]
pub enum RoomListInput {
Viewport { ranges: Vec<RoomListRange> },
}
Expand Down Expand Up @@ -142,7 +144,7 @@ pub struct RoomListEntriesResult {
pub entries_stream: Arc<TaskHandle>,
}

// Also declared in the UDL file.
#[derive(uniffi::Enum)]
pub enum RoomListState {
Init,
FirstRooms,
Expand All @@ -165,11 +167,12 @@ impl From<matrix_sdk_ui::room_list::State> 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<RoomListEntry> },
Clear,
Expand Down Expand Up @@ -208,7 +211,7 @@ impl From<VectorDiff<matrix_sdk::RoomListEntry>> 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);
}
Expand Down

0 comments on commit daf5935

Please sign in to comment.