refactor: update update_icon method to require a non-optional verge reference and adjust related calls (#5417)

This commit is contained in:
Tunglies
2025-11-12 07:36:24 +08:00
committed by GitHub
parent 92a3f0cae3
commit f3a3d0e8b0
6 changed files with 27 additions and 26 deletions
+6 -1
View File
@@ -82,7 +82,12 @@ pub async fn change_clash_mode(mode: String) {
if clash_data.save_config().await.is_ok() {
handle::Handle::refresh_clash();
logging_error!(Type::Tray, tray::Tray::global().update_menu().await);
logging_error!(Type::Tray, tray::Tray::global().update_icon(None).await);
logging_error!(
Type::Tray,
tray::Tray::global()
.update_icon(&Config::verge().await.data_arc())
.await
);
}
let is_auto_close_connection = Config::verge()
+7 -2
View File
@@ -22,7 +22,12 @@ pub async fn patch_clash(patch: Mapping) -> Result<()> {
} else {
if patch.get("mode").is_some() {
logging_error!(Type::Tray, tray::Tray::global().update_menu().await);
logging_error!(Type::Tray, tray::Tray::global().update_icon(None).await);
logging_error!(
Type::Tray,
tray::Tray::global()
.update_icon(&Config::verge().await.data_arc())
.await
);
}
Config::runtime()
.await
@@ -213,7 +218,7 @@ async fn process_terminated_flags(update_flags: i32, patch: &IVerge) -> Result<(
}
if (update_flags & (UpdateFlags::SystrayIcon as i32)) != 0 {
tray::Tray::global()
.update_icon(Some(&Config::verge().await.latest_arc()))
.update_icon(&Config::verge().await.data_arc())
.await?;
}
if (update_flags & (UpdateFlags::SystrayTooltip as i32)) != 0 {