use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UNNotificationCategoryOptions(pub NSUInteger);
bitflags::bitflags! {
impl UNNotificationCategoryOptions: NSUInteger {
#[doc(alias = "UNNotificationCategoryOptionCustomDismissAction")]
const CustomDismissAction = 1<<0;
#[doc(alias = "UNNotificationCategoryOptionAllowInCarPlay")]
const AllowInCarPlay = 1<<1;
#[doc(alias = "UNNotificationCategoryOptionHiddenPreviewsShowTitle")]
const HiddenPreviewsShowTitle = 1<<2;
#[doc(alias = "UNNotificationCategoryOptionHiddenPreviewsShowSubtitle")]
const HiddenPreviewsShowSubtitle = 1<<3;
#[doc(alias = "UNNotificationCategoryOptionAllowAnnouncement")]
#[deprecated = "Announcement option is ignored"]
const AllowAnnouncement = 1<<4;
}
}
unsafe impl Encode for UNNotificationCategoryOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for UNNotificationCategoryOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub static UNNotificationCategoryOptionNone: UNNotificationCategoryOptions =
UNNotificationCategoryOptions(0);
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UNNotificationCategory;
);
extern_conformance!(
unsafe impl NSCoding for UNNotificationCategory {}
);
extern_conformance!(
unsafe impl NSCopying for UNNotificationCategory {}
);
unsafe impl CopyingHelper for UNNotificationCategory {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for UNNotificationCategory {}
);
extern_conformance!(
unsafe impl NSSecureCoding for UNNotificationCategory {}
);
impl UNNotificationCategory {
extern_methods!(
#[unsafe(method(identifier))]
#[unsafe(method_family = none)]
pub fn identifier(&self) -> Retained<NSString>;
#[cfg(feature = "UNNotificationAction")]
#[unsafe(method(actions))]
#[unsafe(method_family = none)]
pub fn actions(&self) -> Retained<NSArray<UNNotificationAction>>;
#[unsafe(method(intentIdentifiers))]
#[unsafe(method_family = none)]
pub fn intentIdentifiers(&self) -> Retained<NSArray<NSString>>;
#[unsafe(method(options))]
#[unsafe(method_family = none)]
pub fn options(&self) -> UNNotificationCategoryOptions;
#[unsafe(method(hiddenPreviewsBodyPlaceholder))]
#[unsafe(method_family = none)]
pub fn hiddenPreviewsBodyPlaceholder(&self) -> Retained<NSString>;
#[unsafe(method(categorySummaryFormat))]
#[unsafe(method_family = none)]
pub fn categorySummaryFormat(&self) -> Retained<NSString>;
#[cfg(feature = "UNNotificationAction")]
#[unsafe(method(categoryWithIdentifier:actions:intentIdentifiers:options:))]
#[unsafe(method_family = none)]
pub fn categoryWithIdentifier_actions_intentIdentifiers_options(
identifier: &NSString,
actions: &NSArray<UNNotificationAction>,
intent_identifiers: &NSArray<NSString>,
options: UNNotificationCategoryOptions,
) -> Retained<Self>;
#[cfg(feature = "UNNotificationAction")]
#[unsafe(method(categoryWithIdentifier:actions:intentIdentifiers:hiddenPreviewsBodyPlaceholder:options:))]
#[unsafe(method_family = none)]
pub fn categoryWithIdentifier_actions_intentIdentifiers_hiddenPreviewsBodyPlaceholder_options(
identifier: &NSString,
actions: &NSArray<UNNotificationAction>,
intent_identifiers: &NSArray<NSString>,
hidden_previews_body_placeholder: &NSString,
options: UNNotificationCategoryOptions,
) -> Retained<Self>;
#[cfg(feature = "UNNotificationAction")]
#[unsafe(method(categoryWithIdentifier:actions:intentIdentifiers:hiddenPreviewsBodyPlaceholder:categorySummaryFormat:options:))]
#[unsafe(method_family = none)]
pub fn categoryWithIdentifier_actions_intentIdentifiers_hiddenPreviewsBodyPlaceholder_categorySummaryFormat_options(
identifier: &NSString,
actions: &NSArray<UNNotificationAction>,
intent_identifiers: &NSArray<NSString>,
hidden_previews_body_placeholder: Option<&NSString>,
category_summary_format: Option<&NSString>,
options: UNNotificationCategoryOptions,
) -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
impl UNNotificationCategory {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}