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 /// `@system.sensor` accelerometer and gyroscope motion streams.
33 Sensor,
34}
35
36/// Normalized QuickApp UX application and page lifecycle hooks mapped into EUV `SystemEvent`s.
37#[derive(Clone, Debug, PartialEq)]
38pub enum QuickAppLifecycleHook {
39 /// `app.ux` `onCreate` initialization with optional `hap://app/` deep link.
40 OnCreate {
41 /// Optional incoming `hap://app/` deep link URI.
42 deep_link: Option<String>,
43 },
44 /// `page.ux` `onShow` foreground visibility.
45 OnShow,
46 /// `page.ux` `onHide` background suspension (0% CPU/GPU freeze).
47 OnHide,
48 /// `app.ux` / `page.ux` `onDestroy` teardown.
49 OnDestroy,
50 /// `page.ux` `onBackPress` hardware/gesture back interception.
51 OnBackPress,
52 /// `page.ux` `onConfigurationChanged` updating theme or locale.
53 OnConfigurationChanged {
54 /// Updated Light/Dark appearance mode.
55 theme: ThemeMode,
56 /// Updated BCP-47 locale tag.
57 locale: String,
58 },
59 /// Host memory trim notification (`level`: `1`=warning, `2`=critical).
60 OnMemoryWarning(i32),
61 /// Soft keyboard height update in physical pixels.
62 OnKeyboardChanged {
63 /// Whether soft keyboard is shown.
64 visible: bool,
65 /// Covered keyboard height in physical pixels.
66 height_px: u32,
67 },
68 /// Host network reachability change (`@system.network`).
69 OnNetworkChanged(NetworkStatus),
70}
71
72/// Outbound `@system.*` host bridge command drained by the generated QuickApp UX shell.
73#[derive(Clone, Debug, PartialEq)]
74pub enum QuickAppHostCommand {
75 /// `@system.router.push({ uri })`.
76 RouterPush(String),
77 /// `@system.router.back()`.
78 RouterBack(u32),
79 /// `@system.storage.set({ key, value })`.
80 StorageSet {
81 /// Storage key.
82 key: String,
83 /// Storage value.
84 value: String,
85 },
86 /// `@system.storage.delete({ key })`.
87 StorageDelete(String),
88 /// `@system.storage.clear()`.
89 StorageClear,
90 /// `@system.clipboard.set({ text })`.
91 ClipboardSet(String),
92 /// `this.$page.setTitleBar({ text })`.
93 SetTitleBar(String),
94 /// `@system.vibrator.vibrate({ mode: 'short' })`.
95 VibrateShort,
96 /// Signals `<canvas>` 2D/WebGL frame presentation for `(width, height)`.
97 PresentCanvas {
98 /// Physical canvas width in pixels.
99 width: u32,
100 /// Physical canvas height in pixels.
101 height: u32,
102 },
103 /// Opens or closes the QuickApp soft keyboard proxy `<input>`.
104 ShowKeyboard {
105 /// Whether keyboard input is active.
106 enabled: bool,
107 /// Logical anchor rect for the focused input.
108 rect: Rect,
109 },
110 /// Shows a QuickApp `@system.prompt.showToast` message.
111 ShowToast(String),
112 /// Opens an external URI via QuickApp `@system.router.push({ uri })`.
113 OpenUrl(String),
114}