1pub use tilo_platform_caps::{Availability, availability, available};
4
5pub type Unsupported = tilo_platform_caps::Unsupported<Feature>;
6
7#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
8#[non_exhaustive]
9pub enum Feature {
10 Show,
11 Schedule,
12 Activate,
13 Close,
16 PriorityContacts,
17}
18
19pub(crate) const WEB_SCHEDULE: &str = "A closed web page cannot show notifications.";
20pub(crate) const MAC_PRIORITY: &str = "macOS decides who breaks through Focus.";
21pub(crate) const WEB_PRIORITY: &str = "Browsers decide who breaks through Do Not Disturb.";
22pub(crate) const MAC_CLOSE: &str =
23 "This macOS backend subscribes to no dismiss action of the notification center.";
24pub(crate) const WEB_CLOSE: &str = "Browsers report a notification closing, never why.";
25
26impl tilo_platform_caps::Feature for Feature {
27 fn targets(self) -> [Availability; 3] {
30 use Availability::{Available, Prompt, Unsupported};
31 match self {
32 Self::Show | Self::Activate => [Available, Prompt, Prompt],
33 Self::Close => [Available, Unsupported(MAC_CLOSE), Unsupported(WEB_CLOSE)],
34 Self::Schedule => [Available, Prompt, Unsupported(WEB_SCHEDULE)],
35 Self::PriorityContacts => [
36 Available,
37 Unsupported(MAC_PRIORITY),
38 Unsupported(WEB_PRIORITY),
39 ],
40 }
41 }
42}