Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(desktop-gpui): hold the automatic update prompt until recording or export finishes
Richie McIlroy5ec4b840db42
diff --git a/apps/desktop-gpui/src/updates.rs b/apps/desktop-gpui/src/updates.rsindex 2a16bf13e..85324423d 100644--- a/apps/desktop-gpui/src/updates.rs+++ b/apps/desktop-gpui/src/updates.rs@@ -91,6 +91,12 @@ fn qualifies(&& remote != current)}+/// A check the user asked for answers now; a scheduled one waits for the+/// work in flight to finish before showing its modal prompt.+fn holds_scheduled_prompt(manual: bool, busy: bool) -> bool {+ !manual && busy+}+fn current_version() -> Result<Version, String> {Version::parse(env!("CARGO_PKG_VERSION")).map_err(|error| error.to_string())}@@ -373,6 +379,22 @@ pub(crate) fn schedule_startup_check(cx: &mut App) {continue;}+ // The prompt is modal and brings Cap forward, so an automatic+ // check holds it until a recording, export, import or+ // transcription has finished rather than interrupting it.+ let mut channel_changed = false;+ while holds_scheduled_prompt(manual, cx.update(work_in_flight)) {+ cx.background_executor().timer(BUSY_RETRY_DELAY).await;+ channel_changed =+ cx.update(|cx| cx.global::<UpdateScheduler>().pending.channel.is_some());+ if channel_changed {+ break;+ }+ }+ if channel_changed {+ continue;+ }+crate::platform::activate_app();let accepted = crate::platform::confirm_dialog("Update Cap",@@ -700,6 +722,14 @@ mod tests {}}+ #[test]+ fn only_scheduled_checks_wait_for_work_in_flight() {+ assert!(holds_scheduled_prompt(false, true));+ assert!(!holds_scheduled_prompt(false, false));+ assert!(!holds_scheduled_prompt(true, true));+ assert!(!holds_scheduled_prompt(true, false));+ }+#[test]fn stable_channel_accepts_newer_versions_and_explicit_prerelease_downgrades() {assert!(qualifies(