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 #[doc(alias = "UIUserNotificationTypeNone")]
19#[deprecated = "Use UserNotifications Framework's UNAuthorizationOptions"]
20 const None = 0;
21 #[doc(alias = "UIUserNotificationTypeBadge")]
22#[deprecated = "Use UserNotifications Framework's UNAuthorizationOptions"]
23 const Badge = 1<<0;
24 #[doc(alias = "UIUserNotificationTypeSound")]
25#[deprecated = "Use UserNotifications Framework's UNAuthorizationOptions"]
26 const Sound = 1<<1;
27 #[doc(alias = "UIUserNotificationTypeAlert")]
28#[deprecated = "Use UserNotifications Framework's UNAuthorizationOptions"]
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 #[doc(alias = "UIUserNotificationActionBehaviorDefault")]
49 #[deprecated = "Use UserNotifications Framework's UNNotificationAction or UNTextInputNotificationAction"]
50 pub const Default: Self = Self(0);
51 #[doc(alias = "UIUserNotificationActionBehaviorTextInput")]
52 #[deprecated = "Use UserNotifications Framework's UNNotificationAction or UNTextInputNotificationAction"]
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 #[doc(alias = "UIUserNotificationActivationModeForeground")]
72 #[deprecated = "Use UserNotifications Framework's UNNotificationActionOptions"]
73 pub const Foreground: Self = Self(0);
74 #[doc(alias = "UIUserNotificationActivationModeBackground")]
75 #[deprecated = "Use UserNotifications Framework's UNNotificationActionOptions"]
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 #[doc(alias = "UIUserNotificationActionContextDefault")]
95 #[deprecated = "Use UserNotifications Framework's -[UNNotificationCategory actions] or -[UNNotificationCategory minimalActions]"]
96 pub const Default: Self = Self(0);
97 #[doc(alias = "UIUserNotificationActionContextMinimal")]
98 #[deprecated = "Use UserNotifications Framework's -[UNNotificationCategory actions] or -[UNNotificationCategory minimalActions]"]
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
129extern_conformance!(
130 unsafe impl NSObjectProtocol for UIUserNotificationSettings {}
131);
132
133impl UIUserNotificationSettings {
134 extern_methods!(
135 #[deprecated = "Use UserNotifications Framework's UNNotificationSettings"]
136 #[unsafe(method(settingsForTypes:categories:))]
137 #[unsafe(method_family = none)]
138 pub unsafe fn settingsForTypes_categories(
139 types: UIUserNotificationType,
140 categories: Option<&NSSet<UIUserNotificationCategory>>,
141 mtm: MainThreadMarker,
142 ) -> Retained<Self>;
143
144 #[deprecated = "Use UserNotifications Framework's UNNotificationSettings"]
145 #[unsafe(method(types))]
146 #[unsafe(method_family = none)]
147 pub unsafe fn types(&self) -> UIUserNotificationType;
148
149 #[deprecated = "Use UserNotifications Framework's UNNotificationSettings"]
150 #[unsafe(method(categories))]
151 #[unsafe(method_family = none)]
152 pub unsafe fn categories(&self) -> Option<Retained<NSSet<UIUserNotificationCategory>>>;
153 );
154}
155
156impl UIUserNotificationSettings {
158 extern_methods!(
159 #[unsafe(method(init))]
160 #[unsafe(method_family = init)]
161 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
162
163 #[unsafe(method(new))]
164 #[unsafe(method_family = new)]
165 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
166 );
167}
168
169extern_class!(
170 #[unsafe(super(NSObject))]
172 #[thread_kind = MainThreadOnly]
173 #[derive(Debug, PartialEq, Eq, Hash)]
174 #[deprecated = "Use UserNotifications Framework's UNNotificationCategory"]
175 pub struct UIUserNotificationCategory;
176);
177
178extern_conformance!(
179 unsafe impl NSCoding for UIUserNotificationCategory {}
180);
181
182extern_conformance!(
183 unsafe impl NSCopying for UIUserNotificationCategory {}
184);
185
186unsafe impl CopyingHelper for UIUserNotificationCategory {
187 type Result = Self;
188}
189
190extern_conformance!(
191 unsafe impl NSMutableCopying for UIUserNotificationCategory {}
192);
193
194unsafe impl MutableCopyingHelper for UIUserNotificationCategory {
195 type Result = UIMutableUserNotificationCategory;
196}
197
198extern_conformance!(
199 unsafe impl NSObjectProtocol for UIUserNotificationCategory {}
200);
201
202extern_conformance!(
203 unsafe impl NSSecureCoding for UIUserNotificationCategory {}
204);
205
206impl UIUserNotificationCategory {
207 extern_methods!(
208 #[unsafe(method(init))]
209 #[unsafe(method_family = init)]
210 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
211
212 #[unsafe(method(initWithCoder:))]
213 #[unsafe(method_family = init)]
214 pub unsafe fn initWithCoder(
215 this: Allocated<Self>,
216 coder: &NSCoder,
217 ) -> Option<Retained<Self>>;
218
219 #[unsafe(method(identifier))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn identifier(&self) -> Option<Retained<NSString>>;
222
223 #[unsafe(method(actionsForContext:))]
224 #[unsafe(method_family = none)]
225 pub unsafe fn actionsForContext(
226 &self,
227 context: UIUserNotificationActionContext,
228 ) -> Option<Retained<NSArray<UIUserNotificationAction>>>;
229 );
230}
231
232impl UIUserNotificationCategory {
234 extern_methods!(
235 #[unsafe(method(new))]
236 #[unsafe(method_family = new)]
237 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
238 );
239}
240
241extern_class!(
242 #[unsafe(super(UIUserNotificationCategory, NSObject))]
244 #[thread_kind = MainThreadOnly]
245 #[derive(Debug, PartialEq, Eq, Hash)]
246 #[deprecated = "Use UserNotifications Framework's UNNotificationCategory"]
247 pub struct UIMutableUserNotificationCategory;
248);
249
250extern_conformance!(
251 unsafe impl NSCoding for UIMutableUserNotificationCategory {}
252);
253
254extern_conformance!(
255 unsafe impl NSCopying for UIMutableUserNotificationCategory {}
256);
257
258unsafe impl CopyingHelper for UIMutableUserNotificationCategory {
259 type Result = UIUserNotificationCategory;
260}
261
262extern_conformance!(
263 unsafe impl NSMutableCopying for UIMutableUserNotificationCategory {}
264);
265
266unsafe impl MutableCopyingHelper for UIMutableUserNotificationCategory {
267 type Result = Self;
268}
269
270extern_conformance!(
271 unsafe impl NSObjectProtocol for UIMutableUserNotificationCategory {}
272);
273
274extern_conformance!(
275 unsafe impl NSSecureCoding for UIMutableUserNotificationCategory {}
276);
277
278impl UIMutableUserNotificationCategory {
279 extern_methods!(
280 #[deprecated = "Use UserNotifications Framework's UNNotificationCategory"]
281 #[unsafe(method(identifier))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn identifier(&self) -> Option<Retained<NSString>>;
284
285 #[deprecated = "Use UserNotifications Framework's UNNotificationCategory"]
287 #[unsafe(method(setIdentifier:))]
288 #[unsafe(method_family = none)]
289 pub unsafe fn setIdentifier(&self, identifier: Option<&NSString>);
290
291 #[deprecated = "Use UserNotifications Framework's UNNotificationCategory"]
292 #[unsafe(method(setActions:forContext:))]
293 #[unsafe(method_family = none)]
294 pub unsafe fn setActions_forContext(
295 &self,
296 actions: Option<&NSArray<UIUserNotificationAction>>,
297 context: UIUserNotificationActionContext,
298 );
299 );
300}
301
302impl UIMutableUserNotificationCategory {
304 extern_methods!(
305 #[unsafe(method(init))]
306 #[unsafe(method_family = init)]
307 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
308
309 #[unsafe(method(initWithCoder:))]
310 #[unsafe(method_family = init)]
311 pub unsafe fn initWithCoder(
312 this: Allocated<Self>,
313 coder: &NSCoder,
314 ) -> Option<Retained<Self>>;
315 );
316}
317
318impl UIMutableUserNotificationCategory {
320 extern_methods!(
321 #[unsafe(method(new))]
322 #[unsafe(method_family = new)]
323 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
324 );
325}
326
327extern_class!(
328 #[unsafe(super(NSObject))]
330 #[thread_kind = MainThreadOnly]
331 #[derive(Debug, PartialEq, Eq, Hash)]
332 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
333 pub struct UIUserNotificationAction;
334);
335
336extern_conformance!(
337 unsafe impl NSCoding for UIUserNotificationAction {}
338);
339
340extern_conformance!(
341 unsafe impl NSCopying for UIUserNotificationAction {}
342);
343
344unsafe impl CopyingHelper for UIUserNotificationAction {
345 type Result = Self;
346}
347
348extern_conformance!(
349 unsafe impl NSMutableCopying for UIUserNotificationAction {}
350);
351
352unsafe impl MutableCopyingHelper for UIUserNotificationAction {
353 type Result = UIMutableUserNotificationAction;
354}
355
356extern_conformance!(
357 unsafe impl NSObjectProtocol for UIUserNotificationAction {}
358);
359
360extern_conformance!(
361 unsafe impl NSSecureCoding for UIUserNotificationAction {}
362);
363
364impl UIUserNotificationAction {
365 extern_methods!(
366 #[unsafe(method(init))]
367 #[unsafe(method_family = init)]
368 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
369
370 #[unsafe(method(initWithCoder:))]
371 #[unsafe(method_family = init)]
372 pub unsafe fn initWithCoder(
373 this: Allocated<Self>,
374 coder: &NSCoder,
375 ) -> Option<Retained<Self>>;
376
377 #[unsafe(method(identifier))]
378 #[unsafe(method_family = none)]
379 pub unsafe fn identifier(&self) -> Option<Retained<NSString>>;
380
381 #[unsafe(method(title))]
382 #[unsafe(method_family = none)]
383 pub unsafe fn title(&self) -> Option<Retained<NSString>>;
384
385 #[unsafe(method(behavior))]
386 #[unsafe(method_family = none)]
387 pub unsafe fn behavior(&self) -> UIUserNotificationActionBehavior;
388
389 #[unsafe(method(parameters))]
390 #[unsafe(method_family = none)]
391 pub unsafe fn parameters(&self) -> Retained<NSDictionary>;
392
393 #[unsafe(method(activationMode))]
394 #[unsafe(method_family = none)]
395 pub unsafe fn activationMode(&self) -> UIUserNotificationActivationMode;
396
397 #[unsafe(method(isAuthenticationRequired))]
398 #[unsafe(method_family = none)]
399 pub unsafe fn isAuthenticationRequired(&self) -> bool;
400
401 #[unsafe(method(isDestructive))]
402 #[unsafe(method_family = none)]
403 pub unsafe fn isDestructive(&self) -> bool;
404 );
405}
406
407impl UIUserNotificationAction {
409 extern_methods!(
410 #[unsafe(method(new))]
411 #[unsafe(method_family = new)]
412 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
413 );
414}
415
416extern_class!(
417 #[unsafe(super(UIUserNotificationAction, NSObject))]
419 #[thread_kind = MainThreadOnly]
420 #[derive(Debug, PartialEq, Eq, Hash)]
421 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
422 pub struct UIMutableUserNotificationAction;
423);
424
425extern_conformance!(
426 unsafe impl NSCoding for UIMutableUserNotificationAction {}
427);
428
429extern_conformance!(
430 unsafe impl NSCopying for UIMutableUserNotificationAction {}
431);
432
433unsafe impl CopyingHelper for UIMutableUserNotificationAction {
434 type Result = UIUserNotificationAction;
435}
436
437extern_conformance!(
438 unsafe impl NSMutableCopying for UIMutableUserNotificationAction {}
439);
440
441unsafe impl MutableCopyingHelper for UIMutableUserNotificationAction {
442 type Result = Self;
443}
444
445extern_conformance!(
446 unsafe impl NSObjectProtocol for UIMutableUserNotificationAction {}
447);
448
449extern_conformance!(
450 unsafe impl NSSecureCoding for UIMutableUserNotificationAction {}
451);
452
453impl UIMutableUserNotificationAction {
454 extern_methods!(
455 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
456 #[unsafe(method(identifier))]
457 #[unsafe(method_family = none)]
458 pub unsafe fn identifier(&self) -> Option<Retained<NSString>>;
459
460 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
462 #[unsafe(method(setIdentifier:))]
463 #[unsafe(method_family = none)]
464 pub unsafe fn setIdentifier(&self, identifier: Option<&NSString>);
465
466 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
467 #[unsafe(method(title))]
468 #[unsafe(method_family = none)]
469 pub unsafe fn title(&self) -> Option<Retained<NSString>>;
470
471 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
473 #[unsafe(method(setTitle:))]
474 #[unsafe(method_family = none)]
475 pub unsafe fn setTitle(&self, title: Option<&NSString>);
476
477 #[unsafe(method(behavior))]
478 #[unsafe(method_family = none)]
479 pub unsafe fn behavior(&self) -> UIUserNotificationActionBehavior;
480
481 #[unsafe(method(setBehavior:))]
483 #[unsafe(method_family = none)]
484 pub unsafe fn setBehavior(&self, behavior: UIUserNotificationActionBehavior);
485
486 #[unsafe(method(parameters))]
487 #[unsafe(method_family = none)]
488 pub unsafe fn parameters(&self) -> Retained<NSDictionary>;
489
490 #[unsafe(method(setParameters:))]
492 #[unsafe(method_family = none)]
493 pub unsafe fn setParameters(&self, parameters: &NSDictionary);
494
495 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
496 #[unsafe(method(activationMode))]
497 #[unsafe(method_family = none)]
498 pub unsafe fn activationMode(&self) -> UIUserNotificationActivationMode;
499
500 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
502 #[unsafe(method(setActivationMode:))]
503 #[unsafe(method_family = none)]
504 pub unsafe fn setActivationMode(&self, activation_mode: UIUserNotificationActivationMode);
505
506 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
507 #[unsafe(method(isAuthenticationRequired))]
508 #[unsafe(method_family = none)]
509 pub unsafe fn isAuthenticationRequired(&self) -> bool;
510
511 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
513 #[unsafe(method(setAuthenticationRequired:))]
514 #[unsafe(method_family = none)]
515 pub unsafe fn setAuthenticationRequired(&self, authentication_required: bool);
516
517 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
518 #[unsafe(method(isDestructive))]
519 #[unsafe(method_family = none)]
520 pub unsafe fn isDestructive(&self) -> bool;
521
522 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
524 #[unsafe(method(setDestructive:))]
525 #[unsafe(method_family = none)]
526 pub unsafe fn setDestructive(&self, destructive: bool);
527 );
528}
529
530impl UIMutableUserNotificationAction {
532 extern_methods!(
533 #[unsafe(method(init))]
534 #[unsafe(method_family = init)]
535 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
536
537 #[unsafe(method(initWithCoder:))]
538 #[unsafe(method_family = init)]
539 pub unsafe fn initWithCoder(
540 this: Allocated<Self>,
541 coder: &NSCoder,
542 ) -> Option<Retained<Self>>;
543 );
544}
545
546impl UIMutableUserNotificationAction {
548 extern_methods!(
549 #[unsafe(method(new))]
550 #[unsafe(method_family = new)]
551 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
552 );
553}