use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-messages")]
#[cfg(not(target_os = "visionos"))]
use objc2_messages::*;
#[cfg(feature = "objc2-ui-kit")]
use objc2_ui_kit::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MessageComposeResult(pub NSInteger);
impl MessageComposeResult {
#[doc(alias = "MessageComposeResultCancelled")]
pub const Cancelled: Self = Self(0);
#[doc(alias = "MessageComposeResultSent")]
pub const Sent: Self = Self(1);
#[doc(alias = "MessageComposeResultFailed")]
pub const Failed: Self = Self(2);
}
unsafe impl Encode for MessageComposeResult {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for MessageComposeResult {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern "C" {
pub static MFMessageComposeViewControllerAttachmentURL: &'static NSString;
}
extern "C" {
pub static MFMessageComposeViewControllerAttachmentAlternateFilename: &'static NSString;
}
extern "C" {
pub static MFMessageComposeViewControllerTextMessageAvailabilityDidChangeNotification:
&'static NSString;
}
extern "C" {
pub static MFMessageComposeViewControllerTextMessageAvailabilityKey: &'static NSString;
}
extern_class!(
#[unsafe(super(UINavigationController, UIViewController, UIResponder, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "objc2-ui-kit")]
pub struct MFMessageComposeViewController;
);
#[cfg(feature = "objc2-ui-kit")]
extern_conformance!(
unsafe impl NSCoding for MFMessageComposeViewController {}
);
#[cfg(feature = "objc2-ui-kit")]
extern_conformance!(
unsafe impl NSObjectProtocol for MFMessageComposeViewController {}
);
#[cfg(feature = "objc2-ui-kit")]
extern_conformance!(
unsafe impl UIAppearanceContainer for MFMessageComposeViewController {}
);
#[cfg(feature = "objc2-ui-kit")]
extern_conformance!(
unsafe impl UIContentContainer for MFMessageComposeViewController {}
);
#[cfg(feature = "objc2-ui-kit")]
extern_conformance!(
unsafe impl UIFocusEnvironment for MFMessageComposeViewController {}
);
#[cfg(feature = "objc2-ui-kit")]
extern_conformance!(
unsafe impl UIResponderStandardEditActions for MFMessageComposeViewController {}
);
#[cfg(feature = "objc2-ui-kit")]
extern_conformance!(
unsafe impl UITraitEnvironment for MFMessageComposeViewController {}
);
#[cfg(feature = "objc2-ui-kit")]
impl MFMessageComposeViewController {
extern_methods!(
#[unsafe(method(canSendText))]
#[unsafe(method_family = none)]
pub unsafe fn canSendText(mtm: MainThreadMarker) -> bool;
#[unsafe(method(canSendSubject))]
#[unsafe(method_family = none)]
pub unsafe fn canSendSubject(mtm: MainThreadMarker) -> bool;
#[unsafe(method(canSendAttachments))]
#[unsafe(method_family = none)]
pub unsafe fn canSendAttachments(mtm: MainThreadMarker) -> bool;
#[unsafe(method(isSupportedAttachmentUTI:))]
#[unsafe(method_family = none)]
pub unsafe fn isSupportedAttachmentUTI(uti: &NSString, mtm: MainThreadMarker) -> bool;
#[unsafe(method(messageComposeDelegate))]
#[unsafe(method_family = none)]
pub unsafe fn messageComposeDelegate(
&self,
) -> Option<Retained<ProtocolObject<dyn MFMessageComposeViewControllerDelegate>>>;
#[unsafe(method(setMessageComposeDelegate:))]
#[unsafe(method_family = none)]
pub unsafe fn setMessageComposeDelegate(
&self,
message_compose_delegate: Option<
&ProtocolObject<dyn MFMessageComposeViewControllerDelegate>,
>,
);
#[unsafe(method(disableUserAttachments))]
#[unsafe(method_family = none)]
pub unsafe fn disableUserAttachments(&self);
#[unsafe(method(recipients))]
#[unsafe(method_family = none)]
pub unsafe fn recipients(&self) -> Option<Retained<NSArray<NSString>>>;
#[unsafe(method(setRecipients:))]
#[unsafe(method_family = none)]
pub unsafe fn setRecipients(&self, recipients: Option<&NSArray<NSString>>);
#[unsafe(method(body))]
#[unsafe(method_family = none)]
pub unsafe fn body(&self) -> Option<Retained<NSString>>;
#[unsafe(method(setBody:))]
#[unsafe(method_family = none)]
pub unsafe fn setBody(&self, body: Option<&NSString>);
#[unsafe(method(subject))]
#[unsafe(method_family = none)]
pub unsafe fn subject(&self) -> Option<Retained<NSString>>;
#[unsafe(method(setSubject:))]
#[unsafe(method_family = none)]
pub unsafe fn setSubject(&self, subject: Option<&NSString>);
#[unsafe(method(attachments))]
#[unsafe(method_family = none)]
pub unsafe fn attachments(&self) -> Option<Retained<NSArray<NSDictionary>>>;
#[cfg(feature = "objc2-messages")]
#[cfg(not(target_os = "visionos"))]
#[unsafe(method(message))]
#[unsafe(method_family = none)]
pub unsafe fn message(&self) -> Option<Retained<MSMessage>>;
#[cfg(feature = "objc2-messages")]
#[cfg(not(target_os = "visionos"))]
#[unsafe(method(setMessage:))]
#[unsafe(method_family = none)]
pub unsafe fn setMessage(&self, message: Option<&MSMessage>);
#[unsafe(method(addAttachmentURL:withAlternateFilename:))]
#[unsafe(method_family = none)]
pub unsafe fn addAttachmentURL_withAlternateFilename(
&self,
attachment_url: &NSURL,
alternate_filename: Option<&NSString>,
) -> bool;
#[unsafe(method(addAttachmentData:typeIdentifier:filename:))]
#[unsafe(method_family = none)]
pub unsafe fn addAttachmentData_typeIdentifier_filename(
&self,
attachment_data: &NSData,
uti: &NSString,
filename: &NSString,
) -> bool;
#[unsafe(method(insertCollaborationItemProvider:))]
#[unsafe(method_family = none)]
pub unsafe fn insertCollaborationItemProvider(
&self,
item_provider: &NSItemProvider,
) -> bool;
);
}
#[cfg(feature = "objc2-ui-kit")]
impl MFMessageComposeViewController {
extern_methods!(
#[unsafe(method(initWithNavigationBarClass:toolbarClass:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithNavigationBarClass_toolbarClass(
this: Allocated<Self>,
navigation_bar_class: Option<&AnyClass>,
toolbar_class: Option<&AnyClass>,
) -> Retained<Self>;
#[unsafe(method(initWithRootViewController:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithRootViewController(
this: Allocated<Self>,
root_view_controller: &UIViewController,
) -> Retained<Self>;
#[unsafe(method(initWithNibName:bundle:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithNibName_bundle(
this: Allocated<Self>,
nib_name_or_nil: Option<&NSString>,
nib_bundle_or_nil: Option<&NSBundle>,
) -> Retained<Self>;
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
a_decoder: &NSCoder,
) -> Option<Retained<Self>>;
);
}
#[cfg(feature = "objc2-ui-kit")]
impl MFMessageComposeViewController {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
extern_protocol!(
pub unsafe trait MFMessageComposeViewControllerDelegate: NSObjectProtocol {
#[cfg(feature = "objc2-ui-kit")]
#[unsafe(method(messageComposeViewController:didFinishWithResult:))]
#[unsafe(method_family = none)]
unsafe fn messageComposeViewController_didFinishWithResult(
&self,
controller: &MFMessageComposeViewController,
result: MessageComposeResult,
);
}
);