mirror of
https://github.com/storytold/craft-launcher.git
synced 2026-12-02 20:22:35 -05:00
feat(ui): hide nightly-only apps until Developer Builds are enabled (#1725)
* feat(ui): hide nightly-only apps until Developer Builds are enabled * test(catalog,i18n): support 20-app catalog with StencilCraft * test(native): sync nightly-apps.json fixture with StencilCraft * test(ui): enable nightly_enabled in every_page_opens_and_pages_through_its_pictures
This commit is contained in:
1 parent
d021699a01
commit
fa026c39fd
23 files changed
+304
-9
No files matched your search
@@ -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();
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
+66
@@ -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",
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -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| {
|
||||
|
||||
@@ -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
|
||||
|
@@ -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í
|
||||
|
@@ -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
|
||||
|
Can't render this file because it contains an unexpected character in line 11 and column 16.
|
@@ -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
|
||||
|
Can't render this file because it contains an unexpected character in line 5 and column 48.
|
@@ -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
|
||||
|
Can't render this file because it contains an unexpected character in line 5 and column 50.
|
@@ -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ó
|
||||
|
Can't render this file because it contains an unexpected character in line 11 and column 16.
|
@@ -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 ビニール・ステンシル・レーザーカットスタジオ
|
||||
|
Can't render this file because it contains an unexpected character in line 14 and column 44.
|
@@ -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 ვინილის, ტრაფარეტებისა და ლაზერული ჭრის სტუდია
|
||||
|
Can't render this file because it contains an unexpected character in line 13 and column 18.
|
@@ -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
|
||||
|
Can't render this file because it contains an unexpected character in line 11 and column 15.
|
@@ -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
|
||||
|
Can't render this file because it contains an unexpected character in line 287 and column 66.
|
@@ -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 Студия винила, трафаретов и лазерной резки
|
||||
|
Can't render this file because it contains an unexpected character in line 13 and column 44.
|
@@ -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 Студія вінілу, трафаретів і лазерного різання
|
||||
|
Can't render this file because it contains an unexpected character in line 13 and column 44.
|
@@ -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 贴纸、镂空模板与激光切割工作室
|
||||
|
Can't render this file because it contains an unexpected character in line 4 and column 3.
|
@@ -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 卡典西德、模板與雷射切割工作室
|
||||
|
Can't render this file because it contains an unexpected character in line 4 and column 3.
|
@@ -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<Platform>, manage_apps: bool) -> bool {
|
||||
self.app.has_separate_nightly_channel() && self.status(platform, manage_apps) == AppStatus::NoRelease
|
||||
}
|
||||
|
||||
pub fn installed_label(&self) -> Option<String> {
|
||||
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),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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(),
|
||||
}
|
||||
|
||||
@@ -198,6 +198,7 @@ fn events() -> Vec<Event> {
|
||||
});
|
||||
}
|
||||
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);
|
||||
}
|
||||
Reference in new issue
Block a user