feat: Add announcement dialog

This commit is contained in:
Myzel394 2024-04-26 14:40:34 +02:00
parent fe73d7dfbb
commit a8a5e36047
No known key found for this signature in database
GPG Key ID: DEC4AAB876F73185
2 changed files with 29 additions and 0 deletions

View File

@ -324,6 +324,7 @@ Maybe this can be labeled better? Let me know. It should be something that can d
<string name="settings_numberhub_newApp">Unitto is now NumberHub!</string>
<string name="settings_numberhub_newApp_message">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!</string>
<string name="settings_numberhub_newApp_announcement">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!</string>
<!-- https://s3.eu-west-1.amazonaws.com/po-pub/i/UCrz06kaEYxCGAE73ZLl9EtX.png -->
<string name="time_zone_no_results_button">Read the article</string>

View File

@ -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)
}
}