Skip to main content

Mountain/RPC/CocoonService/Workspace/
UpdateConfiguration.rs

1
2//! Forward a Cocoon-side configuration change to Sky for workbench
3//! settings refresh.
4
5use serde_json::json;
6use tauri::Emitter;
7use tonic::{Response, Status};
8
9use crate::{
10	RPC::CocoonService::CocoonServiceImpl,
11	Vine::Generated::{Empty, UpdateConfigurationRequest},
12	dev_log,
13};
14
15pub async fn Fn(Service:&CocoonServiceImpl, Request:UpdateConfigurationRequest) -> Result<Response<Empty>, Status> {
16	dev_log!(
17		"cocoon",
18		"[CocoonService] update_configuration: {} changed keys",
19		Request.changed_keys.len()
20	);
21
22	let _ = Service
23		.environment
24		.ApplicationHandle
25		.emit("sky://configuration/changed", json!({ "changedKeys": Request.changed_keys }));
26
27	Ok(Response::new(Empty {}))
28}