diff --git a/Cargo.toml b/Cargo.toml index cb33f1b..88ee88e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ categories = [ "web-programming::websocket", ] authors = ["nekename"] -version = "2.7.0" +version = "2.7.1" edition = "2024" license = "MIT" readme = "README.md" diff --git a/src/inbound/mod.rs b/src/inbound/mod.rs index a90c0e5..fd09d61 100644 --- a/src/inbound/mod.rs +++ b/src/inbound/mod.rs @@ -64,6 +64,7 @@ enum InboundEventType { ApplicationDidTerminate(ApplicationEvent), DidReceiveDeepLink(DidReceiveDeepLinkEvent), SystemDidWakeUp(SystemDidWakeUpEvent), + ShowSettingsInterface(ShowSettingsInterfaceEvent), /* Action events */ KeyDown(KeyEvent), KeyUp(KeyEvent), @@ -122,6 +123,10 @@ pub trait GlobalEventHandler: Send + Sync { async fn system_did_wake_up(&self, _event: SystemDidWakeUpEvent) -> Result<()> { Ok(()) } + + async fn show_settings_interface(&self, _event: ShowSettingsInterfaceEvent) -> Result<()> { + Ok(()) + } } static GLOBAL_EVENT_HANDLER: OnceLock<&'static dyn GlobalEventHandler> = OnceLock::new(); @@ -220,6 +225,13 @@ pub(crate) async fn process_incoming_messages( Ok(()) } } + InboundEventType::ShowSettingsInterface(event) => { + if let Some(h) = GLOBAL_EVENT_HANDLER.get() { + h.show_settings_interface(event).await + } else { + Ok(()) + } + } /* Instance events */ InboundEventType::KeyDown(event) => runtime::handle_key_down(event).await, InboundEventType::KeyUp(event) => runtime::handle_key_up(event).await, diff --git a/src/inbound/settings.rs b/src/inbound/settings.rs index 47161cd..2a2d77d 100644 --- a/src/inbound/settings.rs +++ b/src/inbound/settings.rs @@ -20,3 +20,6 @@ pub struct DidReceiveGlobalSettingsPayload { pub struct DidReceiveGlobalSettingsEvent { pub payload: DidReceiveGlobalSettingsPayload, } + +#[derive(Clone, Debug, Deserialize)] +pub struct ShowSettingsInterfaceEvent {} diff --git a/src/lib.rs b/src/lib.rs index 0067030..1dc93e6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,7 +9,7 @@ pub use crate::runtime::*; pub mod global_events { pub use super::inbound::{ DeviceDidConnectEvent, DeviceDidDisconnectEvent, DidReceiveGlobalSettingsEvent, GlobalEventHandler, - SetBrightnessEvent, SetImageEvent, SystemDidWakeUpEvent, set_global_event_handler, + SetBrightnessEvent, SetImageEvent, ShowSettingsInterfaceEvent, SystemDidWakeUpEvent, set_global_event_handler, }; }