From 456bb7a0c867af729c5f471a994154c0e892ffb5 Mon Sep 17 00:00:00 2001 From: FunkyMuse Date: Wed, 20 Sep 2023 12:27:49 +0200 Subject: [PATCH] refactor: read alert dialog state from simple commons --- .../thankyou/activities/SettingsActivity.kt | 4 +- .../screens/alert_dialog/AlertDialogState.kt | 39 ------------------- gradle/libs.versions.toml | 2 +- 3 files changed, 3 insertions(+), 42 deletions(-) delete mode 100644 app/src/main/kotlin/com/simplemobiletools/thankyou/screens/alert_dialog/AlertDialogState.kt diff --git a/app/src/main/kotlin/com/simplemobiletools/thankyou/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/thankyou/activities/SettingsActivity.kt index 235c1c6..723d703 100644 --- a/app/src/main/kotlin/com/simplemobiletools/thankyou/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/thankyou/activities/SettingsActivity.kt @@ -14,6 +14,8 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.window.DialogProperties import androidx.lifecycle.compose.collectAsStateWithLifecycle +import com.simplemobiletools.commons.compose.alert_dialog.AlertDialogState +import com.simplemobiletools.commons.compose.alert_dialog.rememberAlertDialogState import com.simplemobiletools.commons.compose.extensions.enableEdgeToEdgeSimple import com.simplemobiletools.commons.compose.theme.AppThemeSurface import com.simplemobiletools.commons.compose.theme.Shapes @@ -26,8 +28,6 @@ import com.simplemobiletools.thankyou.extensions.config import com.simplemobiletools.thankyou.extensions.launchChangeAppLanguageIntent import com.simplemobiletools.thankyou.extensions.startCustomizationActivity import com.simplemobiletools.thankyou.screens.SettingsScreen -import com.simplemobiletools.thankyou.screens.alert_dialog.AlertDialogState -import com.simplemobiletools.thankyou.screens.alert_dialog.rememberAlertDialogState import java.util.Locale import kotlin.system.exitProcess diff --git a/app/src/main/kotlin/com/simplemobiletools/thankyou/screens/alert_dialog/AlertDialogState.kt b/app/src/main/kotlin/com/simplemobiletools/thankyou/screens/alert_dialog/AlertDialogState.kt deleted file mode 100644 index b80f1f7..0000000 --- a/app/src/main/kotlin/com/simplemobiletools/thankyou/screens/alert_dialog/AlertDialogState.kt +++ /dev/null @@ -1,39 +0,0 @@ -package com.simplemobiletools.thankyou.screens.alert_dialog - -import androidx.compose.runtime.* - -@Composable -fun rememberAlertDialogState( - isShownInitially: Boolean = false -) = remember { AlertDialogState(isShownInitially) } - -@Stable -class AlertDialogState(isShownInitially: Boolean = false) { - var isShown by mutableStateOf(isShownInitially) - private set - - fun show() { - isShown = true - } - - fun hide() { - isShown = false - } - - fun toggle() { - isShown = !isShown - } - - fun changeValue(predicate: Boolean) { - isShown = predicate - } - - @Composable - fun DialogMember( - content: @Composable () -> Unit - ) { - if (isShown) { - content() - } - } -} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 57a07a7..8d00cf8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,7 @@ #jetbrains kotlin = "1.9.10" #Simple tools -simple-commons = "985e1da5f9" +simple-commons = "5598de895b" #Compose composeActivity = "1.8.0-beta01" compose = "1.6.0-alpha05"