mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-14 09:38:13 +08:00
♻️ 修改更新弹窗机制 #45
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
* @since Beta v0.3.3
|
||||
*/
|
||||
|
||||
import { app } from "@tauri-apps/api";
|
||||
import Database from "tauri-plugin-sql-api";
|
||||
|
||||
import initDataSql from "./sql/initData";
|
||||
@@ -87,6 +88,19 @@ class Sqlite {
|
||||
return await db.select(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 对比数据判断是否需要更新
|
||||
* @since Beta v0.3.3
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
public async checkUpdate(): Promise<boolean> {
|
||||
const dbData = await this.getAppData();
|
||||
const localVersion = await app.getVersion();
|
||||
const dbVersion = dbData.find((item) => item.key === "appVersion")?.value;
|
||||
if (dbVersion === undefined) return true;
|
||||
return localVersion !== dbVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取 cookie
|
||||
* @since Beta v0.3.3
|
||||
|
||||
Reference in New Issue
Block a user