diff --git a/apps/desktop/src-tauri/src/deeplink_actions.rs b/apps/desktop/src-tauri/src/deeplink_actions.rs index dbd90f667f..543dac4dc5 100644 --- a/apps/desktop/src-tauri/src/deeplink_actions.rs +++ b/apps/desktop/src-tauri/src/deeplink_actions.rs @@ -17,7 +17,7 @@ pub enum CaptureMode { #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] -pub enum DeepLinkAction { +pub enum Action { StartRecording { capture_mode: CaptureMode, camera: Option, @@ -26,6 +26,7 @@ pub enum DeepLinkAction { mode: RecordingMode, }, StopRecording, + PauseRecording, OpenEditor { project_path: PathBuf, }, @@ -41,7 +42,7 @@ pub fn handle(app_handle: &AppHandle, urls: Vec) { .into_iter() .filter(|url| !url.as_str().is_empty()) .filter_map(|url| { - DeepLinkAction::try_from(&url) + Action::try_from(&url) .map_err(|e| match e { ActionParseFromUrlError::ParseFailed(msg) => { eprintln!("Failed to parse deep link \"{}\": {}", &url, msg) @@ -49,7 +50,6 @@ pub fn handle(app_handle: &AppHandle, urls: Vec) { ActionParseFromUrlError::Invalid => { eprintln!("Invalid deep link format \"{}\"", &url) } - // Likely login action, not handled here. ActionParseFromUrlError::NotAction => {} }) .ok() @@ -76,7 +76,7 @@ pub enum ActionParseFromUrlError { NotAction, } -impl TryFrom<&Url> for DeepLinkAction { +impl TryFrom<&Url> for Action { type Error = ActionParseFromUrlError; fn try_from(url: &Url) -> Result { @@ -104,10 +104,10 @@ impl TryFrom<&Url> for DeepLinkAction { } } -impl DeepLinkAction { +impl Action { pub async fn execute(self, app: &AppHandle) -> Result<(), String> { match self { - DeepLinkAction::StartRecording { + Action::StartRecording { capture_mode, camera, mic_label, @@ -143,15 +143,18 @@ impl DeepLinkAction { .await .map(|_| ()) } - DeepLinkAction::StopRecording => { + Action::StopRecording => { crate::recording::stop_recording(app.clone(), app.state()).await } - DeepLinkAction::OpenEditor { project_path } => { + Action::PauseRecording => { + crate::recording::pause_recording(app.clone(), app.state()).await + } + Action::OpenEditor { project_path } => { crate::open_project_from_path(Path::new(&project_path), app.clone()) } - DeepLinkAction::OpenSettings { page } => { + Action::OpenSettings { page } => { crate::show_window(app.clone(), ShowCapWindow::Settings { page }).await } } } -} +} \ No newline at end of file diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs index 90803f8abe..c4004d4f6f 100644 --- a/apps/desktop/src-tauri/src/lib.rs +++ b/apps/desktop/src-tauri/src/lib.rs @@ -2776,7 +2776,7 @@ pub async fn run(recording_logging_handle: LoggingHandle, logs_dir: PathBuf) { tauri::Builder::default().plugin(tauri_plugin_single_instance::init(|app, args, _cwd| { trace!("Single instance invoked with args {args:?}"); - // This is also handled as a deeplink on some platforms (eg macOS), see deeplink_actions + // This is also handled as a deeplink on some platforms (eg macOS), see deeplink_actions. let Some(cap_file) = args .iter() .find(|arg| arg.ends_with(".cap"))