mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-10-28 17:22:15 +08:00
chore: sync backend review fixes into contract flow
This commit is contained in:
@@ -1,57 +0,0 @@
|
||||
use crate::{
|
||||
config::{Config, IVerge},
|
||||
core::{autostart, hotkey, lightweight, tray},
|
||||
};
|
||||
use anyhow::Result;
|
||||
use futures::future::BoxFuture;
|
||||
|
||||
pub(crate) fn ensure_autostart(_patch: &IVerge) -> BoxFuture<'_, Result<()>> {
|
||||
Box::pin(async move { autostart::update_launch().await })
|
||||
}
|
||||
|
||||
pub(crate) fn ensure_hotkey(patch: &IVerge) -> BoxFuture<'_, Result<()>> {
|
||||
Box::pin(async move {
|
||||
if let Some(hotkeys) = &patch.hotkeys {
|
||||
hotkey::Hotkey::global().update(hotkeys.to_owned()).await?;
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn ensure_tray_menu(_patch: &IVerge) -> BoxFuture<'_, Result<()>> {
|
||||
Box::pin(async move { tray::Tray::global().update_menu().await })
|
||||
}
|
||||
|
||||
pub(crate) fn ensure_tray_icon(patch: &IVerge) -> BoxFuture<'_, Result<()>> {
|
||||
Box::pin(async move {
|
||||
tray::Tray::global()
|
||||
.update_icon(&Config::verge().await.latest_arc())
|
||||
.await?;
|
||||
#[cfg(target_os = "macos")]
|
||||
if let Some(enabled) = patch.enable_tray_speed {
|
||||
tray::Tray::global().update_speed_task(enabled);
|
||||
}
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
let _ = patch;
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn ensure_tray_tooltip(_patch: &IVerge) -> BoxFuture<'_, Result<()>> {
|
||||
Box::pin(async move { tray::Tray::global().update_tooltip().await })
|
||||
}
|
||||
|
||||
pub(crate) fn ensure_tray_click(_patch: &IVerge) -> BoxFuture<'_, Result<()>> {
|
||||
Box::pin(async move { tray::Tray::global().update_click_behavior().await })
|
||||
}
|
||||
|
||||
pub(crate) fn ensure_lightweight(patch: &IVerge) -> BoxFuture<'_, Result<()>> {
|
||||
Box::pin(async move {
|
||||
if patch.enable_auto_light_weight_mode.unwrap_or(false) {
|
||||
lightweight::enable_auto_light_weight_mode().await;
|
||||
} else {
|
||||
lightweight::disable_auto_light_weight_mode();
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
@@ -238,7 +238,7 @@ impl CoreManager {
|
||||
}
|
||||
}
|
||||
|
||||
fn current_core_readiness_generation(&self) -> Option<u64> {
|
||||
pub(crate) fn current_core_readiness_generation(&self) -> Option<u64> {
|
||||
active_core_readiness_generation(self.core_readiness_state.load(Ordering::Acquire))
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
pub(crate) mod app_effects;
|
||||
pub mod auto_backup;
|
||||
pub mod autostart;
|
||||
pub mod backup;
|
||||
|
||||
Reference in New Issue
Block a user