feat: show app and content version separately
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user