Skip to content

Commit

Permalink
Rename components to presenter on iOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaskioko committed Nov 11, 2024
1 parent c1613fc commit 32bfb3d
Show file tree
Hide file tree
Showing 22 changed files with 858 additions and 875 deletions.
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
20 changes: 10 additions & 10 deletions android/app/src/main/kotlin/com/thomaskioko/tvmaniac/RootScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,55 +15,55 @@ 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 ->
is RootPresenter.Child.Home ->
HomeScreen(presenter = screen.presenter, modifier = fillMaxSizeModifier)
is RootComponent.Child.ShowDetails -> {
is RootPresenter.Child.ShowDetails -> {
ShowDetailsScreen(
presenter = screen.presenter,
modifier = fillMaxSizeModifier,
)
}
is RootComponent.Child.SeasonDetails -> {
is RootPresenter.Child.SeasonDetails -> {
SeasonDetailsScreen(
presenter = screen.presenter,
modifier = fillMaxSizeModifier,
)
}
is RootComponent.Child.Trailers ->
is RootPresenter.Child.Trailers ->
TrailersScreen(
presenter = screen.presenter,
modifier = fillMaxSizeModifier,
)
is RootComponent.Child.MoreShows ->
is RootPresenter.Child.MoreShows ->
MoreShowsScreen(
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
}
Loading

0 comments on commit 32bfb3d

Please sign in to comment.