feat(update): 应用内检测更新,基于 Gitea Release 静默+手动检测与下载安装

- UpdateManager:releases/latest 检测(JSONObject 解析,避免 Gson 反射过 R8),tag 与 versionName 语义化比较,404 视为无更新
- 启动静默检测每进程一次延迟 3s,仅发现新版本才弹窗;关于页手动检测,结果回显在条目副标题
- 下载按 Build.SUPPORTED_ABIS 择包(兜底 arm64-v8a),HttpURLConnection 流式落盘 filesDir/updates,进度回传弹窗,可取消
- 安装经 FileProvider 拉起 ACTION_VIEW,O+ 缺「安装未知应用」权限先引导授权
- 锁屏期间不展示更新弹窗;strings 三语言补齐;README 记录发版约定(versionCode 递增/附件含 ABI 子串)
- network_security_config 仅放行 localhost 明文,供 adb reverse + mock server 联调

真机实测(xaga/MIUI):mock v9.9.9 静默弹窗→关于页手动检测→下载进度→就绪→拉起系统安装器(备案页→确认页显示来源与版本 0.0.1->0.0.1);真实 API 检测回显「当前已是最新版本」
This commit is contained in:
2026-10-16 10:35:53 +08:00
parent 69b83a2f20
commit ed290f3d7d
12 changed files with 524 additions and 0 deletions
+11
View File
@@ -34,6 +34,11 @@
- 备份带版本号,导入新版本备份会提示先升级应用 - 备份带版本号,导入新版本备份会提示先升级应用
- 导入按名称合并分组、按归一化密钥去重令牌,并自动重映射分组 ID - 导入按名称合并分组、按归一化密钥去重令牌,并自动重映射分组 ID
### 应用内更新
- 基于 Gitea Release 实现:启动时静默检测(每进程一次,失败不打扰),关于页可手动检测
- 发现新版本弹窗展示更新内容,确认后应用内下载(按设备 ABI 自动选择 arm64-v8a / armeabi-v7a / x86_64 安装包)并拉起系统安装器
- 首次安装前会引导开启「安装未知应用」权限
### 界面与个性化 ### 界面与个性化
- Jetpack Compose + Material 3,edge-to-edge - Jetpack Compose + Material 3,edge-to-edge
- 主题模式:跟随系统 / 浅色 / 深色 - 主题模式:跟随系统 / 浅色 / 深色
@@ -99,6 +104,12 @@ git tag vX.Y.Z && git push origin vX.Y.Z
产物在 `app/build/outputs/apk/release/`,按设备 ABI 选择(绝大多数设备用 `arm64-v8a`)。 产物在 `app/build/outputs/apk/release/`,按设备 ABI 选择(绝大多数设备用 `arm64-v8a`)。
应用内更新依赖发版约定:
- **递增 `versionCode`**(否则系统拒绝覆盖安装),tag 与 `versionName` 对应(如 `v0.0.2` ↔ `0.0.2`,`V` 前缀大小写均可)
- 三个 APK 附件名需包含 ABI 子串(`arm64-v8a` / `armeabi-v7a` / `x86_64`),更新器按设备 ABI 择包
- 更新检测走 `releases/latest` 接口,仅认最新非草稿、非预发布版本
## 项目结构 ## 项目结构
``` ```
+12
View File
@@ -5,6 +5,8 @@
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.USE_BIOMETRIC" /> <uses-permission android:name="android.permission.USE_BIOMETRIC" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" /> <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<application <application
android:name=".A2FairApplication" android:name=".A2FairApplication"
@@ -15,7 +17,17 @@
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:networkSecurityConfig="@xml/network_security_config"
android:theme="@style/Theme._2FAir"> android:theme="@style/Theme._2FAir">
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true" android:exported="true"
@@ -7,6 +7,7 @@ import android.os.Build
import androidx.lifecycle.ProcessLifecycleOwner import androidx.lifecycle.ProcessLifecycleOwner
import cn.airnan.a2fair.core.backup.BackupManager import cn.airnan.a2fair.core.backup.BackupManager
import cn.airnan.a2fair.core.security.AppLockManager import cn.airnan.a2fair.core.security.AppLockManager
import cn.airnan.a2fair.core.update.UpdateManager
import cn.airnan.a2fair.crypto.CryptoManager import cn.airnan.a2fair.crypto.CryptoManager
import cn.airnan.a2fair.data.AppDatabase import cn.airnan.a2fair.data.AppDatabase
import cn.airnan.a2fair.data.repository.SettingsRepository import cn.airnan.a2fair.data.repository.SettingsRepository
@@ -37,6 +38,8 @@ class A2FairApplication : Application() {
lateinit var backupManager: BackupManager lateinit var backupManager: BackupManager
private set private set
val updateManager: UpdateManager by lazy { UpdateManager(this) }
override fun attachBaseContext(base: Context) { override fun attachBaseContext(base: Context) {
val languageCode = try { val languageCode = try {
runBlocking { base.dataStore.data.first() }[intPreferencesKey("language")] ?: 0 runBlocking { base.dataStore.data.first() }[intPreferencesKey("language")] ?: 0
@@ -23,6 +23,7 @@ import cn.airnan.a2fair.data.repository.dataStore
import cn.airnan.a2fair.ui.navigation.AppNavigation import cn.airnan.a2fair.ui.navigation.AppNavigation
import cn.airnan.a2fair.ui.settings.security.LockScreen import cn.airnan.a2fair.ui.settings.security.LockScreen
import cn.airnan.a2fair.ui.theme._2FAirTheme import cn.airnan.a2fair.ui.theme._2FAirTheme
import cn.airnan.a2fair.ui.update.UpdateDialog
import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.first
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import java.util.Locale import java.util.Locale
@@ -65,9 +66,11 @@ class MainActivity : FragmentActivity() {
val seedColor by settingsRepo.seedColor.collectAsStateWithLifecycle(initialValue = 0xFF6750A4.toInt()) val seedColor by settingsRepo.seedColor.collectAsStateWithLifecycle(initialValue = 0xFF6750A4.toInt())
val isFlagSecureEnabled by settingsRepo.isFlagSecureEnabled.collectAsStateWithLifecycle(initialValue = false) val isFlagSecureEnabled by settingsRepo.isFlagSecureEnabled.collectAsStateWithLifecycle(initialValue = false)
val isLocked by appLockManager.isLocked.collectAsStateWithLifecycle() val isLocked by appLockManager.isLocked.collectAsStateWithLifecycle()
val updateState by app.updateManager.state.collectAsStateWithLifecycle()
LaunchedEffect(Unit) { LaunchedEffect(Unit) {
appLockManager.checkInitialLockState() appLockManager.checkInitialLockState()
app.updateManager.silentCheck()
} }
LaunchedEffect(isFlagSecureEnabled) { LaunchedEffect(isFlagSecureEnabled) {
@@ -114,6 +117,18 @@ class MainActivity : FragmentActivity() {
AppNavigation() AppNavigation()
} }
} }
// 更新弹窗锁屏期间不展示,解锁后可见;下载中弹窗不可随手关(需显式取消)
if (!isLocked) {
UpdateDialog(
state = updateState,
onDismiss = { app.updateManager.dismiss() },
onDownload = { app.updateManager.download(it) },
onCancelDownload = { app.updateManager.cancelDownload() },
onInstall = { app.updateManager.installReady(it) },
onRetryDownload = { app.updateManager.download(it) }
)
}
} }
} }
} }
@@ -0,0 +1,256 @@
package cn.airnan.a2fair.core.update
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Build
import android.provider.Settings
import androidx.core.content.FileProvider
import cn.airnan.a2fair.BuildConfig
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.delay
import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch
import org.json.JSONArray
import org.json.JSONObject
import java.io.File
import java.io.IOException
import java.net.HttpURLConnection
import java.net.URL
import java.util.concurrent.atomic.AtomicBoolean
import kotlin.coroutines.coroutineContext
/** Gitea Release 摘要(应用内更新用) */
data class UpdateInfo(
val tagName: String,
/** tag 去掉 v/V 前缀后的版本号,如 "V0.0.2" -> "0.0.2" */
val version: String,
val changelog: String,
val assetName: String,
val downloadUrl: String,
val sizeBytes: Long
)
sealed interface UpdateState {
data object Checking : UpdateState
data object UpToDate : UpdateState
data class Available(val info: UpdateInfo) : UpdateState
data class CheckError(val message: String) : UpdateState
/** progress 取值 0..100;-1 表示响应无 Content-Length,进度未知 */
data class Downloading(val info: UpdateInfo, val progress: Int) : UpdateState
data class DownloadFailed(val info: UpdateInfo, val message: String) : UpdateState
data class ReadyToInstall(val info: UpdateInfo, val file: File) : UpdateState
}
/**
* 基于 Gitea Release 的应用内更新:
* - 启动时静默检测(每进程一次),仅在发现新版本时弹窗
* - 关于页手动检测,结果回写到 [state]
* - 确认更新后按设备 ABI 择包下载,经 FileProvider 拉起系统安装器
*/
class UpdateManager(private val context: Context) {
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
private val silentChecked = AtomicBoolean(false)
private var checkJob: Job? = null
private var downloadJob: Job? = null
private val _state = MutableStateFlow<UpdateState?>(null)
val state: StateFlow<UpdateState?> = _state.asStateFlow()
/** 启动静默检测:失败与已是最新均不打扰 UI */
fun silentCheck() {
if (!silentChecked.compareAndSet(false, true)) return
scope.launch {
delay(SILENT_CHECK_DELAY_MS)
check(silent = true)
}
}
/** 关于页手动检测 */
fun manualCheck() {
if (_state.value is UpdateState.Downloading) return
checkJob?.cancel()
checkJob = scope.launch { check(silent = false) }
}
fun download(info: UpdateInfo) {
if (_state.value is UpdateState.Downloading) return
downloadJob?.cancel()
downloadJob = scope.launch {
try {
val file = downloadApk(info) { progress ->
_state.value = UpdateState.Downloading(info, progress)
}
_state.value = UpdateState.ReadyToInstall(info, file)
} catch (e: Exception) {
if (e is kotlinx.coroutines.CancellationException) throw e
_state.value = UpdateState.DownloadFailed(info, e.message ?: "unknown")
}
}
}
fun cancelDownload() {
downloadJob?.cancel()
downloadJob = null
_state.value = null
}
/** 关闭弹窗;下载中不允许直接关(必须显式取消) */
fun dismiss() {
if (_state.value is UpdateState.Downloading) return
_state.value = null
}
/** 安装已下载的 APK;缺少「安装未知应用」权限时先引导授权 */
fun installReady(ready: UpdateState.ReadyToInstall) {
if (canInstallNow()) {
install(ready.file)
} else {
requestInstallPermission()
}
}
fun canInstallNow(): Boolean =
Build.VERSION.SDK_INT < Build.VERSION_CODES.O ||
context.packageManager.canRequestPackageInstalls()
private fun requestInstallPermission() {
val intent = Intent(
Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES,
Uri.parse("package:${context.packageName}")
).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(intent)
}
private fun install(file: File) {
val uri = FileProvider.getUriForFile(context, "${context.packageName}.fileprovider", file)
val intent = Intent(Intent.ACTION_VIEW)
.setDataAndType(uri, "application/vnd.android.package-archive")
.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(intent)
}
private suspend fun check(silent: Boolean) {
if (!silent) _state.value = UpdateState.Checking
try {
val info = fetchLatestRelease()
when {
info == null -> if (!silent) _state.value = UpdateState.UpToDate
isNewer(info.version, BuildConfig.VERSION_NAME) ->
_state.value = UpdateState.Available(info)
!silent -> _state.value = UpdateState.UpToDate
}
} catch (e: Exception) {
if (!silent) _state.value = UpdateState.CheckError(e.message ?: "unknown")
}
}
private fun fetchLatestRelease(): UpdateInfo? {
val conn = openConnection("$API_BASE/releases/latest")
val code = conn.responseCode
if (code == HttpURLConnection.HTTP_NOT_FOUND) return null // 仓库尚无 release
if (code != HttpURLConnection.HTTP_OK) throw IOException("HTTP $code")
val body = conn.inputStream.bufferedReader(Charsets.UTF_8).use { it.readText() }
val json = JSONObject(body)
val tagName = json.optString("tag_name").trim()
if (tagName.isEmpty()) return null
val asset = pickAsset(json.optJSONArray("assets")) ?: return null // 没有可用 APK 附件
return UpdateInfo(
tagName = tagName,
version = if (tagName.startsWith("v") || tagName.startsWith("V")) tagName.substring(1) else tagName,
changelog = json.optString("body"),
assetName = asset.optString("name"),
downloadUrl = asset.optString("browser_download_url"),
sizeBytes = asset.optLong("size", -1L)
)
}
/** 按 Build.SUPPORTED_ABIS 优先级择包,兜底 arm64-v8a,再兜底第一个 .apk */
private fun pickAsset(assets: JSONArray?): JSONObject? {
if (assets == null) return null
val apks = (0 until assets.length())
.map { assets.getJSONObject(it) }
.filter { it.optString("name").endsWith(".apk", ignoreCase = true) }
if (apks.isEmpty()) return null
for (abi in Build.SUPPORTED_ABIS) {
apks.firstOrNull { it.optString("name").contains(abi, ignoreCase = true) }
?.let { return it }
}
return apks.firstOrNull { it.optString("name").contains("arm64-v8a", ignoreCase = true) }
?: apks.first()
}
private suspend fun downloadApk(info: UpdateInfo, onProgress: (Int) -> Unit): File {
val dir = File(context.filesDir, "updates").apply { mkdirs() }
val tmp = File(dir, "${info.version}.apk.part")
val target = File(dir, "${info.version}.apk")
target.delete()
val conn = openConnection(info.downloadUrl)
val code = conn.responseCode
if (code != HttpURLConnection.HTTP_OK) throw IOException("HTTP $code")
val total = conn.contentLengthLong
var written = 0L
var lastPercent = -1
val activeContext = coroutineContext
conn.inputStream.use { input ->
tmp.outputStream().use { output ->
val buffer = ByteArray(64 * 1024)
while (true) {
activeContext.ensureActive()
val n = input.read(buffer)
if (n == -1) break
output.write(buffer, 0, n)
written += n
if (total > 0) {
val percent = (written * 100 / total).toInt()
if (percent != lastPercent) {
lastPercent = percent
onProgress(percent)
}
}
}
}
}
if (total > 0 && written != total) throw IOException("truncated download")
if (!tmp.renameTo(target)) throw IOException("rename failed")
return target
}
private fun openConnection(url: String): HttpURLConnection =
(URL(url).openConnection() as HttpURLConnection).apply {
connectTimeout = 10_000
readTimeout = 20_000
instanceFollowRedirects = true
setRequestProperty("Accept", "*/*")
}
companion object {
const val API_BASE = "https://git.airnan.cn/api/v1/repos/wangairnan/2FAir"
private const val SILENT_CHECK_DELAY_MS = 3_000L
/** 语义化比较:v 前缀可有可无,缺失段补 0,比较失败即不更新 */
fun isNewer(remote: String, current: String): Boolean {
fun parse(v: String) = v.split('.')
.map { seg -> seg.takeWhile(Char::isDigit).toIntOrNull() ?: 0 }
val r = parse(remote)
val c = parse(current)
for (i in 0 until maxOf(r.size, c.size)) {
val a = r.getOrElse(i) { 0 }
val b = c.getOrElse(i) { 0 }
if (a != b) return a > b
}
return false
}
}
}
@@ -21,6 +21,7 @@ import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
@@ -28,8 +29,11 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.viewinterop.AndroidView import androidx.compose.ui.viewinterop.AndroidView
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import cn.airnan.a2fair.A2FairApplication
import cn.airnan.a2fair.BuildConfig import cn.airnan.a2fair.BuildConfig
import cn.airnan.a2fair.R import cn.airnan.a2fair.R
import cn.airnan.a2fair.core.update.UpdateState
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
@@ -38,6 +42,21 @@ fun AboutScreen(
onNavigateToLicenses: () -> Unit = {} onNavigateToLicenses: () -> Unit = {}
) { ) {
val context = LocalContext.current val context = LocalContext.current
val app = context.applicationContext as A2FairApplication
val updateState by app.updateManager.state.collectAsStateWithLifecycle()
val updateStatusText = when (val s = updateState) {
null -> stringResource(R.string.check_update_desc)
UpdateState.Checking -> stringResource(R.string.update_checking)
UpdateState.UpToDate -> stringResource(R.string.update_up_to_date)
is UpdateState.Available -> stringResource(R.string.update_available_title, s.info.version)
is UpdateState.CheckError -> stringResource(R.string.update_check_failed, s.message)
is UpdateState.Downloading ->
if (s.progress >= 0) stringResource(R.string.update_download_progress, s.progress)
else stringResource(R.string.update_downloading)
is UpdateState.DownloadFailed -> stringResource(R.string.update_download_failed, s.message)
is UpdateState.ReadyToInstall -> stringResource(R.string.update_ready_title)
}
Scaffold( Scaffold(
topBar = { topBar = {
@@ -104,6 +123,12 @@ fun AboutScreen(
} }
) )
ListItem(
headlineContent = { Text(stringResource(R.string.check_update)) },
supportingContent = { Text(updateStatusText) },
modifier = Modifier.clickable { app.updateManager.manualCheck() }
)
ListItem( ListItem(
headlineContent = { Text(stringResource(R.string.open_source_licenses)) }, headlineContent = { Text(stringResource(R.string.open_source_licenses)) },
supportingContent = { Text(stringResource(R.string.licenses_desc)) }, supportingContent = { Text(stringResource(R.string.licenses_desc)) },
@@ -0,0 +1,129 @@
package cn.airnan.a2fair.ui.update
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
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.LinearProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import cn.airnan.a2fair.R
import cn.airnan.a2fair.core.update.UpdateInfo
import cn.airnan.a2fair.core.update.UpdateState
@Composable
fun UpdateDialog(
state: UpdateState?,
onDismiss: () -> Unit,
onDownload: (UpdateInfo) -> Unit,
onCancelDownload: () -> Unit,
onInstall: (UpdateState.ReadyToInstall) -> Unit,
onRetryDownload: (UpdateInfo) -> Unit
) {
when (state) {
is UpdateState.Available -> AlertDialog(
onDismissRequest = onDismiss,
title = { Text(stringResource(R.string.update_available_title, state.info.version)) },
text = {
Column(
modifier = Modifier
.heightIn(max = 300.dp)
.verticalScroll(rememberScrollState())
) {
if (state.info.changelog.isNotBlank()) {
Text(
text = stringResource(R.string.update_changelog),
style = MaterialTheme.typography.titleSmall
)
Spacer(modifier = Modifier.height(4.dp))
Text(
text = state.info.changelog,
style = MaterialTheme.typography.bodySmall
)
}
}
},
confirmButton = {
TextButton(onClick = { onDownload(state.info) }) {
Text(stringResource(R.string.update_download))
}
},
dismissButton = {
TextButton(onClick = onDismiss) {
Text(stringResource(R.string.update_later))
}
}
)
is UpdateState.Downloading -> AlertDialog(
onDismissRequest = onCancelDownload,
title = { Text(stringResource(R.string.update_downloading)) },
text = {
Column {
if (state.progress >= 0) {
LinearProgressIndicator(
progress = { state.progress / 100f },
modifier = Modifier.fillMaxWidth()
)
Spacer(modifier = Modifier.height(8.dp))
Text(
text = stringResource(R.string.update_download_progress, state.progress),
style = MaterialTheme.typography.bodySmall
)
} else {
LinearProgressIndicator(modifier = Modifier.fillMaxWidth())
}
}
},
confirmButton = {},
dismissButton = {
TextButton(onClick = onCancelDownload) {
Text(stringResource(R.string.update_cancel_download))
}
}
)
is UpdateState.ReadyToInstall -> AlertDialog(
onDismissRequest = onDismiss,
title = { Text(stringResource(R.string.update_ready_title)) },
text = { Text(stringResource(R.string.update_ready_message)) },
confirmButton = {
TextButton(onClick = { onInstall(state) }) {
Text(stringResource(R.string.update_install))
}
},
dismissButton = {
TextButton(onClick = onDismiss) {
Text(stringResource(R.string.update_later))
}
}
)
is UpdateState.DownloadFailed -> AlertDialog(
onDismissRequest = onDismiss,
title = { Text(stringResource(R.string.update_download_failed_title)) },
text = { Text(stringResource(R.string.update_download_failed, state.message)) },
confirmButton = {
TextButton(onClick = { onRetryDownload(state.info) }) {
Text(stringResource(R.string.update_retry))
}
},
dismissButton = {
TextButton(onClick = onDismiss) {
Text(stringResource(R.string.cancel))
}
}
)
else -> Unit
}
}
@@ -164,6 +164,26 @@
<string name="dynamic_color_desc">使用壁纸提取的颜色(Android 12+)</string> <string name="dynamic_color_desc">使用壁纸提取的颜色(Android 12+)</string>
<string name="seed_color">主题色</string> <string name="seed_color">主题色</string>
<!-- Update -->
<string name="check_update">检查更新</string>
<string name="check_update_desc">从 Gitea Release 检查并安装新版本</string>
<string name="update_checking">正在检查更新…</string>
<string name="update_up_to_date">当前已是最新版本</string>
<string name="update_available_title">发现新版本 v%s</string>
<string name="update_changelog">更新内容</string>
<string name="update_download">下载更新</string>
<string name="update_later">以后再说</string>
<string name="update_downloading">正在下载更新…</string>
<string name="update_download_progress">正在下载 %1$d%%</string>
<string name="update_cancel_download">取消下载</string>
<string name="update_download_failed_title">下载失败</string>
<string name="update_download_failed">下载失败:%s</string>
<string name="update_retry">重试</string>
<string name="update_ready_title">安装包下载完成</string>
<string name="update_ready_message">安装包已下载,是否立即安装?</string>
<string name="update_install">立即安装</string>
<string name="update_check_failed">检查更新失败:%s</string>
<!-- About --> <!-- About -->
<string name="back">返回</string> <string name="back">返回</string>
<string name="app_icon">应用图标</string> <string name="app_icon">应用图标</string>
@@ -162,6 +162,26 @@
<string name="dynamic_color_desc">使用桌布提取的顏色(Android 12+)</string> <string name="dynamic_color_desc">使用桌布提取的顏色(Android 12+)</string>
<string name="seed_color">主題色</string> <string name="seed_color">主題色</string>
<!-- Update -->
<string name="check_update">檢查更新</string>
<string name="check_update_desc">從 Gitea Release 檢查並安裝新版本</string>
<string name="update_checking">正在檢查更新…</string>
<string name="update_up_to_date">目前已是最新版本</string>
<string name="update_available_title">發現新版本 v%s</string>
<string name="update_changelog">更新內容</string>
<string name="update_download">下載更新</string>
<string name="update_later">稍後再說</string>
<string name="update_downloading">正在下載更新…</string>
<string name="update_download_progress">正在下載 %1$d%%</string>
<string name="update_cancel_download">取消下載</string>
<string name="update_download_failed_title">下載失敗</string>
<string name="update_download_failed">下載失敗:%s</string>
<string name="update_retry">重試</string>
<string name="update_ready_title">安裝套件下載完成</string>
<string name="update_ready_message">安裝套件已下載,是否立即安裝?</string>
<string name="update_install">立即安裝</string>
<string name="update_check_failed">檢查更新失敗:%s</string>
<!-- About --> <!-- About -->
<string name="back">返回</string> <string name="back">返回</string>
<string name="app_icon">應用程式圖示</string> <string name="app_icon">應用程式圖示</string>
+20
View File
@@ -164,6 +164,26 @@
<string name="dynamic_color_desc">Use colors extracted from wallpaper (Android 12+)</string> <string name="dynamic_color_desc">Use colors extracted from wallpaper (Android 12+)</string>
<string name="seed_color">Seed Color</string> <string name="seed_color">Seed Color</string>
<!-- Update -->
<string name="check_update">Check for updates</string>
<string name="check_update_desc">Check and install new versions from Gitea releases</string>
<string name="update_checking">Checking for updates…</string>
<string name="update_up_to_date">You are on the latest version</string>
<string name="update_available_title">Update available: v%s</string>
<string name="update_changelog">What\'s new</string>
<string name="update_download">Download update</string>
<string name="update_later">Later</string>
<string name="update_downloading">Downloading update…</string>
<string name="update_download_progress">Downloading %1$d%%</string>
<string name="update_cancel_download">Cancel download</string>
<string name="update_download_failed_title">Download failed</string>
<string name="update_download_failed">Download failed: %s</string>
<string name="update_retry">Retry</string>
<string name="update_ready_title">Update downloaded</string>
<string name="update_ready_message">The update package is ready. Install it now?</string>
<string name="update_install">Install now</string>
<string name="update_check_failed">Update check failed: %s</string>
<!-- About --> <!-- About -->
<string name="back">Back</string> <string name="back">Back</string>
<string name="app_icon">App Icon</string> <string name="app_icon">App Icon</string>
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<!-- 应用内更新下载的安装包目录 -->
<files-path name="updates" path="updates/" />
</paths>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 仅放行本机回环明文流量,供 adb reverse + 本地 mock server 联调更新流程;正式更新走 https -->
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="false">localhost</domain>
<domain includeSubdomains="false">127.0.0.1</domain>
</domain-config>
</network-security-config>