diff --git a/feature/about/src/main/java/com/twofasapp/feature/about/ui/about/AboutScreen.kt b/feature/about/src/main/java/com/twofasapp/feature/about/ui/about/AboutScreen.kt index 835c4591..54922446 100644 --- a/feature/about/src/main/java/com/twofasapp/feature/about/ui/about/AboutScreen.kt +++ b/feature/about/src/main/java/com/twofasapp/feature/about/ui/about/AboutScreen.kt @@ -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 ) diff --git a/feature/about/src/main/java/com/twofasapp/feature/about/ui/about/AboutUiState.kt b/feature/about/src/main/java/com/twofasapp/feature/about/ui/about/AboutUiState.kt index 2ef49f51..048473da 100644 --- a/feature/about/src/main/java/com/twofasapp/feature/about/ui/about/AboutUiState.kt +++ b/feature/about/src/main/java/com/twofasapp/feature/about/ui/about/AboutUiState.kt @@ -4,4 +4,5 @@ import com.twofasapp.data.session.domain.AppSettings data class AboutUiState( val appSettings: AppSettings = AppSettings(), + val versionName: String = "" ) diff --git a/feature/about/src/main/java/com/twofasapp/feature/about/ui/about/AboutViewModel.kt b/feature/about/src/main/java/com/twofasapp/feature/about/ui/about/AboutViewModel.kt index 41bc69f7..539e8983 100644 --- a/feature/about/src/main/java/com/twofasapp/feature/about/ui/about/AboutViewModel.kt +++ b/feature/about/src/main/java/com/twofasapp/feature/about/ui/about/AboutViewModel.kt @@ -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) {