feat(app): event_log and mark_read bridge commands
This commit is contained in:
@@ -298,3 +298,16 @@ pub async fn delete_group(state: BridgeState<'_>, group_id: String) -> Result<Va
|
||||
pub async fn focus(state: BridgeState<'_>, surface_id: String) -> Result<Value, String> {
|
||||
data_of(state.request(Cmd::Focus { surface_id: SurfaceId(surface_id) }).await.map_err(|e| e.to_string())?)
|
||||
}
|
||||
|
||||
// ---- M3 event log commands ----
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn event_log(state: BridgeState<'_>, limit: Option<u32>) -> Result<Value, String> {
|
||||
data_of(state.request(Cmd::EventLog { limit }).await.map_err(|e| e.to_string())?)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn mark_read(state: BridgeState<'_>, target: Value) -> Result<Value, String> {
|
||||
let target: spacesh_proto::MarkReadTarget = serde_json::from_value(target).map_err(|e| format!("invalid mark_read target: {e}"))?;
|
||||
data_of(state.request(Cmd::MarkRead { target }).await.map_err(|e| e.to_string())?)
|
||||
}
|
||||
|
||||
@@ -47,6 +47,8 @@ pub fn run() {
|
||||
bridge::set_group,
|
||||
bridge::delete_group,
|
||||
bridge::focus,
|
||||
bridge::event_log,
|
||||
bridge::mark_read,
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running spacesh");
|
||||
|
||||
Reference in New Issue
Block a user