From a7c7a533dbef360bf872004c7da421295346161a Mon Sep 17 00:00:00 2001 From: BTMuli Date: Tue, 12 Dec 2023 17:51:41 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=20macOS=20?= =?UTF-8?q?=E9=97=AA=E9=80=80=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #69 --- src-tauri/src/main.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 94d24c79..158e0c2b 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -21,6 +21,11 @@ async fn init_app(app_handle: tauri::AppHandle) { return; } } + let _mhy = app_handle.get_window("mhy_client"); + if _mhy.is_some() { + std::thread::sleep(std::time::Duration::from_millis(1000)); + _mhy.unwrap().close().unwrap(); + } app_handle.emit_all("initApp", ()).unwrap(); unsafe { APP_INITIALIZED = true; @@ -118,14 +123,6 @@ fn main() { ]) .setup(|_app| { let _window = _app.get_window("TeyvatGuide").unwrap(); - let _mhy = _app.get_window("mhy_client"); - if _mhy.is_some() { - std::thread::spawn(move || { - std::thread::sleep(std::time::Duration::from_secs(2)); - dbg!("close mhy_client"); - _mhy.unwrap().close().unwrap(); - }); - } #[cfg(debug_assertions)] // only include this code on debug builds _window.open_devtools(); // open the devtools on startup Ok(())