From 53ae4362f6c82eefa7f2b2aab127ccc342aa292b Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Thu, 15 Jun 2023 11:12:51 +0200 Subject: [PATCH] ffi: Remove unused public Rust API --- bindings/matrix-sdk-ffi/src/client.rs | 1 + bindings/matrix-sdk-ffi/src/event.rs | 2 +- bindings/matrix-sdk-ffi/src/lib.rs | 44 +++++++++------------ bindings/matrix-sdk-ffi/src/room.rs | 8 +++- bindings/matrix-sdk-ffi/src/room_list.rs | 2 +- bindings/matrix-sdk-ffi/src/sliding_sync.rs | 7 +++- bindings/matrix-sdk-ffi/src/timeline.rs | 5 --- 7 files changed, 33 insertions(+), 36 deletions(-) diff --git a/bindings/matrix-sdk-ffi/src/client.rs b/bindings/matrix-sdk-ffi/src/client.rs index dbb955da15b..72696a2eec5 100644 --- a/bindings/matrix-sdk-ffi/src/client.rs +++ b/bindings/matrix-sdk-ffi/src/client.rs @@ -722,6 +722,7 @@ impl From for Visibility { } } +#[allow(clippy::enum_variant_names)] pub enum RoomPreset { /// `join_rules` is set to `invite` and `history_visibility` is set to /// `shared`. diff --git a/bindings/matrix-sdk-ffi/src/event.rs b/bindings/matrix-sdk-ffi/src/event.rs index 750554ea219..eaf779e0143 100644 --- a/bindings/matrix-sdk-ffi/src/event.rs +++ b/bindings/matrix-sdk-ffi/src/event.rs @@ -5,7 +5,7 @@ use ruma::events::{ RedactedStateEventContent, StaticStateEventContent, SyncMessageLikeEvent, SyncStateEvent, }; -use crate::{ClientError, MembershipState, MessageType}; +use crate::{room_member::MembershipState, timeline::MessageType, ClientError}; pub struct TimelineEvent(pub(crate) AnySyncTimelineEvent); diff --git a/bindings/matrix-sdk-ffi/src/lib.rs b/bindings/matrix-sdk-ffi/src/lib.rs index b00f3b6728e..302e1cecbf5 100644 --- a/bindings/matrix-sdk-ffi/src/lib.rs +++ b/bindings/matrix-sdk-ffi/src/lib.rs @@ -20,40 +20,34 @@ macro_rules! unwrap_or_clone_arc_into_variant { }; } -mod platform; - -pub mod authentication_service; -pub mod client; -pub mod client_builder; +mod authentication_service; +mod client; +mod client_builder; mod error; -pub mod event; +mod event; mod helpers; -pub mod notification; -pub mod room; -pub mod room_list; -pub mod room_member; -pub mod session_verification; -pub mod sliding_sync; -pub mod task_handle; -pub mod timeline; -pub mod tracing; +mod notification; +mod platform; +mod room; +mod room_list; +mod room_member; +mod session_verification; +mod sliding_sync; +mod task_handle; +mod timeline; +mod tracing; use async_compat::TOKIO1 as RUNTIME; -pub use matrix_sdk::ruma::{api::client::account::register, UserId}; -pub use matrix_sdk_ui::timeline::PaginationOutcome; -pub use platform::*; +use matrix_sdk::ruma::events::room::{message::RoomMessageEventContent, MediaSource}; -// Re-exports for more convenient use inside other submodules -use self::error::ClientError; -pub use self::{ - authentication_service::*, client::*, event::*, notification::*, room::*, room_list::*, - room_member::*, session_verification::*, sliding_sync::*, task_handle::TaskHandle, timeline::*, - tracing::*, +use self::{ + client::*, error::ClientError, event::*, notification::*, platform::*, room_list::*, + session_verification::*, sliding_sync::*, task_handle::TaskHandle, timeline::MediaSourceExt, }; uniffi::include_scaffolding!("api"); #[uniffi::export] -pub fn sdk_git_sha() -> String { +fn sdk_git_sha() -> String { env!("VERGEN_GIT_SHA").to_owned() } diff --git a/bindings/matrix-sdk-ffi/src/room.rs b/bindings/matrix-sdk-ffi/src/room.rs index cfe56fec918..0ad02a266aa 100644 --- a/bindings/matrix-sdk-ffi/src/room.rs +++ b/bindings/matrix-sdk-ffi/src/room.rs @@ -33,8 +33,12 @@ use tracing::{error, info}; use super::RUNTIME; use crate::{ error::{ClientError, RoomError}, - AudioInfo, FileInfo, ImageInfo, RoomMember, TaskHandle, ThumbnailInfo, TimelineDiff, - TimelineItem, TimelineListener, VideoInfo, + room_member::RoomMember, + timeline::{ + AudioInfo, FileInfo, ImageInfo, ThumbnailInfo, TimelineDiff, TimelineItem, + TimelineListener, VideoInfo, + }, + TaskHandle, }; #[derive(uniffi::Enum)] diff --git a/bindings/matrix-sdk-ffi/src/room_list.rs b/bindings/matrix-sdk-ffi/src/room_list.rs index bfa3abffbf4..d9d3ceedf21 100644 --- a/bindings/matrix-sdk-ffi/src/room_list.rs +++ b/bindings/matrix-sdk-ffi/src/room_list.rs @@ -8,7 +8,7 @@ use futures_util::{pin_mut, StreamExt}; use ruma::RoomId; use crate::{ - Client, EventTimelineItem, Room, RoomListEntry, RoomSubscription, TaskHandle, + room::Room, timeline::EventTimelineItem, Client, RoomListEntry, RoomSubscription, TaskHandle, UnreadNotificationsCount, RUNTIME, }; diff --git a/bindings/matrix-sdk-ffi/src/sliding_sync.rs b/bindings/matrix-sdk-ffi/src/sliding_sync.rs index c7030acc547..a017303e239 100644 --- a/bindings/matrix-sdk-ffi/src/sliding_sync.rs +++ b/bindings/matrix-sdk-ffi/src/sliding_sync.rs @@ -22,8 +22,11 @@ use matrix_sdk_ui::timeline::SlidingSyncRoomExt; use tracing::{error, warn}; use crate::{ - error::ClientError, helpers::unwrap_or_clone_arc, room::TimelineLock, Client, - EventTimelineItem, Room, TaskHandle, TimelineDiff, TimelineItem, TimelineListener, RUNTIME, + error::ClientError, + helpers::unwrap_or_clone_arc, + room::{Room, TimelineLock}, + timeline::{EventTimelineItem, TimelineDiff, TimelineItem, TimelineListener}, + Client, TaskHandle, RUNTIME, }; #[derive(uniffi::Object)] diff --git a/bindings/matrix-sdk-ffi/src/timeline.rs b/bindings/matrix-sdk-ffi/src/timeline.rs index 68ef3138b7d..359ad9b77c5 100644 --- a/bindings/matrix-sdk-ffi/src/timeline.rs +++ b/bindings/matrix-sdk-ffi/src/timeline.rs @@ -180,11 +180,6 @@ pub struct SetData { pub item: Arc, } -pub struct MoveData { - pub old_index: u32, - pub new_index: u32, -} - #[derive(Clone, Copy, uniffi::Enum)] pub enum TimelineChange { Append,