use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UNNotificationActionOptions(pub NSUInteger);
impl UNNotificationActionOptions {
pub const UNNotificationActionOptionAuthenticationRequired: Self = Self(1 << 0);
pub const UNNotificationActionOptionDestructive: Self = Self(1 << 1);
pub const UNNotificationActionOptionForeground: Self = Self(1 << 2);
}
unsafe impl Encode for UNNotificationActionOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for UNNotificationActionOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub static UNNotificationActionOptionNone: UNNotificationActionOptions =
UNNotificationActionOptions(0);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UNNotificationAction;
unsafe impl ClassType for UNNotificationAction {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCoding for UNNotificationAction {}
unsafe impl NSCopying for UNNotificationAction {}
unsafe impl NSObjectProtocol for UNNotificationAction {}
unsafe impl NSSecureCoding for UNNotificationAction {}
extern_methods!(
unsafe impl UNNotificationAction {
#[method_id(@__retain_semantics Other identifier)]
pub unsafe fn identifier(&self) -> Id<NSString>;
#[method_id(@__retain_semantics Other title)]
pub unsafe fn title(&self) -> Id<NSString>;
#[method(options)]
pub unsafe fn options(&self) -> UNNotificationActionOptions;
#[cfg(feature = "UNNotificationActionIcon")]
#[method_id(@__retain_semantics Other icon)]
pub unsafe fn icon(&self) -> Option<Id<UNNotificationActionIcon>>;
#[method_id(@__retain_semantics Other actionWithIdentifier:title:options:)]
pub unsafe fn actionWithIdentifier_title_options(
identifier: &NSString,
title: &NSString,
options: UNNotificationActionOptions,
) -> Id<Self>;
#[cfg(feature = "UNNotificationActionIcon")]
#[method_id(@__retain_semantics Other actionWithIdentifier:title:options:icon:)]
pub unsafe fn actionWithIdentifier_title_options_icon(
identifier: &NSString,
title: &NSString,
options: UNNotificationActionOptions,
icon: Option<&UNNotificationActionIcon>,
) -> Id<Self>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
}
);
extern_methods!(
unsafe impl UNNotificationAction {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Id<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UNTextInputNotificationAction;
unsafe impl ClassType for UNTextInputNotificationAction {
#[inherits(NSObject)]
type Super = UNNotificationAction;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCoding for UNTextInputNotificationAction {}
unsafe impl NSCopying for UNTextInputNotificationAction {}
unsafe impl NSObjectProtocol for UNTextInputNotificationAction {}
unsafe impl NSSecureCoding for UNTextInputNotificationAction {}
extern_methods!(
unsafe impl UNTextInputNotificationAction {
#[method_id(@__retain_semantics Other actionWithIdentifier:title:options:textInputButtonTitle:textInputPlaceholder:)]
pub unsafe fn actionWithIdentifier_title_options_textInputButtonTitle_textInputPlaceholder(
identifier: &NSString,
title: &NSString,
options: UNNotificationActionOptions,
text_input_button_title: &NSString,
text_input_placeholder: &NSString,
) -> Id<Self>;
#[cfg(feature = "UNNotificationActionIcon")]
#[method_id(@__retain_semantics Other actionWithIdentifier:title:options:icon:textInputButtonTitle:textInputPlaceholder:)]
pub unsafe fn actionWithIdentifier_title_options_icon_textInputButtonTitle_textInputPlaceholder(
identifier: &NSString,
title: &NSString,
options: UNNotificationActionOptions,
icon: Option<&UNNotificationActionIcon>,
text_input_button_title: &NSString,
text_input_placeholder: &NSString,
) -> Id<Self>;
#[method_id(@__retain_semantics Other textInputButtonTitle)]
pub unsafe fn textInputButtonTitle(&self) -> Id<NSString>;
#[method_id(@__retain_semantics Other textInputPlaceholder)]
pub unsafe fn textInputPlaceholder(&self) -> Id<NSString>;
}
);
extern_methods!(
unsafe impl UNTextInputNotificationAction {
#[method_id(@__retain_semantics Other actionWithIdentifier:title:options:)]
pub unsafe fn actionWithIdentifier_title_options(
identifier: &NSString,
title: &NSString,
options: UNNotificationActionOptions,
) -> Id<Self>;
#[cfg(feature = "UNNotificationActionIcon")]
#[method_id(@__retain_semantics Other actionWithIdentifier:title:options:icon:)]
pub unsafe fn actionWithIdentifier_title_options_icon(
identifier: &NSString,
title: &NSString,
options: UNNotificationActionOptions,
icon: Option<&UNNotificationActionIcon>,
) -> Id<Self>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
}
);
extern_methods!(
unsafe impl UNTextInputNotificationAction {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Id<Self>;
}
);