diff --git a/src/messageui.cs b/src/messageui.cs index 549daa86a67d..c365ba381619 100644 --- a/src/messageui.cs +++ b/src/messageui.cs @@ -22,6 +22,67 @@ enum MFMailComposeControllerDeferredAction : long { AddMissingRecipients, } + /// Represents the contents of an email draft. + [NoTV, NoMac, iOS (27, 0), MacCatalyst (27, 0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] // init leaves the non-null properties uninitialized + interface MFMailDraft { + /// Gets the sender address, or if the draft does not specify one. + [NullAllowed, Export ("from")] + string From { get; } + + /// Gets the subject. + [Export ("subject")] + string Subject { get; } + + /// Gets the attributed message body. + [Export ("body")] + NSAttributedString Body { get; } + + /// Gets the primary recipient addresses. + [Export ("to")] + string [] To { get; } + + /// Gets the carbon-copy recipient addresses. + [Export ("cc")] + string [] Cc { get; } + + /// The subject. + /// The attributed message body. + /// The sender address. + /// The primary recipient addresses. + /// The carbon-copy recipient addresses. + /// Creates an email draft with the specified contents and recipients. + [Export ("initWithSubject:body:from:to:cc:")] + NativeHandle Constructor (string subject, NSAttributedString body, string from, string [] to, string [] cc); + } + + interface IMFComposeAssistantViewControllerDelegate { } + + /// Methods for receiving email drafts from a compose assistant. + [NoTV, NoMac, iOS (27, 0), MacCatalyst (27, 0)] + [Protocol (BackwardsCompatibleCodeGeneration = false), Model] + [BaseType (typeof (NSObject))] + interface MFComposeAssistantViewControllerDelegate { + /// The compose assistant that created the draft. + /// The email draft. + /// Notifies the delegate that the compose assistant created an email draft. + [Abstract] + [Export ("composeAssistantViewController:didComposeDraft:")] + void DidComposeDraft (MFComposeAssistantViewController controller, MFMailDraft draft); + } + + /// Provides an interface for composing an email draft. + [NoTV, NoMac, iOS (27, 0), MacCatalyst (27, 0)] + [BaseType (typeof (UIViewController))] + [PrivateDefaultCtor] // init and initWithCoder: abort at runtime + interface MFComposeAssistantViewController { + /// The object that receives the composed draft. + /// Creates a compose assistant with the specified delegate. + [Export ("initWithDelegate:")] + NativeHandle Constructor (IMFComposeAssistantViewControllerDelegate @delegate); + } + /// Provides a user interface for composing and sending email messages. /// /// Apple documentation for MFMailComposeViewController diff --git a/tests/introspection/ApiCtorInitTest.cs b/tests/introspection/ApiCtorInitTest.cs index 0f6d380873e5..a0fab899b86c 100644 --- a/tests/introspection/ApiCtorInitTest.cs +++ b/tests/introspection/ApiCtorInitTest.cs @@ -498,6 +498,11 @@ protected virtual bool Match (ConstructorInfo ctor, Type type) if (ctor.ToString () == $"Void .ctor(Metal.IMTLDevice, MetalPerformanceShaders.MPSNDArrayDescriptor)") return true; break; + case "MFComposeAssistantViewController": + // The inherited UIViewController initializer aborts, and the header does not designate initWithDelegate:. + if (cstr == $"Void .ctor(System.String, Foundation.NSBundle)") + return true; + break; case "MFMailComposeViewController": // You are meant to use the system provided one case "MFMessageComposeViewController": // You are meant to use the system provided one case "GKFriendRequestComposeViewController": // You are meant to use the system provided one diff --git a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-MessageUI.todo b/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-MessageUI.todo deleted file mode 100644 index 11b02d1c8b13..000000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-MessageUI.todo +++ /dev/null @@ -1,10 +0,0 @@ -!missing-protocol! MFComposeAssistantViewControllerDelegate not bound -!missing-selector! MFComposeAssistantViewController::initWithDelegate: not bound -!missing-selector! MFMailDraft::body not bound -!missing-selector! MFMailDraft::cc not bound -!missing-selector! MFMailDraft::from not bound -!missing-selector! MFMailDraft::initWithSubject:body:from:to:cc: not bound -!missing-selector! MFMailDraft::subject not bound -!missing-selector! MFMailDraft::to not bound -!missing-type! MFComposeAssistantViewController not bound -!missing-type! MFMailDraft not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/iOS-MessageUI.todo b/tests/xtro-sharpie/api-annotations-dotnet/iOS-MessageUI.todo deleted file mode 100644 index 11b02d1c8b13..000000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/iOS-MessageUI.todo +++ /dev/null @@ -1,10 +0,0 @@ -!missing-protocol! MFComposeAssistantViewControllerDelegate not bound -!missing-selector! MFComposeAssistantViewController::initWithDelegate: not bound -!missing-selector! MFMailDraft::body not bound -!missing-selector! MFMailDraft::cc not bound -!missing-selector! MFMailDraft::from not bound -!missing-selector! MFMailDraft::initWithSubject:body:from:to:cc: not bound -!missing-selector! MFMailDraft::subject not bound -!missing-selector! MFMailDraft::to not bound -!missing-type! MFComposeAssistantViewController not bound -!missing-type! MFMailDraft not bound