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        #[cfg(feature = "objc2-ui-kit")]
74        /// Override to provide a message tint color, e.g. to match the content of the message, or your app's brand color.
75        ///
76        /// This color will be drawn either in a material or as a solid color, depending on transcript context. The default value is nil, which renders the plugin balloon with the system standard background color. This must be a simple RGB color - other color types such as displayP3 or pattern images are not supported. This also does not support dynamic colors. If your color needs to be dynamic, you must call `invalidateMessageTintColor` when the dynamic conditions change.
77        #[unsafe(method(messageTintColor))]
78        #[unsafe(method_family = none)]
79        unsafe fn messageTintColor(&self) -> Option<Retained<UIColor>>;
80
81        #[cfg(feature = "objc2-core-foundation")]
82        /// The corner radius of the message when presented in the transcript. Use this value to create concentric rounded subviews inside your view. Use continuous corners (kCACornerCurveContinuous) on your view.
83        ///
84        /// This property varies with dynamic type size. Use trait collection registration to trigger an updated layout when dynamic type size changes. To avoid the edges of the transcript view, use `layoutMargins`. This value is only valid when `presentationStyle` is `MSMessagesAppPresentationStyleTranscript`.
85        #[unsafe(method(messageCornerRadius))]
86        #[unsafe(method_family = none)]
87        unsafe fn messageCornerRadius(&self) -> CGFloat;
88
89        /// Call this when `messageTintColor` changes, e.g. due to change in app state or trait collection.
90        ///
91        /// The message will be updated to reflect the new color. This method will only work if the `presentationStyle` is `MSMessagesAppPresentationStyleTranscript`.
92        #[unsafe(method(invalidateMessageTintColor))]
93        #[unsafe(method_family = none)]
94        unsafe fn invalidateMessageTintColor(&self);
95    }
96);
97
98extern_class!(
99    /// [Apple's documentation](https://developer.apple.com/documentation/messages/msmessagesappviewcontroller?language=objc)
100    #[unsafe(super(UIViewController, UIResponder, NSObject))]
101    #[derive(Debug, PartialEq, Eq, Hash)]
102    #[cfg(feature = "objc2-ui-kit")]
103    pub struct MSMessagesAppViewController;
104);
105
106#[cfg(feature = "objc2-ui-kit")]
107extern_conformance!(
108    unsafe impl MSMessagesAppTranscriptPresentation for MSMessagesAppViewController {}
109);
110
111#[cfg(feature = "objc2-ui-kit")]
112extern_conformance!(
113    unsafe impl NSCoding for MSMessagesAppViewController {}
114);
115
116#[cfg(feature = "objc2-ui-kit")]
117extern_conformance!(
118    unsafe impl NSObjectProtocol for MSMessagesAppViewController {}
119);
120
121#[cfg(feature = "objc2-ui-kit")]
122extern_conformance!(
123    unsafe impl UIAppearanceContainer for MSMessagesAppViewController {}
124);
125
126#[cfg(feature = "objc2-ui-kit")]
127extern_conformance!(
128    unsafe impl UIContentContainer for MSMessagesAppViewController {}
129);
130
131#[cfg(feature = "objc2-ui-kit")]
132extern_conformance!(
133    unsafe impl UIFocusEnvironment for MSMessagesAppViewController {}
134);
135
136#[cfg(feature = "objc2-ui-kit")]
137extern_conformance!(
138    unsafe impl UIResponderStandardEditActions for MSMessagesAppViewController {}
139);
140
141#[cfg(feature = "objc2-ui-kit")]
142extern_conformance!(
143    unsafe impl UITraitEnvironment for MSMessagesAppViewController {}
144);
145
146#[cfg(feature = "objc2-ui-kit")]
147impl MSMessagesAppViewController {
148    extern_methods!(
149        #[cfg(feature = "MSConversation")]
150        /// Current active conversation.
151        #[unsafe(method(activeConversation))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn activeConversation(&self) -> Option<Retained<MSConversation>>;
154
155        /// Get the presentation extension's current presentation style.
156        #[unsafe(method(presentationStyle))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn presentationStyle(&self) -> MSMessagesAppPresentationStyle;
159
160        /// The context for which the extension was launched
161        #[unsafe(method(presentationContext))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn presentationContext(&self) -> MSMessagesAppPresentationContext;
164
165        /// Requests that Messages transition the extension to the specified presentation style.
166        ///
167        /// When the current `presentationStyle` is `MSMessagesAppPresentationStyleTranscript`, a new instance of `MSMessagesAppViewController` will be instantiated with the requested presentation style if needed.
168        ///
169        /// Parameter `presentationStyle`: The presentation style to transition to. `MSMessagesAppPresentationStyleTranscript` is not a valid presentation style to request.
170        #[unsafe(method(requestPresentationStyle:))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn requestPresentationStyle(
173            &self,
174            presentation_style: MSMessagesAppPresentationStyle,
175        );
176
177        #[cfg(feature = "MSConversation")]
178        /// Called when the extension is about to become active.
179        ///
180        /// Parameter `conversation`: The current conversation.
181        #[unsafe(method(willBecomeActiveWithConversation:))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn willBecomeActiveWithConversation(&self, conversation: &MSConversation);
184
185        #[cfg(feature = "MSConversation")]
186        /// Called when the extension has become active.
187        ///
188        /// Parameter `conversation`: The current conversation.
189        #[unsafe(method(didBecomeActiveWithConversation:))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn didBecomeActiveWithConversation(&self, conversation: &MSConversation);
192
193        #[cfg(feature = "MSConversation")]
194        /// Called when the extension will resign active.
195        ///
196        /// Parameter `conversation`: The current conversation.
197        #[unsafe(method(willResignActiveWithConversation:))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn willResignActiveWithConversation(&self, conversation: &MSConversation);
200
201        #[cfg(feature = "MSConversation")]
202        /// Called when the extension has resigned active.
203        ///
204        /// Parameter `conversation`: The current conversation.
205        #[unsafe(method(didResignActiveWithConversation:))]
206        #[unsafe(method_family = none)]
207        pub unsafe fn didResignActiveWithConversation(&self, conversation: &MSConversation);
208    );
209}
210
211/// Methods declared on superclass `UIViewController`.
212#[cfg(feature = "objc2-ui-kit")]
213impl MSMessagesAppViewController {
214    extern_methods!(
215        #[unsafe(method(initWithNibName:bundle:))]
216        #[unsafe(method_family = init)]
217        pub unsafe fn initWithNibName_bundle(
218            this: Allocated<Self>,
219            nib_name_or_nil: Option<&NSString>,
220            nib_bundle_or_nil: Option<&NSBundle>,
221        ) -> Retained<Self>;
222
223        /// # Safety
224        ///
225        /// `coder` possibly has further requirements.
226        #[unsafe(method(initWithCoder:))]
227        #[unsafe(method_family = init)]
228        pub unsafe fn initWithCoder(
229            this: Allocated<Self>,
230            coder: &NSCoder,
231        ) -> Option<Retained<Self>>;
232    );
233}
234
235/// Methods declared on superclass `NSObject`.
236#[cfg(feature = "objc2-ui-kit")]
237impl MSMessagesAppViewController {
238    extern_methods!(
239        #[unsafe(method(init))]
240        #[unsafe(method_family = init)]
241        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
242
243        #[unsafe(method(new))]
244        #[unsafe(method_family = new)]
245        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
246    );
247}
248
249/// CompactOrExpandedPresentation.
250#[cfg(feature = "objc2-ui-kit")]
251impl MSMessagesAppViewController {
252    extern_methods!(
253        /// Tells Messages to dismiss the extension and present the keyboard.
254        ///
255        /// Calling this method does nothing when the `presentationStyle` is `MSMessagesAppPresentationStyleTranscript`.
256        #[unsafe(method(dismiss))]
257        #[unsafe(method_family = none)]
258        pub unsafe fn dismiss(&self);
259
260        #[cfg(all(feature = "MSConversation", feature = "MSMessage"))]
261        /// Informs the extension that a new message will be selected in the conversation.
262        ///
263        /// This method will not be called when the `presentationStyle` is `MSMessagesAppPresentationStyleTranscript` or the `presentationContext` is `MSMessagesAppPresentationContextMedia`.
264        ///
265        /// Parameter `message`: The message selected.
266        ///
267        /// Parameter `conversation`: The conversation.
268        #[unsafe(method(willSelectMessage:conversation:))]
269        #[unsafe(method_family = none)]
270        pub unsafe fn willSelectMessage_conversation(
271            &self,
272            message: &MSMessage,
273            conversation: &MSConversation,
274        );
275
276        #[cfg(all(feature = "MSConversation", feature = "MSMessage"))]
277        /// Informs the extension that a new message has been selected in the conversation.
278        ///
279        /// This method will not be called when the `presentationStyle` is `MSMessagesAppPresentationStyleTranscript` or the `presentationContext` is `MSMessagesAppPresentationContextMedia`.
280        ///
281        /// Parameter `message`: The message selected.
282        ///
283        /// Parameter `conversation`: The conversation.
284        #[unsafe(method(didSelectMessage:conversation:))]
285        #[unsafe(method_family = none)]
286        pub unsafe fn didSelectMessage_conversation(
287            &self,
288            message: &MSMessage,
289            conversation: &MSConversation,
290        );
291
292        #[cfg(all(feature = "MSConversation", feature = "MSMessage"))]
293        /// Informs the extension that a new message has arrived.
294        ///
295        /// This method will not be called when the `presentationStyle` is `MSMessagesAppPresentationStyleTranscript` or the `presentationContext` is `MSMessagesAppPresentationContextMedia`.
296        ///
297        /// Parameter `message`: The message received.
298        ///
299        /// Parameter `conversation`: The conversation.
300        #[unsafe(method(didReceiveMessage:conversation:))]
301        #[unsafe(method_family = none)]
302        pub unsafe fn didReceiveMessage_conversation(
303            &self,
304            message: &MSMessage,
305            conversation: &MSConversation,
306        );
307
308        #[cfg(all(feature = "MSConversation", feature = "MSMessage"))]
309        /// Informs the extension that the message send has been triggered.
310        ///
311        /// 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`.
312        ///
313        /// Parameter `message`: The message being sent.
314        ///
315        /// Parameter `conversation`: The conversation the message belongs to.
316        #[unsafe(method(didStartSendingMessage:conversation:))]
317        #[unsafe(method_family = none)]
318        pub unsafe fn didStartSendingMessage_conversation(
319            &self,
320            message: &MSMessage,
321            conversation: &MSConversation,
322        );
323
324        #[cfg(all(feature = "MSConversation", feature = "MSMessage"))]
325        /// Informs the extension that the user has removed the message from the input field.
326        ///
327        /// This method will not be called when the `presentationStyle` is MSMessagesAppPresentationStyleTranscript or the `presentationContext` is `MSMessagesAppPresentationContextMedia`.
328        ///
329        /// Parameter `message`: The message sent.
330        ///
331        /// Parameter `conversation`: The conversation.
332        #[unsafe(method(didCancelSendingMessage:conversation:))]
333        #[unsafe(method_family = none)]
334        pub unsafe fn didCancelSendingMessage_conversation(
335            &self,
336            message: &MSMessage,
337            conversation: &MSConversation,
338        );
339
340        /// Called when the extension is about to transition to a new presentation style.
341        ///
342        /// This method will not be called when the `presentationStyle` is `MSMessagesAppPresentationStyleTranscript`.
343        ///
344        /// Parameter `presentationStyle`: The new presentation style.
345        #[unsafe(method(willTransitionToPresentationStyle:))]
346        #[unsafe(method_family = none)]
347        pub unsafe fn willTransitionToPresentationStyle(
348            &self,
349            presentation_style: MSMessagesAppPresentationStyle,
350        );
351
352        /// Called when the extension finished transitioning to a presentation style.
353        ///
354        /// This method will not be called when the `presentationStyle` is `MSMessagesAppPresentationStyleTranscript`.
355        ///
356        /// Parameter `presentationStyle`: The new presentation style.
357        #[unsafe(method(didTransitionToPresentationStyle:))]
358        #[unsafe(method_family = none)]
359        pub unsafe fn didTransitionToPresentationStyle(
360            &self,
361            presentation_style: MSMessagesAppPresentationStyle,
362        );
363    );
364}