MEComposeSessionHandler

Trait MEComposeSessionHandler 

Source
pub unsafe trait MEComposeSessionHandler: NSObjectProtocol + MainThreadOnly {
    // Provided methods
    unsafe fn mailComposeSessionDidBegin(&self, session: &MEComposeSession)
       where Self: Sized + Message { ... }
    unsafe fn mailComposeSessionDidEnd(&self, session: &MEComposeSession)
       where Self: Sized + Message { ... }
    unsafe fn viewControllerForSession(
        &self,
        session: &MEComposeSession,
    ) -> Retained<MEExtensionViewController>
       where Self: Sized + Message { ... }
    unsafe fn session_annotateAddressesWithCompletionHandler(
        &self,
        session: &MEComposeSession,
        completion_handler: &DynBlock<dyn Fn(NonNull<NSDictionary<MEEmailAddress, MEAddressAnnotation>>)>,
    )
       where Self: Sized + Message { ... }
    unsafe fn session_canSendMessageWithCompletionHandler(
        &self,
        session: &MEComposeSession,
        completion: &DynBlock<dyn Fn(*mut NSError)>,
    )
       where Self: Sized + Message { ... }
    unsafe fn additionalHeadersForSession(
        &self,
        session: &MEComposeSession,
    ) -> Retained<NSDictionary<NSString, NSArray<NSString>>>
       where Self: Sized + Message { ... }
}
Available on crate feature MEComposeSession only.
Expand description

Methods in this protocol can be used by a mail app extension to keep track of new messages composed by the user and to make changes to the recipeint email address tokens.

See also Apple’s documentation

Provided Methods§

Source

unsafe fn mailComposeSessionDidBegin(&self, session: &MEComposeSession)
where Self: Sized + Message,

This is invoked when a new message compose window is created.

Parameter session: - MEComposeSessioninstance that is tied to the compose window that is opened.

Source

unsafe fn mailComposeSessionDidEnd(&self, session: &MEComposeSession)
where Self: Sized + Message,

This is invoked when a message compose window is closed.

Parameter session: - MEComposeSessioninstance that is tied to the compose window that was closed.

Source

unsafe fn viewControllerForSession( &self, session: &MEComposeSession, ) -> Retained<MEExtensionViewController>
where Self: Sized + Message,

Available on crate features MEExtensionViewController and objc2-app-kit only.

A view controller to be presented in Mail compose window.

Mail will call this method when user clicks on the extension’s button.

Source

unsafe fn session_annotateAddressesWithCompletionHandler( &self, session: &MEComposeSession, completion_handler: &DynBlock<dyn Fn(NonNull<NSDictionary<MEEmailAddress, MEAddressAnnotation>>)>, )
where Self: Sized + Message,

Available on crate features MEAddressAnnotation and MEEmailAddress and block2 only.

Delegate method to annotate mail addresses.

Mail will call this method based on user’s input in To, Cc or Bcc fields.

Source

unsafe fn session_canSendMessageWithCompletionHandler( &self, session: &MEComposeSession, completion: &DynBlock<dyn Fn(*mut NSError)>, )
where Self: Sized + Message,

Available on crate feature block2 only.

Validate if the message is ready to be delivered to recipients.

Mail will call this method when user clicks on the send message button. Extensions can provide an error from the MEComposeSessionErrorDomainerror domain to indicate why message validation has failed.

Source

unsafe fn additionalHeadersForSession( &self, session: &MEComposeSession, ) -> Retained<NSDictionary<NSString, NSArray<NSString>>>
where Self: Sized + Message,

Set Additional headers on outgoing mail message.

Mail will call this method to request additional headers to be set on the MEMessagethat user is composing as part of this MEComposeSession.Keys in this dictionary will be normalized to lowercase before they are set on the message.

Trait Implementations§

Source§

impl ProtocolType for dyn MEComposeSessionHandler

Source§

const NAME: &'static str = "MEComposeSessionHandler"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn MEComposeSessionHandler

Implementations on Foreign Types§

Source§

impl<T> MEComposeSessionHandler for ProtocolObject<T>

Implementors§