mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-10-24 20:52:15 +08:00
feat: Implement DNS management for macOS
- Added `set_public_dns` and `restore_public_dns` functions in `dns.rs` to manage system DNS settings. - Introduced `resolve` module to encapsulate DNS and scheme resolution functionalities. - Implemented `resolve_scheme` function in `scheme.rs` to handle deep links and profile imports. - Created UI readiness management in `ui.rs` to track and update UI loading states. - Developed window management logic in `window.rs` to handle window creation and visibility. - Added initial loading overlay script in `window_script.rs` for better user experience during startup. - Updated server handling in `server.rs` to integrate new resolve functionalities. - Refactored window creation calls in `window_manager.rs` to use the new window management logic.
This commit is contained in:
@@ -78,7 +78,7 @@ pub async fn run_once_auto_lightweight() {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn auto_lightweight_mode_init() {
|
||||
pub async fn auto_lightweight_mode_init() -> Result<()> {
|
||||
if let Some(app_handle) = handle::Handle::global().app_handle() {
|
||||
// Check if state is available before accessing it
|
||||
if app_handle.try_state::<Mutex<LightWeightState>>().is_none() {
|
||||
@@ -88,7 +88,7 @@ pub async fn auto_lightweight_mode_init() {
|
||||
true,
|
||||
"LightWeightState 尚未初始化,跳过自动轻量模式初始化"
|
||||
);
|
||||
return;
|
||||
return Err(anyhow::anyhow!("LightWeightState not be initialized"));
|
||||
}
|
||||
|
||||
let is_silent_start =
|
||||
@@ -114,9 +114,12 @@ pub async fn auto_lightweight_mode_init() {
|
||||
// 确保托盘状态更新
|
||||
if let Err(e) = Tray::global().update_part().await {
|
||||
log::warn!("Failed to update tray: {e}");
|
||||
return Err(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// 检查是否处于轻量模式
|
||||
@@ -214,7 +217,7 @@ pub async fn exit_lightweight_mode() {
|
||||
handle::Handle::global().set_activation_policy_regular();
|
||||
|
||||
// 重置UI就绪状态
|
||||
crate::utils::resolve::reset_ui_ready();
|
||||
crate::utils::resolve::ui::reset_ui_ready();
|
||||
|
||||
// 更新托盘显示
|
||||
let _tray = crate::core::tray::Tray::global();
|
||||
|
||||
Reference in New Issue
Block a user