Skip to main content

Mountain/RPC/CocoonService/Window/
ReportProgress.rs

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