Skip to main content

Mountain/RPC/CocoonService/Workspace/
UpdateConfiguration.rs

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