Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(desktop-gpui): report start-cancelled when a superseded start is discarded
Richie McIlroy9793ad9a6bf3
diff --git a/apps/desktop-gpui/src/recording.rs b/apps/desktop-gpui/src/recording.rsindex d933ed123..7c91d53e2 100644--- a/apps/desktop-gpui/src/recording.rs+++ b/apps/desktop-gpui/src/recording.rs@@ -1123,6 +1123,21 @@ impl ActiveRecording {/// delete and restart flows. Deleting a directory this app just created is/// app behavior, same as the Tauri delete button.pub async fn cancel_and_delete(self) -> anyhow::Result<()> {+ self.cancel_and_delete_with_query(None).await+ }++ /// `cancel_and_delete` for a start that was superseded before it began,+ /// telling the server why its Instant video is deleted.+ #[cfg(not(target_os = "linux"))]+ pub(crate) async fn discard_cancelled_start(self) -> anyhow::Result<()> {+ let query = crate::upload::instant_cleanup::delete_query(+ crate::upload::instant_cleanup::CleanupReason::StartCancelled,+ None,+ );+ self.cancel_and_delete_with_query(query).await+ }++ async fn cancel_and_delete_with_query(self, query: Option<String>) -> anyhow::Result<()> {if let Some(gate) = &self.start_gate {gate.arm();}@@ -1175,7 +1190,7 @@ impl ActiveRecording {None => None,};let remote_result = if let Some(upload) = upload.as_mut() {- upload.cancel().await+ upload.cancel(query.as_deref()).await} else {Ok(())};diff --git a/apps/desktop-gpui/src/session.rs b/apps/desktop-gpui/src/session.rsindex 894b61d54..b964bbead 100644--- a/apps/desktop-gpui/src/session.rs+++ b/apps/desktop-gpui/src/session.rs@@ -963,7 +963,7 @@ impl RecordingSession {#[cfg(target_os = "linux")]let discarded = active.cancel_preserving().await;#[cfg(not(target_os = "linux"))]- let discarded = active.cancel_and_delete().await;+ let discarded = active.discard_cancelled_start().await;match discarded {Ok(()) => {if let Some(video_id) = &video_id {diff --git a/apps/desktop-gpui/src/upload.rs b/apps/desktop-gpui/src/upload.rsindex 6bbef37d1..29c8c831a 100644--- a/apps/desktop-gpui/src/upload.rs+++ b/apps/desktop-gpui/src/upload.rs@@ -462,7 +462,8 @@ impl InstantUpload {result.map_err(|error| format!("Instant recording thumbnail upload failed: {error}"))}- pub async fn cancel(&mut self) -> Result<(), String> {+ /// `query` adds parameters to the server delete.+ pub async fn cancel(&mut self, query: Option<&str>) -> Result<(), String> {self.abort_segments().await;if let Some(ownership) = &self.ownership {queue::record_cancelled(ownership.project_path())?;@@ -470,7 +471,7 @@ impl InstantUpload {with_upload_context(self.request_context.clone(),self.reads.clone(),- delete_instant_video(&self.video.id),+ delete_instant_video_with_query(&self.video.id, query),).await}@@ -492,10 +493,6 @@ impl InstantUpload {}}-pub async fn delete_instant_video(video_id: &str) -> Result<(), String> {- delete_instant_video_with_query(video_id, None).await-}-pub(crate) async fn delete_instant_video_with_query(video_id: &str,query: Option<&str>,