objc2_messages/generated/
MSMessagesAppViewController.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::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9#[cfg(feature = "objc2-ui-kit")]
10use objc2_ui_kit::*;
11
12use crate::*;
13
14/// Describes how the extension is presented in Messages.
15///
16/// See also [Apple's documentation](https://developer.apple.com/documentation/messages/msmessagesapppresentationstyle?language=objc)
17// NS_ENUM
18#[repr(transparent)]
19#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
20pub struct MSMessagesAppPresentationStyle(pub NSUInteger);
21impl MSMessagesAppPresentationStyle {
22    #[doc(alias = "MSMessagesAppPresentationStyleCompact")]
23    pub const Compact: Self = Self(0);
24    #[doc(alias = "MSMessagesAppPresentationStyleExpanded")]
25    pub const Expanded: Self = Self(1);
26    #[doc(alias = "MSMessagesAppPresentationStyleTranscript")]
27    pub const Transcript: Self = Self(2);
28}
29
30unsafe impl Encode for MSMessagesAppPresentationStyle {
31    const ENCODING: Encoding = NSUInteger::ENCODING;
32}
33
34unsafe impl RefEncode for MSMessagesAppPresentationStyle {
35    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
36}
37
38/// Describes the context for which the extension was launched
39///
40/// See also [Apple's documentation](https://developer.apple.com/documentation/messages/msmessagesapppresentationcontext?language=objc)
41// NS_ENUM
42#[repr(transparent)]
43#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
44pub struct MSMessagesAppPresentationContext(pub NSUInteger);
45impl MSMessagesAppPresentationContext {
46    #[doc(alias = "MSMessagesAppPresentationContextMessages")]
47    pub const Messages: Self = Self(0);
48    #[doc(alias = "MSMessagesAppPresentationContextMedia")]
49    pub const Media: Self = Self(1);
50}
51
52unsafe impl Encode for MSMessagesAppPresentationContext {
53    const ENCODING: Encoding = NSUInteger::ENCODING;
54}
55
56unsafe impl RefEncode for MSMessagesAppPresentationContext {
57    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
58}
59
60extern_protocol!(
61    /// [Apple's documentation](https://developer.apple.com/documentation/messages/msmessagesapptranscriptpresentation?language=objc)
62    pub unsafe trait MSMessagesAppTranscriptPresentation {
63        #[cfg(feature = "objc2-core-foundation")]
64        /// The content size of the view controller's view fitting the constraining size.
65        ///
66        /// This method will only be called if the `presentationStyle` is `MSMessagesAppPresentationStyleTranscript`.
67        ///
68        /// Parameter `size`: The maximum size the view will be displayed at.
69        #[unsafe(method(contentSizeThatFits:))]
70        #[unsafe(method_family = none)]
71        unsafe fn contentSizeThatFits(&self, size: CGSize) -> CGSize;
72    }
73);
74
75extern_class!(
76    /// [Apple's documentation](https://developer.apple.com/documentation/messages/msmessagesappviewcontroller?language=objc)
77    #[unsafe(super(UIViewController, UIResponder, NSObject))]
78    #[derive(Debug, PartialEq, Eq, Hash)]
79    #[cfg(feature = "objc2-ui-kit")]
80    pub struct MSMessagesAppViewController;
81);
82
83#[cfg(feature = "objc2-ui-kit")]
84extern_conformance!(
85    unsafe impl MSMessagesAppTranscriptPresentation for MSMessagesAppViewController {}
86);
87
88#[cfg(feature = "objc2-ui-kit")]
89extern_conformance!(
90    unsafe impl NSCoding for MSMessagesAppViewController {}
91);
92
93#[cfg(feature = "objc2-ui-kit")]
94extern_conformance!(
95    unsafe impl NSObjectProtocol for MSMessagesAppViewController {}
96);
97
98#[cfg(feature = "objc2-ui-kit")]
99extern_conformance!(
100    unsafe impl UIAppearanceContainer for MSMessagesAppViewController {}
101);
102
103#[cfg(feature = "objc2-ui-kit")]
104extern_conformance!(
105    unsafe impl UIContentContainer for MSMessagesAppViewController {}
106);
107
108#[cfg(feature = "objc2-ui-kit")]
109extern_conformance!(
110    unsafe impl UIFocusEnvironment for MSMessagesAppViewController {}
111);
112
113#[cfg(feature = "objc2-ui-kit")]
114extern_conformance!(
115    unsafe impl UIResponderStandardEditActions for MSMessagesAppViewController {}
116);
117
118#[cfg(feature = "objc2-ui-kit")]
119extern_conformance!(
120    unsafe impl UITraitEnvironment for MSMessagesAppViewController {}
121);
122
123#[cfg(feature = "objc2-ui-kit")]
124impl MSMessagesAppViewController {
125    extern_methods!(
126        #[cfg(feature = "MSConversation")]
127        /// Current active conversation.
128        #[unsafe(method(activeConversation))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn activeConversation(&self) -> Option<Retained<MSConversation>>;
131
132        /// Get the presentation extension's current presentation style.
133        #[unsafe(method(presentationStyle))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn presentationStyle(&self) -> MSMessagesAppPresentationStyle;
136
137        /// The context for which the extension was launched
138        #[unsafe(method(presentationContext))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn presentationContext(&self) -> MSMessagesAppPresentationContext;
141
142        /// Requests that Messages transition the extension to the specified presentation style.
143        ///
144        /// When the current `presentationStyle` is `MSMessagesAppPresentationStyleTranscript`, a new instance of `MSMessagesAppViewController` will be instantiated with the requested presentation style if needed.
145        ///
146        /// Parameter `presentationStyle`: The presentation style to transition to. `MSMessagesAppPresentationStyleTranscript` is not a valid presentation style to request.
147        #[unsafe(method(requestPresentationStyle:))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn requestPresentationStyle(
150            &self,
151            presentation_style: MSMessagesAppPresentationStyle,
152        );
153
154        #[cfg(feature = "MSConversation")]
155        /// Called when the extension is about to become active.
156        ///
157        /// Parameter `conversation`: The current conversation.
158        #[unsafe(method(willBecomeActiveWithConversation:))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn willBecomeActiveWithConversation(&self, conversation: &MSConversation);
161
162        #[cfg(feature = "MSConversation")]
163        /// Called when the extension has become active.
164        ///
165        /// Parameter `conversation`: The current conversation.
166        #[unsafe(method(didBecomeActiveWithConversation:))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn didBecomeActiveWithConversation(&self, conversation: &MSConversation);
169
170        #[cfg(feature = "MSConversation")]
171        /// Called when the extension will resign active.
172        ///
173        /// Parameter `conversation`: The current conversation.
174        #[unsafe(method(willResignActiveWithConversation:))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn willResignActiveWithConversation(&self, conversation: &MSConversation);
177
178        #[cfg(feature = "MSConversation")]
179        /// Called when the extension has resigned active.
180        ///
181        /// Parameter `conversation`: The current conversation.
182        #[unsafe(method(didResignActiveWithConversation:))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn didResignActiveWithConversation(&self, conversation: &MSConversation);
185    );
186}
187
188/// Methods declared on superclass `UIViewController`.
189#[cfg(feature = "objc2-ui-kit")]
190impl MSMessagesAppViewController {
191    extern_methods!(
192        #[unsafe(method(initWithNibName:bundle:))]
193        #[unsafe(method_family = init)]
194        pub unsafe fn initWithNibName_bundle(
195            this: Allocated<Self>,
196            nib_name_or_nil: Option<&NSString>,
197            nib_bundle_or_nil: Option<&NSBundle>,
198        ) -> Retained<Self>;
199
200        #[unsafe(method(initWithCoder:))]
201        #[unsafe(method_family = init)]
202        pub unsafe fn initWithCoder(
203            this: Allocated<Self>,
204            coder: &NSCoder,
205        ) -> Option<Retained<Self>>;
206    );
207}
208
209/// Methods declared on superclass `NSObject`.
210#[cfg(feature = "objc2-ui-kit")]
211impl MSMessagesAppViewController {
212    extern_methods!(
213        #[unsafe(method(init))]
214        #[unsafe(method_family = init)]
215        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
216
217        #[unsafe(method(new))]
218        #[unsafe(method_family = new)]
219        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
220    );
221}
222
223/// CompactOrExpandedPresentation.
224#[cfg(feature = "objc2-ui-kit")]
225impl MSMessagesAppViewController {
226    extern_methods!(
227        /// Tells Messages to dismiss the extension and present the keyboard.
228        ///
229        /// Calling this method does nothing when the `presentationStyle` is `MSMessagesAppPresentationStyleTranscript`.
230        #[unsafe(method(dismiss))]
231        #[unsafe(method_family = none)]
232        pub unsafe fn dismiss(&self);
233
234        #[cfg(all(feature = "MSConversation", feature = "MSMessage"))]
235        /// Informs the extension that a new message will be selected in the conversation.
236        ///
237        /// This method will not be called when the `presentationStyle` is `MSMessagesAppPresentationStyleTranscript` or the `presentationContext` is `MSMessagesAppPresentationContextMedia`.
238        ///
239        /// Parameter `message`: The message selected.
240        ///
241        /// Parameter `conversation`: The conversation.
242        #[unsafe(method(willSelectMessage:conversation:))]
243        #[unsafe(method_family = none)]
244        pub unsafe fn willSelectMessage_conversation(
245            &self,
246            message: &MSMessage,
247            conversation: &MSConversation,
248        );
249
250        #[cfg(all(feature = "MSConversation", feature = "MSMessage"))]
251        /// Informs the extension that a new message has been selected in the conversation.
252        ///
253        /// This method will not be called when the `presentationStyle` is `MSMessagesAppPresentationStyleTranscript` or the `presentationContext` is `MSMessagesAppPresentationContextMedia`.
254        ///
255        /// Parameter `message`: The message selected.
256        ///
257        /// Parameter `conversation`: The conversation.
258        #[unsafe(method(didSelectMessage:conversation:))]
259        #[unsafe(method_family = none)]
260        pub unsafe fn didSelectMessage_conversation(
261            &self,
262            message: &MSMessage,
263            conversation: &MSConversation,
264        );
265
266        #[cfg(all(feature = "MSConversation", feature = "MSMessage"))]
267        /// Informs the extension that a new message has arrived.
268        ///
269        /// This method will not be called when the `presentationStyle` is `MSMessagesAppPresentationStyleTranscript` or the `presentationContext` is `MSMessagesAppPresentationContextMedia`.
270        ///
271        /// Parameter `message`: The message received.
272        ///
273        /// Parameter `conversation`: The conversation.
274        #[unsafe(method(didReceiveMessage:conversation:))]
275        #[unsafe(method_family = none)]
276        pub unsafe fn didReceiveMessage_conversation(
277            &self,
278            message: &MSMessage,
279            conversation: &MSConversation,
280        );
281
282        #[cfg(all(feature = "MSConversation", feature = "MSMessage"))]
283        /// Informs the extension that the message send has been triggered.
284        ///
285        /// This is called when a user interaction with Messages start the message send process. It does not guarantee the message will be successfully sent or delivered. This method will not be called when the `presentationStyle` is `MSMessagesAppPresentationStyleTranscript` or the `presentationContext` is `MSMessagesAppPresentationContextMedia`.
286        ///
287        /// Parameter `message`: The message being sent.
288        ///
289        /// Parameter `conversation`: The conversation the message belongs to.
290        #[unsafe(method(didStartSendingMessage:conversation:))]
291        #[unsafe(method_family = none)]
292        pub unsafe fn didStartSendingMessage_conversation(
293            &self,
294            message: &MSMessage,
295            conversation: &MSConversation,
296        );
297
298        #[cfg(all(feature = "MSConversation", feature = "MSMessage"))]
299        /// Informs the extension that the user has removed the message from the input field.
300        ///
301        /// This method will not be called when the `presentationStyle` is MSMessagesAppPresentationStyleTranscript or the `presentationContext` is `MSMessagesAppPresentationContextMedia`.
302        ///
303        /// Parameter `message`: The message sent.
304        ///
305        /// Parameter `conversation`: The conversation.
306        #[unsafe(method(didCancelSendingMessage:conversation:))]
307        #[unsafe(method_family = none)]
308        pub unsafe fn didCancelSendingMessage_conversation(
309            &self,
310            message: &MSMessage,
311            conversation: &MSConversation,
312        );
313
314        /// Called when the extension is about to transition to a new presentation style.
315        ///
316        /// This method will not be called when the `presentationStyle` is `MSMessagesAppPresentationStyleTranscript`.
317        ///
318        /// Parameter `presentationStyle`: The new presentation style.
319        #[unsafe(method(willTransitionToPresentationStyle:))]
320        #[unsafe(method_family = none)]
321        pub unsafe fn willTransitionToPresentationStyle(
322            &self,
323            presentation_style: MSMessagesAppPresentationStyle,
324        );
325
326        /// Called when the extension finished transitioning to a presentation style.
327        ///
328        /// This method will not be called when the `presentationStyle` is `MSMessagesAppPresentationStyleTranscript`.
329        ///
330        /// Parameter `presentationStyle`: The new presentation style.
331        #[unsafe(method(didTransitionToPresentationStyle:))]
332        #[unsafe(method_family = none)]
333        pub unsafe fn didTransitionToPresentationStyle(
334            &self,
335            presentation_style: MSMessagesAppPresentationStyle,
336        );
337    );
338}