From a8a5e36047cc083eea94d2f47707ed1988912ef8 Mon Sep 17 00:00:00 2001 From: Myzel394 <50424412+Myzel394@users.noreply.github.com> Date: Fri, 26 Apr 2024 14:40:34 +0200 Subject: [PATCH] feat: Add announcement dialog --- core/base/src/main/res/values/strings.xml | 1 + .../feature/settings/SettingsScreen.kt | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/core/base/src/main/res/values/strings.xml b/core/base/src/main/res/values/strings.xml index 645bde68..c462d343 100644 --- a/core/base/src/main/res/values/strings.xml +++ b/core/base/src/main/res/values/strings.xml @@ -324,6 +324,7 @@ Maybe this can be labeled better? Let me know. It should be something that can d Unitto is now NumberHub! Unitto has been discontinued. You\'re one of the first users to try NumberHub! Please spread the word and share the app with your friends. Thank you for your support! + NumberHub serves as a drop-in replacement for Unitto. It has the same features and more. NumberHub is still in beta and changes may occur. Please report any issues you find. Thanks for being one of the first to try it out! Read the article diff --git a/feature/settings/src/main/java/app/myzel394/numberhub/feature/settings/SettingsScreen.kt b/feature/settings/src/main/java/app/myzel394/numberhub/feature/settings/SettingsScreen.kt index bdab1c79..81710470 100644 --- a/feature/settings/src/main/java/app/myzel394/numberhub/feature/settings/SettingsScreen.kt +++ b/feature/settings/src/main/java/app/myzel394/numberhub/feature/settings/SettingsScreen.kt @@ -52,6 +52,7 @@ import androidx.compose.material.icons.filled.Vibration import androidx.compose.material.icons.filled._123 import androidx.compose.material.icons.outlined.CheckCircle import androidx.compose.material.icons.outlined.NewReleases +import androidx.compose.material3.AlertDialog import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.DropdownMenu import androidx.compose.material3.DropdownMenuItem @@ -59,12 +60,14 @@ import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.Scaffold import androidx.compose.material3.Text +import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -200,6 +203,30 @@ private fun SettingsScreen( .verticalScroll(rememberScrollState()) .padding(padding), ) { + var showNewAppInfo by rememberSaveable { + mutableStateOf(false) + } + + if (showNewAppInfo) { + AlertDialog( + icon = { + Icon(Icons.Outlined.CheckCircle, null) + }, + title = { + Text(stringResource(R.string.settings_numberhub_newApp)) + }, + text = { + Text(stringResource(R.string.settings_numberhub_newApp_announcement)) + }, + confirmButton = { + TextButton(onClick = { showNewAppInfo = false }) { + Text(stringResource(R.string.ok_label)) + } + }, + onDismissRequest = { showNewAppInfo = false }, + ) + } + AnimatedVisibility( visible = !uiState.hasSeenNewAppAnnouncement, enter = expandVertically() + fadeIn(), @@ -215,6 +242,7 @@ private fun SettingsScreen( title = title, support = stringResource(R.string.settings_numberhub_newApp_message), ) { + showNewAppInfo = true //onHasSeenNewAppAnnouncement(true) } }