Skip to main content

Mountain/IPC/WindAirCommands/
ApplyUpdate.rs

1
2//! `ApplyUpdate` Tauri command - tell Air to install a
3//! previously downloaded update package.
4
5use crate::{
6	IPC::WindAirCommands::{GetAirAddress, GetOrCreateAirClient},
7	dev_log,
8};
9
10#[tauri::command]
11pub async fn ApplyUpdate(update_id:String, update_path:String) -> Result<bool, String> {
12	dev_log!(
13		"grpc",
14		"[WindAirCommands] ApplyUpdate called: id={}, path={}",
15		update_id,
16		update_path
17	);
18
19	let air_address = GetAirAddress::Fn()?;
20
21	let client = GetOrCreateAirClient::Fn(air_address).await?;
22
23	let request_id = uuid::Uuid::new_v4().to_string();
24
25	client
26		.apply_update(request_id, update_id, update_path)
27		.await
28		.map_err(|e| format!("Update application failed: {:?}", e))?;
29
30	dev_log!("grpc", "[WindAirCommands] Update applied successfully");
31
32	Ok(true)
33}