diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/HomeComponent.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/HomeComponent.kt index 1fed965..8acf1f3 100644 --- a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/HomeComponent.kt +++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/HomeComponent.kt @@ -8,6 +8,7 @@ import dev.datlag.aniflow.anilist.model.Medium import dev.datlag.aniflow.anilist.model.User import dev.datlag.aniflow.anilist.state.CollectionState import dev.datlag.aniflow.anilist.type.MediaType +import dev.datlag.aniflow.settings.model.TitleLanguage import dev.datlag.aniflow.trace.TraceRepository import dev.datlag.aniflow.ui.navigation.Component import dev.datlag.aniflow.ui.navigation.DialogComponent @@ -16,6 +17,7 @@ import kotlinx.coroutines.flow.Flow interface HomeComponent : Component { val viewing: Flow val user: Flow + val titleLanguage: Flow val airing: Flow val trending: Flow diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/HomeScreen.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/HomeScreen.kt index bbfcaf5..659dbeb 100644 --- a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/HomeScreen.kt +++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/HomeScreen.kt @@ -185,6 +185,7 @@ fun HomeScreen(component: HomeComponent) { val isManga = remember(viewType) { viewType == MediaType.MANGA } + val titleLanguage by component.titleLanguage.collectAsStateWithLifecycle(null) LazyColumn( state = listState, @@ -196,6 +197,7 @@ fun HomeScreen(component: HomeComponent) { item { ScheduleOverview( flow = component.airing, + titleLanguage = titleLanguage, onMediumClick = component::details ) } @@ -204,6 +206,7 @@ fun HomeScreen(component: HomeComponent) { DefaultOverview( title = "Trending", flow = component.trending, + titleLanguage = titleLanguage, onMediumClick = component::details ) } @@ -211,6 +214,7 @@ fun HomeScreen(component: HomeComponent) { DefaultOverview( title = "Popular", flow = component.popularNow, + titleLanguage = titleLanguage, onMediumClick = component::details ) } @@ -219,6 +223,7 @@ fun HomeScreen(component: HomeComponent) { DefaultOverview( title = "Popular Next", flow = component.popularNext, + titleLanguage = titleLanguage, onMediumClick = component::details ) } diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/HomeScreenComponent.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/HomeScreenComponent.kt index 9a15745..796936b 100644 --- a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/HomeScreenComponent.kt +++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/HomeScreenComponent.kt @@ -21,6 +21,7 @@ import dev.datlag.aniflow.model.coroutines.Executor import dev.datlag.aniflow.other.StateSaver import dev.datlag.aniflow.other.UserHelper import dev.datlag.aniflow.settings.Settings +import dev.datlag.aniflow.settings.model.TitleLanguage import dev.datlag.aniflow.trace.TraceRepository import dev.datlag.aniflow.ui.navigation.DialogComponent import dev.datlag.aniflow.ui.navigation.screen.home.dialog.settings.SettingsDialogComponent @@ -49,6 +50,8 @@ class HomeScreenComponent( MediaType.ANIME } } + override val titleLanguage: Flow = appSettings.titleLanguage + private val viewTypeExecutor = Executor() private val userHelper by instance() diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/component/DefaultOverview.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/component/DefaultOverview.kt index 23c6a22..5cd690c 100644 --- a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/component/DefaultOverview.kt +++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/component/DefaultOverview.kt @@ -17,6 +17,7 @@ import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import dev.datlag.aniflow.anilist.model.Medium import dev.datlag.aniflow.anilist.state.CollectionState +import dev.datlag.aniflow.settings.model.TitleLanguage import dev.datlag.aniflow.ui.navigation.screen.home.component.default.MediumCard import dev.datlag.tooling.decompose.lifecycle.collectAsStateWithLifecycle import kotlinx.coroutines.flow.Flow @@ -26,6 +27,7 @@ import kotlinx.coroutines.flow.Flow fun DefaultOverview( title: String, flow: Flow, + titleLanguage: TitleLanguage?, onMediumClick: (Medium) -> Unit, ) { Column( @@ -60,7 +62,7 @@ fun DefaultOverview( items(current.collection.toList(), key = { it.id }) { MediumCard( medium = it, - titleLanguage = null, + titleLanguage = titleLanguage, modifier = Modifier .width(200.dp) .height(280.dp) diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/component/ScheduleOverview.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/component/ScheduleOverview.kt index 1310ec0..795c2ad 100644 --- a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/component/ScheduleOverview.kt +++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/component/ScheduleOverview.kt @@ -20,6 +20,7 @@ import androidx.compose.ui.unit.dp import dev.datlag.aniflow.anilist.AiringTodayRepository import dev.datlag.aniflow.anilist.model.Medium import dev.datlag.aniflow.other.StateSaver +import dev.datlag.aniflow.settings.model.TitleLanguage import dev.datlag.aniflow.ui.navigation.screen.home.component.airing.AiringCard import dev.datlag.tooling.decompose.lifecycle.collectAsStateWithLifecycle import kotlinx.coroutines.flow.Flow @@ -28,6 +29,7 @@ import kotlinx.coroutines.flow.Flow @Composable fun ScheduleOverview( flow: Flow, + titleLanguage: TitleLanguage?, onMediumClick: (Medium) -> Unit ) { Column( @@ -69,7 +71,7 @@ fun ScheduleOverview( items(current.collection.toList()) { AiringCard( airing = it, - titleLanguage = null, + titleLanguage = titleLanguage, modifier = Modifier .height(150.dp) .fillParentMaxWidth(fraction = 0.9F)