euv_core/platform/quickapp/enum.rs
1use super::*;
2
3/// Supported QuickApp runtime distributions (QuickApp Alliance standard and Huawei QuickApp).
4#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
5pub enum QuickAppVendor {
6 /// QuickApp Alliance standard runtime (`@system.*` across Xiaomi, OPPO, vivo, Lenovo, Meizu, ZTE, Honor).
7 #[default]
8 Alliance,
9 /// Huawei QuickApp runtime (`@system.*` + `@service.*` AppGallery QuickApp).
10 Huawei,
11}
12
13/// Standard QuickApp `manifest.json` `features` module declarations.
14#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub enum QuickAppFeatureModule {
16 /// `@system.router` page navigation.
17 Router,
18 /// `@system.storage` sandboxed key-value persistence.
19 Storage,
20 /// `@system.clipboard` system clipboard read/write.
21 Clipboard,
22 /// `@system.device` screen, safe-area, and device metadata.
23 Device,
24 /// `@system.network` connectivity reachability observer.
25 Network,
26 /// `@system.vibrator` haptic vibration feedback.
27 Vibrator,
28 /// `@system.prompt` toast and dialog bridge.
29 Prompt,
30 /// `@system.share` OS share sheet integration.
31 Share,
32}
33
34/// Normalized QuickApp UX application and page lifecycle hooks mapped into EUV `SystemEvent`s.
35#[derive(Clone, Debug, PartialEq)]
36pub enum QuickAppLifecycleHook {
37 /// `app.ux` `onCreate` initialization with optional `hap://app/` deep link.
38 OnCreate {
39 /// Optional incoming `hap://app/` deep link URI.
40 deep_link: Option<String>,
41 },
42 /// `page.ux` `onShow` foreground visibility.
43 OnShow,
44 /// `page.ux` `onHide` background suspension (0% CPU/GPU freeze).
45 OnHide,
46 /// `app.ux` / `page.ux` `onDestroy` teardown.
47 OnDestroy,
48 /// `page.ux` `onBackPress` hardware/gesture back interception.
49 OnBackPress,
50 /// `page.ux` `onConfigurationChanged` updating theme or locale.
51 OnConfigurationChanged {
52 /// Updated Light/Dark appearance mode.
53 theme: ThemeMode,
54 /// Updated BCP-47 locale tag.
55 locale: String,
56 },
57 /// Host memory trim notification (`level`: `1`=warning, `2`=critical).
58 OnMemoryWarning(i32),
59 /// Soft keyboard height update in physical pixels.
60 OnKeyboardChanged {
61 /// Whether soft keyboard is shown.
62 visible: bool,
63 /// Covered keyboard height in physical pixels.
64 height_px: u32,
65 },
66}
67
68/// Outbound `@system.*` host bridge command drained by the generated QuickApp UX shell.
69#[derive(Clone, Debug, PartialEq)]
70pub enum QuickAppHostCommand {
71 /// `@system.router.push({ uri })`.
72 RouterPush(String),
73 /// `@system.router.back()`.
74 RouterBack(u32),
75 /// `@system.storage.set({ key, value })`.
76 StorageSet {
77 /// Storage key.
78 key: String,
79 /// Storage value.
80 value: String,
81 },
82 /// `@system.storage.delete({ key })`.
83 StorageDelete(String),
84 /// `@system.storage.clear()`.
85 StorageClear,
86 /// `@system.clipboard.set({ text })`.
87 ClipboardSet(String),
88 /// `this.$page.setTitleBar({ text })`.
89 SetTitleBar(String),
90 /// `@system.vibrator.vibrate({ mode: 'short' })`.
91 VibrateShort,
92 /// Signals `<canvas>` 2D/WebGL frame presentation for `(width, height)`.
93 PresentCanvas {
94 /// Physical canvas width in pixels.
95 width: u32,
96 /// Physical canvas height in pixels.
97 height: u32,
98 },
99}