Skip to content
This repository was archived by the owner on Aug 5, 2026. It is now read-only.

Commit a876553

Browse files
committed
feat: add notification bridge from app
1 parent 526d341 commit a876553

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

src/AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ main.rs
6363
| WebSocket events to UI | `websocket.rs` | `broadcast_event()`, `WebSocketServer` |
6464
| OTA updates | `app/msgpack.rs` | `download_ota_chunks_task()`, MD5 verification |
6565
| `media.control.*` routing | `app/hid_mapping.rs` (shared mapping), `iap2_wrapper.rs` (WebSocket source), `app/msgpack.rs` (phone EA source) | Both sources resolve via `method_to_hid_command`. WebSocket path calls `lib_conn.send_hid_command` directly; Phone EA path forwards through `hid_tx` channel — see MEDIA CONTROL / HID below |
66+
| `notification.show` (UI alerts) | `app/msgpack.rs` (explicit log branch) | Phone-emitted events with `{id, title, body, category, daysUntilExpiry, timestamp}`. Forwarded to WebSocket UI clients via the existing `broadcast_event` fallthrough; the explicit branch only adds logging. Consumed by `nocturne-ui/src/components/common/notifications/NotificationBridge.jsx`. |
6667

6768
## CONVENTIONS
6869

src/app/msgpack.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,14 @@ impl MsgPackProtocolHandler {
957957
if let Some(has_lifetime) = data.get("hasLifetime").and_then(|v| v.as_bool()) {
958958
info!("Lifetime entitlement updated: {}", has_lifetime);
959959
}
960+
} else if topic == "notification.show" {
961+
let id = data.get("id").and_then(|v| v.as_str()).unwrap_or("");
962+
let title = data.get("title").and_then(|v| v.as_str()).unwrap_or("");
963+
let category = data.get("category").and_then(|v| v.as_str()).unwrap_or("");
964+
info!(
965+
"Forwarding notification.show to UI: id={} category={} title=\"{}\"",
966+
id, category, title
967+
);
960968
} else {
961969
info!("Broadcasting event to WebSocket clients: {}", topic);
962970
}

0 commit comments

Comments
 (0)