diff --git a/package.json b/package.json index 9bba9fa..1ae15c7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "scrcpy-mask", "private": true, - "version": "0.1.10", + "version": "0.2.0", "type": "module", "scripts": { "dev": "vite", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 4b63133..c35b8ff 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "scrcpy-mask" -version = "0.1.10" +version = "0.2.0" description = "A Tauri App" authors = ["AkiChase"] edition = "2021" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 1961dd0..bcdd7e5 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,6 +1,6 @@ { "productName": "scrcpy-mask", - "version": "0.1.10", + "version": "0.2.0", "identifier": "com.akichase.mask", "build": { "beforeDevCommand": "pnpm dev", diff --git a/src/components/Mask.vue b/src/components/Mask.vue index 4fab8a1..639ed5c 100644 --- a/src/components/Mask.vue +++ b/src/components/Mask.vue @@ -227,6 +227,23 @@ function renderUpdateInfo(content: string) { return h("div", { style: "margin: 20px 0" }, pList); } +function compareVersion(v1: string, v2: string) { + const [x1, y1, z1] = v1.split("."); + const [x2, y2, z2] = v2.split("."); + + if (x1 !== x2) { + return parseInt(x1) > parseInt(x2) ? 1 : -1; + } + if (y1 !== y2) { + return parseInt(y1) > parseInt(y2) ? 1 : -1; + } + if (z1 !== z2) { + return parseInt(z1) > parseInt(z2) ? 1 : -1; + } + + return 0; +} + async function checkUpdate() { try { const curVersion = await getVersion(); @@ -241,8 +258,10 @@ async function checkUpdate() { } else { const data = await res.json(); const latestVersion = (data.tag_name as string).slice(1); - if (latestVersion <= curVersion) { - message.success(t("pages.Mask.checkUpdate.isLatest", [latestVersion])); + if (compareVersion(curVersion, latestVersion) >= 0) { + message.success( + t("pages.Mask.checkUpdate.isLatest", [latestVersion, curVersion]) + ); return; } const body = data.body as string; diff --git a/src/i18n/en-US.json b/src/i18n/en-US.json index 888fedd..9d5ffda 100644 --- a/src/i18n/en-US.json +++ b/src/i18n/en-US.json @@ -43,7 +43,7 @@ "blankConfig": "Blank config", "checkUpdate": { "failed": "Check for updates failed", - "isLatest": "Latest version: {0}, currently the latest version", + "isLatest": "Latest version: {0}, currently the latest version: {1}", "notLatest": { "title": "Latest version: {0}", "positiveText": "Release page", diff --git a/src/i18n/zh-CN.json b/src/i18n/zh-CN.json index 008a1be..425e53c 100644 --- a/src/i18n/zh-CN.json +++ b/src/i18n/zh-CN.json @@ -42,7 +42,7 @@ "blankConfig": "空白方案", "checkUpdate": { "failed": "检查更新失败", - "isLatest": "最新版本: {0},当前已是最新版本", + "isLatest": "最新版本: {0},当前已是最新版本: {1}", "notLatest": { "title": "最新版本:{0}", "positiveText": "前往发布页",