Skip to content
Closed
Changes from 2 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
30 changes: 30 additions & 0 deletions apps/desktop/src-tauri/src/deeplink_actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ pub enum DeepLinkAction {
mode: RecordingMode,
},
StopRecording,
PauseRecording,
ResumeRecording,
TogglePauseRecording,
RestartRecording,
SwitchMicrophone {
mic_label: Option<String>,
},
SwitchCamera {
camera: Option<DeviceOrModelID>,
},
OpenEditor {
project_path: PathBuf,
},
Expand Down Expand Up @@ -146,6 +156,26 @@ impl DeepLinkAction {
DeepLinkAction::StopRecording => {
crate::recording::stop_recording(app.clone(), app.state()).await
}
DeepLinkAction::PauseRecording => {
crate::recording::pause_recording(app.clone(), app.state()).await
}
Comment on lines +159 to +165
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For deeplinks, do you want pause/resume/toggle to behave like StopRecording and error when there’s no active recording? Right now these will succeed silently when nothing is recording.

Suggested change
DeepLinkAction::PauseRecording => {
crate::recording::pause_recording(app.clone(), app.state()).await
}
DeepLinkAction::PauseRecording => {
let state = app.state::<ArcLock<App>>();
if state.read().await.current_recording().is_none() {
return Err("Recording not in progress".to_string());
}
crate::recording::pause_recording(app.clone(), state).await
}

DeepLinkAction::ResumeRecording => {
crate::recording::resume_recording(app.clone(), app.state()).await
}
DeepLinkAction::TogglePauseRecording => {
crate::recording::toggle_pause_recording(app.clone(), app.state()).await
}
DeepLinkAction::RestartRecording => {
crate::recording::restart_recording(app.clone(), app.state())
.await
.map(|_| ())
}
DeepLinkAction::SwitchMicrophone { mic_label } => {
crate::set_mic_input(app.state(), mic_label).await
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: it’s a bit easier to follow (and a little less inference-dependent) if this matches the StartRecording pattern and makes the state type explicit.

Suggested change
crate::set_mic_input(app.state(), mic_label).await
crate::set_mic_input(app.state::<ArcLock<App>>(), mic_label).await

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 7bd37b3: SwitchMicrophone now treats empty/whitespace labels as unset (None) and uses explicit app.state::<ArcLock<App>>().

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small robustness thing: treat empty mic labels as None so callers that send "" don’t end up trying to select a non-existent device.

Suggested change
crate::set_mic_input(app.state(), mic_label).await
crate::set_mic_input(app.state(), mic_label.filter(|label| !label.trim().is_empty())).await

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 7bd37b3: SwitchMicrophone now treats empty/whitespace labels as unset (None) and uses explicit app.state::<ArcLock<App>>().

}
DeepLinkAction::SwitchCamera { camera } => {
crate::set_camera_input(app.clone(), app.state(), camera, None).await
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor robustness: mirror the mic label handling and treat an empty DeviceID("") as unset so it doesn't trigger 3 init retries.

Suggested change
crate::set_camera_input(app.clone(), app.state(), camera, None).await
let camera = camera.filter(|id| match id {
DeviceOrModelID::DeviceID(device_id) => !device_id.trim().is_empty(),
DeviceOrModelID::ModelID(_) => true,
});
crate::set_camera_input(app.clone(), app.state(), camera, None).await

}
DeepLinkAction::OpenEditor { project_path } => {
crate::open_project_from_path(Path::new(&project_path), app.clone())
}
Expand Down