From 9acf5ce4796fc06c1904854842326ff46f408e72 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Mon, 31 Oct 2022 21:11:03 +0000 Subject: [PATCH] avoiding exposing directory modules classes --- .../app/dapk/st/directory/DirectoryListingScreen.kt | 8 ++++---- .../main/kotlin/app/dapk/st/directory/DirectoryModule.kt | 2 +- .../main/kotlin/app/dapk/st/directory/ShortcutHandler.kt | 2 +- .../kotlin/app/dapk/st/directory/state/DirectoryAction.kt | 6 +++--- .../app/dapk/st/directory/state/DirectoryReducer.kt | 2 +- .../kotlin/app/dapk/st/directory/state/DirectoryState.kt | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/features/directory/src/main/kotlin/app/dapk/st/directory/DirectoryListingScreen.kt b/features/directory/src/main/kotlin/app/dapk/st/directory/DirectoryListingScreen.kt index 2226172..e572b4e 100644 --- a/features/directory/src/main/kotlin/app/dapk/st/directory/DirectoryListingScreen.kt +++ b/features/directory/src/main/kotlin/app/dapk/st/directory/DirectoryListingScreen.kt @@ -35,12 +35,12 @@ import app.dapk.st.design.components.CircleishAvatar import app.dapk.st.design.components.GenericEmpty import app.dapk.st.design.components.GenericError import app.dapk.st.design.components.Toolbar -import app.dapk.st.directory.state.DirectoryEvent.OpenDownloadUrl -import app.dapk.st.directory.state.DirectoryScreenState.Content -import app.dapk.st.directory.state.DirectoryScreenState.EmptyLoading import app.dapk.st.directory.state.ComponentLifecycle import app.dapk.st.directory.state.DirectoryEvent +import app.dapk.st.directory.state.DirectoryEvent.OpenDownloadUrl import app.dapk.st.directory.state.DirectoryScreenState +import app.dapk.st.directory.state.DirectoryScreenState.Content +import app.dapk.st.directory.state.DirectoryScreenState.EmptyLoading import app.dapk.st.directory.state.DirectoryState import app.dapk.st.engine.DirectoryItem import app.dapk.st.engine.RoomOverview @@ -57,7 +57,7 @@ import java.time.temporal.ChronoUnit import kotlin.math.roundToInt @Composable -fun DirectoryScreen(directoryViewModel: DirectoryState) { +internal fun DirectoryScreen(directoryViewModel: DirectoryState) { val state = directoryViewModel.current val listState: LazyListState = rememberLazyListState( diff --git a/features/directory/src/main/kotlin/app/dapk/st/directory/DirectoryModule.kt b/features/directory/src/main/kotlin/app/dapk/st/directory/DirectoryModule.kt index 6e3bd6f..d4aaf19 100644 --- a/features/directory/src/main/kotlin/app/dapk/st/directory/DirectoryModule.kt +++ b/features/directory/src/main/kotlin/app/dapk/st/directory/DirectoryModule.kt @@ -14,7 +14,7 @@ class DirectoryModule( private val chatEngine: ChatEngine, ) : ProvidableModule { - fun directoryViewModel(): StateViewModel { + internal fun directoryViewModel(): StateViewModel { return createStateViewModel { directoryReducer(chatEngine, ShortcutHandler(context), it) } } } diff --git a/features/directory/src/main/kotlin/app/dapk/st/directory/ShortcutHandler.kt b/features/directory/src/main/kotlin/app/dapk/st/directory/ShortcutHandler.kt index 276a8d3..cec13fc 100644 --- a/features/directory/src/main/kotlin/app/dapk/st/directory/ShortcutHandler.kt +++ b/features/directory/src/main/kotlin/app/dapk/st/directory/ShortcutHandler.kt @@ -9,7 +9,7 @@ import app.dapk.st.engine.RoomOverview import app.dapk.st.matrix.common.RoomId import app.dapk.st.messenger.MessengerActivity -class ShortcutHandler(private val context: Context) { +internal class ShortcutHandler(private val context: Context) { private val cachedRoomIds = mutableListOf() diff --git a/features/directory/src/main/kotlin/app/dapk/st/directory/state/DirectoryAction.kt b/features/directory/src/main/kotlin/app/dapk/st/directory/state/DirectoryAction.kt index 3392f36..37b76fa 100644 --- a/features/directory/src/main/kotlin/app/dapk/st/directory/state/DirectoryAction.kt +++ b/features/directory/src/main/kotlin/app/dapk/st/directory/state/DirectoryAction.kt @@ -3,16 +3,16 @@ package app.dapk.st.directory.state import app.dapk.st.engine.DirectoryState import app.dapk.state.Action -sealed interface ComponentLifecycle : Action { +internal sealed interface ComponentLifecycle : Action { object OnVisible : ComponentLifecycle object OnGone : ComponentLifecycle } -sealed interface DirectorySideEffect : Action { +internal sealed interface DirectorySideEffect : Action { object ScrollToTop : DirectorySideEffect } -sealed interface DirectoryStateChange : Action { +internal sealed interface DirectoryStateChange : Action { object Empty : DirectoryStateChange data class Content(val content: DirectoryState) : DirectoryStateChange } diff --git a/features/directory/src/main/kotlin/app/dapk/st/directory/state/DirectoryReducer.kt b/features/directory/src/main/kotlin/app/dapk/st/directory/state/DirectoryReducer.kt index f01e74f..9325a0b 100644 --- a/features/directory/src/main/kotlin/app/dapk/st/directory/state/DirectoryReducer.kt +++ b/features/directory/src/main/kotlin/app/dapk/st/directory/state/DirectoryReducer.kt @@ -7,7 +7,7 @@ import kotlinx.coroutines.Job import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach -fun directoryReducer( +internal fun directoryReducer( chatEngine: ChatEngine, shortcutHandler: ShortcutHandler, eventEmitter: suspend (DirectoryEvent) -> Unit, diff --git a/features/directory/src/main/kotlin/app/dapk/st/directory/state/DirectoryState.kt b/features/directory/src/main/kotlin/app/dapk/st/directory/state/DirectoryState.kt index 3f20567..bb3fe80 100644 --- a/features/directory/src/main/kotlin/app/dapk/st/directory/state/DirectoryState.kt +++ b/features/directory/src/main/kotlin/app/dapk/st/directory/state/DirectoryState.kt @@ -3,9 +3,9 @@ package app.dapk.st.directory.state import app.dapk.st.core.State import app.dapk.st.engine.DirectoryState -typealias DirectoryState = State +internal typealias DirectoryState = State -sealed interface DirectoryScreenState { +internal sealed interface DirectoryScreenState { object EmptyLoading : DirectoryScreenState object Empty : DirectoryScreenState data class Content( @@ -13,7 +13,7 @@ sealed interface DirectoryScreenState { ) : DirectoryScreenState } -sealed interface DirectoryEvent { +internal sealed interface DirectoryEvent { data class OpenDownloadUrl(val url: String) : DirectoryEvent object ScrollToTop : DirectoryEvent }