Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 12 additions & 0 deletions src/inbound/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ enum InboundEventType {
ApplicationDidTerminate(ApplicationEvent),
DidReceiveDeepLink(DidReceiveDeepLinkEvent),
SystemDidWakeUp(SystemDidWakeUpEvent),
ShowSettingsInterface(ShowSettingsInterfaceEvent),
/* Action events */
KeyDown(KeyEvent),
KeyUp(KeyEvent),
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions src/inbound/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ pub struct DidReceiveGlobalSettingsPayload {
pub struct DidReceiveGlobalSettingsEvent {
pub payload: DidReceiveGlobalSettingsPayload,
}

#[derive(Clone, Debug, Deserialize)]
pub struct ShowSettingsInterfaceEvent {}
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
}

Expand Down