Mountain/Environment/OutputProvider/
ChannelVisibility.rs1use CommonLibrary::Error::CommonError::CommonError;
8use serde_json::json;
9use tauri::Emitter;
10
11use crate::{Environment::Utility, dev_log};
12
13pub(super) async fn reveal_channel(
15 env:&crate::Environment::MountainEnvironment::MountainEnvironment,
16 channel_identifier:String,
17 preserve_focus:bool,
18) -> Result<(), CommonError> {
19 dev_log!("output", "[OutputProvider] Revealing channel: '{}'", channel_identifier);
20
21 let mut channels_guard = env
22 .ApplicationState
23 .Feature
24 .OutputChannels
25 .OutputChannels
26 .lock()
27 .map_err(Utility::MapApplicationStateLockErrorToCommonError)?;
28
29 if let Some(channel_state) = channels_guard.get_mut(&channel_identifier) {
30 channel_state.IsVisible = true;
31
32 let event_payload = json!({ "Id": channel_identifier, "PreserveFocus": preserve_focus });
33
34 env.ApplicationHandle
35 .emit("sky://output/reveal", event_payload)
36 .map_err(|Error| CommonError::UserInterfaceInteraction { Reason:Error.to_string() })?;
37 } else {
38 dev_log!(
39 "output",
40 "warn: [OutputProvider] Channel '{}' not found for reveal.",
41 channel_identifier
42 );
43 }
44
45 Ok(())
46}
47
48pub(super) async fn close_channel(
50 _env:&crate::Environment::MountainEnvironment::MountainEnvironment,
51 _channel_identifier:String,
52) -> Result<(), CommonError> {
53 dev_log!("output", "warn: [OutputProvider] Close is not fully implemented.");
54
55 Ok(())
56}