feat: add periodic tray menu refresh and normalize tunnel metrics field names
Add background task to refresh tray menu every 5 seconds to keep status display current. Add RawTunnelMetrics type and normalizeTunnelMetrics helper to handle both snake_case and camelCase field names from backend responses. Update refreshTunnelMetrics to normalize metrics before setting state and explicitly cast active status to boolean.
This commit is contained in:
@@ -665,6 +665,14 @@ pub fn run() {
|
||||
});
|
||||
refresh_tray_menu(app.handle());
|
||||
|
||||
let app_handle = app.handle().clone();
|
||||
tauri::async_runtime::spawn(async move {
|
||||
loop {
|
||||
refresh_tray_menu(&app_handle);
|
||||
tauri::async_runtime::sleep(std::time::Duration::from_secs(5)).await;
|
||||
}
|
||||
});
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.on_window_event(|window, event| match event {
|
||||
|
||||
Reference in New Issue
Block a user