refactor(update): убрать чейнжлог из диалога обновления
Markdown из GitHub-релиза не парсится и выглядит сырым.
This commit is contained in:
1 parent
3a1fdba179
commit
49c85b8d6a
3 files changed
+3
-26
No files matched your search
@@ -51,8 +51,7 @@ class AppUpdater(private val context: Context) {
|
|||||||
if (isNewer(remoteVersion, getCurrentVersion())) {
|
if (isNewer(remoteVersion, getCurrentVersion())) {
|
||||||
latestApkUrl = findApkUrl(release)
|
latestApkUrl = findApkUrl(release)
|
||||||
if (latestApkUrl != null) {
|
if (latestApkUrl != null) {
|
||||||
val changelog = release.optString("body", "").trim()
|
_state.value = UpdateState.Available(remoteVersion)
|
||||||
_state.value = UpdateState.Available(remoteVersion, changelog)
|
|
||||||
} else {
|
} else {
|
||||||
_state.value = if (silent) UpdateState.Idle
|
_state.value = if (silent) UpdateState.Idle
|
||||||
else UpdateState.Error("APK не найден в релизе")
|
else UpdateState.Error("APK не найден в релизе")
|
||||||
|
|||||||
@@ -6,12 +6,8 @@ import androidx.compose.foundation.layout.Column
|
|||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.heightIn
|
|
||||||
import androidx.compose.foundation.rememberScrollState
|
|
||||||
import androidx.compose.foundation.verticalScroll
|
|
||||||
import androidx.compose.material3.AlertDialog
|
import androidx.compose.material3.AlertDialog
|
||||||
import androidx.compose.material3.LinearWavyProgressIndicator
|
import androidx.compose.material3.LinearWavyProgressIndicator
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@@ -48,25 +44,7 @@ internal fun UpdateDialogs(
|
|||||||
AlertDialog(
|
AlertDialog(
|
||||||
onDismissRequest = { dismissedVersion = state.version },
|
onDismissRequest = { dismissedVersion = state.version },
|
||||||
title = { Text(stringResource(R.string.update_available_title)) },
|
title = { Text(stringResource(R.string.update_available_title)) },
|
||||||
text = {
|
text = { Text(stringResource(R.string.update_available, state.version)) },
|
||||||
Column {
|
|
||||||
Text(stringResource(R.string.update_available, state.version))
|
|
||||||
if (state.changelog.isNotEmpty()) {
|
|
||||||
Spacer(Modifier.height(8.dp))
|
|
||||||
Column(
|
|
||||||
modifier = Modifier
|
|
||||||
.heightIn(max = 200.dp)
|
|
||||||
.verticalScroll(rememberScrollState())
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
state.changelog,
|
|
||||||
style = MaterialTheme.typography.bodySmall,
|
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
confirmButton = {
|
confirmButton = {
|
||||||
TextButton(onClick = {
|
TextButton(onClick = {
|
||||||
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ sealed class ProxyState {
|
|||||||
sealed class UpdateState {
|
sealed class UpdateState {
|
||||||
object Idle : UpdateState()
|
object Idle : UpdateState()
|
||||||
object Checking : UpdateState()
|
object Checking : UpdateState()
|
||||||
data class Available(val version: String, val changelog: String) : UpdateState()
|
data class Available(val version: String) : UpdateState()
|
||||||
object NoUpdate : UpdateState()
|
object NoUpdate : UpdateState()
|
||||||
data class Downloading(val progress: Int) : UpdateState()
|
data class Downloading(val progress: Int) : UpdateState()
|
||||||
object ReadyToInstall : UpdateState()
|
object ReadyToInstall : UpdateState()
|
||||||
|
|||||||
Reference in new issue
Block a user