From b8dbabb8f3914939ad42b82e69025f32eee415bf Mon Sep 17 00:00:00 2001 From: AkiChase <1003019131@qq.com> Date: Wed, 22 May 2024 09:23:26 +0800 Subject: [PATCH 1/3] fix(i18n): device rotation --- src/components/Device.vue | 2 +- src/i18n/en-US.json | 3 ++- src/i18n/zh-CN.json | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/Device.vue b/src/components/Device.vue index 617fdec..39ebfe6 100644 --- a/src/components/Device.vue +++ b/src/components/Device.vue @@ -79,7 +79,7 @@ onMounted(async () => { } else { store.screenSizeW = payload.width; store.screenSizeH = payload.height; - message.info("设备旋转"); + message.info(t("pages.Device.deviceRotation")); } break; default: diff --git a/src/i18n/en-US.json b/src/i18n/en-US.json index ea0a57f..acaaffc 100644 --- a/src/i18n/en-US.json +++ b/src/i18n/en-US.json @@ -36,7 +36,8 @@ "wsClose": "Close", "wsConnect": "Control", "adbDeviceError": "Unable to get available devices", - "adbConnectError": "Wireless connection failed" + "adbConnectError": "Wireless connection failed", + "deviceRotation": "Device rotation" }, "Mask": { "inputBoxPlaceholder": "Input text and then press enter/esc", diff --git a/src/i18n/zh-CN.json b/src/i18n/zh-CN.json index dd31153..6df22a0 100644 --- a/src/i18n/zh-CN.json +++ b/src/i18n/zh-CN.json @@ -36,7 +36,8 @@ "wsClose": "断开", "wsConnect": "控制", "adbDeviceError": "无法获取可用设备", - "adbConnectError": "无线连接失败" + "adbConnectError": "无线连接失败", + "deviceRotation": "设备旋转" }, "Mask": { "keyconfigException": "按键方案异常,请删除此方案", From 30f6d37c2a336b738d5717eb0256bcf686735789 Mon Sep 17 00:00:00 2001 From: AkiChase <1003019131@qq.com> Date: Wed, 22 May 2024 09:41:24 +0800 Subject: [PATCH 2/3] fix(adb): adb path reading --- src-tauri/src/adb.rs | 1 + src-tauri/src/main.rs | 14 +++++++++++--- src/components/Mask.vue | 6 ++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src-tauri/src/adb.rs b/src-tauri/src/adb.rs index 3c418d4..44d900c 100644 --- a/src-tauri/src/adb.rs +++ b/src-tauri/src/adb.rs @@ -88,6 +88,7 @@ pub struct Adb; impl Adb { pub fn cmd_base() -> Command { let adb_path = share::ADB_PATH.lock().unwrap().clone(); + println!("{}", &adb_path); #[cfg(target_os = "windows")] { let mut cmd = Command::new(adb_path); diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 01290b6..735cab7 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -164,7 +164,10 @@ fn set_adb_path(adb_path: String, app: tauri::AppHandle) -> Result<(), String> { let path = std::path::PathBuf::from("store.bin"); let store_res: Result<(), tauri_plugin_store::Error> = tauri_plugin_store::with_store(app, stores, path, |store| { - store.insert("adbPath".to_string(), serde_json::json!(adb_path))?; + store.insert( + "adbPath".to_string(), + serde_json::Value::String(adb_path.clone()), + )?; *share::ADB_PATH.lock().unwrap() = adb_path; Ok(()) }); @@ -190,9 +193,14 @@ async fn main() { tauri_plugin_store::with_store(app.app_handle().clone(), stores, path, |store| { // load adb path match store.get("adbPath") { - Some(value) => *share::ADB_PATH.lock().unwrap() = value.to_string(), + Some(value) => { + *share::ADB_PATH.lock().unwrap() = value.as_str().unwrap().to_string() + } None => store - .insert("adbPath".to_string(), serde_json::json!("adb")) + .insert( + "adbPath".to_string(), + serde_json::Value::String("adb".to_string()), + ) .unwrap(), }; diff --git a/src/components/Mask.vue b/src/components/Mask.vue index 2aaa9c5..d3fe790 100644 --- a/src/components/Mask.vue +++ b/src/components/Mask.vue @@ -66,12 +66,14 @@ onActivated(async () => { }); onMounted(async () => { - store.checkAdb = checkAdb; - await checkAdb(); await loadLocalStore(); store.checkUpdate = checkUpdate; store.showInputBox = showInputBox; if (store.checkUpdateAtStart) checkUpdate(); + store.checkAdb = checkAdb; + setTimeout(() => { + checkAdb(); + }, 500); }); let checkAdbMessage: MessageReactive | null = null; From f4d5824eefb8926f4294c793640e62e2e0acef67 Mon Sep 17 00:00:00 2001 From: AkiChase <1003019131@qq.com> Date: Wed, 22 May 2024 09:42:26 +0800 Subject: [PATCH 3/3] Scrcpy Mask v0.4.2 --- package.json | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 426100e..62e71b2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "scrcpy-mask", "private": true, - "version": "0.4.1", + "version": "0.4.2", "type": "module", "scripts": { "dev": "vite", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 0b19dc5..ba80516 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "scrcpy-mask" -version = "0.4.1" +version = "0.4.2" description = "A Tauri App" authors = ["AkiChase"] edition = "2021" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 4b5a801..27fe412 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,6 +1,6 @@ { "productName": "scrcpy-mask", - "version": "0.4.1", + "version": "0.4.2", "identifier": "com.akichase.mask", "build": { "beforeDevCommand": "pnpm dev",