Skip to content

Commit

Permalink
Merge pull request #342 from thomaskioko/house-keeping
Browse files Browse the repository at this point in the history
House keeping
  • Loading branch information
thomaskioko authored Nov 11, 2024
2 parents 0051e6c + 32bfb3d commit 16e6df8
Show file tree
Hide file tree
Showing 130 changed files with 1,355 additions and 1,315 deletions.
File renamed without changes.
18 changes: 9 additions & 9 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ dependencies {
implementation(projects.database)
implementation(projects.datastore.api)
implementation(projects.datastore.implementation)
implementation(projects.presentation.discover)
implementation(projects.presentation.library)
implementation(projects.presentation.home)
implementation(projects.presentation.moreShows)
implementation(projects.presentation.search)
implementation(projects.presentation.seasondetails)
implementation(projects.presentation.settings)
implementation(projects.presentation.showDetails)
implementation(projects.presentation.trailers)
implementation(projects.presenter.discover)
implementation(projects.presenter.library)
implementation(projects.presenter.home)
implementation(projects.presenter.moreShows)
implementation(projects.presenter.search)
implementation(projects.presenter.seasondetails)
implementation(projects.presenter.settings)
implementation(projects.presenter.showDetails)
implementation(projects.presenter.trailers)
implementation(projects.tmdbApi.api)
implementation(projects.tmdbApi.implementation)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class MainActivity : ComponentActivity() {
enableEdgeToEdge()

setContent {
val themeState by component.rootComponent.themeState.collectAsState()
val themeState by component.rootPresenter.themeState.collectAsState()
val darkTheme = shouldUseDarkTheme(themeState)

splashScreen.setKeepOnScreenCondition { themeState.isFetching }
Expand All @@ -59,7 +59,7 @@ class MainActivity : ComponentActivity() {
onDispose {}
}

TvManiacTheme(darkTheme = darkTheme) { RootScreen(rootComponent = component.rootComponent) }
TvManiacTheme(darkTheme = darkTheme) { RootScreen(rootPresenter = component.rootPresenter) }
}
}
}
Expand Down
30 changes: 15 additions & 15 deletions android/app/src/main/kotlin/com/thomaskioko/tvmaniac/RootScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,57 +15,57 @@ import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import com.arkivanov.decompose.extensions.compose.stack.Children
import com.thomaskioko.tvmaniac.home.HomeScreen
import com.thomaskioko.tvmaniac.navigation.RootComponent
import com.thomaskioko.tvmaniac.navigation.RootPresenter
import com.thomaskioko.tvmaniac.seasondetails.ui.SeasonDetailsScreen
import com.thomaskioko.tvmaniac.ui.moreshows.MoreShowsScreen
import com.thomaskioko.tvmaniac.ui.showdetails.ShowDetailsScreen
import com.thomaskioko.tvmaniac.ui.trailers.videoplayer.TrailersScreen

