refactor: improve proxy retrieval and add window destruction method

This commit is contained in:
Tunglies
2025-03-19 02:04:01 +08:00
parent baa535b609
commit 772ecdd3b0
3 changed files with 29 additions and 16 deletions

View File

@@ -41,6 +41,18 @@ impl Handle {
window
}
pub fn destroy_window(&self) -> Result<(), String> {
if let Some(window) = self.get_window() {
log_err!(window.close());
}
if let Some(window) = Self::global().get_window() {
if let Some(webview) = window.get_webview_window("main") {
log_err!(webview.destroy());
}
}
Ok(())
}
pub fn refresh_clash() {
if let Some(window) = Self::global().get_window() {
log_err!(window.emit("verge://refresh-clash-config", "yes"));