mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-06 00:32:13 +08:00
refactor: frontend (#7097)
* refactor: remove unused window show/hide event listeners * refactor: deduplicate profile-changed event handling * refactor: remove unused setupCloseListener from use-listen * refactor: remove unused removeAllListeners from use-listen * fix(backend): dedupe profile changed notification on import * fix: avoid duplicate timer update completed event * refactor(frontend): simplify proxy switch fallback path
This commit is contained in:
@@ -94,14 +94,6 @@ pub async fn import_profile(url: std::string::String, option: Option<PrfOption>)
|
||||
handle::Handle::notify_profile_changed(uid);
|
||||
}
|
||||
|
||||
// 异步保存配置文件并发送全局通知
|
||||
if let Some(uid) = &item.uid {
|
||||
// 延迟发送,确保文件已完全写入
|
||||
tokio::time::sleep(Duration::from_millis(100)).await;
|
||||
logging!(info, Type::Cmd, "[导入订阅] 发送配置变更通知: {}", uid);
|
||||
handle::Handle::notify_profile_changed(uid);
|
||||
}
|
||||
|
||||
logging!(info, Type::Cmd, "[导入订阅] 导入完成: {}", help::mask_url(&url));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::{config::Config, core::handle, feat, process::AsyncHandler, singleton, utils::resolve::is_resolve_done};
|
||||
use crate::{config::Config, feat, process::AsyncHandler, singleton, utils::resolve::is_resolve_done};
|
||||
use anyhow::Result;
|
||||
use clash_verge_logging::{Type, logging, logging_error};
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
@@ -396,7 +396,6 @@ impl Timer {
|
||||
uid,
|
||||
task_start.elapsed().as_millis()
|
||||
);
|
||||
handle::Handle::notify_profile_update_completed(uid);
|
||||
}
|
||||
Ok(Err(e)) => logging_error!(Type::Timer, "Failed to update profile uid {}: {}", uid, e),
|
||||
Err(_) => logging_error!(Type::Timer, "Timer task timed out for uid: {}", uid),
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use anyhow::Result;
|
||||
use percent_encoding::percent_decode_str;
|
||||
use smartstring::alias::String;
|
||||
@@ -123,7 +121,6 @@ async fn fetch_profile_item(url: &str, name: Option<&String>) -> Option<PrfItem>
|
||||
async fn post_import_updates(uid: &String, had_current_profile: bool) {
|
||||
handle::Handle::refresh_verge();
|
||||
handle::Handle::notify_profile_changed(uid);
|
||||
tokio::time::sleep(Duration::from_millis(100)).await;
|
||||
|
||||
let should_update_core = if uid.is_empty() || had_current_profile {
|
||||
false
|
||||
@@ -131,7 +128,6 @@ async fn post_import_updates(uid: &String, had_current_profile: bool) {
|
||||
let profiles = Config::profiles().await;
|
||||
profiles.latest_arc().is_current_profile_index(uid)
|
||||
};
|
||||
handle::Handle::notify_profile_changed(uid);
|
||||
|
||||
if should_update_core {
|
||||
refresh_core_config().await;
|
||||
|
||||
Reference in New Issue
Block a user