@Composable
fun RootScreen(rootComponent: RootComponent, modifier: Modifier = Modifier) {
fun RootScreen(rootPresenter: RootPresenter, modifier: Modifier = Modifier) {
Surface(modifier = modifier, color = MaterialTheme.colorScheme.background) {
Column(
modifier =
Modifier.fillMaxSize()
.windowInsetsPadding(WindowInsets.systemBars.only(WindowInsetsSides.Horizontal)),
) {
ChildrenContent(rootComponent = rootComponent, modifier = Modifier.weight(1F))
ChildrenContent(rootPresenter = rootPresenter, modifier = Modifier.weight(1F))
}
}
}

@Composable
private fun ChildrenContent(rootComponent: RootComponent, modifier: Modifier = Modifier) {
val childStack by rootComponent.stack.collectAsState()
private fun ChildrenContent(rootPresenter: RootPresenter, modifier: Modifier = Modifier) {
val childStack by rootPresenter.stack.collectAsState()

Children(
modifier = modifier,
stack = childStack,
) { child ->
val fillMaxSizeModifier = Modifier.fillMaxSize()
when (val screen = child.instance) {
is RootComponent.Child.Home ->
HomeScreen(component = screen.component, modifier = fillMaxSizeModifier)
is RootComponent.Child.ShowDetails -> {
is RootPresenter.Child.Home ->
HomeScreen(presenter = screen.presenter, modifier = fillMaxSizeModifier)
is RootPresenter.Child.ShowDetails -> {
ShowDetailsScreen(
component = screen.component,
presenter = screen.presenter,
modifier = fillMaxSizeModifier,
)
}
is RootComponent.Child.SeasonDetails -> {
is RootPresenter.Child.SeasonDetails -> {
SeasonDetailsScreen(
component = screen.component,
presenter = screen.presenter,
modifier = fillMaxSizeModifier,
)
}
is RootComponent.Child.Trailers ->
is RootPresenter.Child.Trailers ->
TrailersScreen(
component = screen.component,
presenter = screen.presenter,
modifier = fillMaxSizeModifier,
)
is RootComponent.Child.MoreShows ->
is RootPresenter.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 @@ -4,7 +4,7 @@ import androidx.activity.ComponentActivity
import com.arkivanov.decompose.ComponentContext
import com.arkivanov.decompose.defaultComponentContext
import com.thomaskioko.tvmaniac.core.base.annotations.ActivityScope
import com.thomaskioko.tvmaniac.navigation.RootComponent
import com.thomaskioko.tvmaniac.navigation.RootPresenter
import com.thomaskioko.tvmaniac.navigation.di.NavigatorComponent
import com.thomaskioko.tvmaniac.traktauth.api.TraktAuthManager
import com.thomaskioko.tvmaniac.traktauth.implementation.TraktAuthManagerComponent
Expand All @@ -21,7 +21,7 @@ abstract class ActivityComponent(
ApplicationComponent.create(activity.application),
) : NavigatorComponent, TraktAuthManagerComponent {
abstract val traktAuthManager: TraktAuthManager
abstract val rootComponent: RootComponent
abstract val rootPresenter: RootPresenter

companion object
}
2 changes: 1 addition & 1 deletion android/ui/discover/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
android { namespace = "com.thomaskioko.tvmaniac.ui.discover" }

dependencies {
api(projects.presentation.discover)
api(projects.presenter.discover)

implementation(projects.android.designsystem)
implementation(projects.android.resources)
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
2 changes: 1 addition & 1 deletion android/ui/home/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins { alias(libs.plugins.tvmaniac.compose.library) }
android { namespace = "com.thomaskioko.tvmaniac.ui.home" }

dependencies {
api(projects.presentation.home)
api(projects.presenter.home)

implementation(projects.android.designsystem)
implementation(projects.android.resources)
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
2 changes: 1 addition & 1 deletion android/ui/library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
android { namespace = "com.thomaskioko.tvmaniac.ui.library" }

dependencies {
api(projects.presentation.library)
api(projects.presenter.library)

implementation(projects.android.designsystem)
implementation(projects.android.resources)
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
2 changes: 1 addition & 1 deletion android/ui/more-shows/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
android { namespace = "com.thomaskioko.tvmaniac.ui.moreshows" }

dependencies {
api(projects.presentation.moreShows)
api(projects.presenter.moreShows)

implementation(projects.android.designsystem)

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
2 changes: 1 addition & 1 deletion android/ui/search/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
android { namespace = "com.thomaskioko.tvmaniac.ui.search" }

dependencies {
api(projects.presentation.search)
api(projects.presenter.search)

implementation(projects.android.designsystem)
implementation(projects.android.resources)
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
2 changes: 1 addition & 1 deletion android/ui/season-details/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
android { namespace = "com.thomaskioko.tvmaniac.ui.seasondetails" }

dependencies {
api(projects.presentation.seasondetails)
api(projects.presenter.seasondetails)

implementation(projects.android.designsystem)
implementation(projects.android.resources)
Expand Down
Loading

0 comments on commit 16e6df8

Please sign in to comment.