fixing visibility

This commit is contained in:
Adam Brown 2022-10-31 22:39:25 +00:00
parent b243a93782
commit 6c3006142b
7 changed files with 14 additions and 14 deletions

View File

@ -57,7 +57,7 @@ import java.time.temporal.ChronoUnit
import kotlin.math.roundToInt import kotlin.math.roundToInt
@Composable @Composable
internal fun DirectoryScreen(directoryViewModel: DirectoryState) { fun DirectoryScreen(directoryViewModel: DirectoryState) {
val state = directoryViewModel.current val state = directoryViewModel.current
val listState: LazyListState = rememberLazyListState( val listState: LazyListState = rememberLazyListState(

View File

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

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
internal sealed interface ComponentLifecycle : Action { sealed interface ComponentLifecycle : Action {
object OnVisible : ComponentLifecycle object OnVisible : ComponentLifecycle
object OnGone : ComponentLifecycle object OnGone : ComponentLifecycle
} }
internal sealed interface DirectorySideEffect : Action { sealed interface DirectorySideEffect : Action {
object ScrollToTop : DirectorySideEffect object ScrollToTop : DirectorySideEffect
} }
internal sealed interface DirectoryStateChange : Action { 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

@ -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
internal typealias DirectoryState = State<DirectoryScreenState, DirectoryEvent> typealias DirectoryState = State<DirectoryScreenState, DirectoryEvent>
internal sealed interface DirectoryScreenState { 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 @@ internal sealed interface DirectoryScreenState {
) : DirectoryScreenState ) : DirectoryScreenState
} }
internal sealed interface DirectoryEvent { sealed interface DirectoryEvent {
data class OpenDownloadUrl(val url: String) : DirectoryEvent data class OpenDownloadUrl(val url: String) : DirectoryEvent
object ScrollToTop : DirectoryEvent object ScrollToTop : DirectoryEvent
} }

View File

@ -13,7 +13,7 @@ class HomeModule(
val betaVersionUpgradeUseCase: BetaVersionUpgradeUseCase, val betaVersionUpgradeUseCase: BetaVersionUpgradeUseCase,
) : ProvidableModule { ) : ProvidableModule {
fun homeViewModel(directory: DirectoryState, login: LoginViewModel, profileViewModel: ProfileViewModel): HomeViewModel { internal fun homeViewModel(directory: DirectoryState, login: LoginViewModel, profileViewModel: ProfileViewModel): HomeViewModel {
return HomeViewModel( return HomeViewModel(
chatEngine, chatEngine,
storeModule.credentialsStore(), storeModule.credentialsStore(),

View File

@ -18,7 +18,7 @@ import app.dapk.st.profile.ProfileScreen
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
fun HomeScreen(homeViewModel: HomeViewModel) { internal fun HomeScreen(homeViewModel: HomeViewModel) {
LifecycleEffect( LifecycleEffect(
onStart = { homeViewModel.start() }, onStart = { homeViewModel.start() },
onStop = { homeViewModel.stop() } onStop = { homeViewModel.stop() }

View File

@ -18,10 +18,10 @@ import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
class HomeViewModel( internal class HomeViewModel(
private val chatEngine: ChatEngine, private val chatEngine: ChatEngine,
private val credentialsProvider: CredentialsStore, private val credentialsProvider: CredentialsStore,
private val directoryViewModel: DirectoryState, private val directoryState: DirectoryState,
private val loginViewModel: LoginViewModel, private val loginViewModel: LoginViewModel,
private val profileViewModel: ProfileViewModel, private val profileViewModel: ProfileViewModel,
private val cacheCleaner: StoreCleaner, private val cacheCleaner: StoreCleaner,
@ -32,7 +32,7 @@ class HomeViewModel(
private var listenForInvitesJob: Job? = null private var listenForInvitesJob: Job? = null
fun directory() = directoryViewModel fun directory() = directoryState
fun login() = loginViewModel fun login() = loginViewModel
fun profile() = profileViewModel fun profile() = profileViewModel
@ -93,7 +93,7 @@ class HomeViewModel(
} }
fun scrollToTopOfMessages() { fun scrollToTopOfMessages() {
directoryViewModel.dispatch(DirectorySideEffect.ScrollToTop) directoryState.dispatch(DirectorySideEffect.ScrollToTop)
} }
fun changePage(page: Page) { fun changePage(page: Page) {