mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-04-25 09:39:34 -04:00
fix(ffi): add Pop and Clear to VecDiff for sliding-sync
This commit is contained in:
@@ -82,9 +82,8 @@ interface SlidingSyncViewRoomsListDiff {
|
||||
u32 new_index
|
||||
);
|
||||
Push(RoomListEntry value);
|
||||
// The following are supported by the generic VecDiff-type but
|
||||
// in sliding sync effectively do not happen and thus aren't exposed
|
||||
// to not pollute the API: Pop(); Clear();
|
||||
Pop();
|
||||
Clear();
|
||||
};
|
||||
|
||||
callback interface SlidingSyncViewRoomListObserver {
|
||||
|
||||
@@ -216,6 +216,8 @@ pub enum SlidingSyncViewRoomsListDiff {
|
||||
RemoveAt { index: u32 },
|
||||
Move { old_index: u32, new_index: u32 },
|
||||
Push { value: RoomListEntry },
|
||||
Pop, // removes the last item
|
||||
Clear, // clears the list
|
||||
}
|
||||
|
||||
impl From<VecDiff<MatrixRoomEntry>> for SlidingSyncViewRoomsListDiff {
|
||||
@@ -242,7 +244,8 @@ impl From<VecDiff<MatrixRoomEntry>> for SlidingSyncViewRoomsListDiff {
|
||||
VecDiff::Push { value } => {
|
||||
SlidingSyncViewRoomsListDiff::Push { value: (&value).into() }
|
||||
}
|
||||
_ => unimplemented!("Clear and Pop aren't provided within sliding sync"),
|
||||
VecDiff::Pop {} => SlidingSyncViewRoomsListDiff::Pop,
|
||||
VecDiff::Clear {} => SlidingSyncViewRoomsListDiff::Clear,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user