Skip to content

Commit

Permalink
Some house keeping. Rename components to presenter.
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaskioko committed Nov 11, 2024
1 parent 0a3b6a7 commit 4867de7
Show file tree
Hide file tree
Showing 31 changed files with 350 additions and 356 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,27 @@ private fun ChildrenContent(rootComponent: RootComponent, modifier: Modifier = M
val fillMaxSizeModifier = Modifier.fillMaxSize()
when (val screen = child.instance) {
is RootComponent.Child.Home ->
HomeScreen(component = screen.component, modifier = fillMaxSizeModifier)
HomeScreen(presenter = screen.presenter, modifier = fillMaxSizeModifier)
is RootComponent.Child.ShowDetails -> {
ShowDetailsScreen(
component = screen.component,
presenter = screen.presenter,
modifier = fillMaxSizeModifier,
)
}
is RootComponent.Child.SeasonDetails -> {
SeasonDetailsScreen(
component = screen.component,
presenter = screen.presenter,
modifier = fillMaxSizeModifier,
)
}
is RootComponent.Child.Trailers ->
TrailersScreen(
component = screen.component,
presenter = screen.presenter,
modifier = fillMaxSizeModifier,
)
is RootComponent.Child.MoreShows ->
MoreShowsScreen(
component = screen.component,
presenter = screen.presenter,
modifier = fillMaxSizeModifier,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ import com.thomaskioko.tvmaniac.compose.util.DynamicThemePrimaryColorsFromImage
import com.thomaskioko.tvmaniac.compose.util.rememberDominantColorState
import com.thomaskioko.tvmaniac.presentation.discover.DataLoaded
import com.thomaskioko.tvmaniac.presentation.discover.DiscoverShowAction
import com.thomaskioko.tvmaniac.presentation.discover.DiscoverShowsComponent
import com.thomaskioko.tvmaniac.presentation.discover.DiscoverShowsPresenter
import com.thomaskioko.tvmaniac.presentation.discover.DiscoverState
import com.thomaskioko.tvmaniac.presentation.discover.EmptyState
import com.thomaskioko.tvmaniac.presentation.discover.ErrorState
Expand All @@ -92,10 +92,10 @@ import kotlinx.collections.immutable.ImmutableList

@Composable
fun DiscoverScreen(
component: DiscoverShowsComponent,
presenter: DiscoverShowsPresenter,
modifier: Modifier = Modifier,
) {
val discoverState by component.state.collectAsState()
val discoverState by presenter.state.collectAsState()
val pagerState =
rememberPagerState(
initialPage = 2,
Expand All @@ -108,7 +108,7 @@ fun DiscoverScreen(
state = discoverState,
snackBarHostState = snackBarHostState,
pagerState = pagerState,
onAction = component::dispatch,
onAction = presenter::dispatch,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import androidx.compose.ui.res.stringResource
import com.arkivanov.decompose.extensions.compose.stack.Children
import com.thomaskioko.tvmaniac.compose.components.TvManiacBottomNavigationItem
import com.thomaskioko.tvmaniac.compose.components.TvManiacNavigationBar
import com.thomaskioko.tvmaniac.presentation.home.HomeComponent
import com.thomaskioko.tvmaniac.presentation.home.HomeComponent.Child.Discover
import com.thomaskioko.tvmaniac.presentation.home.HomeComponent.Child.Library
import com.thomaskioko.tvmaniac.presentation.home.HomeComponent.Child.Search
import com.thomaskioko.tvmaniac.presentation.home.HomeComponent.Child.Settings
import com.thomaskioko.tvmaniac.presentation.home.HomePresenter
import com.thomaskioko.tvmaniac.presentation.home.HomePresenter.Child.Discover
import com.thomaskioko.tvmaniac.presentation.home.HomePresenter.Child.Library
import com.thomaskioko.tvmaniac.presentation.home.HomePresenter.Child.Search
import com.thomaskioko.tvmaniac.presentation.home.HomePresenter.Child.Settings
import com.thomaskioko.tvmaniac.resources.R
import com.thomaskioko.tvmaniac.ui.search.SearchScreen
import com.thomaskioko.tvmaniac.ui.discover.DiscoverScreen
Expand All @@ -29,18 +29,18 @@ import com.thomaskioko.tvmaniac.ui.settings.SettingsScreen

@Composable
fun HomeScreen(
component: HomeComponent,
presenter: HomePresenter,
modifier: Modifier = Modifier,
) {
Column(modifier = modifier) {
ChildrenContent(homeComponent = component, modifier = Modifier.weight(1F))
BottomNavigationContent(component = component, modifier = Modifier.fillMaxWidth())
ChildrenContent(homePresenter = presenter, modifier = Modifier.weight(1F))
BottomNavigationContent(component = presenter, modifier = Modifier.fillMaxWidth())
}
}

@Composable
private fun ChildrenContent(homeComponent: HomeComponent, modifier: Modifier = Modifier) {
val childStack by homeComponent.stack.collectAsState()
private fun ChildrenContent(homePresenter: HomePresenter, modifier: Modifier = Modifier) {
val childStack by homePresenter.stack.collectAsState()

Children(
modifier = modifier,
Expand All @@ -50,25 +50,25 @@ private fun ChildrenContent(homeComponent: HomeComponent, modifier: Modifier = M
when (val screen = child.instance) {
is Discover -> {
DiscoverScreen(
component = screen.component,
presenter = screen.component,
modifier = fillMaxSizeModifier,
)
}
is Library -> {
LibraryScreen(
component = screen.component,
presenter = screen.component,
modifier = fillMaxSizeModifier,
)
}
is Search -> {
SearchScreen(
component = screen.component,
presenter = screen.component,
modifier = fillMaxSizeModifier,
)
}
is Settings -> {
SettingsScreen(
component = screen.component,
presenter = screen.component,
modifier = fillMaxSizeModifier,
)
}
Expand All @@ -78,7 +78,7 @@ private fun ChildrenContent(homeComponent: HomeComponent, modifier: Modifier = M

@Composable
internal fun BottomNavigationContent(
component: HomeComponent,
component: HomePresenter,
modifier: Modifier = Modifier,
) {
val childStack by component.stack.collectAsState()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import com.thomaskioko.tvmaniac.compose.extensions.copy
import com.thomaskioko.tvmaniac.compose.theme.TvManiacTheme
import com.thomaskioko.tvmaniac.presentation.watchlist.ErrorLoadingShows
import com.thomaskioko.tvmaniac.presentation.watchlist.LibraryAction
import com.thomaskioko.tvmaniac.presentation.watchlist.LibraryComponent
import com.thomaskioko.tvmaniac.presentation.watchlist.LibraryPresenter
import com.thomaskioko.tvmaniac.presentation.watchlist.LibraryContent
import com.thomaskioko.tvmaniac.presentation.watchlist.LibraryShowClicked
import com.thomaskioko.tvmaniac.presentation.watchlist.LibraryState
Expand All @@ -54,15 +54,15 @@ import kotlinx.collections.immutable.ImmutableList

@Composable
fun LibraryScreen(
component: LibraryComponent,
presenter: LibraryPresenter,
modifier: Modifier = Modifier,
) {
val libraryState by component.state.collectAsState()
val libraryState by presenter.state.collectAsState()

LibraryScreen(
modifier = modifier,
state = libraryState,
onAction = component::dispatch,
onAction = presenter::dispatch,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,22 @@ import com.thomaskioko.tvmaniac.compose.theme.TvManiacTheme
import com.thomaskioko.tvmaniac.presentation.moreshows.MoreBackClicked
import com.thomaskioko.tvmaniac.presentation.moreshows.MoreShowClicked
import com.thomaskioko.tvmaniac.presentation.moreshows.MoreShowsActions
import com.thomaskioko.tvmaniac.presentation.moreshows.MoreShowsComponent
import com.thomaskioko.tvmaniac.presentation.moreshows.MoreShowsPresenter
import com.thomaskioko.tvmaniac.presentation.moreshows.MoreShowsState
import com.thomaskioko.tvmaniac.presentation.moreshows.RefreshMoreShows
import com.thomaskioko.tvmaniac.presentation.moreshows.TvShow

@Composable
fun MoreShowsScreen(
component: MoreShowsComponent,
presenter: MoreShowsPresenter,
modifier: Modifier = Modifier,
) {
val state by component.state.collectAsState()
val state by presenter.state.collectAsState()

MoreShowsScreen(
modifier = modifier,
state = state,
onAction = component::dispatch,
onAction = presenter::dispatch,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import com.thomaskioko.tvmaniac.presentation.search.SearchResultAvailable
import com.thomaskioko.tvmaniac.presentation.search.SearchShowAction
import com.thomaskioko.tvmaniac.presentation.search.SearchShowClicked
import com.thomaskioko.tvmaniac.presentation.search.SearchShowState
import com.thomaskioko.tvmaniac.presentation.search.SearchShowsComponent
import com.thomaskioko.tvmaniac.presentation.search.SearchShowsPresenter
import com.thomaskioko.tvmaniac.presentation.search.ShowContentAvailable
import com.thomaskioko.tvmaniac.presentation.search.ShowItem
import com.thomaskioko.tvmaniac.resources.R
Expand All @@ -60,15 +60,15 @@ import kotlinx.collections.immutable.ImmutableList

@Composable
fun SearchScreen(
component: SearchShowsComponent,
presenter: SearchShowsPresenter,
modifier: Modifier = Modifier,
) {
val state by component.state.collectAsState()
val state by presenter.state.collectAsState()

SearchScreen(
modifier = modifier,
state = state,
onAction = component::dispatch,
onAction = presenter::dispatch,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ import com.thomaskioko.tvmaniac.presentation.seasondetails.ReloadSeasonDetails
import com.thomaskioko.tvmaniac.presentation.seasondetails.SeasonDetailState
import com.thomaskioko.tvmaniac.presentation.seasondetails.SeasonDetailsAction
import com.thomaskioko.tvmaniac.presentation.seasondetails.SeasonDetailsBackClicked
import com.thomaskioko.tvmaniac.presentation.seasondetails.SeasonDetailsComponent
import com.thomaskioko.tvmaniac.presentation.seasondetails.SeasonDetailsPresenter
import com.thomaskioko.tvmaniac.presentation.seasondetails.SeasonDetailsErrorState
import com.thomaskioko.tvmaniac.presentation.seasondetails.SeasonDetailsLoaded
import com.thomaskioko.tvmaniac.presentation.seasondetails.SeasonGalleryClicked
Expand All @@ -87,15 +87,15 @@ import kotlinx.collections.immutable.ImmutableList

@Composable
fun SeasonDetailsScreen(
component: SeasonDetailsComponent,
presenter: SeasonDetailsPresenter,
modifier: Modifier = Modifier,
) {
val state by component.state.collectAsState()
val state by presenter.state.collectAsState()

SeasonDetailsScreen(
modifier = modifier,
state = state,
onAction = component::dispatch,
onAction = presenter::dispatch,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
Expand Down Expand Up @@ -54,7 +52,6 @@ import androidx.compose.ui.unit.DpOffset
import androidx.compose.ui.unit.dp
import com.thomaskioko.tvmaniac.compose.components.AsyncImageComposable
import com.thomaskioko.tvmaniac.compose.components.BasicDialog
import com.thomaskioko.tvmaniac.compose.components.PosterCard
import com.thomaskioko.tvmaniac.compose.components.ThemePreviews
import com.thomaskioko.tvmaniac.compose.components.TvManiacTopBar
import com.thomaskioko.tvmaniac.compose.theme.TvManiacTheme
Expand All @@ -63,7 +60,7 @@ import com.thomaskioko.tvmaniac.presentation.settings.ChangeThemeClicked
import com.thomaskioko.tvmaniac.presentation.settings.DismissThemeClicked
import com.thomaskioko.tvmaniac.presentation.settings.DismissTraktDialog
import com.thomaskioko.tvmaniac.presentation.settings.SettingsActions
import com.thomaskioko.tvmaniac.presentation.settings.SettingsComponent
import com.thomaskioko.tvmaniac.presentation.settings.SettingsPresenter
import com.thomaskioko.tvmaniac.presentation.settings.SettingsState
import com.thomaskioko.tvmaniac.presentation.settings.ShowTraktDialog
import com.thomaskioko.tvmaniac.presentation.settings.ThemeSelected
Expand All @@ -74,17 +71,17 @@ import com.thomaskioko.tvmaniac.resources.R

@Composable
fun SettingsScreen(
component: SettingsComponent,
presenter: SettingsPresenter,
modifier: Modifier = Modifier,
) {
val state by component.state.collectAsState()
val state by presenter.state.collectAsState()
val snackbarHostState = remember { SnackbarHostState() }

SettingsScreen(
modifier = modifier,
state = state,
snackbarHostState = snackbarHostState,
onAction = component::dispatch,
onAction = presenter::dispatch,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ import com.thomaskioko.tvmaniac.presentation.showdetails.FollowShowClicked
import com.thomaskioko.tvmaniac.presentation.showdetails.ReloadShowDetails
import com.thomaskioko.tvmaniac.presentation.showdetails.SeasonClicked
import com.thomaskioko.tvmaniac.presentation.showdetails.ShowDetailsAction
import com.thomaskioko.tvmaniac.presentation.showdetails.ShowDetailsComponent
import com.thomaskioko.tvmaniac.presentation.showdetails.ShowDetailsPresenter
import com.thomaskioko.tvmaniac.presentation.showdetails.ShowDetailsContent
import com.thomaskioko.tvmaniac.presentation.showdetails.ShowInfoState
import com.thomaskioko.tvmaniac.presentation.showdetails.WatchTrailerClicked
Expand All @@ -113,10 +113,10 @@ import kotlinx.collections.immutable.ImmutableList

@Composable
fun ShowDetailsScreen(
component: ShowDetailsComponent,
presenter: ShowDetailsPresenter,
modifier: Modifier = Modifier,
) {
val state by component.state.collectAsState()
val state by presenter.state.collectAsState()

val snackBarHostState = remember { SnackbarHostState() }
val listState = rememberLazyListState()
Expand All @@ -127,7 +127,7 @@ fun ShowDetailsScreen(
title = (state as? ShowDetailsContent)?.showDetails?.title ?: "",
snackBarHostState = snackBarHostState,
listState = listState,
onAction = component::dispatch,
onAction = presenter::dispatch,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import com.thomaskioko.tvmaniac.presentation.trailers.ReloadTrailers
import com.thomaskioko.tvmaniac.presentation.trailers.TrailerError
import com.thomaskioko.tvmaniac.presentation.trailers.TrailerSelected
import com.thomaskioko.tvmaniac.presentation.trailers.TrailersAction
import com.thomaskioko.tvmaniac.presentation.trailers.TrailersComponent
import com.thomaskioko.tvmaniac.presentation.trailers.TrailersPresenter
import com.thomaskioko.tvmaniac.presentation.trailers.TrailersContent
import com.thomaskioko.tvmaniac.presentation.trailers.TrailersState
import com.thomaskioko.tvmaniac.presentation.trailers.VideoPlayerError
Expand All @@ -68,15 +68,15 @@ import kotlinx.collections.immutable.ImmutableList

@Composable
fun TrailersScreen(
component: TrailersComponent,
presenter: TrailersPresenter,
modifier: Modifier = Modifier,
) {
val state by component.state.collectAsState()
val state by presenter.state.collectAsState()

TrailersScreen(
modifier = modifier,
state = state,
onAction = component::dispatch,
onAction = presenter::dispatch,
)
}

Expand Down
Loading

0 comments on commit 4867de7

Please sign in to comment.