fix: version display format -> three-number (e.g. 1.7.10) without v prefix
This commit is contained in:
parent
461fca7ead
commit
7ea7729f96
5 changed files with 12 additions and 10 deletions
|
|
@ -450,7 +450,7 @@ internal fun SettingsScreen(
|
|||
onClick = updateViewModel::startDownload
|
||||
) {
|
||||
Text(
|
||||
text = "Update v${s.versionName} verfügbar – jetzt installieren",
|
||||
text = "Update ${s.versionName}.${s.versionCode} verfügbar – jetzt installieren",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
|
|
@ -471,7 +471,7 @@ internal fun SettingsScreen(
|
|||
)
|
||||
}
|
||||
is UpdateStatus.ReadyToInstall -> Text(
|
||||
text = "v${s.versionName} bereit zur Installation",
|
||||
text = "${s.versionName}.${s.versionCode} bereit zur Installation",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ internal fun UpdateBanner(
|
|||
) {
|
||||
when (status) {
|
||||
is UpdateStatus.Available -> AvailableBanner(
|
||||
versionName = status.versionName,
|
||||
versionName = "${status.versionName}.${status.versionCode}",
|
||||
onDownloadClick = onDownloadClick,
|
||||
onDismiss = onDismiss
|
||||
)
|
||||
|
|
@ -54,7 +54,7 @@ internal fun UpdateBanner(
|
|||
progress = status.progress
|
||||
)
|
||||
is UpdateStatus.ReadyToInstall -> ReadyBanner(
|
||||
versionName = status.versionName,
|
||||
versionName = "${status.versionName}.${status.versionCode}",
|
||||
onDismiss = onDismiss
|
||||
)
|
||||
is UpdateStatus.Error -> ErrorBanner(
|
||||
|
|
@ -87,7 +87,7 @@ private fun AvailableBanner(
|
|||
)
|
||||
Column(modifier = Modifier.weight(1f)) {
|
||||
Text(
|
||||
text = "Update verfügbar: v$versionName",
|
||||
text = "Update verfügbar: $versionName",
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer
|
||||
)
|
||||
|
|
@ -151,7 +151,7 @@ private fun ReadyBanner(
|
|||
tint = MaterialTheme.colorScheme.onPrimaryContainer
|
||||
)
|
||||
Text(
|
||||
text = "v$versionName wurde heruntergeladen. Installer wird gestartet…",
|
||||
text = "$versionName wurde heruntergeladen. Installer wird gestartet…",
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
modifier = Modifier.weight(1f)
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ internal data class UpdateUiState(
|
|||
internal sealed interface UpdateStatus {
|
||||
data object Hidden : UpdateStatus
|
||||
data object Checking : UpdateStatus
|
||||
data class Available(val versionName: String, val apkUrl: String) : UpdateStatus
|
||||
data class Available(val versionName: String, val versionCode: Int, val apkUrl: String) : UpdateStatus
|
||||
data class Downloading(val progress: Float) : UpdateStatus
|
||||
data class ReadyToInstall(val versionName: String) : UpdateStatus
|
||||
data class ReadyToInstall(val versionName: String, val versionCode: Int) : UpdateStatus
|
||||
data class Error(val message: String) : UpdateStatus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ internal class UpdateViewModel @Inject constructor(
|
|||
it.copy(
|
||||
status = UpdateStatus.Available(
|
||||
versionName = result.versionInfo.versionName,
|
||||
versionCode = result.versionInfo.versionCode,
|
||||
apkUrl = result.versionInfo.apkUrl
|
||||
)
|
||||
)
|
||||
|
|
@ -64,6 +65,7 @@ internal class UpdateViewModel @Inject constructor(
|
|||
|
||||
val apkUrl = status.apkUrl
|
||||
val versionName = status.versionName
|
||||
val versionCode = status.versionCode
|
||||
val targetFile = File(context.cacheDir, "update/app-latest.apk")
|
||||
|
||||
viewModelScope.launch {
|
||||
|
|
@ -78,7 +80,7 @@ internal class UpdateViewModel @Inject constructor(
|
|||
).fold(
|
||||
onSuccess = {
|
||||
_uiState.update {
|
||||
it.copy(status = UpdateStatus.ReadyToInstall(versionName))
|
||||
it.copy(status = UpdateStatus.ReadyToInstall(versionName, versionCode))
|
||||
}
|
||||
installApk(targetFile)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ private fun buildHomepageHtml(versionName: String, versionCode: Int, apkUrl: Str
|
|||
<h1>Bollwerk</h1>
|
||||
<p class="subtitle">Inventar • Vorsorge • Sicherheit</p>
|
||||
<div class="rust-line"></div>
|
||||
<p class="version">v<span>$versionName</span></p>
|
||||
<p class="version"><span>$versionName.$versionCode</span></p>
|
||||
<div id="qrcode"></div>
|
||||
<a href="${apkUrl.replace("\"", """)}" class="download-link">⬇ APK herunterladen</a>
|
||||
<p class="hint">QR-Code scannen oder Link antippen, um die App zu installieren.</p>
|
||||
|
|
|
|||
Loading…
Reference in a new issue