From c96f2724d630cfe2cf2633614941037437eebc09 Mon Sep 17 00:00:00 2001 From: CakeAL <1742507190@qq.com> Date: Thu, 18 Jul 2024 08:55:07 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(main):=20macOS=20=E7=9A=84?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/src/main.rs | 15 +++++++++------ src-tauri/src/utils.rs | 2 ++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 26a7e85..88b0c67 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -7,7 +7,6 @@ use tauri::Manager; use ustb_wifi_tools::commands::*; use ustb_wifi_tools::entities::AppState; use ustb_wifi_tools::setting::Setting; -use ustb_wifi_tools::utils::get_windows_build_number; fn main() { tauri::Builder::default() @@ -53,11 +52,15 @@ fn background_init(app: &mut tauri::App) -> Result<(), Box= 22000 { - window_vibrancy::apply_mica(&win, None).map_err(|err| format!("启动错误: {}", err))?; - } else { - window_vibrancy::apply_blur(&win, Some((18, 18, 18, 125))).map_err(|err| format!("启动错误: {}", err))?; + { + use ustb_wifi_tools::utils::get_windows_build_number; + if get_windows_build_number()? >= 22000 { + window_vibrancy::apply_mica(&win, None).map_err(|err| format!("启动错误: {}", err))?; + } else { + window_vibrancy::apply_blur(&win, Some((18, 18, 18, 125))) + .map_err(|err| format!("启动错误: {}", err))?; + } } - + Ok(()) } diff --git a/src-tauri/src/utils.rs b/src-tauri/src/utils.rs index 292ecae..1d706a7 100644 --- a/src-tauri/src/utils.rs +++ b/src-tauri/src/utils.rs @@ -135,6 +135,7 @@ pub fn login_via_headless_browser(browser_path: PathBuf, account: &Account) -> R Ok(res) } + #[cfg(target_os = "windows")] pub fn get_windows_build_number() -> Result> { use std::{process::Command, str::from_utf8}; @@ -177,6 +178,7 @@ mod test { } #[test] + #[cfg(target_os = "windows")] fn test_get_windows_build_number() { let res = get_windows_build_number(); dbg!(res.unwrap());