feat: show app and content version separately
This commit is contained in:
@@ -8,7 +8,7 @@ android {
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
versionName "1.0.0"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
aaptOptions {
|
||||
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
|
||||
|
||||
@@ -15,6 +15,7 @@ export const AUTO_UPDATE_KEY = "app.autoUpdate";
|
||||
export function useAppUpdate() {
|
||||
const supported = Capacitor.isNativePlatform();
|
||||
const currentVersion = ref("");
|
||||
const nativeVersion = ref("");
|
||||
const latest = ref<LatestVersion | null>(null);
|
||||
const checking = ref(false);
|
||||
const downloading = ref(false);
|
||||
@@ -22,7 +23,7 @@ export function useAppUpdate() {
|
||||
const ready = ref<BundleInfo | null>(null);
|
||||
const error = ref("");
|
||||
|
||||
/** 读取当前运行的 Web 包版本,内置包为 builtin */
|
||||
/** 读取当前运行的 Web 包版本与原生壳版本 */
|
||||
async function loadCurrent(): Promise<void> {
|
||||
if (!supported) {
|
||||
return;
|
||||
@@ -30,8 +31,10 @@ export function useAppUpdate() {
|
||||
try {
|
||||
const result = await CapacitorUpdater.current();
|
||||
currentVersion.value = result.bundle?.version ?? "builtin";
|
||||
nativeVersion.value = result.native ?? "";
|
||||
} catch {
|
||||
currentVersion.value = "";
|
||||
nativeVersion.value = "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,6 +114,7 @@ export function useAppUpdate() {
|
||||
return {
|
||||
supported,
|
||||
currentVersion,
|
||||
nativeVersion,
|
||||
latest,
|
||||
checking,
|
||||
downloading,
|
||||
|
||||
@@ -48,7 +48,8 @@
|
||||
</t-cell>
|
||||
</t-cell-group>
|
||||
<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="自动检查更新">
|
||||
<template #right-icon>
|
||||
<t-switch :model-value="autoUpdate" @change="handleAutoUpdateChange" />
|
||||
@@ -143,6 +144,7 @@ async function playSettingSoundPreview(type: "scanSuccess" | "registerSuccess"):
|
||||
const {
|
||||
supported: updateSupported,
|
||||
currentVersion,
|
||||
nativeVersion,
|
||||
latest,
|
||||
checking,
|
||||
downloading,
|
||||
|
||||
Reference in New Issue
Block a user