Skip to content

Commit

Permalink
fix: issue in which experiments were shown as off if on
Browse files Browse the repository at this point in the history
Signed-off-by: Infi <[email protected]>
  • Loading branch information
infi committed Oct 29, 2024
1 parent 6ec199f commit 4c2bf87
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.compose.material3.ListItem
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextOverflow
Expand All @@ -26,6 +27,12 @@ import kotlinx.coroutines.launch
class ExperimentsSettingsScreenViewModel : ViewModel() {
private val kv = KVStorage(RevoltApplication.instance)

fun init() {
viewModelScope.launch {
useKotlinMdRendererChecked.value = Experiments.useKotlinBasedMarkdownRenderer.isEnabled
}
}

fun disableExperiments(then: () -> Unit = {}) {
viewModelScope.launch {
kv.remove("experimentsEnabled")
Expand All @@ -50,6 +57,10 @@ fun ExperimentsSettingsScreen(
navController: NavController,
viewModel: ExperimentsSettingsScreenViewModel = viewModel()
) {
LaunchedEffect(Unit) {
viewModel.init()
}

SettingsPage(
navController,
title = {
Expand Down

0 comments on commit 4c2bf87

Please sign in to comment.