objc2_ui_kit/generated/
UIUserNotificationSettings.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[deprecated = "Use UserNotifications Framework's UNAuthorizationOptions"]
13#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct UIUserNotificationType(pub NSUInteger);
16bitflags::bitflags! {
17 impl UIUserNotificationType: NSUInteger {
18#[deprecated = "Use UserNotifications Framework's UNAuthorizationOptions"]
19 #[doc(alias = "UIUserNotificationTypeNone")]
20 const None = 0;
21#[deprecated = "Use UserNotifications Framework's UNAuthorizationOptions"]
22 #[doc(alias = "UIUserNotificationTypeBadge")]
23 const Badge = 1<<0;
24#[deprecated = "Use UserNotifications Framework's UNAuthorizationOptions"]
25 #[doc(alias = "UIUserNotificationTypeSound")]
26 const Sound = 1<<1;
27#[deprecated = "Use UserNotifications Framework's UNAuthorizationOptions"]
28 #[doc(alias = "UIUserNotificationTypeAlert")]
29 const Alert = 1<<2;
30 }
31}
32
33unsafe impl Encode for UIUserNotificationType {
34 const ENCODING: Encoding = NSUInteger::ENCODING;
35}
36
37unsafe impl RefEncode for UIUserNotificationType {
38 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
39}
40
41#[deprecated = "Use UserNotifications Framework's UNNotificationAction or UNTextInputNotificationAction"]
44#[repr(transparent)]
45#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
46pub struct UIUserNotificationActionBehavior(pub NSUInteger);
47impl UIUserNotificationActionBehavior {
48 #[deprecated = "Use UserNotifications Framework's UNNotificationAction or UNTextInputNotificationAction"]
49 #[doc(alias = "UIUserNotificationActionBehaviorDefault")]
50 pub const Default: Self = Self(0);
51 #[deprecated = "Use UserNotifications Framework's UNNotificationAction or UNTextInputNotificationAction"]
52 #[doc(alias = "UIUserNotificationActionBehaviorTextInput")]
53 pub const TextInput: Self = Self(1);
54}
55
56unsafe impl Encode for UIUserNotificationActionBehavior {
57 const ENCODING: Encoding = NSUInteger::ENCODING;
58}
59
60unsafe impl RefEncode for UIUserNotificationActionBehavior {
61 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
62}
63
64#[deprecated = "Use UserNotifications Framework's UNNotificationActionOptions"]
67#[repr(transparent)]
68#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
69pub struct UIUserNotificationActivationMode(pub NSUInteger);
70impl UIUserNotificationActivationMode {
71 #[deprecated = "Use UserNotifications Framework's UNNotificationActionOptions"]
72 #[doc(alias = "UIUserNotificationActivationModeForeground")]
73 pub const Foreground: Self = Self(0);
74 #[deprecated = "Use UserNotifications Framework's UNNotificationActionOptions"]
75 #[doc(alias = "UIUserNotificationActivationModeBackground")]
76 pub const Background: Self = Self(1);
77}
78
79unsafe impl Encode for UIUserNotificationActivationMode {
80 const ENCODING: Encoding = NSUInteger::ENCODING;
81}
82
83unsafe impl RefEncode for UIUserNotificationActivationMode {
84 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
85}
86
87#[deprecated = "Use UserNotifications Framework's -[UNNotificationCategory actions] or -[UNNotificationCategory minimalActions]"]
90#[repr(transparent)]
91#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
92pub struct UIUserNotificationActionContext(pub NSUInteger);
93impl UIUserNotificationActionContext {
94 #[deprecated = "Use UserNotifications Framework's -[UNNotificationCategory actions] or -[UNNotificationCategory minimalActions]"]
95 #[doc(alias = "UIUserNotificationActionContextDefault")]
96 pub const Default: Self = Self(0);
97 #[deprecated = "Use UserNotifications Framework's -[UNNotificationCategory actions] or -[UNNotificationCategory minimalActions]"]
98 #[doc(alias = "UIUserNotificationActionContextMinimal")]
99 pub const Minimal: Self = Self(1);
100}
101
102unsafe impl Encode for UIUserNotificationActionContext {
103 const ENCODING: Encoding = NSUInteger::ENCODING;
104}
105
106unsafe impl RefEncode for UIUserNotificationActionContext {
107 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
108}
109
110extern "C" {
111 pub static UIUserNotificationTextInputActionButtonTitleKey: &'static NSString;
113}
114
115extern "C" {
116 pub static UIUserNotificationActionResponseTypedTextKey: &'static NSString;
118}
119
120extern_class!(
121 #[unsafe(super(NSObject))]
123 #[thread_kind = MainThreadOnly]
124 #[derive(Debug, PartialEq, Eq, Hash)]
125 #[deprecated = "Use UserNotifications Framework's UNNotificationSettings"]
126 pub struct UIUserNotificationSettings;
127);
128
129unsafe impl NSObjectProtocol for UIUserNotificationSettings {}
130
131impl UIUserNotificationSettings {
132 extern_methods!(
133 #[deprecated = "Use UserNotifications Framework's UNNotificationSettings"]
134 #[unsafe(method(settingsForTypes:categories:))]
135 #[unsafe(method_family = none)]
136 pub unsafe fn settingsForTypes_categories(
137 types: UIUserNotificationType,
138 categories: Option<&NSSet<UIUserNotificationCategory>>,
139 mtm: MainThreadMarker,
140 ) -> Retained<Self>;
141
142 #[deprecated = "Use UserNotifications Framework's UNNotificationSettings"]
143 #[unsafe(method(types))]
144 #[unsafe(method_family = none)]
145 pub unsafe fn types(&self) -> UIUserNotificationType;
146
147 #[deprecated = "Use UserNotifications Framework's UNNotificationSettings"]
148 #[unsafe(method(categories))]
149 #[unsafe(method_family = none)]
150 pub unsafe fn categories(&self) -> Option<Retained<NSSet<UIUserNotificationCategory>>>;
151 );
152}
153
154impl UIUserNotificationSettings {
156 extern_methods!(
157 #[unsafe(method(init))]
158 #[unsafe(method_family = init)]
159 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
160
161 #[unsafe(method(new))]
162 #[unsafe(method_family = new)]
163 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
164 );
165}
166
167extern_class!(
168 #[unsafe(super(NSObject))]
170 #[thread_kind = MainThreadOnly]
171 #[derive(Debug, PartialEq, Eq, Hash)]
172 #[deprecated = "Use UserNotifications Framework's UNNotificationCategory"]
173 pub struct UIUserNotificationCategory;
174);
175
176unsafe impl NSCoding for UIUserNotificationCategory {}
177
178unsafe impl NSCopying for UIUserNotificationCategory {}
179
180unsafe impl CopyingHelper for UIUserNotificationCategory {
181 type Result = Self;
182}
183
184unsafe impl NSMutableCopying for UIUserNotificationCategory {}
185
186unsafe impl MutableCopyingHelper for UIUserNotificationCategory {
187 type Result = UIMutableUserNotificationCategory;
188}
189
190unsafe impl NSObjectProtocol for UIUserNotificationCategory {}
191
192unsafe impl NSSecureCoding for UIUserNotificationCategory {}
193
194impl UIUserNotificationCategory {
195 extern_methods!(
196 #[unsafe(method(init))]
197 #[unsafe(method_family = init)]
198 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
199
200 #[unsafe(method(initWithCoder:))]
201 #[unsafe(method_family = init)]
202 pub unsafe fn initWithCoder(
203 this: Allocated<Self>,
204 coder: &NSCoder,
205 ) -> Option<Retained<Self>>;
206
207 #[unsafe(method(identifier))]
208 #[unsafe(method_family = none)]
209 pub unsafe fn identifier(&self) -> Option<Retained<NSString>>;
210
211 #[unsafe(method(actionsForContext:))]
212 #[unsafe(method_family = none)]
213 pub unsafe fn actionsForContext(
214 &self,
215 context: UIUserNotificationActionContext,
216 ) -> Option<Retained<NSArray<UIUserNotificationAction>>>;
217 );
218}
219
220impl UIUserNotificationCategory {
222 extern_methods!(
223 #[unsafe(method(new))]
224 #[unsafe(method_family = new)]
225 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
226 );
227}
228
229extern_class!(
230 #[unsafe(super(UIUserNotificationCategory, NSObject))]
232 #[thread_kind = MainThreadOnly]
233 #[derive(Debug, PartialEq, Eq, Hash)]
234 #[deprecated = "Use UserNotifications Framework's UNNotificationCategory"]
235 pub struct UIMutableUserNotificationCategory;
236);
237
238unsafe impl NSCoding for UIMutableUserNotificationCategory {}
239
240unsafe impl NSCopying for UIMutableUserNotificationCategory {}
241
242unsafe impl CopyingHelper for UIMutableUserNotificationCategory {
243 type Result = UIUserNotificationCategory;
244}
245
246unsafe impl NSMutableCopying for UIMutableUserNotificationCategory {}
247
248unsafe impl MutableCopyingHelper for UIMutableUserNotificationCategory {
249 type Result = Self;
250}
251
252unsafe impl NSObjectProtocol for UIMutableUserNotificationCategory {}
253
254unsafe impl NSSecureCoding for UIMutableUserNotificationCategory {}
255
256impl UIMutableUserNotificationCategory {
257 extern_methods!(
258 #[deprecated = "Use UserNotifications Framework's UNNotificationCategory"]
259 #[unsafe(method(identifier))]
260 #[unsafe(method_family = none)]
261 pub unsafe fn identifier(&self) -> Option<Retained<NSString>>;
262
263 #[deprecated = "Use UserNotifications Framework's UNNotificationCategory"]
265 #[unsafe(method(setIdentifier:))]
266 #[unsafe(method_family = none)]
267 pub unsafe fn setIdentifier(&self, identifier: Option<&NSString>);
268
269 #[deprecated = "Use UserNotifications Framework's UNNotificationCategory"]
270 #[unsafe(method(setActions:forContext:))]
271 #[unsafe(method_family = none)]
272 pub unsafe fn setActions_forContext(
273 &self,
274 actions: Option<&NSArray<UIUserNotificationAction>>,
275 context: UIUserNotificationActionContext,
276 );
277 );
278}
279
280impl UIMutableUserNotificationCategory {
282 extern_methods!(
283 #[unsafe(method(init))]
284 #[unsafe(method_family = init)]
285 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
286
287 #[unsafe(method(initWithCoder:))]
288 #[unsafe(method_family = init)]
289 pub unsafe fn initWithCoder(
290 this: Allocated<Self>,
291 coder: &NSCoder,
292 ) -> Option<Retained<Self>>;
293 );
294}
295
296impl UIMutableUserNotificationCategory {
298 extern_methods!(
299 #[unsafe(method(new))]
300 #[unsafe(method_family = new)]
301 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
302 );
303}
304
305extern_class!(
306 #[unsafe(super(NSObject))]
308 #[thread_kind = MainThreadOnly]
309 #[derive(Debug, PartialEq, Eq, Hash)]
310 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
311 pub struct UIUserNotificationAction;
312);
313
314unsafe impl NSCoding for UIUserNotificationAction {}
315
316unsafe impl NSCopying for UIUserNotificationAction {}
317
318unsafe impl CopyingHelper for UIUserNotificationAction {
319 type Result = Self;
320}
321
322unsafe impl NSMutableCopying for UIUserNotificationAction {}
323
324unsafe impl MutableCopyingHelper for UIUserNotificationAction {
325 type Result = UIMutableUserNotificationAction;
326}
327
328unsafe impl NSObjectProtocol for UIUserNotificationAction {}
329
330unsafe impl NSSecureCoding for UIUserNotificationAction {}
331
332impl UIUserNotificationAction {
333 extern_methods!(
334 #[unsafe(method(init))]
335 #[unsafe(method_family = init)]
336 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
337
338 #[unsafe(method(initWithCoder:))]
339 #[unsafe(method_family = init)]
340 pub unsafe fn initWithCoder(
341 this: Allocated<Self>,
342 coder: &NSCoder,
343 ) -> Option<Retained<Self>>;
344
345 #[unsafe(method(identifier))]
346 #[unsafe(method_family = none)]
347 pub unsafe fn identifier(&self) -> Option<Retained<NSString>>;
348
349 #[unsafe(method(title))]
350 #[unsafe(method_family = none)]
351 pub unsafe fn title(&self) -> Option<Retained<NSString>>;
352
353 #[unsafe(method(behavior))]
354 #[unsafe(method_family = none)]
355 pub unsafe fn behavior(&self) -> UIUserNotificationActionBehavior;
356
357 #[unsafe(method(parameters))]
358 #[unsafe(method_family = none)]
359 pub unsafe fn parameters(&self) -> Retained<NSDictionary>;
360
361 #[unsafe(method(activationMode))]
362 #[unsafe(method_family = none)]
363 pub unsafe fn activationMode(&self) -> UIUserNotificationActivationMode;
364
365 #[unsafe(method(isAuthenticationRequired))]
366 #[unsafe(method_family = none)]
367 pub unsafe fn isAuthenticationRequired(&self) -> bool;
368
369 #[unsafe(method(isDestructive))]
370 #[unsafe(method_family = none)]
371 pub unsafe fn isDestructive(&self) -> bool;
372 );
373}
374
375impl UIUserNotificationAction {
377 extern_methods!(
378 #[unsafe(method(new))]
379 #[unsafe(method_family = new)]
380 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
381 );
382}
383
384extern_class!(
385 #[unsafe(super(UIUserNotificationAction, NSObject))]
387 #[thread_kind = MainThreadOnly]
388 #[derive(Debug, PartialEq, Eq, Hash)]
389 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
390 pub struct UIMutableUserNotificationAction;
391);
392
393unsafe impl NSCoding for UIMutableUserNotificationAction {}
394
395unsafe impl NSCopying for UIMutableUserNotificationAction {}
396
397unsafe impl CopyingHelper for UIMutableUserNotificationAction {
398 type Result = UIUserNotificationAction;
399}
400
401unsafe impl NSMutableCopying for UIMutableUserNotificationAction {}
402
403unsafe impl MutableCopyingHelper for UIMutableUserNotificationAction {
404 type Result = Self;
405}
406
407unsafe impl NSObjectProtocol for UIMutableUserNotificationAction {}
408
409unsafe impl NSSecureCoding for UIMutableUserNotificationAction {}
410
411impl UIMutableUserNotificationAction {
412 extern_methods!(
413 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
414 #[unsafe(method(identifier))]
415 #[unsafe(method_family = none)]
416 pub unsafe fn identifier(&self) -> Option<Retained<NSString>>;
417
418 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
420 #[unsafe(method(setIdentifier:))]
421 #[unsafe(method_family = none)]
422 pub unsafe fn setIdentifier(&self, identifier: Option<&NSString>);
423
424 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
425 #[unsafe(method(title))]
426 #[unsafe(method_family = none)]
427 pub unsafe fn title(&self) -> Option<Retained<NSString>>;
428
429 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
431 #[unsafe(method(setTitle:))]
432 #[unsafe(method_family = none)]
433 pub unsafe fn setTitle(&self, title: Option<&NSString>);
434
435 #[unsafe(method(behavior))]
436 #[unsafe(method_family = none)]
437 pub unsafe fn behavior(&self) -> UIUserNotificationActionBehavior;
438
439 #[unsafe(method(setBehavior:))]
441 #[unsafe(method_family = none)]
442 pub unsafe fn setBehavior(&self, behavior: UIUserNotificationActionBehavior);
443
444 #[unsafe(method(parameters))]
445 #[unsafe(method_family = none)]
446 pub unsafe fn parameters(&self) -> Retained<NSDictionary>;
447
448 #[unsafe(method(setParameters:))]
450 #[unsafe(method_family = none)]
451 pub unsafe fn setParameters(&self, parameters: &NSDictionary);
452
453 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
454 #[unsafe(method(activationMode))]
455 #[unsafe(method_family = none)]
456 pub unsafe fn activationMode(&self) -> UIUserNotificationActivationMode;
457
458 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
460 #[unsafe(method(setActivationMode:))]
461 #[unsafe(method_family = none)]
462 pub unsafe fn setActivationMode(&self, activation_mode: UIUserNotificationActivationMode);
463
464 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
465 #[unsafe(method(isAuthenticationRequired))]
466 #[unsafe(method_family = none)]
467 pub unsafe fn isAuthenticationRequired(&self) -> bool;
468
469 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
471 #[unsafe(method(setAuthenticationRequired:))]
472 #[unsafe(method_family = none)]
473 pub unsafe fn setAuthenticationRequired(&self, authentication_required: bool);
474
475 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
476 #[unsafe(method(isDestructive))]
477 #[unsafe(method_family = none)]
478 pub unsafe fn isDestructive(&self) -> bool;
479
480 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
482 #[unsafe(method(setDestructive:))]
483 #[unsafe(method_family = none)]
484 pub unsafe fn setDestructive(&self, destructive: bool);
485 );
486}
487
488impl UIMutableUserNotificationAction {
490 extern_methods!(
491 #[unsafe(method(init))]
492 #[unsafe(method_family = init)]
493 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
494
495 #[unsafe(method(initWithCoder:))]
496 #[unsafe(method_family = init)]
497 pub unsafe fn initWithCoder(
498 this: Allocated<Self>,
499 coder: &NSCoder,
500 ) -> Option<Retained<Self>>;
501 );
502}
503
504impl UIMutableUserNotificationAction {
506 extern_methods!(
507 #[unsafe(method(new))]
508 #[unsafe(method_family = new)]
509 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
510 );
511}