Skip to main content

euv_core/system/capabilities/
struct.rs

1use super::*;
2
3/// Declarative content payload for iOS Dynamic Island, Live Activities, and cross-platform live status pills.
4#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
5pub struct LiveActivityContent {
6    /// Expanded and Lock Screen primary title.
7    pub(crate) title: String,
8    /// Expanded and Lock Screen supporting status text.
9    pub(crate) subtitle: String,
10    /// Dynamic Island compact leading slot text or icon tag.
11    #[new(skip)]
12    pub(crate) compact_leading: String,
13    /// Dynamic Island compact trailing slot metric or countdown text.
14    #[new(skip)]
15    pub(crate) compact_trailing: String,
16    /// Dynamic Island minimal circular badge text.
17    #[new(skip)]
18    pub(crate) minimal_badge: String,
19    /// Optional completion progress in `0..=100`.
20    #[new(skip)]
21    #[get(skip)]
22    pub(crate) progress_percent: Option<u8>,
23    /// Accent color RGB hex (`0xRRGGBB`) for tinting the island or progress ring.
24    #[new(skip)]
25    #[get(type(copy))]
26    pub(crate) accent_hex: u32,
27}
28
29/// Active handle tracking a running Dynamic Island / Live Activity session.
30#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
31pub struct LiveActivityHandle {
32    /// Unique application-scoped activity identifier.
33    pub(crate) activity_id: String,
34    /// Platform hosting the live activity.
35    #[get(type(copy))]
36    pub(crate) platform: PlatformKind,
37    /// Resolved native presentation surface (`Compact`, `LockScreen`, `FallbackStatusBar`, etc.).
38    #[get(type(copy))]
39    pub(crate) presentation: IslandPresentationMode,
40    /// Current rendered live activity content.
41    pub(crate) content: LiveActivityContent,
42    /// Whether the live activity is currently active.
43    #[get(type(copy))]
44    pub(crate) active: bool,
45}
46
47/// Cross-platform native system notification payload.
48#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
49pub struct SystemNotification {
50    /// Stable notification identifier for replacement or dismissal.
51    pub(crate) id: String,
52    /// Notification heading.
53    pub(crate) title: String,
54    /// Notification message body.
55    pub(crate) body: String,
56    /// Optional app icon badge count.
57    #[new(skip)]
58    #[get(skip)]
59    pub(crate) badge_count: Option<u32>,
60    /// Suppresses alert sound when `true`.
61    #[new(skip)]
62    #[get(type(copy))]
63    pub(crate) silent: bool,
64}
65
66/// Desktop system tray / macOS menu bar icon configuration.
67#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
68pub struct SystemTrayConfig {
69    /// Hover tooltip text.
70    pub(crate) tooltip: String,
71    /// Optional inline title shown in macOS menu bar or Linux tray.
72    #[new(skip)]
73    pub(crate) title: String,
74    /// Ordered context menu action labels.
75    #[new(skip)]
76    pub(crate) menu_items: Vec<String>,
77}
78
79/// Cross-platform native OS share sheet payload (`UIActivityViewController`, `NSSharingServicePicker`, Android `Intent`, Web Share).
80#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
81pub struct SharePayload {
82    /// Share dialog title.
83    pub(crate) title: String,
84    /// Body text to share.
85    pub(crate) text: String,
86    /// Optional URL to attach.
87    #[new(skip)]
88    pub(crate) url: String,
89}
90
91/// Unified per-app hub coordinating permissions, protocols, Dynamic Island / Live Activities, haptics, tray, and A11y announcements.
92#[derive(Clone, Data, Debug, Default, New)]
93pub struct PlatformServiceHub {
94    /// Active platform kind.
95    #[get(type(copy))]
96    pub(crate) platform: PlatformKind,
97    /// Unified system permission manager.
98    #[new(skip)]
99    pub(crate) permissions: PermissionManager,
100    /// Custom URL protocol & deep link registry.
101    #[new(skip)]
102    pub(crate) protocols: ProtocolRegistry,
103    /// Running and ended Dynamic Island / Live Activities.
104    #[new(skip)]
105    pub(crate) live_activities: Vec<LiveActivityHandle>,
106    /// Dispatched system notifications.
107    #[new(skip)]
108    pub(crate) notifications: Vec<SystemNotification>,
109    /// Queued screen reader live announcements.
110    #[new(skip)]
111    pub(crate) announcements: Vec<A11yAnnouncement>,
112    /// Active desktop system tray configuration, if installed.
113    #[new(skip)]
114    #[get(skip)]
115    pub(crate) tray: Option<SystemTrayConfig>,
116    /// Total haptic pulses emitted.
117    #[new(skip)]
118    #[get(type(copy))]
119    pub(crate) haptic_count: u64,
120}