objc2_user_notifications/generated/
UNNotificationCategory.rs1use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct UNNotificationCategoryOptions(pub NSUInteger);
14bitflags::bitflags! {
15 impl UNNotificationCategoryOptions: NSUInteger {
16 #[doc(alias = "UNNotificationCategoryOptionCustomDismissAction")]
17 const CustomDismissAction = 1<<0;
18 #[doc(alias = "UNNotificationCategoryOptionAllowInCarPlay")]
19 const AllowInCarPlay = 1<<1;
20 #[doc(alias = "UNNotificationCategoryOptionHiddenPreviewsShowTitle")]
21 const HiddenPreviewsShowTitle = 1<<2;
22 #[doc(alias = "UNNotificationCategoryOptionHiddenPreviewsShowSubtitle")]
23 const HiddenPreviewsShowSubtitle = 1<<3;
24#[deprecated = "Announcement option is ignored"]
25 #[doc(alias = "UNNotificationCategoryOptionAllowAnnouncement")]
26 const AllowAnnouncement = 1<<4;
27 }
28}
29
30unsafe impl Encode for UNNotificationCategoryOptions {
31 const ENCODING: Encoding = NSUInteger::ENCODING;
32}
33
34unsafe impl RefEncode for UNNotificationCategoryOptions {
35 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
36}
37
38pub static UNNotificationCategoryOptionNone: UNNotificationCategoryOptions =
40 UNNotificationCategoryOptions(0);
41
42extern_class!(
43 #[unsafe(super(NSObject))]
45 #[derive(Debug, PartialEq, Eq, Hash)]
46 pub struct UNNotificationCategory;
47);
48
49unsafe impl NSCoding for UNNotificationCategory {}
50
51unsafe impl NSCopying for UNNotificationCategory {}
52
53unsafe impl CopyingHelper for UNNotificationCategory {
54 type Result = Self;
55}
56
57unsafe impl NSObjectProtocol for UNNotificationCategory {}
58
59unsafe impl NSSecureCoding for UNNotificationCategory {}
60
61impl UNNotificationCategory {
62 extern_methods!(
63 #[unsafe(method(identifier))]
64 #[unsafe(method_family = none)]
65 pub unsafe fn identifier(&self) -> Retained<NSString>;
66
67 #[cfg(feature = "UNNotificationAction")]
68 #[unsafe(method(actions))]
69 #[unsafe(method_family = none)]
70 pub unsafe fn actions(&self) -> Retained<NSArray<UNNotificationAction>>;
71
72 #[unsafe(method(intentIdentifiers))]
73 #[unsafe(method_family = none)]
74 pub unsafe fn intentIdentifiers(&self) -> Retained<NSArray<NSString>>;
75
76 #[unsafe(method(options))]
77 #[unsafe(method_family = none)]
78 pub unsafe fn options(&self) -> UNNotificationCategoryOptions;
79
80 #[unsafe(method(hiddenPreviewsBodyPlaceholder))]
81 #[unsafe(method_family = none)]
82 pub unsafe fn hiddenPreviewsBodyPlaceholder(&self) -> Retained<NSString>;
83
84 #[unsafe(method(categorySummaryFormat))]
91 #[unsafe(method_family = none)]
92 pub unsafe fn categorySummaryFormat(&self) -> Retained<NSString>;
93
94 #[cfg(feature = "UNNotificationAction")]
95 #[unsafe(method(categoryWithIdentifier:actions:intentIdentifiers:options:))]
96 #[unsafe(method_family = none)]
97 pub unsafe fn categoryWithIdentifier_actions_intentIdentifiers_options(
98 identifier: &NSString,
99 actions: &NSArray<UNNotificationAction>,
100 intent_identifiers: &NSArray<NSString>,
101 options: UNNotificationCategoryOptions,
102 ) -> Retained<Self>;
103
104 #[cfg(feature = "UNNotificationAction")]
105 #[unsafe(method(categoryWithIdentifier:actions:intentIdentifiers:hiddenPreviewsBodyPlaceholder:options:))]
106 #[unsafe(method_family = none)]
107 pub unsafe fn categoryWithIdentifier_actions_intentIdentifiers_hiddenPreviewsBodyPlaceholder_options(
108 identifier: &NSString,
109 actions: &NSArray<UNNotificationAction>,
110 intent_identifiers: &NSArray<NSString>,
111 hidden_previews_body_placeholder: &NSString,
112 options: UNNotificationCategoryOptions,
113 ) -> Retained<Self>;
114
115 #[cfg(feature = "UNNotificationAction")]
116 #[unsafe(method(categoryWithIdentifier:actions:intentIdentifiers:hiddenPreviewsBodyPlaceholder:categorySummaryFormat:options:))]
117 #[unsafe(method_family = none)]
118 pub unsafe fn categoryWithIdentifier_actions_intentIdentifiers_hiddenPreviewsBodyPlaceholder_categorySummaryFormat_options(
119 identifier: &NSString,
120 actions: &NSArray<UNNotificationAction>,
121 intent_identifiers: &NSArray<NSString>,
122 hidden_previews_body_placeholder: Option<&NSString>,
123 category_summary_format: Option<&NSString>,
124 options: UNNotificationCategoryOptions,
125 ) -> Retained<Self>;
126
127 #[unsafe(method(init))]
128 #[unsafe(method_family = init)]
129 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
130 );
131}
132
133impl UNNotificationCategory {
135 extern_methods!(
136 #[unsafe(method(new))]
137 #[unsafe(method_family = new)]
138 pub unsafe fn new() -> Retained<Self>;
139 );
140}