feat(system): app update log
This commit is contained in:
@@ -6,11 +6,23 @@ import { ref } from "vue";
|
||||
/** 自动更新的存储键 */
|
||||
export const AUTO_UPDATE_KEY = "app.autoUpdate";
|
||||
|
||||
/** Capacitor appId,与 capacitor.config.ts 保持一致 */
|
||||
export const APP_ID = "com.imyeyu.gao.customer";
|
||||
|
||||
/**
|
||||
* 服务端下发的更新信息
|
||||
*
|
||||
* 在插件协议基础上多一个 note:更新说明由后端附加,插件不识别但会原样透传
|
||||
*/
|
||||
export type UpdateInfo = LatestVersion & {
|
||||
note?: string;
|
||||
};
|
||||
|
||||
// 模块级状态,页面与启动逻辑共享同一份
|
||||
const supported = Capacitor.isNativePlatform();
|
||||
const currentVersion = ref("");
|
||||
const nativeVersion = ref("");
|
||||
const latest = ref<LatestVersion | null>(null);
|
||||
const latest = ref<UpdateInfo | null>(null);
|
||||
const checking = ref(false);
|
||||
const downloading = ref(false);
|
||||
const percent = ref(0);
|
||||
@@ -34,7 +46,7 @@ async function loadCurrent(): Promise<void> {
|
||||
}
|
||||
|
||||
/** 查询服务端最新版本 */
|
||||
async function check(): Promise<LatestVersion | null> {
|
||||
async function check(): Promise<UpdateInfo | null> {
|
||||
if (!supported) {
|
||||
error.value = "仅在 App 内可用";
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user