1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// The MSMessage encapsulates the data to be transferred to remote devices.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/messages/msmessage?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MSMessage;
);
extern_conformance!(
unsafe impl NSCoding for MSMessage {}
);
extern_conformance!(
unsafe impl NSCopying for MSMessage {}
);
unsafe impl CopyingHelper for MSMessage {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MSMessage {}
);
extern_conformance!(
unsafe impl NSSecureCoding for MSMessage {}
);
impl MSMessage {
extern_methods!(
/// Initializes a new message that is not part of a session.
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "MSSession")]
/// Initializes a message with a session.
///
/// See: insertMessage:completionHandler:
///
/// Parameter `session`: The session that new message will join.
///
/// A message initialized with a session will be updated
/// and moved to the bottom of the conversation transcript when another message created
/// with the same session is sent.
#[unsafe(method(initWithSession:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithSession(this: Allocated<Self>, session: &MSSession)
-> Retained<Self>;
#[cfg(feature = "MSSession")]
/// An MSSession that identifies the session that message belongs to.
#[unsafe(method(session))]
#[unsafe(method_family = none)]
pub unsafe fn session(&self) -> Option<Retained<MSSession>>;
/// A BOOL representing whether the message is a pending message or is a message that has been sent/received.
///
/// This value starts as `YES` when creating an `MSMessage` for sending. After calling `-[MSConversation insertMessage:completionHandler:]`, `isPending` still returns `YES` until `-[MSMessagesAppViewController didStartSendingMessage:conversation]` is called. This property is useful for knowing if the `selectedMessage` of `-[MSMessagesAppViewController activeConversation]` represents an unsent message.
#[unsafe(method(isPending))]
#[unsafe(method_family = none)]
pub unsafe fn isPending(&self) -> bool;
/// A NSUUID instance that identifies the participant that sent the message.
///
/// This NSUUID identifies the message's sender. This value is scoped to
/// the current device and will be different on all devices that participate in the
/// conversation.
#[unsafe(method(senderParticipantIdentifier))]
#[unsafe(method_family = none)]
pub unsafe fn senderParticipantIdentifier(&self) -> Retained<NSUUID>;
#[cfg(feature = "MSMessageLayout")]
/// A subclass of MSMessageLayout.
///
/// The MSMessageLayout subclass will be used to construct UI
/// representing the message in the conversation transcript.
#[unsafe(method(layout))]
#[unsafe(method_family = none)]
pub unsafe fn layout(&self) -> Option<Retained<MSMessageLayout>>;
#[cfg(feature = "MSMessageLayout")]
/// Setter for [`layout`][Self::layout].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setLayout:))]
#[unsafe(method_family = none)]
pub unsafe fn setLayout(&self, layout: Option<&MSMessageLayout>);
/// A HTTP(S) or data URL used to encode data to be transferred in message.
///
/// This URL should encode any data that is to be delivered to the extension running
/// on the recipient's device(s). When no app exists on the receiving device that
/// can consume the message, if this URL is a HTTP(S) url, it will be loaded in a web browser.
#[unsafe(method(URL))]
#[unsafe(method_family = none)]
pub unsafe fn URL(&self) -> Option<Retained<NSURL>>;
/// Setter for [`URL`][Self::URL].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setURL:))]
#[unsafe(method_family = none)]
pub unsafe fn setURL(&self, url: Option<&NSURL>);
/// A Boolean value that indicates whether the messages should expire after being read.
///
/// YES if the message should expire after it is read. Expired messages will
/// be deleted a short time after being read by the receiver. The user may opt to keep the message.
/// This property defaults to NO.
#[unsafe(method(shouldExpire))]
#[unsafe(method_family = none)]
pub unsafe fn shouldExpire(&self) -> bool;
/// Setter for [`shouldExpire`][Self::shouldExpire].
#[unsafe(method(setShouldExpire:))]
#[unsafe(method_family = none)]
pub unsafe fn setShouldExpire(&self, should_expire: bool);
/// A localized string describing the message.
///
/// This string should provide a succinct description of the message. This
/// will be used by the Accessibility Speech feature when speaking the message for users
/// with disabilities.
#[unsafe(method(accessibilityLabel))]
#[unsafe(method_family = none)]
pub unsafe fn accessibilityLabel(&self) -> Option<Retained<NSString>>;
/// Setter for [`accessibilityLabel`][Self::accessibilityLabel].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setAccessibilityLabel:))]
#[unsafe(method_family = none)]
pub unsafe fn setAccessibilityLabel(&self, accessibility_label: Option<&NSString>);
/// A localized string describing the message.
///
/// This string should provide a succinct description of the message. This
/// will be used to provide a summary of the message in the UI.
#[unsafe(method(summaryText))]
#[unsafe(method_family = none)]
pub unsafe fn summaryText(&self) -> Option<Retained<NSString>>;
/// Setter for [`summaryText`][Self::summaryText].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setSummaryText:))]
#[unsafe(method_family = none)]
pub unsafe fn setSummaryText(&self, summary_text: Option<&NSString>);
/// An error object that indicates why a message failed to send.
///
/// This value is nil if the message is has not yet been sent, is still
/// sending or has been sent successfully.
#[unsafe(method(error))]
#[unsafe(method_family = none)]
pub unsafe fn error(&self) -> Option<Retained<NSError>>;
/// Setter for [`error`][Self::error].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setError:))]
#[unsafe(method_family = none)]
pub unsafe fn setError(&self, error: Option<&NSError>);
);
}
/// Methods declared on superclass `NSObject`.
impl MSMessage {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}