basic system tray functionality

This commit is contained in:
Joseph Montanaro committed 2022-12-21 14:49:01 -08:00
1 parent 50f0985f4f
commit 5ffa55c03c
9 files changed
+136 -14

No files matched your search

+16 -2
View File
@@ -1,5 +1,8 @@
use core::time::Duration;
use serde::{Serialize, Deserialize};
use tauri::State;
use tokio::time::sleep;
use crate::clientinfo::Client;
use crate::state::{AppState, Session, Credentials};
@@ -27,9 +30,20 @@ pub enum Approval {
#[tauri::command]
pub fn respond(response: RequestResponse, app_state: State<'_, AppState>) -> Result<(), String> {
pub fn respond(
response: RequestResponse,
window: tauri::Window,
app_state: State<'_, AppState>
) -> Result<(), String> {
app_state.send_response(response)
.map_err(|e| format!("Error responding to request: {e}"))
.map_err(|e| format!("Error responding to request: {e}"))?;
tauri::async_runtime::spawn(async move {
sleep(Duration::from_secs(3)).await;
let _ = window.hide();
});
Ok(())
}