Merge pull request #22 from AkiChase/dev

Scrcpy Mask v0.2.0
This commit is contained in:
如初 2024-05-14 10:25:00 +08:00 committed by GitHub
commit 251c98d9e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 26 additions and 7 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "scrcpy-mask", "name": "scrcpy-mask",
"private": true, "private": true,
"version": "0.1.10", "version": "0.2.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "scrcpy-mask" name = "scrcpy-mask"
version = "0.1.10" version = "0.2.0"
description = "A Tauri App" description = "A Tauri App"
authors = ["AkiChase"] authors = ["AkiChase"]
edition = "2021" edition = "2021"

View File

@ -1,6 +1,6 @@
{ {
"productName": "scrcpy-mask", "productName": "scrcpy-mask",
"version": "0.1.10", "version": "0.2.0",
"identifier": "com.akichase.mask", "identifier": "com.akichase.mask",
"build": { "build": {
"beforeDevCommand": "pnpm dev", "beforeDevCommand": "pnpm dev",

View File

@ -227,6 +227,23 @@ function renderUpdateInfo(content: string) {
return h("div", { style: "margin: 20px 0" }, pList); 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() { async function checkUpdate() {
try { try {
const curVersion = await getVersion(); const curVersion = await getVersion();
@ -241,8 +258,10 @@ async function checkUpdate() {
} else { } else {
const data = await res.json(); const data = await res.json();
const latestVersion = (data.tag_name as string).slice(1); const latestVersion = (data.tag_name as string).slice(1);
if (latestVersion <= curVersion) { if (compareVersion(curVersion, latestVersion) >= 0) {
message.success(t("pages.Mask.checkUpdate.isLatest", [latestVersion])); message.success(
t("pages.Mask.checkUpdate.isLatest", [latestVersion, curVersion])
);
return; return;
} }
const body = data.body as string; const body = data.body as string;

View File

@ -43,7 +43,7 @@
"blankConfig": "Blank config", "blankConfig": "Blank config",
"checkUpdate": { "checkUpdate": {
"failed": "Check for updates failed", "failed": "Check for updates failed",
"isLatest": "Latest version: {0}, currently the latest version", "isLatest": "Latest version: {0}, currently the latest version: {1}",
"notLatest": { "notLatest": {
"title": "Latest version: {0}", "title": "Latest version: {0}",
"positiveText": "Release page", "positiveText": "Release page",

View File

@ -42,7 +42,7 @@
"blankConfig": "空白方案", "blankConfig": "空白方案",
"checkUpdate": { "checkUpdate": {
"failed": "检查更新失败", "failed": "检查更新失败",
"isLatest": "最新版本: {0},当前已是最新版本", "isLatest": "最新版本: {0},当前已是最新版本: {1}",
"notLatest": { "notLatest": {
"title": "最新版本:{0}", "title": "最新版本:{0}",
"positiveText": "前往发布页", "positiveText": "前往发布页",