Mountain/Vine/Server/Notification/
ProgressStart.rs1use serde_json::{Value, json};
8use tauri::Emitter;
9
10use crate::{Vine::Server::MountainVinegRPCService::MountainVinegRPCService, dev_log};
11
12pub async fn ProgressStart(Service:&MountainVinegRPCService, Parameter:&Value) {
13 let Handle = Parameter.get("handle").and_then(Value::as_str).unwrap_or("");
14
15 let Title = Parameter.get("title").and_then(Value::as_str).unwrap_or("");
16
17 let Cancellable = Parameter.get("cancellable").and_then(Value::as_bool).unwrap_or(false);
18
19 if let Err(Error) = Service.ApplicationHandle().emit(
20 "sky://notification/progress-begin",
21 json!({
22 "id": Handle,
23 "title": Title,
24 "cancellable": Cancellable,
25 }),
26 ) {
27 dev_log!(
28 "grpc",
29 "warn: [MountainVinegRPCService] sky://notification/progress-begin emit failed: {}",
30 Error
31 );
32 }
33}