Skip to main content

Mountain/RPC/CocoonService/Window/
ReportProgress.rs

1//! Update a progress notification with a new message + increment.
2
3use serde_json::json;
4use tauri::Emitter;
5use tonic::{Response, Status};
6use ::Vine::Generated::{Empty, ReportProgressRequest};
7
8use crate::{RPC::CocoonService::CocoonServiceImpl, dev_log};
9
10pub async fn Fn(Service:&CocoonServiceImpl, Request:ReportProgressRequest) -> Result<Response<Empty>, Status> {
11	dev_log!("cocoon", "[CocoonService] report_progress: handle={}", Request.handle);
12
13	let _ = Service.environment.ApplicationHandle.emit(
14		"sky://progress/update",
15		json!({
16			"handle": Request.handle,
17			"message": Request.message,
18			"increment": Request.increment,
19		}),
20	);
21
22	Ok(Response::new(Empty {}))
23}