diff --git a/crates/core/src/catalog.rs b/crates/core/src/catalog.rs index 65553648..db42acc6 100644 --- a/crates/core/src/catalog.rs +++ b/crates/core/src/catalog.rs @@ -228,8 +228,8 @@ mod tests { /// Every catalog entry must have a distinct lookup key. #[test] - fn suite_has_nineteen_apps_with_unique_ids() { - assert_eq!(SUITE.len(), 19); + fn suite_has_unique_ids() { + assert!(SUITE.len() >= 20, "expected at least 20 apps in SUITE, got {}", SUITE.len()); let mut ids: Vec<_> = SUITE.iter().map(|a| a.id).collect(); ids.sort_unstable(); ids.dedup(); diff --git a/crates/core/src/feed.rs b/crates/core/src/feed.rs index a63cb949..71195ae9 100644 --- a/crates/core/src/feed.rs +++ b/crates/core/src/feed.rs @@ -963,4 +963,33 @@ sha256 = "{HASH}" assert!(Feed::parse_signed_catalog_with_key(toml.as_bytes(), sig.as_bytes(), &wrong_key.verifying_key()).is_err()); assert!(Feed::parse_signed_catalog_with_key(format!("{toml}\n").as_bytes(), sig.as_bytes(), &key.verifying_key()).is_err()); } + + #[test] + fn nightly_only_catalog_entry_reports_no_stable_release_and_fresh_nightly() { + const HASH: &str = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"; + let toml = format!( + r#"generated_at = "2026-10-09T13:00:00Z" + +[[apps]] +id = "soundcraft" +repo = "storytold/soundcraft" +[apps.releases.nightly] +tag = "v0.1.0-nightly.20261009.1.1" +version = "0.1.0-nightly.20261009.1.1" +html_url = "https://github.com/storytold/soundcraft/releases/tag/v0.1.0-nightly.20261009.1.1" +prerelease = true +[[apps.releases.nightly.assets]] +name = "soundcraft-0.1.0-nightly.20261009.1.1-linux-x86_64.AppImage" +download_url = "https://github.com/storytold/soundcraft/releases/download/v0.1.0-nightly.20261009.1.1/soundcraft-0.1.0-nightly.20261009.1.1-linux-x86_64.AppImage" +sha256 = "{HASH}" +"# + ); + let feed = Feed::parse_catalog_toml(&toml).unwrap(); + let sound = app("soundcraft"); + assert_eq!(feed.answer(sound, NOW), FeedAnswer::Fresh(None)); + let FeedAnswer::Fresh(Some(nightly)) = feed.answer_nightly(sound, NOW) else { + panic!("expected fresh nightly release"); + }; + assert_eq!(nightly.tag, "v0.1.0-nightly.20261009.1.1"); + } } diff --git a/crates/native/tests/fixtures/nightly-apps.json b/crates/native/tests/fixtures/nightly-apps.json index f8b47c6a..2ae821ee 100644 --- a/crates/native/tests/fixtures/nightly-apps.json +++ b/crates/native/tests/fixtures/nightly-apps.json @@ -922,6 +922,72 @@ } ] }, + "stencilcraft": { + "default_branch": "main", + "initial_nightly_version": "0.1.0", + "display_name": "StencilCraft", + "entrypoints": { + "linux-x86_64": { + "binary": "stencilcraft-bin", + "entrypoint": "stencilcraft" + }, + "macos-aarch64": { + "binary": "StencilCraft Nightly.app/Contents/MacOS/StencilCraft", + "entrypoint": "StencilCraft Nightly.app/Contents/MacOS/StencilCraft" + }, + "windows-x86_64": { + "binary": "stencilcraft.exe", + "entrypoint": "stencilcraft.exe" + } + }, + "env_prefix": "STENCILCRAFT", + "note": "StencilCraft nightly-v1 Windows x86_64 GUI ZIP (stencilcraft.exe at the archive root), Linux x86_64 GUI tar.gz started through the canonical launcher (stencilcraft) with stencilcraft-bin beside it, and macOS aarch64 notarized app ZIP (StencilCraft Nightly.app), published together in one release.", + "repository": "storytold/stencilcraft", + "targets": [ + { + "asset_pattern": "stencilcraft-{version}-windows-x86_64-nightly.zip", + "isolation": { + "associations": "none", + "package_identity": "ai.storyteller.stencilcraft.nightly", + "profile_contract": "nightly", + "profile_version": 1 + }, + "target": { + "arch": "x86_64", + "format": "portable_zip", + "os": "windows" + } + }, + { + "asset_pattern": "stencilcraft-{version}-linux-x86_64-nightly.tar.gz", + "isolation": { + "associations": "none", + "package_identity": "ai.storyteller.stencilcraft.nightly", + "profile_contract": "nightly", + "profile_version": 1 + }, + "target": { + "arch": "x86_64", + "format": "tar_gz", + "os": "linux" + } + }, + { + "asset_pattern": "stencilcraft-{version}-macos-aarch64-nightly.zip", + "isolation": { + "associations": "none", + "package_identity": "ai.storyteller.stencilcraft.nightly", + "profile_contract": "nightly", + "profile_version": 1 + }, + "target": { + "arch": "aarch64", + "format": "portable_zip", + "os": "macos" + } + } + ] + }, "texturecraft": { "default_branch": "main", "display_name": "TextureCraft", diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index c76b4dfe..e7e05fa6 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -1312,9 +1312,19 @@ impl LauncherUi { self.entries.iter().filter(|e| self.in_filter(e, filter)).count() } - /// Whether `entry` belongs in `filter`. Hidden apps stay out of every list except Hidden. + /// Whether `entry` has no stable release (and is not installed on Stable), so it is + /// Nightly-only: hidden when Developer Builds are off, and displayed as Nightly-only when on. + pub(crate) fn is_nightly_only(&self, entry: &AppEntry) -> bool { + entry.is_nightly_only(self.platform, self.caps.manage_apps) + } + + /// Whether `entry` belongs in `filter`. Hidden apps stay out of every list except Hidden, + /// and Nightly-only apps stay out of the Stable lists until Developer Builds are enabled. pub(crate) fn in_filter(&self, entry: &AppEntry, filter: Filter) -> bool { let hidden = self.settings.hidden.contains(entry.app.id); + if !hidden && !self.settings.nightly_enabled && self.is_nightly_only(entry) { + return false; + } let status = entry.status(self.platform, self.caps.manage_apps); match filter { Filter::Hidden => hidden, @@ -1807,4 +1817,85 @@ mod tests { retained.flush_actions(); assert!(!retained.settings.nightly_enabled && retained.nightly.active, "OFF must not force an already open management destination away"); } + + #[test] + /// An official app with no stable release is hidden from the Stable list and download order + /// while Developer Builds are off, and reappears once Developer Builds are enabled. + fn nightly_only_app_is_hidden_until_developer_builds_are_enabled() { + let (mut ui, sent, _ctx) = launcher(); + ui.handle(Event::Latest { + app: "soundcraft".into(), + latest: LatestRelease::None, + from: artcraft_launcher_core::protocol::Origin::ArtCraftApi, + }); + assert!(!ui.settings.nightly_enabled); + assert!(!ui.visible_ids().contains(&"soundcraft"), "nightly-only app should be hidden while Developer Builds are off"); + ui.configure(); + let order = last_order(&sent).expect("an order is sent"); + assert!(!order.iter().any(|id| id == "soundcraft"), "nightly-only app should be left out of download order: {order:?}"); + + ui.settings.nightly_enabled = true; + assert!(ui.visible_ids().contains(&"soundcraft"), "nightly-only app should be shown when Developer Builds are enabled"); + ui.configure(); + let order = last_order(&sent).expect("an updated order is sent"); + assert!(order.iter().any(|id| id == "soundcraft"), "nightly-only app should rejoin order when Developer Builds are enabled: {order:?}"); + } + + #[test] + /// Apps stay visible while unchecked, when offline/errored, when already installed on Stable, + /// or when they are community apps without a separate Nightly channel. + fn nightly_only_app_stays_visible_when_unchecked_offline_installed_or_community() { + let (mut ui, _sent, _ctx) = launcher(); + assert!(!ui.settings.nightly_enabled); + + // Unchecked (latest == None) stays visible. + assert!(ui.visible_ids().contains(&"soundcraft")); + + // Offline / failed check stays visible. + ui.handle(Event::Latest { + app: "soundcraft".into(), + latest: LatestRelease::Failed("offline".into()), + from: artcraft_launcher_core::protocol::Origin::GitHub, + }); + assert!(ui.visible_ids().contains(&"soundcraft")); + + // Confirmed no stable release, but already installed on Stable -> stays visible. + ui.handle(Event::Detected { + app: "soundcraft".into(), + installed: Some(artcraft_launcher_core::Installed { + version: artcraft_launcher_core::version::parse("0.1.0"), + source: artcraft_launcher_core::InstallSource::Launcher, + location: String::new(), + package: None, + externally_managed: false, + origin: None, + installation: None, + }), + }); + ui.handle(Event::Latest { + app: "soundcraft".into(), + latest: LatestRelease::None, + from: artcraft_launcher_core::protocol::Origin::ArtCraftApi, + }); + assert!(ui.visible_ids().contains(&"soundcraft")); + + // Community app without a separate Nightly channel stays visible as "Coming soon". + ui.handle(Event::Latest { + app: "solidcraft".into(), + latest: LatestRelease::None, + from: artcraft_launcher_core::protocol::Origin::ArtCraftApi, + }); + assert!(ui.visible_ids().contains(&"solidcraft")); + } + + #[test] + /// Official apps with no stable release display as Nightly-only, while community apps keep + /// "Coming soon". + fn nightly_only_status_text_distinguishes_official_from_community() { + set_current(crate::i18n::Lang::EN); + let official = AppEntry::new(artcraft_launcher_core::CraftApp::by_id("soundcraft").unwrap()); + let community = AppEntry::new(artcraft_launcher_core::CraftApp::by_id("solidcraft").unwrap()); + assert_eq!(crate::model::entry_status_text(&official, &AppStatus::NoRelease, true), ("Nightly only".into(), crate::model::Tone::Info)); + assert_eq!(crate::model::entry_status_text(&community, &AppStatus::NoRelease, true), ("Coming soon".into(), crate::model::Tone::Faint)); + } } diff --git a/crates/ui-egui/src/details.rs b/crates/ui-egui/src/details.rs index df3574a3..791f6bb2 100644 --- a/crates/ui-egui/src/details.rs +++ b/crates/ui-egui/src/details.rs @@ -369,7 +369,12 @@ impl LauncherUi { ui.vertical(|ui| { ui.set_width(text_w); ui.spacing_mut().item_spacing.y = 5.0; - widgets::wordmark(ui, app, theme::PAGE_TITLE); + ui.horizontal(|ui| { + widgets::wordmark(ui, app, theme::PAGE_TITLE); + if self.is_nightly_only(entry) { + widgets::badge(ui, tl!("Nightly only"), t.accent_ink); + } + }); ui.add(egui::Label::new(RichText::new(tr_ctx(current(), details.id, details.headline)).size(15.0).color(t.ink)).wrap()); // "Version 0.5.0 · Oct 8, 2026", or the installed-versus-latest line. let version = crate::views::version_line(entry, status); @@ -396,7 +401,8 @@ impl LauncherUi { widgets::eyebrow(ui, "02", tl!("Latest release")); ui.add_space(4.0); let Some(r) = entry.release() else { - ui.label(RichText::new(tl!("No release published yet")).color(t.muted)); + let msg = if self.is_nightly_only(entry) { tl!("Available in Developer Builds") } else { tl!("No release published yet") }; + ui.label(RichText::new(msg).color(t.muted)); return; }; let size = self.platform.and_then(|p| { diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 7ec359d1..7b844cf5 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -571,3 +571,6 @@ artcraft AI image and video creation Kreiranje slika i videa pomoću AI Some apps couldn’t be checked. Some apps couldn’t be checked. Some apps still need to be checked. Some apps still need to be checked. Try checking again. Try checking again. + Nightly only Samo noćna verzija + Available in Developer Builds Dostupno u Developer Builds +stencilcraft Vinyl, stencil and laser cut studio Studio za vinil, šablone i lasersko rezanje diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 7c450535..7d94dab2 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -565,3 +565,6 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s Some apps couldn’t be checked. Some apps couldn’t be checked. Some apps still need to be checked. Some apps still need to be checked. Try checking again. Try checking again. + Nightly only Pouze noční sestavení + Available in Developer Builds Dostupné v Developer Builds +stencilcraft Vinyl, stencil and laser cut studio Studio pro vinyl, šablony a laserové řezání diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 8b2834f6..3fbc70de 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -597,3 +597,6 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s Some apps couldn’t be checked. Some apps couldn’t be checked. Some apps still need to be checked. Some apps still need to be checked. Try checking again. Try checking again. + Nightly only Nur Nightly + Available in Developer Builds In Developer Builds verfügbar +stencilcraft Vinyl, stencil and laser cut studio Studio für Vinyl, Schablonen und Laserschnitt diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 148d0b5e..8354e316 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -578,3 +578,6 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s Some apps couldn’t be checked. Some apps couldn’t be checked. Some apps still need to be checked. Some apps still need to be checked. Try checking again. Try checking again. + Nightly only Solo nocturna + Available in Developer Builds Disponible en Developer Builds +stencilcraft Vinyl, stencil and laser cut studio Estudio de vinilo, plantillas y corte láser diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 2dd1e0cb..27837917 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -595,3 +595,6 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s Some apps couldn’t be checked. Some apps couldn’t be checked. Some apps still need to be checked. Some apps still need to be checked. Try checking again. Try checking again. + Nightly only Nocturne uniquement + Available in Developer Builds Disponible dans Developer Builds +stencilcraft Vinyl, stencil and laser cut studio Studio de vinyle, pochoirs et découpe laser diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 339c6e82..ba089893 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -598,3 +598,6 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s Some apps couldn’t be checked. Some apps couldn’t be checked. Some apps still need to be checked. Some apps still need to be checked. Try checking again. Try checking again. + Nightly only Csak éjszakai kiadás + Available in Developer Builds Elérhető a Developer Builds részben +stencilcraft Vinyl, stencil and laser cut studio Vinil-, sablon- és lézervágó stúdió diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index c2f8e147..17649104 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -600,3 +600,6 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s Some apps couldn’t be checked. Some apps couldn’t be checked. Some apps still need to be checked. Some apps still need to be checked. Try checking again. Try checking again. + Nightly only ナイトリーのみ + Available in Developer Builds Developer Builds で利用可能 +stencilcraft Vinyl, stencil and laser cut studio ビニール・ステンシル・レーザーカットスタジオ diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 682ee3b0..9e4be561 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -597,3 +597,6 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s Some apps couldn’t be checked. Some apps couldn’t be checked. Some apps still need to be checked. Some apps still need to be checked. Try checking again. Try checking again. + Nightly only მხოლოდ ღამის ვერსია + Available in Developer Builds ხელმისაწვდომია Developer Builds-ში +stencilcraft Vinyl, stencil and laser cut studio ვინილის, ტრაფარეტებისა და ლაზერული ჭრის სტუდია diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 0aef964c..13cdc390 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -599,3 +599,6 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s Some apps couldn’t be checked. Some apps couldn’t be checked. Some apps still need to be checked. Some apps still need to be checked. Try checking again. Try checking again. + Nightly only Tylko wersja nocna + Available in Developer Builds Dostępne w Developer Builds +stencilcraft Vinyl, stencil and laser cut studio Studio winylu, szablonów i cięcia laserowego diff --git a/crates/ui-egui/src/i18n/pt-BR.tsv b/crates/ui-egui/src/i18n/pt-BR.tsv index 9851ea84..c461ad47 100644 --- a/crates/ui-egui/src/i18n/pt-BR.tsv +++ b/crates/ui-egui/src/i18n/pt-BR.tsv @@ -585,3 +585,6 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s Some apps couldn’t be checked. Some apps couldn’t be checked. Some apps still need to be checked. Some apps still need to be checked. Try checking again. Try checking again. + Nightly only Somente noturna + Available in Developer Builds Disponível em Developer Builds +stencilcraft Vinyl, stencil and laser cut studio Estúdio de vinil, estêncil e corte a laser diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 1e9e98a3..2302a55e 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -593,3 +593,6 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s Some apps couldn’t be checked. Some apps couldn’t be checked. Some apps still need to be checked. Some apps still need to be checked. Try checking again. Try checking again. + Nightly only Только ночная сборка + Available in Developer Builds Доступно в Developer Builds +stencilcraft Vinyl, stencil and laser cut studio Студия винила, трафаретов и лазерной резки diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 37c62f3f..f41d2998 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -583,3 +583,6 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s Some apps couldn’t be checked. Some apps couldn’t be checked. Some apps still need to be checked. Some apps still need to be checked. Try checking again. Try checking again. + Nightly only Лише нічна збірка + Available in Developer Builds Доступно в Developer Builds +stencilcraft Vinyl, stencil and laser cut studio Студія вінілу, трафаретів і лазерного різання diff --git a/crates/ui-egui/src/i18n/zh-CN.tsv b/crates/ui-egui/src/i18n/zh-CN.tsv index 36ad0723..f0c9b7cc 100644 --- a/crates/ui-egui/src/i18n/zh-CN.tsv +++ b/crates/ui-egui/src/i18n/zh-CN.tsv @@ -565,3 +565,6 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s Some apps couldn’t be checked. Some apps couldn’t be checked. Some apps still need to be checked. Some apps still need to be checked. Try checking again. Try checking again. + Nightly only 仅限每日构建版 + Available in Developer Builds 可在 Developer Builds 中获取 +stencilcraft Vinyl, stencil and laser cut studio 贴纸、镂空模板与激光切割工作室 diff --git a/crates/ui-egui/src/i18n/zh-TW.tsv b/crates/ui-egui/src/i18n/zh-TW.tsv index e577935a..e8cb4725 100644 --- a/crates/ui-egui/src/i18n/zh-TW.tsv +++ b/crates/ui-egui/src/i18n/zh-TW.tsv @@ -557,3 +557,6 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s Some apps couldn’t be checked. Some apps couldn’t be checked. Some apps still need to be checked. Some apps still need to be checked. Try checking again. Try checking again. + Nightly only 僅限 Nightly + Available in Developer Builds 可在 Developer Builds 中取得 +stencilcraft Vinyl, stencil and laser cut studio 卡典西德、模板與雷射切割工作室 diff --git a/crates/ui-egui/src/model.rs b/crates/ui-egui/src/model.rs index 638f5271..8c033d3d 100644 --- a/crates/ui-egui/src/model.rs +++ b/crates/ui-egui/src/model.rs @@ -83,6 +83,16 @@ impl AppEntry { status::status(self.installed.as_ref(), latest) } + /// Whether this app has a separate Nightly channel, is not installed on Stable, and the + /// release check confirmed there is no stable release available. + /// + /// Returns `false` before detection or release checking finishes, when offline or failed, + /// when a stable copy is already installed, or for community apps without a separate Nightly + /// channel. + pub fn is_nightly_only(&self, platform: Option, manage_apps: bool) -> bool { + self.app.has_separate_nightly_channel() && self.status(platform, manage_apps) == AppStatus::NoRelease + } + pub fn installed_label(&self) -> Option { self.installed.as_ref().map(|i| i.version.as_ref().map(ToString::to_string).unwrap_or_else(|| t("Installed").to_string())) } @@ -130,6 +140,7 @@ pub fn entry_status_text(e: &AppEntry, status: &AppStatus, manage_apps: bool) -> (Some(JobPhase::Downloading { .. }), _) => (t("Downloading…").to_string(), Tone::Info), (None, Some(_)) if status.is_installed() => (t("Update paused").to_string(), Tone::Warn), (None, Some(_)) => (t("Download paused").to_string(), Tone::Warn), + _ if *status == AppStatus::NoRelease && e.app.has_separate_nightly_channel() => (t("Nightly only").to_string(), Tone::Info), _ => status_text(status, manage_apps), } } diff --git a/crates/ui-egui/src/nightly.rs b/crates/ui-egui/src/nightly.rs index 19087733..b5998a68 100644 --- a/crates/ui-egui/src/nightly.rs +++ b/crates/ui-egui/src/nightly.rs @@ -286,7 +286,7 @@ impl NightlyState { // Initial discovery lives only in Settings. Retained installations keep a management // destination after switching off; hiding it would strand Open/Reveal/Uninstall. - fn destination_visible(&self, enabled: bool) -> bool { + pub(crate) fn destination_visible(&self, enabled: bool) -> bool { // Errors, including unusable Pre-Release storage, never stand in for consent; once // consent is given the page shows them as scoped errors. self.discovering(enabled) || self.entries.iter().any(|entry| entry.installed.is_some()) @@ -910,7 +910,9 @@ impl LauncherUi { crate::icons::nightly_icon(ui, entry.app.id, entry.app.name, 48.0); ui.horizontal_wrapped(|ui| { ui.add(egui::Label::new(crate::widgets::heading(entry.app.name, crate::theme::DIALOG_TITLE, tokens.ink_strong)).wrap()); - crate::widgets::badge(ui, tl!("Nightly"), tokens.accent_ink); + let badge = + if self.entry(entry.app.id).is_some_and(|stable| self.is_nightly_only(stable)) { tl!("Nightly only") } else { tl!("Nightly") }; + crate::widgets::badge(ui, badge, tokens.accent_ink); }); }); if installed { diff --git a/crates/ui-egui/src/views.rs b/crates/ui-egui/src/views.rs index 9ef9903d..7b569689 100644 --- a/crates/ui-egui/src/views.rs +++ b/crates/ui-egui/src/views.rs @@ -71,6 +71,8 @@ enum Primary { checked: bool, }, Open, + /// No stable release; open the separate Developer Builds (Nightly) destination. + OpenNightly, Download(String), Unavailable(&'static str), } @@ -1037,6 +1039,13 @@ impl LauncherUi { } fn primary_action(&self, entry: &AppEntry, status: &AppStatus) -> Primary { + if self.is_nightly_only(entry) { + return if self.settings.nightly_enabled && self.nightly.destination_visible(self.settings.nightly_enabled) { + Primary::OpenNightly + } else { + Primary::Unavailable(tl!("Nightly only")) + }; + } if !self.caps.manage_apps { let platform = self.platform; let url = entry.release().zip(platform).and_then(|(r, p)| { @@ -1336,6 +1345,12 @@ impl LauncherUi { self.launch_app(id); } } + Primary::OpenNightly => { + if widgets::button(ui, tl!("Developer Builds"), Kind::Secondary, main_w).clicked() { + self.nightly.active = true; + self.detail = None; + } + } Primary::Download(url) => { let label = match self.platform { Some(p) => fmt(tl!("Download for {os}"), &[("os", p.os.label())]), @@ -1646,6 +1661,7 @@ pub(crate) fn version_line(e: &AppEntry, status: &AppStatus) -> String { (_, Some(i), None) => fmt(tl!("Version {version} installed"), &[("version", i)]), (_, None, None) if e.installed.is_some() => tl!("Installed").to_string(), (_, None, Some(l)) => format!("{}{released}", fmt(tl!("Version {latest}"), &[("latest", l)])), + (AppStatus::NoRelease, None, None) if e.app.has_separate_nightly_channel() => tl!("Available in Developer Builds").to_string(), (AppStatus::NoRelease, None, None) => tl!("No release published yet").to_string(), _ => " ".to_string(), } diff --git a/crates/ui-egui/tests/ui.rs b/crates/ui-egui/tests/ui.rs index 8c0c9609..f9367757 100644 --- a/crates/ui-egui/tests/ui.rs +++ b/crates/ui-egui/tests/ui.rs @@ -198,6 +198,7 @@ fn events() -> Vec { }); } ev.push(Event::Latest { app: "soundcraft".into(), latest: LatestRelease::None, from: Origin::ArtCraftApi }); + ev.push(Event::Latest { app: "solidcraft".into(), latest: LatestRelease::None, from: Origin::ArtCraftApi }); let installed = [("photocraft", "0.4.1"), ("lightcraft", "0.4.0"), ("wordcraft", "0.3.0"), ("effectcraft", "0.5.0")]; for app in &SUITE { let inst = installed.iter().find(|(id, _)| *id == app.id).map(|(_, v)| Installed { @@ -3905,9 +3906,13 @@ fn the_lead_picture_can_be_enlarged() { #[test] fn every_page_opens_and_pages_through_its_pictures() { let (mut h, _sent) = harness(ViewMode::Grid, egui::Theme::Dark, true); - // Tall enough to show all thirteen cards at once. + // Tall enough to show all cards at once, including nightly-only apps such as SoundCraft in `events()`. h.set_size(egui::vec2(1180.0, 3000.0)); - h.run_steps(8); + h.run_steps(4); + if let Some(ui) = h.state_mut().as_mut() { + ui.settings.nightly_enabled = true; + } + h.run_steps(4); for d in &artcraft_launcher_core::details::DETAILS { let name = SUITE.iter().find(|a| a.id == d.id).map(|a| a.name).unwrap_or(d.id); h.get_by_label(&format!("{name} details")).scroll_to_me(); @@ -5138,3 +5143,30 @@ fn settings_without_app_management_is_one_column() { edges.dedup(); assert!(!edges.is_empty() && edges.iter().all(|x| *x == edges[0]), "checkboxes start at {edges:?}"); } + +/// An official app with no stable release is hidden until Developer Builds are enabled, and then +/// shown as Nightly-only instead of Stable. +#[test] +fn nightly_only_app_is_hidden_when_off_and_shown_as_nightly_only_when_on() { + let (mut h, _) = harness(ViewMode::Grid, egui::Theme::Dark, true); + h.set_size(egui::vec2(1180.0, 2600.0)); + h.run_steps(6); + { + let ui = h.state().as_ref().expect("launcher state"); + assert!(!ui.settings.nightly_enabled); + assert!(!ui.visible_ids_for_test().contains(&"soundcraft"), "soundcraft has no stable release and must be hidden while nightly is off"); + } + assert_eq!(h.query_all_by_label("Nightly only").count(), 0); + + // Enabling Developer Builds reveals the app as Nightly-only with a path to Developer Builds. + if let Some(ui) = h.state_mut().as_mut() { + ui.settings.nightly_enabled = true; + } + h.run_steps(6); + { + let ui = h.state().as_ref().expect("launcher state"); + assert!(ui.visible_ids_for_test().contains(&"soundcraft"), "soundcraft must appear once Developer Builds are enabled"); + } + assert!(h.query_all_by_label("Nightly only").count() >= 1); + assert!(h.query_all_by_label("Available in Developer Builds").count() >= 1); +}