DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Update prompt shows the app icon and accent color instead of a letter (#2023)
Dylan M. Taylor15d13dde2083
diff --git a/Cargo.lock b/Cargo.lockindex 1c361aef2..6344685d7 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -1138,13 +1138,14 @@ dependencies = [[[package]]name = "craft-update"version = "0.1.0"-source = "git+https://github.com/storytold/craft-libs?rev=92d392cff132eaf53e13afff77f38b5c11b73aa0#92d392cff132eaf53e13afff77f38b5c11b73aa0"+source = "git+https://github.com/storytold/craft-libs?rev=1065653e75854e9c17e1ff563acdd344c1b185f0#1065653e75854e9c17e1ff563acdd344c1b185f0"dependencies = ["chrono","dunce","egui","flate2","getrandom 0.3.4",+ "image","log","plist","semver",diff --git a/Cargo.toml b/Cargo.tomlindex 139d06f01..fd8629f62 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -17,7 +17,8 @@ craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "92d392cff1craft-keymap = { git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0", version = "=0.1.0", features = ["egui", "ui"] }# Separations, ink coverage and the ink manager; same revision as craft-pdf and the krilla patch.craft-prepress = { git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0", version = "=0.1.0", features = ["flatten"] }-craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0", features = ["egui"] }+# craft-update with storytold/craft-libs#434: the update prompt shows the app's icon, accent and developer.+craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "1065653e75854e9c17e1ff563acdd344c1b185f0", features = ["egui"] }# internaldesigncraft-geom = { path = "crates/geom" }designcraft-color = { path = "crates/color" }diff --git a/apps/designcraft/src/main.rs b/apps/designcraft/src/main.rsindex 5f056aab3..4b4a1ab7f 100644--- a/apps/designcraft/src/main.rs+++ b/apps/designcraft/src/main.rs@@ -255,7 +255,7 @@ fn control_port_from(source: &str, value: Option<String>) -> Option<u16> {fn main() -> std::process::ExitCode {// Windows: the update helper is a copy of this program started with `--finish-update`.#[cfg(windows)]- if let Some(result) = craft_update::self_update::finish(&craft_update::suite::DESIGNCRAFT, &std::env::args_os().skip(1).collect::<Vec<_>>()) {+ if let Some(result) = craft_update::self_update::finish(&designcraft_ui_egui::UPDATE_APP, &std::env::args_os().skip(1).collect::<Vec<_>>()) {std::process::exit(i32::from(result.is_err()));}// First, so every start-up record (and the engine's panic hook, installed with the firstdiff --git a/crates/engine/src/cmd/export/text_tests.rs b/crates/engine/src/cmd/export/text_tests.rsindex e533320f8..2efcb2f92 100644--- a/crates/engine/src/cmd/export/text_tests.rs+++ b/crates/engine/src/cmd/export/text_tests.rs@@ -204,12 +204,12 @@ fn black_and_gold(pdf: &[u8]) -> Vec<(u8, u8)> {let mut out = Vec::new();for st in file.objects().into_iter().filter_map(|o| o.into_stream()) {let d = st.dict();- if !d.get::<Name<'_>>(b"Subtype").is_some_and(|n| n.as_ref() == b"Image") || d.get::<i32>(b"BitsPerComponent") != Some(8) {+ if d.get::<Name<'_>>(b"Subtype").is_none_or(|n| n.as_ref() != b"Image") || d.get::<i32>(b"BitsPerComponent") != Some(8) {continue;}let Some(cs) = d.get::<Array<'_>>(b"ColorSpace") else { continue };let mut it = cs.iter::<Object<'_>>();- if !it.next().and_then(|o| o.into_name()).is_some_and(|n| n.as_ref() == b"DeviceN") {+ if it.next().and_then(|o| o.into_name()).is_none_or(|n| n.as_ref() != b"DeviceN") {continue;}let Some(Object::Array(names)) = it.next() else { continue };diff --git a/crates/pdf/src/gradient_inks.rs b/crates/pdf/src/gradient_inks.rsindex e889ee1d2..c92b80158 100644--- a/crates/pdf/src/gradient_inks.rs+++ b/crates/pdf/src/gradient_inks.rs@@ -87,7 +87,7 @@ impl Exporter<'_> {let inks: Vec<Option<Ink>> = g.stops.iter().map(|s| self.stop_ink(s)).collect();let has_spot = inks.iter().any(|i| matches!(i, Some(Ink::Spot { .. })));let on_paper = g.stops.iter().any(|s| s.swatch.as_deref() == Some(designcraft_color::swatch::PAPER));- if !has_spot && !overprint && !(on_paper && self.for_print() && !self.rgb_only) {+ if !(has_spot || overprint || on_paper && self.for_print() && !self.rgb_only) {return None;}let Some(inks) = inks.into_iter().collect::<Option<Vec<Ink>>>() else {diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rsindex 0221aa257..a53cffcfa 100644--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@ -6,6 +6,15 @@#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]#![forbid(unsafe_code)]+/// DesignCraft as craft-update knows it, with its 128 px icon and accent colour: the update+/// prompt shows both, and an AppImage's menu entry gets the icon.+#[cfg(not(target_arch = "wasm32"))]+pub const UPDATE_APP: craft_update::app::App = craft_update::app::App {+ icon_png: Some(include_bytes!("../../../assets/app-icon/hicolor/128x128/apps/ai.storyteller.designcraft.png")),+ accent: Some([0x7b, 0xb5, 0x1c]),+ ..craft_update::suite::DESIGNCRAFT+};+pub mod about;pub mod canvas;pub mod chrome;diff --git a/crates/ui-egui/src/updates_ui.rs b/crates/ui-egui/src/updates_ui.rsindex 43803c9a5..10d3b83a4 100644--- a/crates/ui-egui/src/updates_ui.rs+++ b/crates/ui-egui/src/updates_ui.rs@@ -26,7 +26,7 @@ impl Default for Runtime {fn default() -> Self {Self {#[cfg(not(target_arch = "wasm32"))]- updater: Updater::new(&craft_update::suite::DESIGNCRAFT, env!("CARGO_PKG_VERSION")),+ updater: Updater::new(&crate::UPDATE_APP, env!("CARGO_PKG_VERSION")),#[cfg(not(target_arch = "wasm32"))]startup_check: false,#[cfg(not(target_arch = "wasm32"))]