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