avoiding exposing directory modules classes

This commit is contained in:
Adam Brown 2022-10-31 21:11:03 +00:00
parent fe363058b5
commit 9acf5ce479
6 changed files with 13 additions and 13 deletions

View File

@ -35,12 +35,12 @@ import app.dapk.st.design.components.CircleishAvatar
import app.dapk.st.design.components.GenericEmpty import app.dapk.st.design.components.GenericEmpty
import app.dapk.st.design.components.GenericError import app.dapk.st.design.components.GenericError
import app.dapk.st.design.components.Toolbar 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.ComponentLifecycle
import app.dapk.st.directory.state.DirectoryEvent 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
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.directory.state.DirectoryState
import app.dapk.st.engine.DirectoryItem import app.dapk.st.engine.DirectoryItem
import app.dapk.st.engine.RoomOverview import app.dapk.st.engine.RoomOverview
@ -57,7 +57,7 @@ import java.time.temporal.ChronoUnit
import kotlin.math.roundToInt import kotlin.math.roundToInt
@Composable @Composable
fun DirectoryScreen(directoryViewModel: DirectoryState) { internal fun DirectoryScreen(directoryViewModel: DirectoryState) {
val state = directoryViewModel.current val state = directoryViewModel.current
val listState: LazyListState = rememberLazyListState( val listState: LazyListState = rememberLazyListState(

View File

@ -14,7 +14,7 @@ class DirectoryModule(
private val chatEngine: ChatEngine, private val chatEngine: ChatEngine,
) : ProvidableModule { ) : ProvidableModule {
fun directoryViewModel(): StateViewModel<DirectoryScreenState, DirectoryEvent> { internal fun directoryViewModel(): StateViewModel<DirectoryScreenState, DirectoryEvent> {
return createStateViewModel { directoryReducer(chatEngine, ShortcutHandler(context), it) } return createStateViewModel { directoryReducer(chatEngine, ShortcutHandler(context), it) }
} }
} }

View File

@ -9,7 +9,7 @@ import app.dapk.st.engine.RoomOverview
import app.dapk.st.matrix.common.RoomId import app.dapk.st.matrix.common.RoomId
import app.dapk.st.messenger.MessengerActivity import app.dapk.st.messenger.MessengerActivity
class ShortcutHandler(private val context: Context) { internal class ShortcutHandler(private val context: Context) {
private val cachedRoomIds = mutableListOf<RoomId>() private val cachedRoomIds = mutableListOf<RoomId>()

View File

@ -3,16 +3,16 @@ package app.dapk.st.directory.state
import app.dapk.st.engine.DirectoryState import app.dapk.st.engine.DirectoryState
import app.dapk.state.Action import app.dapk.state.Action
sealed interface ComponentLifecycle : Action { internal sealed interface ComponentLifecycle : Action {
object OnVisible : ComponentLifecycle object OnVisible : ComponentLifecycle
object OnGone : ComponentLifecycle object OnGone : ComponentLifecycle
} }
sealed interface DirectorySideEffect : Action { internal sealed interface DirectorySideEffect : Action {
object ScrollToTop : DirectorySideEffect object ScrollToTop : DirectorySideEffect
} }
sealed interface DirectoryStateChange : Action { internal sealed interface DirectoryStateChange : Action {
object Empty : DirectoryStateChange object Empty : DirectoryStateChange
data class Content(val content: DirectoryState) : DirectoryStateChange data class Content(val content: DirectoryState) : DirectoryStateChange
} }

View File

@ -7,7 +7,7 @@ import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onEach
fun directoryReducer( internal fun directoryReducer(
chatEngine: ChatEngine, chatEngine: ChatEngine,
shortcutHandler: ShortcutHandler, shortcutHandler: ShortcutHandler,
eventEmitter: suspend (DirectoryEvent) -> Unit, eventEmitter: suspend (DirectoryEvent) -> Unit,

View File

@ -3,9 +3,9 @@ package app.dapk.st.directory.state
import app.dapk.st.core.State import app.dapk.st.core.State
import app.dapk.st.engine.DirectoryState import app.dapk.st.engine.DirectoryState
typealias DirectoryState = State<DirectoryScreenState, DirectoryEvent> internal typealias DirectoryState = State<DirectoryScreenState, DirectoryEvent>
sealed interface DirectoryScreenState { internal sealed interface DirectoryScreenState {
object EmptyLoading : DirectoryScreenState object EmptyLoading : DirectoryScreenState
object Empty : DirectoryScreenState object Empty : DirectoryScreenState
data class Content( data class Content(
@ -13,7 +13,7 @@ sealed interface DirectoryScreenState {
) : DirectoryScreenState ) : DirectoryScreenState
} }
sealed interface DirectoryEvent { internal sealed interface DirectoryEvent {
data class OpenDownloadUrl(val url: String) : DirectoryEvent data class OpenDownloadUrl(val url: String) : DirectoryEvent
object ScrollToTop : DirectoryEvent object ScrollToTop : DirectoryEvent
} }