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 #[deprecated = "Use UserNotifications Framework's -[UNTextInputNotificationAction textInputButtonTitle]"]
113 pub static UIUserNotificationTextInputActionButtonTitleKey: &'static NSString;
114}
115
116extern "C" {
117 #[deprecated = "Use UserNotifications Framework's -[UNTextInputNotificationResponse userText]"]
119 pub static UIUserNotificationActionResponseTypedTextKey: &'static NSString;
120}
121
122extern_class!(
123 #[unsafe(super(NSObject))]
125 #[thread_kind = MainThreadOnly]
126 #[derive(Debug, PartialEq, Eq, Hash)]
127 #[deprecated = "Use UserNotifications Framework's UNNotificationSettings"]
128 pub struct UIUserNotificationSettings;
129);
130
131extern_conformance!(
132 unsafe impl NSObjectProtocol for UIUserNotificationSettings {}
133);
134
135impl UIUserNotificationSettings {
136 extern_methods!(
137 #[deprecated = "Use UserNotifications Framework's UNNotificationSettings"]
138 #[unsafe(method(settingsForTypes:categories:))]
139 #[unsafe(method_family = none)]
140 pub fn settingsForTypes_categories(
141 types: UIUserNotificationType,
142 categories: Option<&NSSet<UIUserNotificationCategory>>,
143 mtm: MainThreadMarker,
144 ) -> Retained<Self>;
145
146 #[deprecated = "Use UserNotifications Framework's UNNotificationSettings"]
147 #[unsafe(method(types))]
148 #[unsafe(method_family = none)]
149 pub fn types(&self) -> UIUserNotificationType;
150
151 #[deprecated = "Use UserNotifications Framework's UNNotificationSettings"]
152 #[unsafe(method(categories))]
153 #[unsafe(method_family = none)]
154 pub fn categories(&self) -> Option<Retained<NSSet<UIUserNotificationCategory>>>;
155 );
156}
157
158impl UIUserNotificationSettings {
160 extern_methods!(
161 #[unsafe(method(init))]
162 #[unsafe(method_family = init)]
163 pub fn init(this: Allocated<Self>) -> Retained<Self>;
164
165 #[unsafe(method(new))]
166 #[unsafe(method_family = new)]
167 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
168 );
169}
170
171extern_class!(
172 #[unsafe(super(NSObject))]
174 #[thread_kind = MainThreadOnly]
175 #[derive(Debug, PartialEq, Eq, Hash)]
176 #[deprecated = "Use UserNotifications Framework's UNNotificationCategory"]
177 pub struct UIUserNotificationCategory;
178);
179
180extern_conformance!(
181 unsafe impl NSCoding for UIUserNotificationCategory {}
182);
183
184extern_conformance!(
185 unsafe impl NSCopying for UIUserNotificationCategory {}
186);
187
188unsafe impl CopyingHelper for UIUserNotificationCategory {
189 type Result = Self;
190}
191
192extern_conformance!(
193 unsafe impl NSMutableCopying for UIUserNotificationCategory {}
194);
195
196unsafe impl MutableCopyingHelper for UIUserNotificationCategory {
197 type Result = UIMutableUserNotificationCategory;
198}
199
200extern_conformance!(
201 unsafe impl NSObjectProtocol for UIUserNotificationCategory {}
202);
203
204extern_conformance!(
205 unsafe impl NSSecureCoding for UIUserNotificationCategory {}
206);
207
208impl UIUserNotificationCategory {
209 extern_methods!(
210 #[unsafe(method(init))]
211 #[unsafe(method_family = init)]
212 pub fn init(this: Allocated<Self>) -> Retained<Self>;
213
214 #[unsafe(method(initWithCoder:))]
218 #[unsafe(method_family = init)]
219 pub unsafe fn initWithCoder(
220 this: Allocated<Self>,
221 coder: &NSCoder,
222 ) -> Option<Retained<Self>>;
223
224 #[unsafe(method(identifier))]
225 #[unsafe(method_family = none)]
226 pub fn identifier(&self) -> Option<Retained<NSString>>;
227
228 #[unsafe(method(actionsForContext:))]
229 #[unsafe(method_family = none)]
230 pub fn actionsForContext(
231 &self,
232 context: UIUserNotificationActionContext,
233 ) -> Option<Retained<NSArray<UIUserNotificationAction>>>;
234 );
235}
236
237impl UIUserNotificationCategory {
239 extern_methods!(
240 #[unsafe(method(new))]
241 #[unsafe(method_family = new)]
242 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
243 );
244}
245
246extern_class!(
247 #[unsafe(super(UIUserNotificationCategory, NSObject))]
249 #[thread_kind = MainThreadOnly]
250 #[derive(Debug, PartialEq, Eq, Hash)]
251 #[deprecated = "Use UserNotifications Framework's UNNotificationCategory"]
252 pub struct UIMutableUserNotificationCategory;
253);
254
255extern_conformance!(
256 unsafe impl NSCoding for UIMutableUserNotificationCategory {}
257);
258
259extern_conformance!(
260 unsafe impl NSCopying for UIMutableUserNotificationCategory {}
261);
262
263unsafe impl CopyingHelper for UIMutableUserNotificationCategory {
264 type Result = UIUserNotificationCategory;
265}
266
267extern_conformance!(
268 unsafe impl NSMutableCopying for UIMutableUserNotificationCategory {}
269);
270
271unsafe impl MutableCopyingHelper for UIMutableUserNotificationCategory {
272 type Result = Self;
273}
274
275extern_conformance!(
276 unsafe impl NSObjectProtocol for UIMutableUserNotificationCategory {}
277);
278
279extern_conformance!(
280 unsafe impl NSSecureCoding for UIMutableUserNotificationCategory {}
281);
282
283impl UIMutableUserNotificationCategory {
284 extern_methods!(
285 #[deprecated = "Use UserNotifications Framework's UNNotificationCategory"]
286 #[unsafe(method(identifier))]
287 #[unsafe(method_family = none)]
288 pub fn identifier(&self) -> Option<Retained<NSString>>;
289
290 #[deprecated = "Use UserNotifications Framework's UNNotificationCategory"]
294 #[unsafe(method(setIdentifier:))]
295 #[unsafe(method_family = none)]
296 pub fn setIdentifier(&self, identifier: Option<&NSString>);
297
298 #[deprecated = "Use UserNotifications Framework's UNNotificationCategory"]
299 #[unsafe(method(setActions:forContext:))]
300 #[unsafe(method_family = none)]
301 pub fn setActions_forContext(
302 &self,
303 actions: Option<&NSArray<UIUserNotificationAction>>,
304 context: UIUserNotificationActionContext,
305 );
306 );
307}
308
309impl UIMutableUserNotificationCategory {
311 extern_methods!(
312 #[unsafe(method(init))]
313 #[unsafe(method_family = init)]
314 pub fn init(this: Allocated<Self>) -> Retained<Self>;
315
316 #[unsafe(method(initWithCoder:))]
320 #[unsafe(method_family = init)]
321 pub unsafe fn initWithCoder(
322 this: Allocated<Self>,
323 coder: &NSCoder,
324 ) -> Option<Retained<Self>>;
325 );
326}
327
328impl UIMutableUserNotificationCategory {
330 extern_methods!(
331 #[unsafe(method(new))]
332 #[unsafe(method_family = new)]
333 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
334 );
335}
336
337extern_class!(
338 #[unsafe(super(NSObject))]
340 #[thread_kind = MainThreadOnly]
341 #[derive(Debug, PartialEq, Eq, Hash)]
342 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
343 pub struct UIUserNotificationAction;
344);
345
346extern_conformance!(
347 unsafe impl NSCoding for UIUserNotificationAction {}
348);
349
350extern_conformance!(
351 unsafe impl NSCopying for UIUserNotificationAction {}
352);
353
354unsafe impl CopyingHelper for UIUserNotificationAction {
355 type Result = Self;
356}
357
358extern_conformance!(
359 unsafe impl NSMutableCopying for UIUserNotificationAction {}
360);
361
362unsafe impl MutableCopyingHelper for UIUserNotificationAction {
363 type Result = UIMutableUserNotificationAction;
364}
365
366extern_conformance!(
367 unsafe impl NSObjectProtocol for UIUserNotificationAction {}
368);
369
370extern_conformance!(
371 unsafe impl NSSecureCoding for UIUserNotificationAction {}
372);
373
374impl UIUserNotificationAction {
375 extern_methods!(
376 #[unsafe(method(init))]
377 #[unsafe(method_family = init)]
378 pub fn init(this: Allocated<Self>) -> Retained<Self>;
379
380 #[unsafe(method(initWithCoder:))]
384 #[unsafe(method_family = init)]
385 pub unsafe fn initWithCoder(
386 this: Allocated<Self>,
387 coder: &NSCoder,
388 ) -> Option<Retained<Self>>;
389
390 #[unsafe(method(identifier))]
391 #[unsafe(method_family = none)]
392 pub fn identifier(&self) -> Option<Retained<NSString>>;
393
394 #[unsafe(method(title))]
395 #[unsafe(method_family = none)]
396 pub fn title(&self) -> Option<Retained<NSString>>;
397
398 #[unsafe(method(behavior))]
399 #[unsafe(method_family = none)]
400 pub fn behavior(&self) -> UIUserNotificationActionBehavior;
401
402 #[unsafe(method(parameters))]
403 #[unsafe(method_family = none)]
404 pub fn parameters(&self) -> Retained<NSDictionary>;
405
406 #[unsafe(method(activationMode))]
407 #[unsafe(method_family = none)]
408 pub fn activationMode(&self) -> UIUserNotificationActivationMode;
409
410 #[unsafe(method(isAuthenticationRequired))]
411 #[unsafe(method_family = none)]
412 pub fn isAuthenticationRequired(&self) -> bool;
413
414 #[unsafe(method(isDestructive))]
415 #[unsafe(method_family = none)]
416 pub fn isDestructive(&self) -> bool;
417 );
418}
419
420impl UIUserNotificationAction {
422 extern_methods!(
423 #[unsafe(method(new))]
424 #[unsafe(method_family = new)]
425 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
426 );
427}
428
429extern_class!(
430 #[unsafe(super(UIUserNotificationAction, NSObject))]
432 #[thread_kind = MainThreadOnly]
433 #[derive(Debug, PartialEq, Eq, Hash)]
434 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
435 pub struct UIMutableUserNotificationAction;
436);
437
438extern_conformance!(
439 unsafe impl NSCoding for UIMutableUserNotificationAction {}
440);
441
442extern_conformance!(
443 unsafe impl NSCopying for UIMutableUserNotificationAction {}
444);
445
446unsafe impl CopyingHelper for UIMutableUserNotificationAction {
447 type Result = UIUserNotificationAction;
448}
449
450extern_conformance!(
451 unsafe impl NSMutableCopying for UIMutableUserNotificationAction {}
452);
453
454unsafe impl MutableCopyingHelper for UIMutableUserNotificationAction {
455 type Result = Self;
456}
457
458extern_conformance!(
459 unsafe impl NSObjectProtocol for UIMutableUserNotificationAction {}
460);
461
462extern_conformance!(
463 unsafe impl NSSecureCoding for UIMutableUserNotificationAction {}
464);
465
466impl UIMutableUserNotificationAction {
467 extern_methods!(
468 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
469 #[unsafe(method(identifier))]
470 #[unsafe(method_family = none)]
471 pub fn identifier(&self) -> Option<Retained<NSString>>;
472
473 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
477 #[unsafe(method(setIdentifier:))]
478 #[unsafe(method_family = none)]
479 pub fn setIdentifier(&self, identifier: Option<&NSString>);
480
481 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
482 #[unsafe(method(title))]
483 #[unsafe(method_family = none)]
484 pub fn title(&self) -> Option<Retained<NSString>>;
485
486 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
490 #[unsafe(method(setTitle:))]
491 #[unsafe(method_family = none)]
492 pub fn setTitle(&self, title: Option<&NSString>);
493
494 #[unsafe(method(behavior))]
495 #[unsafe(method_family = none)]
496 pub fn behavior(&self) -> UIUserNotificationActionBehavior;
497
498 #[unsafe(method(setBehavior:))]
500 #[unsafe(method_family = none)]
501 pub fn setBehavior(&self, behavior: UIUserNotificationActionBehavior);
502
503 #[unsafe(method(parameters))]
504 #[unsafe(method_family = none)]
505 pub fn parameters(&self) -> Retained<NSDictionary>;
506
507 #[unsafe(method(setParameters:))]
515 #[unsafe(method_family = none)]
516 pub unsafe fn setParameters(&self, parameters: &NSDictionary);
517
518 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
519 #[unsafe(method(activationMode))]
520 #[unsafe(method_family = none)]
521 pub fn activationMode(&self) -> UIUserNotificationActivationMode;
522
523 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
525 #[unsafe(method(setActivationMode:))]
526 #[unsafe(method_family = none)]
527 pub fn setActivationMode(&self, activation_mode: UIUserNotificationActivationMode);
528
529 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
530 #[unsafe(method(isAuthenticationRequired))]
531 #[unsafe(method_family = none)]
532 pub fn isAuthenticationRequired(&self) -> bool;
533
534 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
536 #[unsafe(method(setAuthenticationRequired:))]
537 #[unsafe(method_family = none)]
538 pub fn setAuthenticationRequired(&self, authentication_required: bool);
539
540 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
541 #[unsafe(method(isDestructive))]
542 #[unsafe(method_family = none)]
543 pub fn isDestructive(&self) -> bool;
544
545 #[deprecated = "Use UserNotifications Framework's UNNotificationAction"]
547 #[unsafe(method(setDestructive:))]
548 #[unsafe(method_family = none)]
549 pub fn setDestructive(&self, destructive: bool);
550 );
551}
552
553impl UIMutableUserNotificationAction {
555 extern_methods!(
556 #[unsafe(method(init))]
557 #[unsafe(method_family = init)]
558 pub fn init(this: Allocated<Self>) -> Retained<Self>;
559
560 #[unsafe(method(initWithCoder:))]
564 #[unsafe(method_family = init)]
565 pub unsafe fn initWithCoder(
566 this: Allocated<Self>,
567 coder: &NSCoder,
568 ) -> Option<Retained<Self>>;
569 );
570}
571
572impl UIMutableUserNotificationAction {
574 extern_methods!(
575 #[unsafe(method(new))]
576 #[unsafe(method_family = new)]
577 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
578 );
579}