Fix about version

This commit is contained in:
Rafał Kobyłko 2024-10-07 18:54:07 +02:00
parent 99e06b26de
commit 7684e2ec13
3 changed files with 11 additions and 9 deletions

View File

@ -43,7 +43,6 @@ internal fun AboutScreen(
ScreenContent(
uiState = uiState,
versionName = viewModel.versionName,
onLicensesClick = openLicenses,
onReviewClick = { viewModel.reviewDone() },
onSendCrashLogsToggle = { viewModel.toggleSendCrashLogs() }
@ -53,7 +52,6 @@ internal fun AboutScreen(
@Composable
private fun ScreenContent(
uiState: AboutUiState,
versionName: String,
onLicensesClick: () -> Unit,
onReviewClick: () -> Unit,
onSendCrashLogsToggle: () -> Unit,
@ -207,7 +205,7 @@ private fun ScreenContent(
.padding(start = 24.dp, end = 16.dp)
) {
Text(
text = stringResource(id = R.string.settings__version, versionName),
text = stringResource(id = R.string.settings__version, uiState.versionName),
color = TwTheme.color.onSurfaceSecondary,
style = TwTheme.typo.body3
)

View File

@ -4,4 +4,5 @@ import com.twofasapp.data.session.domain.AppSettings
data class AboutUiState(
val appSettings: AppSettings = AppSettings(),
val versionName: String = ""
)

View File

@ -29,14 +29,17 @@ internal class AboutViewModel(
uiState.update { it.copy(appSettings = appSettings) }
}
}
}
val versionName =
if (appBuild.buildVariant != BuildVariant.Release) {
"${appBuild.versionName} (${appBuild.buildVariant.name.camelCaseBeginLower()})"
} else {
appBuild.versionName
uiState.update {
it.copy(
versionName = if (appBuild.buildVariant != BuildVariant.Release) {
"${appBuild.versionName} (${appBuild.buildVariant.name.camelCaseBeginLower()})"
} else {
appBuild.versionName
}
)
}
}
fun reviewDone() {
viewModelScope.launch(dispatchers.io) {