Skip to main content

euv_core/system/protocol/
struct.rs

1use super::*;
2
3/// Declarative custom URL protocol registration and universal/app link specification.
4#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
5pub struct ProtocolRegistration {
6    /// Custom URI scheme name (e.g. `"euv"`, `"myapp"`).
7    pub(crate) scheme: String,
8    /// Human-readable handler display name shown in OS chooser dialogs.
9    pub(crate) display_name: String,
10    /// Reverse-DNS bundle or application identifier (e.g. `"dev.euv.app"`).
11    pub(crate) bundle_id: String,
12    /// Optional desktop executable path invoked for custom URI launches.
13    #[new(skip)]
14    pub(crate) executable_path: String,
15    /// Optional HTTPS domains for iOS/iPadOS Associated Domains and Android App Links.
16    #[new(skip)]
17    pub(crate) universal_domains: Vec<String>,
18}
19
20/// Parsed incoming custom-scheme or universal deep link event.
21#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
22pub struct DeepLinkEvent {
23    /// Original full URI string.
24    pub(crate) raw_url: String,
25    /// Normalized lowercase scheme (e.g. `"euv"`).
26    pub(crate) scheme: String,
27    /// Authority or host segment.
28    pub(crate) host: String,
29    /// Normalized path segment beginning with `/` when non-empty.
30    pub(crate) path: String,
31    /// Parsed query key-value pairs.
32    pub(crate) query: HashMap<String, String>,
33}
34
35/// Platform-specific manifest or OS registration artifact produced for a `ProtocolRegistration`.
36#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
37pub struct ProtocolManifestEntry {
38    /// Target execution platform.
39    #[get(type(copy))]
40    pub(crate) platform: PlatformKind,
41    /// Native OS registration mechanism name.
42    pub(crate) mechanism: String,
43    /// Ready-to-apply manifest snippet, registry path, desktop entry, or Web API invocation.
44    pub(crate) descriptor: String,
45}
46
47/// Cross-platform registry managing custom URI protocol handlers and incoming deep links.
48#[derive(Clone, Data, Debug, Default, New)]
49pub struct ProtocolRegistry {
50    /// Registered custom protocol definitions.
51    #[new(skip)]
52    pub(crate) registrations: Vec<ProtocolRegistration>,
53    /// Queue of received deep link events awaiting app consumption.
54    #[new(skip)]
55    pub(crate) pending_links: Vec<DeepLinkEvent>,
56}