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 #[doc(alias = "UNNotificationCategoryOptionAllowAnnouncement")]
25#[deprecated = "Announcement option is ignored"]
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
49extern_conformance!(
50 unsafe impl NSCoding for UNNotificationCategory {}
51);
52
53extern_conformance!(
54 unsafe impl NSCopying for UNNotificationCategory {}
55);
56
57unsafe impl CopyingHelper for UNNotificationCategory {
58 type Result = Self;
59}
60
61extern_conformance!(
62 unsafe impl NSObjectProtocol for UNNotificationCategory {}
63);
64
65extern_conformance!(
66 unsafe impl NSSecureCoding for UNNotificationCategory {}
67);
68
69impl UNNotificationCategory {
70 extern_methods!(
71 #[unsafe(method(identifier))]
72 #[unsafe(method_family = none)]
73 pub fn identifier(&self) -> Retained<NSString>;
74
75 #[cfg(feature = "UNNotificationAction")]
76 #[unsafe(method(actions))]
77 #[unsafe(method_family = none)]
78 pub fn actions(&self) -> Retained<NSArray<UNNotificationAction>>;
79
80 #[unsafe(method(intentIdentifiers))]
81 #[unsafe(method_family = none)]
82 pub fn intentIdentifiers(&self) -> Retained<NSArray<NSString>>;
83
84 #[unsafe(method(options))]
85 #[unsafe(method_family = none)]
86 pub fn options(&self) -> UNNotificationCategoryOptions;
87
88 #[unsafe(method(hiddenPreviewsBodyPlaceholder))]
89 #[unsafe(method_family = none)]
90 pub fn hiddenPreviewsBodyPlaceholder(&self) -> Retained<NSString>;
91
92 #[unsafe(method(categorySummaryFormat))]
99 #[unsafe(method_family = none)]
100 pub fn categorySummaryFormat(&self) -> Retained<NSString>;
101
102 #[cfg(feature = "UNNotificationAction")]
103 #[unsafe(method(categoryWithIdentifier:actions:intentIdentifiers:options:))]
104 #[unsafe(method_family = none)]
105 pub fn categoryWithIdentifier_actions_intentIdentifiers_options(
106 identifier: &NSString,
107 actions: &NSArray<UNNotificationAction>,
108 intent_identifiers: &NSArray<NSString>,
109 options: UNNotificationCategoryOptions,
110 ) -> Retained<Self>;
111
112 #[cfg(feature = "UNNotificationAction")]
113 #[unsafe(method(categoryWithIdentifier:actions:intentIdentifiers:hiddenPreviewsBodyPlaceholder:options:))]
114 #[unsafe(method_family = none)]
115 pub fn categoryWithIdentifier_actions_intentIdentifiers_hiddenPreviewsBodyPlaceholder_options(
116 identifier: &NSString,
117 actions: &NSArray<UNNotificationAction>,
118 intent_identifiers: &NSArray<NSString>,
119 hidden_previews_body_placeholder: &NSString,
120 options: UNNotificationCategoryOptions,
121 ) -> Retained<Self>;
122
123 #[cfg(feature = "UNNotificationAction")]
124 #[unsafe(method(categoryWithIdentifier:actions:intentIdentifiers:hiddenPreviewsBodyPlaceholder:categorySummaryFormat:options:))]
125 #[unsafe(method_family = none)]
126 pub fn categoryWithIdentifier_actions_intentIdentifiers_hiddenPreviewsBodyPlaceholder_categorySummaryFormat_options(
127 identifier: &NSString,
128 actions: &NSArray<UNNotificationAction>,
129 intent_identifiers: &NSArray<NSString>,
130 hidden_previews_body_placeholder: Option<&NSString>,
131 category_summary_format: Option<&NSString>,
132 options: UNNotificationCategoryOptions,
133 ) -> Retained<Self>;
134
135 #[unsafe(method(init))]
136 #[unsafe(method_family = init)]
137 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
138 );
139}
140
141impl UNNotificationCategory {
143 extern_methods!(
144 #[unsafe(method(new))]
145 #[unsafe(method_family = new)]
146 pub unsafe fn new() -> Retained<Self>;
147 );
148}