From 4c2bf8703e9be3d080934749e8a291a3ab3b5f2b Mon Sep 17 00:00:00 2001 From: Infi <infi@infi.sh> Date: Tue, 29 Oct 2024 01:22:47 +0100 Subject: [PATCH] fix: issue in which experiments were shown as off if on Signed-off-by: Infi <infi@infi.sh> --- .../screens/settings/ExperimentsSettingsScreen.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/src/main/java/chat/revolt/screens/settings/ExperimentsSettingsScreen.kt b/app/src/main/java/chat/revolt/screens/settings/ExperimentsSettingsScreen.kt index 2d3cd571..29a79173 100644 --- a/app/src/main/java/chat/revolt/screens/settings/ExperimentsSettingsScreen.kt +++ b/app/src/main/java/chat/revolt/screens/settings/ExperimentsSettingsScreen.kt @@ -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 @@ -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") @@ -50,6 +57,10 @@ fun ExperimentsSettingsScreen( navController: NavController, viewModel: ExperimentsSettingsScreenViewModel = viewModel() ) { + LaunchedEffect(Unit) { + viewModel.init() + } + SettingsPage( navController, title = {