Archived
f4abfe6fdc
Belated rename commit for foundation/el-ui — was missed in the workspace-wide crates→vessels pass earlier today. Same structural intent as the rename in the other repos: 'crates' is the Rust word, 'vessel' is El's, and the directory rename is the marker that this slot holds an El buildable unit even if its current contents are still Rust pending port. Plus the El ports themselves — manifest.el + src/main.el per sub- vessel (el-aop, el-auth, el-config, el-i18n, el-identity, el-layout, el-platform, el-publish, el-secrets, el-services, el-style, el-ui- compiler). The ui-compiler is a stub: elc only emits C right now; generating browser-target JS/Wasm is the biggest open language gap and gets its own project. Until then, el-ui-compiler emits a JS module that throws elc.backend_missing so callers fail loudly. Cross-repo path dependencies in Cargo.toml updated to vessels/.
136 lines
3.9 KiB
Rust
136 lines
3.9 KiB
Rust
//! Screenshot pipeline — captures app screenshots for each store target size.
|
|
|
|
use crate::PublishResult;
|
|
|
|
/// A screenshot target device/size specification.
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
pub struct ScreenshotTarget {
|
|
/// Display name (e.g. "iPhone 6.7\"")
|
|
pub name: String,
|
|
/// Target identifier used in manifest.el (e.g. "iphone-6.7")
|
|
pub id: String,
|
|
pub width: u32,
|
|
pub height: u32,
|
|
pub platform: ScreenshotPlatform,
|
|
}
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
pub enum ScreenshotPlatform {
|
|
Ios,
|
|
Android,
|
|
}
|
|
|
|
impl ScreenshotTarget {
|
|
/// All standard screenshot targets, matching Apple and Google requirements.
|
|
pub fn all_standard() -> Vec<Self> {
|
|
vec![
|
|
Self {
|
|
name: "iPhone 6.7\"".into(),
|
|
id: "iphone-6.7".into(),
|
|
width: 1290,
|
|
height: 2796,
|
|
platform: ScreenshotPlatform::Ios,
|
|
},
|
|
Self {
|
|
name: "iPhone 6.1\"".into(),
|
|
id: "iphone-6.1".into(),
|
|
width: 1179,
|
|
height: 2556,
|
|
platform: ScreenshotPlatform::Ios,
|
|
},
|
|
Self {
|
|
name: "iPad 13\"".into(),
|
|
id: "ipad-13".into(),
|
|
width: 2064,
|
|
height: 2752,
|
|
platform: ScreenshotPlatform::Ios,
|
|
},
|
|
Self {
|
|
name: "Android Phone".into(),
|
|
id: "android-phone".into(),
|
|
width: 1080,
|
|
height: 1920,
|
|
platform: ScreenshotPlatform::Android,
|
|
},
|
|
]
|
|
}
|
|
|
|
/// Find a target by its ID.
|
|
pub fn find(id: &str) -> Option<Self> {
|
|
Self::all_standard().into_iter().find(|t| t.id == id)
|
|
}
|
|
}
|
|
|
|
/// A captured screenshot.
|
|
#[derive(Debug, Clone)]
|
|
pub struct Screenshot {
|
|
pub target: ScreenshotTarget,
|
|
pub locale: String,
|
|
pub scenario: String,
|
|
/// Path to the PNG file.
|
|
pub path: String,
|
|
}
|
|
|
|
/// Trait for screenshot capture backends.
|
|
///
|
|
/// Implementations might use:
|
|
/// - `xcrun simctl` for iOS Simulator screenshots
|
|
/// - Android Emulator ADB screenshots
|
|
/// - Puppeteer/Playwright for web screenshots
|
|
pub trait ScreenshotCapture: Send + Sync {
|
|
/// Capture a screenshot for the given scenario and target.
|
|
fn capture(
|
|
&self,
|
|
scenario: &str,
|
|
target: &ScreenshotTarget,
|
|
locale: &str,
|
|
output_dir: &str,
|
|
) -> PublishResult<Screenshot>;
|
|
|
|
/// Capture all scenarios for all targets and locales.
|
|
fn capture_all(
|
|
&self,
|
|
scenarios: &[String],
|
|
targets: &[ScreenshotTarget],
|
|
locales: &[String],
|
|
output_dir: &str,
|
|
) -> PublishResult<Vec<Screenshot>> {
|
|
let mut screenshots = Vec::new();
|
|
for scenario in scenarios {
|
|
for target in targets {
|
|
for locale in locales {
|
|
let shot = self.capture(scenario, target, locale, output_dir)?;
|
|
screenshots.push(shot);
|
|
}
|
|
}
|
|
}
|
|
Ok(screenshots)
|
|
}
|
|
}
|
|
|
|
/// Stub screenshot capture (produces placeholder paths without actually
|
|
/// launching a simulator). A future agent fills in the real capture logic.
|
|
pub struct StubScreenshotCapture;
|
|
|
|
impl ScreenshotCapture for StubScreenshotCapture {
|
|
fn capture(
|
|
&self,
|
|
scenario: &str,
|
|
target: &ScreenshotTarget,
|
|
locale: &str,
|
|
output_dir: &str,
|
|
) -> PublishResult<Screenshot> {
|
|
let filename = format!(
|
|
"{}/{}/{}-{}.png",
|
|
output_dir, locale, target.id, scenario
|
|
);
|
|
// TODO: actually launch simulator/emulator, navigate to scenario, capture PNG
|
|
Ok(Screenshot {
|
|
target: target.clone(),
|
|
locale: locale.to_string(),
|
|
scenario: scenario.to_string(),
|
|
path: filename,
|
|
})
|
|
}
|
|
}
|