From ff1e3c1d047baae28cc572896d75a199e092f33b Mon Sep 17 00:00:00 2001 From: Sadik111 Date: Sat, 24 Jan 2026 22:28:56 +0530 Subject: [PATCH] feat(deeplink): add pause, resume, and device switching actions (#1540) --- .../desktop/src-tauri/src/deeplink_actions.rs | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/apps/desktop/src-tauri/src/deeplink_actions.rs b/apps/desktop/src-tauri/src/deeplink_actions.rs index dbd90f667f..be88af5b5e 100644 --- a/apps/desktop/src-tauri/src/deeplink_actions.rs +++ b/apps/desktop/src-tauri/src/deeplink_actions.rs @@ -32,6 +32,14 @@ pub enum DeepLinkAction { OpenSettings { page: Option, }, + PauseRecording, + ResumeRecording, + SwitchMicrophone { + mic_label: Option, + }, + SwitchCamera { + camera: Option, + }, } pub fn handle(app_handle: &AppHandle, urls: Vec) { @@ -152,6 +160,41 @@ impl DeepLinkAction { DeepLinkAction::OpenSettings { page } => { crate::show_window(app.clone(), ShowCapWindow::Settings { page }).await } + DeepLinkAction::PauseRecording => { + crate::recording::pause_recording(app.clone(), app.state()).await + } + DeepLinkAction::ResumeRecording => { + crate::recording::resume_recording(app.clone(), app.state()).await + } + DeepLinkAction::SwitchMicrophone { mic_label } => { + if let Some(ref label) = mic_label { + let available_mics = cap_recording::feeds::microphone::MicrophoneFeed::list(); + if !available_mics.contains_key(label) { + return Err(format!("Microphone with label \"{}\" not found", label)); + } + } + + let state = app.state::>(); + crate::set_mic_input(state, mic_label).await + } + DeepLinkAction::SwitchCamera { camera } => { + if let Some(ref id) = camera { + let cameras: Vec<_> = cap_camera::list_cameras().collect(); + let exists = cameras.iter().any(|info| match id { + DeviceOrModelID::DeviceID(device_id) => info.device_id() == device_id, + DeviceOrModelID::ModelID(model_id) => { + info.model_id().is_some_and(|existing| existing == model_id) + } + }); + + if !exists { + return Err(format!("Camera with ID \"{:?}\" not found", id)); + } + } + + let state = app.state::>(); + crate::set_camera_input(app.clone(), state, camera).await + } } } }