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