Updates: opt-in launch check, Check for Updates…, install after a normal quit, from the Gitea release; dmgs carry an Applications link (UPD-1, REL-1)

This commit is contained in:
ZacharyZhang-NY committed 2026-10-09 16:34:32 -04:00
1 parent fa273aff13
commit b03c9f2853
28 files changed
+896 -16

No files matched your search

+27
View File
@@ -102,6 +102,33 @@ fn build(
if !document {
window.focus(&focus, cx);
}
if let Some(updates) = crate::updates::updater(cx) {
cx.subscribe(
&updates,
|root: &mut Root, _, news: &crate::updates::UpdateNews, cx| match news {
crate::updates::UpdateNews::Failed(error) => {
let text = crate::i18n::text(cx, "updates.failed", &[("error", error)]);
root.toast(text, Severity::Danger, cx);
}
crate::updates::UpdateNews::Latest => {
let args = [
("app", root.app.name()),
("version", env!("CARGO_PKG_VERSION")),
];
let text = crate::i18n::text(cx, "updates.latest", &args);
root.toast(text, Severity::Success, cx);
}
},
)
.detach();
// A failed install from the last quit says why.
if let Some(note) = updates.update(cx, |updates, _| updates.note.take()) {
let text = crate::i18n::text(cx, "updates.failed", &[("error", &note)]);
cx.defer_in(window, move |root: &mut Root, _, cx| {
root.toast(text, Severity::Danger, cx)
});
}
}
Root {
app,
focus,