objc2_mail_kit/generated/
MEMessageSecurityHandler.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern "C" {
11    /// Error domain and codes for extensions to report errors before message is delivered.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/mailkit/memessagesecurityerrordomain?language=objc)
14    pub static MEMessageSecurityErrorDomain: &'static NSErrorDomain;
15}
16
17/// [Apple's documentation](https://developer.apple.com/documentation/mailkit/memessagesecurityerrorcode?language=objc)
18// NS_ERROR_ENUM
19#[repr(transparent)]
20#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
21pub struct MEMessageSecurityErrorCode(pub NSInteger);
22impl MEMessageSecurityErrorCode {
23    #[doc(alias = "MEMessageSecurityEncodingError")]
24    pub const EncodingError: Self = Self(0);
25    #[doc(alias = "MEMessageSecurityDecodingError")]
26    pub const DecodingError: Self = Self(1);
27}
28
29unsafe impl Encode for MEMessageSecurityErrorCode {
30    const ENCODING: Encoding = NSInteger::ENCODING;
31}
32
33unsafe impl RefEncode for MEMessageSecurityErrorCode {
34    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
35}
36
37extern_protocol!(
38    /// [Apple's documentation](https://developer.apple.com/documentation/mailkit/memessagesecurityhandler?language=objc)
39    #[cfg(all(feature = "MEMessageDecoder", feature = "MEMessageEncoder"))]
40    pub unsafe trait MEMessageSecurityHandler:
41        MEMessageEncoder + MEMessageDecoder + MainThreadOnly
42    {
43        #[cfg(all(
44            feature = "MEExtensionViewController",
45            feature = "MEMessageSigner",
46            feature = "objc2-app-kit"
47        ))]
48        /// Invoked by Mail to request a subclass of
49        /// `MEExtensionViewController.`Extensions can maintain any additional state in their subclasses and associate it with
50        /// `messsageComposeSession`instance.
51        #[unsafe(method(extensionViewControllerForMessageSigners:))]
52        #[unsafe(method_family = none)]
53        unsafe fn extensionViewControllerForMessageSigners(
54            &self,
55            message_signers: &NSArray<MEMessageSigner>,
56        ) -> Option<Retained<MEExtensionViewController>>;
57
58        #[cfg(all(feature = "MEExtensionViewController", feature = "objc2-app-kit"))]
59        /// Invoked by Mail to request a subclass of
60        /// `MEExtensionViewController`when the user clicks a banner or on the extensions icon in the message header view.
61        #[unsafe(method(extensionViewControllerForMessageContext:))]
62        #[unsafe(method_family = none)]
63        unsafe fn extensionViewControllerForMessageContext(
64            &self,
65            context: &NSData,
66        ) -> Option<Retained<MEExtensionViewController>>;
67
68        #[cfg(all(
69            feature = "MEExtensionViewController",
70            feature = "block2",
71            feature = "objc2-app-kit"
72        ))]
73        /// Invoked when the primary action for the message banner is clicked. The extension can provide an optional view controller to render any additional information.
74        #[unsafe(method(primaryActionClickedForMessageContext:completionHandler:))]
75        #[unsafe(method_family = none)]
76        unsafe fn primaryActionClickedForMessageContext_completionHandler(
77            &self,
78            context: &NSData,
79            completion_handler: &block2::DynBlock<dyn Fn(*mut MEExtensionViewController)>,
80        );
81    }
82);