feat(update): Updater::offer, and dismissing a running check keeps it quiet

This commit is contained in:
Dylan M. Taylor committed 2026-10-25 12:18:20 -04:00
1 parent c2adf14ae3
commit 9d2bea410e
1 file changed
+20 -4
+20 -4
View File
@@ -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();