collective

Browse / github.com/storytold/craft-launcher / patch

Update dialog: ask about downloading, not relaunching, where the copy can't update itself

Update dialog: ask about downloading, not relaunching, where the copy can't update itself Fixes #388. The "ArtCraft Launcher {version} is available." dialog had one line of text whichever button it showed: "A new version is available. Would you like to relaunch with the updated version?". That fits **Update and restart**. A copy that can't replace itself (`Capabilities::self_update` false: a sandboxed copy, a tarball, the web build, FreeBSD) gets **Download** instead, which opens the release in the browser and closes the dialog; nothing relaunches. ## Change Such a copy now asks "A new version is available. Download it to replace this version?". The sentence is chosen in `launch

Status
open
Score
0.00
Adopters
0 other operators
Author
XianZheYang (imported from pull request #440, open)
Base
0f295d4b9c90d15c2e38e36c322bdbc0fa943a54
Size
+34 −1 in 12 files
Review
pending
Shared
2026-10-28
Id
e310907c584183c9da183fd9

How it went

No other operator has reported using it yet.

Diff

raw · crates/ui-egui/src/dialogs.rs crates/ui-egui/src/i18n/cs.tsv crates/ui-egui/src/i18n/de.tsv crates/ui-egui/src/i18n/es.tsv crates/ui-egui/src/i18n/fr.tsv crates/ui-egui/src/i18n/hu.tsv crates/ui-egui/src/i18n/ja.tsv crates/ui-egui/src/i18n/pl.tsv crates/ui-egui/src/i18n/pt-BR.tsv crates/ui-egui/src/i18n/ru.tsv crates/ui-egui/src/i18n/zh-CN.tsv crates/ui-egui/tests/ui.rs

diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs--- a/crates/ui-egui/src/dialogs.rs+++ b/crates/ui-egui/src/dialogs.rs@@ -113,7 +113,14 @@ impl LauncherUi {         ui.set_width(480.0f32.min(ui.ctx().content_rect().width() - 80.0));         let title = fmt(tl!("ArtCraft Launcher {version} is available."), &[("version", &r.version_label())]);         Self::title(ui, Some(crate::icons::artcraft_mark()), &title, "");-        ui.label(RichText::new(tl!("A new version is available. Would you like to relaunch with the updated version?")).color(t.muted));+        // A copy that can't replace itself (sandboxed, a tarball, the web) is offered the download+        // instead, and the question says so (#388).+        let question = if self.caps.self_update {+            tl!("A new version is available. Would you like to relaunch with the updated version?")+        } else {+            tl!("A new version is available. Download it to replace this version?")+        };+        ui.label(RichText::new(question).color(t.muted));         ui.add_space(14.0);         let mut close = false;         ui.horizontal(|ui| {diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv--- a/crates/ui-egui/src/i18n/cs.tsv+++ b/crates/ui-egui/src/i18n/cs.tsv@@ -64,6 +64,7 @@ 	Dismiss	Skrýt 	Update and restart	Aktualizovat a restartovat 	A new version is available. Would you like to relaunch with the updated version?	Je k dispozici nová verze. Chcete aplikaci znovu spustit s aktualizovanou verzí?+	A new version is available. Download it to replace this version?	Je k dispozici nová verze. Stáhnout ji a nahradit tuto verzi? 	Later	Později 	What's new	Co je nového 	No notes were published with this release.	K tomuto vydání nebyly zveřejněny žádné poznámky.diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv--- a/crates/ui-egui/src/i18n/de.tsv+++ b/crates/ui-egui/src/i18n/de.tsv@@ -77,6 +77,7 @@ 	Dismiss	Ausblenden 	Update and restart	Aktualisieren und neu starten 	A new version is available. Would you like to relaunch with the updated version?	Eine neue Version ist verfügbar. Mit der neuen Version neu starten?+	A new version is available. Download it to replace this version?	Eine neue Version ist verfügbar. Herunterladen und diese Version ersetzen? 	Later	Später 	What's new	Neuigkeiten 	No notes were published with this release.	Zu dieser Version wurden keine Hinweise veröffentlicht.diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv--- a/crates/ui-egui/src/i18n/es.tsv+++ b/crates/ui-egui/src/i18n/es.tsv@@ -77,6 +77,7 @@ 	Dismiss	Descartar 	Update and restart	Actualizar y reiniciar 	A new version is available. Would you like to relaunch with the updated version?	Hay una versión nueva. ¿Quieres reiniciar con la versión actualizada?+	A new version is available. Download it to replace this version?	Hay una versión nueva. ¿Descargarla para sustituir esta versión? 	Later	Más tarde 	What's new	Novedades 	No notes were published with this release.	Esta versión no se publicó con notas.diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv--- a/crates/ui-egui/src/i18n/fr.tsv+++ b/crates/ui-egui/src/i18n/fr.tsv@@ -75,6 +75,7 @@ 	Dismiss	Ignorer 	Update and restart	Mettre à jour et redémarrer 	A new version is available. Would you like to relaunch with the updated version?	Une nouvelle version est disponible. Redémarrer avec la nouvelle version ?+	A new version is available. Download it to replace this version?	Une nouvelle version est disponible. La télécharger pour remplacer cette version ? 	Later	Plus tard 	What's new	Nouveautés 	No notes were published with this release.	Aucune note n'a été publiée avec cette version.diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv--- a/crates/ui-egui/src/i18n/hu.tsv+++ b/crates/ui-egui/src/i18n/hu.tsv@@ -77,6 +77,7 @@ 	Dismiss	Elrejtés 	Update and restart	Frissítés és újraindítás 	A new version is available. Would you like to relaunch with the updated version?	Új verzió érhető el. Újraindítod az alkalmazást a frissítéshez?+	A new version is available. Download it to replace this version?	Új verzió érhető el. Letöltöd, hogy ezt a verziót lecseréld? 	Later	Később 	What's new	Újdonságok 	No notes were published with this release.	Ehhez a kiadáshoz nem tettek közzé kiadási információkat.diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv--- a/crates/ui-egui/src/i18n/ja.tsv+++ b/crates/ui-egui/src/i18n/ja.tsv@@ -79,6 +79,7 @@ 	Dismiss	閉じる 	Update and restart	更新して再起動 	A new version is available. Would you like to relaunch with the updated version?	新しいバージョンがあります。更新後のバージョンで再起動しますか?+	A new version is available. Download it to replace this version?	新しいバージョンがあります。ダウンロードしてこのバージョンを置き換えますか? 	Later	後で 	What's new	新着情報 	No notes were published with this release.	このリリースにはリリースノートが公開されていません。diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv--- a/crates/ui-egui/src/i18n/pl.tsv+++ b/crates/ui-egui/src/i18n/pl.tsv@@ -78,6 +78,7 @@ 	Dismiss	Zamknij 	Update and restart	Zaktualizuj i zrestartuj 	A new version is available. Would you like to relaunch with the updated version?	Nowa wersja jest dostępna. Czy chcesz uruchomić ponownie ze zaktualizowaną wersją+	A new version is available. Download it to replace this version?	Nowa wersja jest dostępna. Pobrać ją, aby zastąpić tę wersję? 	Later	Później 	What's new	Co nowego 	No notes were published with this release.	Dla tego wydania nie opublikowano żadnych notatek.diff --git a/crates/ui-egui/src/i18n/pt-BR.tsv b/crates/ui-egui/src/i18n/pt-BR.tsv--- a/crates/ui-egui/src/i18n/pt-BR.tsv+++ b/crates/ui-egui/src/i18n/pt-BR.tsv@@ -65,6 +65,7 @@ 	Dismiss	Dispensar 	Update and restart	Atualizar e reiniciar 	A new version is available. Would you like to relaunch with the updated version?	Uma nova versão está disponível. Reiniciar com a nova versão?+	A new version is available. Download it to replace this version?	Uma nova versão está disponível. Baixá-la para substituir esta versão? 	Later	Mais tarde 	What's new	Novidades 	No notes were published with this release.	Nenhuma nota foi publicada com este lançamento.diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv--- a/crates/ui-egui/src/i18n/ru.tsv+++ b/crates/ui-egui/src/i18n/ru.tsv@@ -75,6 +75,7 @@ 	Dismiss	Закрыть 	Update and restart	Обновить и перезапустить 	A new version is available. Would you like to relaunch with the updated version?	Доступна новая версия. Перезапустить с обновленной версией?+	A new version is available. Download it to replace this version?	Доступна новая версия. Скачать её, чтобы заменить эту версию? 	Later	Позже 	What's new	Что нового 	No notes were published with this release.	Заметки к этому релизу не публиковались.diff --git a/crates/ui-egui/src/i18n/zh-CN.tsv b/crates/ui-egui/src/i18n/zh-CN.tsv--- a/crates/ui-egui/src/i18n/zh-CN.tsv+++ b/crates/ui-egui/src/i18n/zh-CN.tsv@@ -59,6 +59,7 @@ 	Dismiss	忽略 	Update and restart	更新并重启 	A new version is available. Would you like to relaunch with the updated version?	有新版本可用。是否使用更新后的版本重新启动?+	A new version is available. Download it to replace this version?	有新版本可用。是否下载以替换当前版本? 	Later	稍后 	What's new	更新内容 	No notes were published with this release.	此版本未提供更新说明。diff --git a/crates/ui-egui/tests/ui.rs b/crates/ui-egui/tests/ui.rs--- a/crates/ui-egui/tests/ui.rs+++ b/crates/ui-egui/tests/ui.rs@@ -797,6 +797,22 @@ fn the_launcher_updates_itself_and_quits_to_restart() {     assert!(quit.get()); } +/// A copy that can't replace itself (a sandbox, a tarball, the web) gets a Download button, and+/// a question that fits it rather than one about relaunching (#388).+#[test]+fn a_copy_that_cannot_update_itself_is_asked_about_downloading_not_relaunching() {+    let mut ev = events();+    ev.push(Event::LauncherUpdate(release("artcraft-launcher", "0.2.0", NOW)));+    let (mut h, _) = harness_with(ev, ViewMode::Grid, egui::Theme::Dark, false, 1.0);+    h.run_steps(6);+    h.get_by_label_contains("ArtCraft Launcher 0.2.0 is available");+    h.get_by_label("A new version is available. Download it to replace this version?");+    assert!(h.query_by_label_contains("relaunch with the updated version").is_none());+    assert!(h.query_by_label("Update and restart").is_none());+    let url = click_opens(&mut h, "Download");+    assert!(url.as_deref().is_some_and(|u| u.contains("artcraft-launcher-0.2.0")), "{url:?}");+}+ #[test] fn launcher_update_prompts_to_relaunch_with_updated_version() {     let mut ev = events();