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
16 let Title = Parameter.get("title").and_then(Value::as_str).unwrap_or("");
17
18 let Cancellable = Parameter.get("cancellable").and_then(Value::as_bool).unwrap_or(false);
19
20 if let Err(Error) = Service.ApplicationHandle().emit(
21 "sky://notification/progress-begin",
22 json!({
23 "id": Handle,
24 "title": Title,
25 "cancellable": Cancellable,
26 }),
27 ) {
28 dev_log!(
29 "grpc",
30 "warn: [MountainVinegRPCService] sky://notification/progress-begin emit failed: {}",
31 Error
32 );
33 }
34}