Skip to content

Commit d9721fa

Browse files
committed
feat(deeplink): add pause, resume, and device switching actions (#1540)
1 parent 2c49c7d commit d9721fa

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

apps/desktop/src-tauri/src/deeplink_actions.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ pub enum DeepLinkAction {
3232
OpenSettings {
3333
page: Option<String>,
3434
},
35+
PauseRecording,
36+
ResumeRecording,
37+
SwitchMicrophone {
38+
mic_label: Option<String>,
39+
},
40+
SwitchCamera {
41+
camera: Option<DeviceOrModelID>,
42+
},
3543
}
3644

3745
pub fn handle(app_handle: &AppHandle, urls: Vec<Url>) {
@@ -152,6 +160,32 @@ impl DeepLinkAction {
152160
DeepLinkAction::OpenSettings { page } => {
153161
crate::show_window(app.clone(), ShowCapWindow::Settings { page }).await
154162
}
163+
DeepLinkAction::PauseRecording => {
164+
let state = app.state::<ArcLock<App>>();
165+
let guard = state.read().await;
166+
if let Some(recording) = guard.current_recording() {
167+
recording.pause().await.map_err(|e| e.to_string())
168+
} else {
169+
Ok(())
170+
}
171+
}
172+
DeepLinkAction::ResumeRecording => {
173+
let state = app.state::<ArcLock<App>>();
174+
let guard = state.read().await;
175+
if let Some(recording) = guard.current_recording() {
176+
recording.resume().await.map_err(|e| e.to_string())
177+
} else {
178+
Ok(())
179+
}
180+
}
181+
DeepLinkAction::SwitchMicrophone { mic_label } => {
182+
let state = app.state::<ArcLock<App>>();
183+
crate::set_mic_input(state, mic_label).await
184+
}
185+
DeepLinkAction::SwitchCamera { camera } => {
186+
let state = app.state::<ArcLock<App>>();
187+
crate::set_camera_input(app.clone(), state, camera).await
188+
}
155189
}
156190
}
157191
}

0 commit comments

Comments
 (0)