From 9d2bea410e8da2fd03437daaf74c9760e7521d3c Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 25 Oct 2026 12:18:20 -0400 Subject: [PATCH] feat(update): Updater::offer, and dismissing a running check keeps it quiet --- crates/update/src/updater.rs | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/crates/update/src/updater.rs b/crates/update/src/updater.rs index 48d46e31..d90976de 100644 --- a/crates/update/src/updater.rs +++ b/crates/update/src/updater.rs @@ -91,15 +91,22 @@ impl Updater { self.begin(ctx, true); } + /// Opens the startup prompt for a release the app found itself. + pub fn offer(&mut self, release: Release) { + if self.install.is_none() { + self.prompt = Some(StartupPrompt::new(self.app, release, self.version.clone())); + } + } + pub fn status(&self) -> &Status { &self.status } - /// Dismisses the outcome of a requested check. + /// Dismisses the outcome of a requested check. One still running carries on, and reports + /// like the check at start (a prompt if there is a release, otherwise nothing). pub fn dismiss_status(&mut self) { - if self.check.is_none() { - self.status = Status::Idle; - } + self.requested = false; + self.status = Status::Idle; } /// Whether the startup prompt is showing. @@ -303,6 +310,15 @@ mod tests { assert_eq!(u.status(), &Status::Idle); } + #[test] + fn dismissing_a_running_check_keeps_it_quiet() { + let (ctx, mut u) = (egui::Context::default(), updater(Ok(None))); + u.check_now(&ctx); + u.dismiss_status(); + settle(&mut u, &ctx); + assert_eq!(u.status(), &Status::Idle); + } + #[test] fn a_requested_check_reports_a_failure_but_the_startup_check_stays_quiet() { let ctx = egui::Context::default();