feat: show app and content version separately

This commit is contained in:
Timi
2026-11-07 15:15:36 +08:00
parent c204cad375
commit deb93e1af0
3 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions { aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
+5 -1
View File
@@ -15,6 +15,7 @@ export const AUTO_UPDATE_KEY = "app.autoUpdate";
export function useAppUpdate() { export function useAppUpdate() {
const supported = Capacitor.isNativePlatform(); const supported = Capacitor.isNativePlatform();
const currentVersion = ref(""); const currentVersion = ref("");
const nativeVersion = ref("");
const latest = ref<LatestVersion | null>(null); const latest = ref<LatestVersion | null>(null);
const checking = ref(false); const checking = ref(false);
const downloading = ref(false); const downloading = ref(false);
@@ -22,7 +23,7 @@ export function useAppUpdate() {
const ready = ref<BundleInfo | null>(null); const ready = ref<BundleInfo | null>(null);
const error = ref(""); const error = ref("");
/** 读取当前运行的 Web 包版本,内置包为 builtin */ /** 读取当前运行的 Web 包版本与原生壳版本 */
async function loadCurrent(): Promise<void> { async function loadCurrent(): Promise<void> {
if (!supported) { if (!supported) {
return; return;
@@ -30,8 +31,10 @@ export function useAppUpdate() {
try { try {
const result = await CapacitorUpdater.current(); const result = await CapacitorUpdater.current();
currentVersion.value = result.bundle?.version ?? "builtin"; currentVersion.value = result.bundle?.version ?? "builtin";
nativeVersion.value = result.native ?? "";
} catch { } catch {
currentVersion.value = ""; currentVersion.value = "";
nativeVersion.value = "";
} }
} }
@@ -111,6 +114,7 @@ export function useAppUpdate() {
return { return {
supported, supported,
currentVersion, currentVersion,
nativeVersion,
latest, latest,
checking, checking,
downloading, downloading,
+3 -1
View File
@@ -48,7 +48,8 @@
</t-cell> </t-cell>
</t-cell-group> </t-cell-group>
<t-cell-group title="版本更新" theme="card" v-entrance-transition> <t-cell-group title="版本更新" theme="card" v-entrance-transition>
<t-cell title="当前版本" :note="currentVersion || '—'" /> <t-cell title="App 版本" :note="nativeVersion || '—'" />
<t-cell title="内容版本" :note="currentVersion || '—'" />
<t-cell title="自动检查更新"> <t-cell title="自动检查更新">
<template #right-icon> <template #right-icon>
<t-switch :model-value="autoUpdate" @change="handleAutoUpdateChange" /> <t-switch :model-value="autoUpdate" @change="handleAutoUpdateChange" />
@@ -143,6 +144,7 @@ async function playSettingSoundPreview(type: "scanSuccess" | "registerSuccess"):
const { const {
supported: updateSupported, supported: updateSupported,
currentVersion, currentVersion,
nativeVersion,
latest, latest,
checking, checking,
downloading, downloading,