Revert "fix: ensure app state is saved on exit and window events for better state management"

This reverts commit 9af0803e9b.

chore: update UPDATELOG
This commit is contained in:
Tunglies
2025-05-22 10:25:00 +08:00
parent d49618786e
commit b1c31f7a6f
4 changed files with 3 additions and 31 deletions

View File

@@ -25,6 +25,7 @@
- 修复 .window-state.json 无法删除的问题 - 修复 .window-state.json 无法删除的问题
- 无法修改配置更新 HTTP 请求超时 - 无法修改配置更新 HTTP 请求超时
- 修复 getDelayFix 钩子问题 - 修复 getDelayFix 钩子问题
- 使用外部扩展脚本覆写代理组时首页无法显示代理组
#### 新增了: #### 新增了:
- Mihomo(Meta)内核升级至 1.19.8 - Mihomo(Meta)内核升级至 1.19.8

View File

@@ -17,7 +17,6 @@
"autostart:allow-enable", "autostart:allow-enable",
"autostart:allow-disable", "autostart:allow-disable",
"autostart:allow-is-enabled", "autostart:allow-is-enabled",
"core:window:allow-set-theme", "core:window:allow-set-theme"
"window-state:default"
] ]
} }

View File

@@ -342,26 +342,12 @@ pub fn run() {
if code.is_none() { if code.is_none() {
api.prevent_exit(); api.prevent_exit();
} }
if let Some(app_handle) = core::handle::Handle::global().app_handle() {
logging_error!(
Type::Window,
true,
app_handle.save_window_state(StateFlags::all())
);
}
} }
tauri::RunEvent::Exit => { tauri::RunEvent::Exit => {
// avoid duplicate cleanup // avoid duplicate cleanup
if core::handle::Handle::global().is_exiting() { if core::handle::Handle::global().is_exiting() {
return; return;
} }
if let Some(app_handle) = core::handle::Handle::global().app_handle() {
logging_error!(
Type::Window,
true,
app_handle.save_window_state(StateFlags::all())
);
}
feat::clean(); feat::clean();
} }
tauri::RunEvent::WindowEvent { label, event, .. } => { tauri::RunEvent::WindowEvent { label, event, .. } => {
@@ -380,13 +366,6 @@ pub fn run() {
} else { } else {
logging!(warn, Type::Window, true, "尝试隐藏窗口但窗口不存在"); logging!(warn, Type::Window, true, "尝试隐藏窗口但窗口不存在");
} }
if let Some(app_handle) = core::handle::Handle::global().app_handle() {
logging_error!(
Type::Window,
true,
app_handle.save_window_state(StateFlags::all())
);
}
} }
tauri::WindowEvent::Focused(true) => { tauri::WindowEvent::Focused(true) => {
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
@@ -450,13 +429,6 @@ pub fn run() {
hotkey::Hotkey::global().unregister("CMD+W") hotkey::Hotkey::global().unregister("CMD+W")
); );
} }
if let Some(app_handle) = core::handle::Handle::global().app_handle() {
logging_error!(
Type::Window,
true,
app_handle.save_window_state(StateFlags::all())
);
}
} }
_ => {} _ => {}
} }

View File

@@ -74,4 +74,4 @@
"csp": null "csp": null
} }
} }
} }