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