Fix some issues with preferences not updating the UI

This commit is contained in:
Jobobby04 2022-12-24 16:29:22 -05:00
parent 389156944c
commit 562b264048
2 changed files with 8 additions and 3 deletions

View File

@ -8,11 +8,13 @@ import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import cafe.adriel.voyager.core.model.rememberScreenModel
import cafe.adriel.voyager.navigator.tab.LocalTabNavigator
import cafe.adriel.voyager.navigator.tab.TabOptions
import eu.kanade.core.prefs.asState
import eu.kanade.domain.ui.UiPreferences
import eu.kanade.presentation.components.TabbedScreen
import eu.kanade.presentation.util.Tab
@ -46,9 +48,10 @@ data class BrowseTab(
@Composable
override fun Content() {
val context = LocalContext.current
val scope = rememberCoroutineScope()
// SY -->
val feedTabInFront = remember {
Injekt.get<UiPreferences>().feedTabInFront().get()
val feedTabInFront by remember {
Injekt.get<UiPreferences>().feedTabInFront().asState(scope)
}
// SY <--

View File

@ -1,8 +1,10 @@
package eu.kanade.tachiyomi.ui.browse.source
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.getValue
import cafe.adriel.voyager.core.model.StateScreenModel
import cafe.adriel.voyager.core.model.coroutineScope
import eu.kanade.core.prefs.asState
import eu.kanade.domain.base.BasePreferences
import eu.kanade.domain.source.interactor.GetEnabledSources
import eu.kanade.domain.source.interactor.GetShowLatest
@ -51,7 +53,7 @@ class SourcesScreenModel(
private val _events = Channel<Event>(Int.MAX_VALUE)
val events = _events.receiveAsFlow()
val useNewSourceNavigation = uiPreferences.useNewSourceNavigation().get()
val useNewSourceNavigation by uiPreferences.useNewSourceNavigation().asState(coroutineScope)
init {
// SY -->