From 9f90b6d4a8fa1c454a470f7cadbd8681eab8666c Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Fri, 30 Jun 2023 19:46:10 +0200 Subject: [PATCH] chore(ui): Rename `room_list` module to `room_list_service`. --- bindings/matrix-sdk-ffi/src/room_list.rs | 26 +++++++------- crates/matrix-sdk-ui/src/lib.rs | 4 +-- .../{room_list => room_list_service}/mod.rs | 1 - .../{room_list => room_list_service}/room.rs | 0 .../room_list.rs | 0 .../{room_list => room_list_service}/state.rs | 0 .../matrix-sdk-ui/tests/integration/main.rs | 2 +- .../{room_list.rs => room_list_service.rs} | 34 +++++++++---------- 8 files changed, 33 insertions(+), 34 deletions(-) rename crates/matrix-sdk-ui/src/{room_list => room_list_service}/mod.rs (99%) rename crates/matrix-sdk-ui/src/{room_list => room_list_service}/room.rs (100%) rename crates/matrix-sdk-ui/src/{room_list => room_list_service}/room_list.rs (100%) rename crates/matrix-sdk-ui/src/{room_list => room_list_service}/state.rs (100%) rename crates/matrix-sdk-ui/tests/integration/{room_list.rs => room_list_service.rs} (98%) diff --git a/bindings/matrix-sdk-ffi/src/room_list.rs b/bindings/matrix-sdk-ffi/src/room_list.rs index 5010d3227..14b2dc353 100644 --- a/bindings/matrix-sdk-ffi/src/room_list.rs +++ b/bindings/matrix-sdk-ffi/src/room_list.rs @@ -57,9 +57,9 @@ pub enum RoomListError { InvalidRoomId { error: String }, } -impl From for RoomListError { - fn from(value: matrix_sdk_ui::room_list::Error) -> Self { - use matrix_sdk_ui::room_list::Error::*; +impl From for RoomListError { + fn from(value: matrix_sdk_ui::room_list_service::Error) -> Self { + use matrix_sdk_ui::room_list_service::Error::*; match value { SlidingSync(error) => Self::SlidingSync { error: error.to_string() }, @@ -87,7 +87,7 @@ pub enum RoomListInput { Viewport { ranges: Vec }, } -impl From for matrix_sdk_ui::room_list::Input { +impl From for matrix_sdk_ui::room_list_service::Input { fn from(value: RoomListInput) -> Self { match value { RoomListInput::Viewport { ranges } => Self::Viewport( @@ -122,7 +122,7 @@ impl RoomListService { } fn is_syncing(&self) -> bool { - use matrix_sdk_ui::room_list::State; + use matrix_sdk_ui::room_list_service::State; matches!(self.inner.state().get(), State::SettingUp | State::Running) } @@ -172,7 +172,7 @@ impl RoomListService { #[derive(uniffi::Object)] pub struct RoomList { room_list_service: Arc, - inner: Arc, + inner: Arc, } #[uniffi::export] @@ -239,9 +239,9 @@ pub enum RoomListServiceState { Terminated, } -impl From for RoomListServiceState { - fn from(value: matrix_sdk_ui::room_list::State) -> Self { - use matrix_sdk_ui::room_list::State::*; +impl From for RoomListServiceState { + fn from(value: matrix_sdk_ui::room_list_service::State) -> Self { + use matrix_sdk_ui::room_list_service::State::*; match value { Init => Self::Init, @@ -259,9 +259,9 @@ pub enum RoomListLoadingState { Loaded { maximum_number_of_rooms: Option }, } -impl From for RoomListLoadingState { - fn from(value: matrix_sdk_ui::room_list::RoomListLoadingState) -> Self { - use matrix_sdk_ui::room_list::RoomListLoadingState::*; +impl From for RoomListLoadingState { + fn from(value: matrix_sdk_ui::room_list_service::RoomListLoadingState) -> Self { + use matrix_sdk_ui::room_list_service::RoomListLoadingState::*; match value { NotLoaded => Self::NotLoaded, @@ -326,7 +326,7 @@ pub trait RoomListEntriesListener: Send + Sync + Debug { #[derive(uniffi::Object)] pub struct RoomListItem { - inner: Arc, + inner: Arc, } #[uniffi::export] diff --git a/crates/matrix-sdk-ui/src/lib.rs b/crates/matrix-sdk-ui/src/lib.rs index a32541506..32dc10a78 100644 --- a/crates/matrix-sdk-ui/src/lib.rs +++ b/crates/matrix-sdk-ui/src/lib.rs @@ -17,9 +17,9 @@ mod events; #[cfg(feature = "experimental-encryption-sync")] pub mod encryption_sync; #[cfg(feature = "experimental-room-list")] -pub mod room_list; +pub mod room_list_service; pub mod timeline; #[cfg(feature = "experimental-room-list")] -pub use self::room_list::RoomListService; +pub use self::room_list_service::RoomListService; pub use self::timeline::Timeline; diff --git a/crates/matrix-sdk-ui/src/room_list/mod.rs b/crates/matrix-sdk-ui/src/room_list_service/mod.rs similarity index 99% rename from crates/matrix-sdk-ui/src/room_list/mod.rs rename to crates/matrix-sdk-ui/src/room_list_service/mod.rs index 16fcfa936..662eac29c 100644 --- a/crates/matrix-sdk-ui/src/room_list/mod.rs +++ b/crates/matrix-sdk-ui/src/room_list_service/mod.rs @@ -63,7 +63,6 @@ //! machine's state, which can be pretty helpful for the client app. mod room; -#[allow(clippy::module_inception)] mod room_list; mod state; diff --git a/crates/matrix-sdk-ui/src/room_list/room.rs b/crates/matrix-sdk-ui/src/room_list_service/room.rs similarity index 100% rename from crates/matrix-sdk-ui/src/room_list/room.rs rename to crates/matrix-sdk-ui/src/room_list_service/room.rs diff --git a/crates/matrix-sdk-ui/src/room_list/room_list.rs b/crates/matrix-sdk-ui/src/room_list_service/room_list.rs similarity index 100% rename from crates/matrix-sdk-ui/src/room_list/room_list.rs rename to crates/matrix-sdk-ui/src/room_list_service/room_list.rs diff --git a/crates/matrix-sdk-ui/src/room_list/state.rs b/crates/matrix-sdk-ui/src/room_list_service/state.rs similarity index 100% rename from crates/matrix-sdk-ui/src/room_list/state.rs rename to crates/matrix-sdk-ui/src/room_list_service/state.rs diff --git a/crates/matrix-sdk-ui/tests/integration/main.rs b/crates/matrix-sdk-ui/tests/integration/main.rs index dad0298e4..bbd8b1d14 100644 --- a/crates/matrix-sdk-ui/tests/integration/main.rs +++ b/crates/matrix-sdk-ui/tests/integration/main.rs @@ -29,7 +29,7 @@ use wiremock::{ #[cfg(feature = "experimental-encryption-sync")] mod encryption_sync; #[cfg(feature = "experimental-room-list")] -mod room_list; +mod room_list_service; mod sliding_sync; mod timeline; diff --git a/crates/matrix-sdk-ui/tests/integration/room_list.rs b/crates/matrix-sdk-ui/tests/integration/room_list_service.rs similarity index 98% rename from crates/matrix-sdk-ui/tests/integration/room_list.rs rename to crates/matrix-sdk-ui/tests/integration/room_list_service.rs index 17bf3e76f..b9237367a 100644 --- a/crates/matrix-sdk-ui/tests/integration/room_list.rs +++ b/crates/matrix-sdk-ui/tests/integration/room_list_service.rs @@ -6,7 +6,7 @@ use futures_util::{pin_mut, FutureExt, StreamExt}; use imbl::vector; use matrix_sdk_test::async_test; use matrix_sdk_ui::{ - room_list::{ + room_list_service::{ Error, Input, InputResult, RoomListEntry, RoomListLoadingState, State, ALL_ROOMS_LIST_NAME as ALL_ROOMS, INVITES_LIST_NAME as INVITES, VISIBLE_ROOMS_LIST_NAME as VISIBLE_ROOMS, @@ -30,7 +30,7 @@ use crate::{ timeline::sliding_sync::{assert_timeline_stream, timeline_event}, }; -async fn new_room_list() -> Result<(MockServer, RoomListService), Error> { +async fn new_room_list_service() -> Result<(MockServer, RoomListService), Error> { let (client, server) = logged_in_client().await; let room_list = RoomListService::new(client).await?; @@ -204,7 +204,7 @@ macro_rules! assert_entries_stream { #[async_test] async fn test_sync_all_states() -> Result<(), Error> { - let (server, room_list) = new_room_list().await?; + let (server, room_list) = new_room_list_service().await?; let sync = room_list.sync(); pin_mut!(sync); @@ -450,7 +450,7 @@ async fn test_sync_all_states() -> Result<(), Error> { #[async_test] async fn test_sync_resumes_from_previous_state() -> Result<(), Error> { - let (server, room_list) = new_room_list().await?; + let (server, room_list) = new_room_list_service().await?; // Start a sync, and drop it at the end of the block. { @@ -569,7 +569,7 @@ async fn test_sync_resumes_from_previous_state() -> Result<(), Error> { #[async_test] async fn test_sync_resumes_from_error() -> Result<(), Error> { - let (server, room_list) = new_room_list().await?; + let (server, room_list) = new_room_list_service().await?; let sync = room_list.sync(); pin_mut!(sync); @@ -870,7 +870,7 @@ async fn test_sync_resumes_from_error() -> Result<(), Error> { #[async_test] async fn test_sync_resumes_from_terminated() -> Result<(), Error> { - let (server, room_list) = new_room_list().await?; + let (server, room_list) = new_room_list_service().await?; // Let's stop the sync before actually syncing (we never know!). // We get an error, obviously. @@ -1109,7 +1109,7 @@ async fn test_sync_resumes_from_terminated() -> Result<(), Error> { #[async_test] async fn test_loading_states() -> Result<(), Error> { - let (server, room_list) = new_room_list().await?; + let (server, room_list) = new_room_list_service().await?; let sync = room_list.sync(); pin_mut!(sync); @@ -1217,7 +1217,7 @@ async fn test_loading_states() -> Result<(), Error> { #[async_test] async fn test_entries_stream() -> Result<(), Error> { - let (server, room_list) = new_room_list().await?; + let (server, room_list) = new_room_list_service().await?; let sync = room_list.sync(); pin_mut!(sync); @@ -1352,7 +1352,7 @@ async fn test_entries_stream() -> Result<(), Error> { #[async_test] async fn test_entries_stream_with_updated_filter() -> Result<(), Error> { - let (server, room_list) = new_room_list().await?; + let (server, room_list) = new_room_list_service().await?; let sync = room_list.sync(); pin_mut!(sync); @@ -1493,7 +1493,7 @@ async fn test_entries_stream_with_updated_filter() -> Result<(), Error> { #[async_test] async fn test_invites_stream() -> Result<(), Error> { - let (server, room_list) = new_room_list().await?; + let (server, room_list) = new_room_list_service().await?; let sync = room_list.sync(); pin_mut!(sync); @@ -1651,7 +1651,7 @@ async fn test_invites_stream() -> Result<(), Error> { #[async_test] async fn test_room() -> Result<(), Error> { - let (server, room_list) = new_room_list().await?; + let (server, room_list) = new_room_list_service().await?; let sync = room_list.sync(); pin_mut!(sync); @@ -1734,7 +1734,7 @@ async fn test_room() -> Result<(), Error> { #[async_test] async fn test_room_not_found() -> Result<(), Error> { - let (_server, room_list) = new_room_list().await?; + let (_server, room_list) = new_room_list_service().await?; let room_id = room_id!("!foo:bar.org"); @@ -1750,7 +1750,7 @@ async fn test_room_not_found() -> Result<(), Error> { #[async_test] async fn test_room_subscription() -> Result<(), Error> { - let (server, room_list) = new_room_list().await?; + let (server, room_list) = new_room_list_service().await?; let sync = room_list.sync(); pin_mut!(sync); @@ -1871,7 +1871,7 @@ async fn test_room_subscription() -> Result<(), Error> { #[async_test] async fn test_room_unread_notifications() -> Result<(), Error> { - let (server, room_list) = new_room_list().await?; + let (server, room_list) = new_room_list_service().await?; let sync = room_list.sync(); pin_mut!(sync); @@ -1958,7 +1958,7 @@ async fn test_room_unread_notifications() -> Result<(), Error> { #[async_test] async fn test_room_timeline() -> Result<(), Error> { - let (server, room_list) = new_room_list().await?; + let (server, room_list) = new_room_list_service().await?; let sync = room_list.sync(); pin_mut!(sync); @@ -2042,7 +2042,7 @@ async fn test_room_timeline() -> Result<(), Error> { #[async_test] async fn test_room_latest_event() -> Result<(), Error> { - let (server, room_list) = new_room_list().await?; + let (server, room_list) = new_room_list_service().await?; let sync = room_list.sync(); pin_mut!(sync); @@ -2133,7 +2133,7 @@ async fn test_room_latest_event() -> Result<(), Error> { #[async_test] async fn test_input_viewport() -> Result<(), Error> { - let (server, room_list) = new_room_list().await?; + let (server, room_list) = new_room_list_service().await?; let sync = room_list.sync(); pin_mut!(sync);