fix: refresh clash ui await patch
This commit is contained in:
parent
6423a29600
commit
96e76665d6
@ -43,7 +43,7 @@ impl Handle {
|
|||||||
// update system tray state (clash config)
|
// update system tray state (clash config)
|
||||||
pub fn update_systray_clash(&self) -> Result<()> {
|
pub fn update_systray_clash(&self) -> Result<()> {
|
||||||
if self.app_handle.is_none() {
|
if self.app_handle.is_none() {
|
||||||
bail!("unhandle error");
|
bail!("update_systray_clash unhandle error");
|
||||||
}
|
}
|
||||||
|
|
||||||
let app_handle = self.app_handle.as_ref().unwrap();
|
let app_handle = self.app_handle.as_ref().unwrap();
|
||||||
@ -75,7 +75,7 @@ impl Handle {
|
|||||||
/// update the system tray state (verge config)
|
/// update the system tray state (verge config)
|
||||||
pub fn update_systray(&self) -> Result<()> {
|
pub fn update_systray(&self) -> Result<()> {
|
||||||
if self.app_handle.is_none() {
|
if self.app_handle.is_none() {
|
||||||
bail!("unhandle error");
|
bail!("update_systray unhandle error");
|
||||||
}
|
}
|
||||||
|
|
||||||
let app_handle = self.app_handle.as_ref().unwrap();
|
let app_handle = self.app_handle.as_ref().unwrap();
|
||||||
|
@ -224,14 +224,16 @@ impl Core {
|
|||||||
let mut mapping = Mapping::new();
|
let mut mapping = Mapping::new();
|
||||||
mapping.insert(Value::from("mode"), Value::from(mode));
|
mapping.insert(Value::from("mode"), Value::from(mode));
|
||||||
|
|
||||||
|
let handle = self.handle.clone();
|
||||||
|
|
||||||
tauri::async_runtime::spawn(async move {
|
tauri::async_runtime::spawn(async move {
|
||||||
log_if_err!(Service::patch_config(info, mapping.to_owned()).await);
|
log_if_err!(Service::patch_config(info, mapping.to_owned()).await);
|
||||||
});
|
|
||||||
|
|
||||||
// update tray
|
// update tray
|
||||||
let handle = self.handle.lock();
|
let handle = handle.lock();
|
||||||
handle.refresh_clash();
|
handle.refresh_clash();
|
||||||
handle.update_systray_clash()?;
|
log_if_err!(handle.update_systray_clash());
|
||||||
|
});
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user