From 45cee1d0fa96e5c074163ce6886931393e1349b1 Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Fri, 22 Nov 2024 16:25:32 +0400 Subject: [PATCH] simplify --- .../simplex/common/views/onboarding/WhatsNewView.kt | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/onboarding/WhatsNewView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/onboarding/WhatsNewView.kt index 16547dbc77..f5f4359c63 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/onboarding/WhatsNewView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/onboarding/WhatsNewView.kt @@ -28,12 +28,11 @@ import dev.icerock.moko.resources.ImageResource import dev.icerock.moko.resources.StringResource @Composable -fun ModalData.WhatsNewView(showWhatsNew: MutableState = mutableStateOf(true), updatedConditions: Boolean = false, viaSettings: Boolean = false, close: () -> Unit) { +fun ModalData.WhatsNewView(updatedConditions: Boolean = false, viaSettings: Boolean = false, close: () -> Unit) { val currentVersion = remember { mutableStateOf(versionDescriptions.lastIndex) } - val showUpdatedConditions = remember { stateGetOrPut("updatedConditions") { updatedConditions } } val rhId = chatModel.remoteHostId() - if (showUpdatedConditions.value) { + if (updatedConditions) { LaunchedEffect(Unit) { val conditionsId = chatModel.conditions.value.currentConditions.conditionsId try { @@ -156,7 +155,7 @@ fun ModalData.WhatsNewView(showWhatsNew: MutableState = mutableStateOf( ReadMoreButton(v.post) } - if (showUpdatedConditions.value) { + if (updatedConditions) { Text( stringResource(MR.strings.view_updated_conditions), color = MaterialTheme.colors.primary, @@ -174,13 +173,9 @@ fun ModalData.WhatsNewView(showWhatsNew: MutableState = mutableStateOf( Modifier.fillMaxWidth(), contentAlignment = Alignment.Center ) { Text( - if (updatedConditions) generalGetString(MR.strings.view_updated_conditions) else generalGetString(MR.strings.ok), + generalGetString(MR.strings.ok), modifier = Modifier.clickable(onClick = { - if (updatedConditions) { - showWhatsNew.value = false - } else { close() - } }), style = MaterialTheme.typography.h3, color = MaterialTheme.colors.primary