diff --git a/composeApp/src/androidMain/AndroidManifest.xml b/composeApp/src/androidMain/AndroidManifest.xml index 6115813..f4d4dcd 100644 --- a/composeApp/src/androidMain/AndroidManifest.xml +++ b/composeApp/src/androidMain/AndroidManifest.xml @@ -97,6 +97,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 796936b..69a0e49 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 @@ -25,11 +25,9 @@ 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 +import dev.datlag.tooling.compose.ioDispatcher import dev.datlag.tooling.decompose.ioScope -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.SharingStarted -import kotlinx.coroutines.flow.map -import kotlinx.coroutines.flow.stateIn +import kotlinx.coroutines.flow.* import org.kodein.di.DI import org.kodein.di.instance @@ -61,7 +59,9 @@ class HomeScreenComponent( private val airingTodayRepository by instance() override val airing: Flow = airingTodayRepository.airing.map { StateSaver.Home.updateAiring(it) - }.stateIn( + }.flowOn( + context = ioDispatcher() + ).stateIn( scope = stateScope, started = SharingStarted.WhileSubscribed(), initialValue = AiringTodayRepository.State.None @@ -70,7 +70,9 @@ class HomeScreenComponent( private val trendingRepository by instance() override val trending: Flow = trendingRepository.trending.map { StateSaver.Home.updateTrending(it) - }.stateIn( + }.flowOn( + context = ioDispatcher() + ).stateIn( scope = stateScope, started = SharingStarted.WhileSubscribed(), initialValue = CollectionState.None @@ -79,7 +81,9 @@ class HomeScreenComponent( private val popularSeasonRepository by instance() override val popularNow: Flow = popularSeasonRepository.popularThisSeason.map { StateSaver.Home.updatePopularCurrent(it) - }.stateIn( + }.flowOn( + context = ioDispatcher() + ).stateIn( scope = stateScope, started = SharingStarted.WhileSubscribed(), initialValue = CollectionState.None @@ -88,14 +92,16 @@ class HomeScreenComponent( private val popularNextSeasonRepository by instance() override val popularNext: Flow = popularNextSeasonRepository.popularNextSeason.map { StateSaver.Home.updatePopularNext(it) - }.stateIn( + }.flowOn( + context = ioDispatcher() + ).stateIn( scope = stateScope, started = SharingStarted.WhileSubscribed(), initialValue = CollectionState.None ) private val traceRepository by instance() - override val traceState: Flow = traceRepository.response + override val traceState: Flow = traceRepository.response.flowOn(context = ioDispatcher()) private val dialogNavigation = SlotNavigation() override val dialog: Value> = childSlot( diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/medium/MediumScreenComponent.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/medium/MediumScreenComponent.kt index 34a6138..56d3656 100644 --- a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/medium/MediumScreenComponent.kt +++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/medium/MediumScreenComponent.kt @@ -65,7 +65,9 @@ class MediumScreenComponent( override val charLanguage: Flow = appSettings.charLanguage.flowOn(ioDispatcher()) private val mediumRepository by di.instance() - override val mediumState = mediumRepository.medium.stateIn( + override val mediumState = mediumRepository.medium.flowOn( + context = ioDispatcher() + ).stateIn( scope = ioScope(), started = SharingStarted.WhileSubscribed(), initialValue = MediumRepository.State.None