From c51b064ba2ab5f672375199b37f9a52ff12ce0d8 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 28 Feb 2022 22:37:14 +0100 Subject: [PATCH] [Message[s|UI]] Add to Mac Catalyst. #13935. (#14268) Fixes https://github.com/xamarin/xamarin-macios/issues/13935. --- src/frameworks.sources | 2 + src/messages.cs | 17 +++ .../MacCatalyst-MessageUI.todo | 40 ------- .../MacCatalyst-Messages.todo | 105 ------------------ ...Messages.ignore => common-Messages.ignore} | 0 tools/common/Frameworks.cs | 3 +- 6 files changed, 20 insertions(+), 147 deletions(-) delete mode 100644 tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-MessageUI.todo delete mode 100644 tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-Messages.todo rename tests/xtro-sharpie/api-annotations-dotnet/{iOS-Messages.ignore => common-Messages.ignore} (100%) diff --git a/src/frameworks.sources b/src/frameworks.sources index 5b23ea251f..68b79bb05a 100644 --- a/src/frameworks.sources +++ b/src/frameworks.sources @@ -2299,6 +2299,8 @@ MACCATALYST_FRAMEWORKS = \ MediaAccessibility \ MediaPlayer \ MediaToolbox \ + Messages \ + MessageUI \ Metal \ MetalKit \ MetalPerformanceShaders \ diff --git a/src/messages.cs b/src/messages.cs index 5c19ddf7ee..f6c00cfd96 100644 --- a/src/messages.cs +++ b/src/messages.cs @@ -21,6 +21,7 @@ using NativeHandle = System.IntPtr; #if !MONOMAC namespace Messages { + [MacCatalyst (14,0)] [iOS (10,0)] [Native] public enum MSMessagesAppPresentationStyle : ulong @@ -30,6 +31,7 @@ namespace Messages { Transcript, } + [MacCatalyst (14,0)] [iOS (10,0)] [Native] public enum MSStickerSize : long @@ -39,6 +41,7 @@ namespace Messages { Large } + [MacCatalyst (14,0)] [Native] [ErrorDomain ("MSMessagesErrorDomain")] public enum MSMessageErrorCode : long @@ -57,6 +60,7 @@ namespace Messages { APIUnavailableInPresentationContext, } + [MacCatalyst (14,0)] [iOS (12,0)] [Native] public enum MSMessagesAppPresentationContext : long @@ -65,6 +69,7 @@ namespace Messages { Media, } + [MacCatalyst (14,0)] [iOS (11,0)] [Protocol] interface MSMessagesAppTranscriptPresentation @@ -74,6 +79,7 @@ namespace Messages { CGSize GetContentSizeThatFits (CGSize size); } + [MacCatalyst (14,0)] [iOS (10,0)] [BaseType (typeof(UIViewController))] interface MSMessagesAppViewController : MSMessagesAppTranscriptPresentation @@ -132,6 +138,7 @@ namespace Messages { MSMessagesAppPresentationContext PresentationContext { get; } } + [MacCatalyst (14,0)] [iOS (10,0)] [BaseType (typeof(NSObject))] interface MSConversation @@ -182,6 +189,7 @@ namespace Messages { void SendAttachment (NSUrl url, [NullAllowed] string filename, [NullAllowed] Action completionHandler); } + [MacCatalyst (14,0)] [iOS (10,0)] [BaseType (typeof(NSObject))] [DisableDefaultCtor] // designated @@ -224,12 +232,14 @@ namespace Messages { NSError Error { get; set; } } + [MacCatalyst (14,0)] [iOS (10,0)] [BaseType (typeof(NSObject))] [Abstract] // as per docs [DisableDefaultCtor] interface MSMessageLayout : NSCopying {} + [MacCatalyst (14,0)] [iOS (10,0)] [BaseType (typeof(MSMessageLayout))] interface MSMessageTemplateLayout @@ -259,10 +269,12 @@ namespace Messages { string ImageSubtitle { get; set; } } + [MacCatalyst (14,0)] [iOS (10,0)] [BaseType (typeof(NSObject))] interface MSSession : NSSecureCoding {} + [MacCatalyst (14,0)] [iOS (10,0)] [BaseType (typeof(NSObject))] [DisableDefaultCtor] @@ -279,6 +291,7 @@ namespace Messages { string LocalizedDescription { get; } } + [MacCatalyst (14,0)] [iOS (10,0)] [BaseType (typeof(UIView))] interface MSStickerView @@ -308,6 +321,7 @@ namespace Messages { interface IMSStickerBrowserViewDataSource { } + [MacCatalyst (14,0)] [iOS (10,0)] [Protocol, Model] [BaseType (typeof(NSObject))] @@ -322,6 +336,7 @@ namespace Messages { MSSticker GetSticker (MSStickerBrowserView stickerBrowserView, nint index); } + [MacCatalyst (14,0)] [iOS (10,0)] [BaseType (typeof(UIView))] interface MSStickerBrowserView @@ -353,6 +368,7 @@ namespace Messages { void ReloadData (); } + [MacCatalyst (14,0)] [iOS (10,0)] [BaseType (typeof(UIViewController))] interface MSStickerBrowserViewController : MSStickerBrowserViewDataSource @@ -368,6 +384,7 @@ namespace Messages { MSStickerSize StickerSize { get; } } + [MacCatalyst (14,0)] [iOS (11,0)] [BaseType (typeof(MSMessageLayout))] [DisableDefaultCtor] 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 882a55d7fb..0000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-MessageUI.todo +++ /dev/null @@ -1,40 +0,0 @@ -!missing-enum! MessageComposeResult not bound -!missing-enum! MFMailComposeErrorCode not bound -!missing-enum! MFMailComposeResult not bound -!missing-field! MFMailComposeErrorDomain not bound -!missing-field! MFMessageComposeViewControllerAttachmentAlternateFilename not bound -!missing-field! MFMessageComposeViewControllerAttachmentURL not bound -!missing-field! MFMessageComposeViewControllerTextMessageAvailabilityDidChangeNotification not bound -!missing-field! MFMessageComposeViewControllerTextMessageAvailabilityKey not bound -!missing-protocol! MFMailComposeViewControllerDelegate not bound -!missing-protocol! MFMessageComposeViewControllerDelegate not bound -!missing-selector! +MFMailComposeViewController::canSendMail not bound -!missing-selector! +MFMessageComposeViewController::canSendAttachments not bound -!missing-selector! +MFMessageComposeViewController::canSendSubject not bound -!missing-selector! +MFMessageComposeViewController::canSendText not bound -!missing-selector! +MFMessageComposeViewController::isSupportedAttachmentUTI: not bound -!missing-selector! MFMailComposeViewController::addAttachmentData:mimeType:fileName: not bound -!missing-selector! MFMailComposeViewController::mailComposeDelegate not bound -!missing-selector! MFMailComposeViewController::setBccRecipients: not bound -!missing-selector! MFMailComposeViewController::setCcRecipients: not bound -!missing-selector! MFMailComposeViewController::setMailComposeDelegate: not bound -!missing-selector! MFMailComposeViewController::setMessageBody:isHTML: not bound -!missing-selector! MFMailComposeViewController::setPreferredSendingEmailAddress: not bound -!missing-selector! MFMailComposeViewController::setSubject: not bound -!missing-selector! MFMailComposeViewController::setToRecipients: not bound -!missing-selector! MFMessageComposeViewController::addAttachmentData:typeIdentifier:filename: not bound -!missing-selector! MFMessageComposeViewController::addAttachmentURL:withAlternateFilename: not bound -!missing-selector! MFMessageComposeViewController::attachments not bound -!missing-selector! MFMessageComposeViewController::body not bound -!missing-selector! MFMessageComposeViewController::disableUserAttachments not bound -!missing-selector! MFMessageComposeViewController::message not bound -!missing-selector! MFMessageComposeViewController::messageComposeDelegate not bound -!missing-selector! MFMessageComposeViewController::recipients not bound -!missing-selector! MFMessageComposeViewController::setBody: not bound -!missing-selector! MFMessageComposeViewController::setMessage: not bound -!missing-selector! MFMessageComposeViewController::setMessageComposeDelegate: not bound -!missing-selector! MFMessageComposeViewController::setRecipients: not bound -!missing-selector! MFMessageComposeViewController::setSubject: not bound -!missing-selector! MFMessageComposeViewController::subject not bound -!missing-type! MFMailComposeViewController not bound -!missing-type! MFMessageComposeViewController not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-Messages.todo b/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-Messages.todo deleted file mode 100644 index 75d1684f00..0000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-Messages.todo +++ /dev/null @@ -1,105 +0,0 @@ -!missing-enum! MSMessageErrorCode not bound -!missing-enum! MSMessagesAppPresentationContext not bound -!missing-enum! MSMessagesAppPresentationStyle not bound -!missing-enum! MSStickerSize not bound -!missing-field! MSMessagesErrorDomain not bound -!missing-field! MSStickersErrorDomain not bound -!missing-protocol! MSMessagesAppTranscriptPresentation not bound -!missing-protocol! MSStickerBrowserViewDataSource not bound -!missing-selector! MSConversation::insertAttachment:withAlternateFilename:completionHandler: not bound -!missing-selector! MSConversation::insertMessage:completionHandler: not bound -!missing-selector! MSConversation::insertSticker:completionHandler: not bound -!missing-selector! MSConversation::insertText:completionHandler: not bound -!missing-selector! MSConversation::localParticipantIdentifier not bound -!missing-selector! MSConversation::remoteParticipantIdentifiers not bound -!missing-selector! MSConversation::selectedMessage not bound -!missing-selector! MSConversation::sendAttachment:withAlternateFilename:completionHandler: not bound -!missing-selector! MSConversation::sendMessage:completionHandler: not bound -!missing-selector! MSConversation::sendSticker:completionHandler: not bound -!missing-selector! MSConversation::sendText:completionHandler: not bound -!missing-selector! MSMessage::accessibilityLabel not bound -!missing-selector! MSMessage::error not bound -!missing-selector! MSMessage::init not bound -!missing-selector! MSMessage::initWithSession: not bound -!missing-selector! MSMessage::isPending not bound -!missing-selector! MSMessage::layout not bound -!missing-selector! MSMessage::senderParticipantIdentifier not bound -!missing-selector! MSMessage::session not bound -!missing-selector! MSMessage::setAccessibilityLabel: not bound -!missing-selector! MSMessage::setError: not bound -!missing-selector! MSMessage::setLayout: not bound -!missing-selector! MSMessage::setShouldExpire: not bound -!missing-selector! MSMessage::setSummaryText: not bound -!missing-selector! MSMessage::setURL: not bound -!missing-selector! MSMessage::shouldExpire not bound -!missing-selector! MSMessage::summaryText not bound -!missing-selector! MSMessage::URL not bound -!missing-selector! MSMessageLiveLayout::alternateLayout not bound -!missing-selector! MSMessageLiveLayout::initWithAlternateLayout: not bound -!missing-selector! MSMessagesAppViewController::activeConversation not bound -!missing-selector! MSMessagesAppViewController::didBecomeActiveWithConversation: not bound -!missing-selector! MSMessagesAppViewController::didCancelSendingMessage:conversation: not bound -!missing-selector! MSMessagesAppViewController::didReceiveMessage:conversation: not bound -!missing-selector! MSMessagesAppViewController::didResignActiveWithConversation: not bound -!missing-selector! MSMessagesAppViewController::didSelectMessage:conversation: not bound -!missing-selector! MSMessagesAppViewController::didStartSendingMessage:conversation: not bound -!missing-selector! MSMessagesAppViewController::didTransitionToPresentationStyle: not bound -!missing-selector! MSMessagesAppViewController::dismiss not bound -!missing-selector! MSMessagesAppViewController::presentationContext not bound -!missing-selector! MSMessagesAppViewController::presentationStyle not bound -!missing-selector! MSMessagesAppViewController::requestPresentationStyle: not bound -!missing-selector! MSMessagesAppViewController::willBecomeActiveWithConversation: not bound -!missing-selector! MSMessagesAppViewController::willResignActiveWithConversation: not bound -!missing-selector! MSMessagesAppViewController::willSelectMessage:conversation: not bound -!missing-selector! MSMessagesAppViewController::willTransitionToPresentationStyle: not bound -!missing-selector! MSMessageTemplateLayout::caption not bound -!missing-selector! MSMessageTemplateLayout::image not bound -!missing-selector! MSMessageTemplateLayout::imageSubtitle not bound -!missing-selector! MSMessageTemplateLayout::imageTitle not bound -!missing-selector! MSMessageTemplateLayout::mediaFileURL not bound -!missing-selector! MSMessageTemplateLayout::setCaption: not bound -!missing-selector! MSMessageTemplateLayout::setImage: not bound -!missing-selector! MSMessageTemplateLayout::setImageSubtitle: not bound -!missing-selector! MSMessageTemplateLayout::setImageTitle: not bound -!missing-selector! MSMessageTemplateLayout::setMediaFileURL: not bound -!missing-selector! MSMessageTemplateLayout::setSubcaption: not bound -!missing-selector! MSMessageTemplateLayout::setTrailingCaption: not bound -!missing-selector! MSMessageTemplateLayout::setTrailingSubcaption: not bound -!missing-selector! MSMessageTemplateLayout::subcaption not bound -!missing-selector! MSMessageTemplateLayout::trailingCaption not bound -!missing-selector! MSMessageTemplateLayout::trailingSubcaption not bound -!missing-selector! MSSticker::imageFileURL not bound -!missing-selector! MSSticker::initWithContentsOfFileURL:localizedDescription:error: not bound -!missing-selector! MSSticker::localizedDescription not bound -!missing-selector! MSStickerBrowserView::contentInset not bound -!missing-selector! MSStickerBrowserView::contentOffset not bound -!missing-selector! MSStickerBrowserView::dataSource not bound -!missing-selector! MSStickerBrowserView::initWithFrame: not bound -!missing-selector! MSStickerBrowserView::initWithFrame:stickerSize: not bound -!missing-selector! MSStickerBrowserView::reloadData not bound -!missing-selector! MSStickerBrowserView::setContentInset: not bound -!missing-selector! MSStickerBrowserView::setContentOffset: not bound -!missing-selector! MSStickerBrowserView::setContentOffset:animated: not bound -!missing-selector! MSStickerBrowserView::setDataSource: not bound -!missing-selector! MSStickerBrowserView::stickerSize not bound -!missing-selector! MSStickerBrowserViewController::initWithStickerSize: not bound -!missing-selector! MSStickerBrowserViewController::stickerBrowserView not bound -!missing-selector! MSStickerBrowserViewController::stickerSize not bound -!missing-selector! MSStickerView::animationDuration not bound -!missing-selector! MSStickerView::initWithFrame:sticker: not bound -!missing-selector! MSStickerView::isAnimating not bound -!missing-selector! MSStickerView::setSticker: not bound -!missing-selector! MSStickerView::startAnimating not bound -!missing-selector! MSStickerView::sticker not bound -!missing-selector! MSStickerView::stopAnimating not bound -!missing-type! MSConversation not bound -!missing-type! MSMessage not bound -!missing-type! MSMessageLayout not bound -!missing-type! MSMessageLiveLayout not bound -!missing-type! MSMessagesAppViewController not bound -!missing-type! MSMessageTemplateLayout not bound -!missing-type! MSSession not bound -!missing-type! MSSticker not bound -!missing-type! MSStickerBrowserView not bound -!missing-type! MSStickerBrowserViewController not bound -!missing-type! MSStickerView not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/iOS-Messages.ignore b/tests/xtro-sharpie/api-annotations-dotnet/common-Messages.ignore similarity index 100% rename from tests/xtro-sharpie/api-annotations-dotnet/iOS-Messages.ignore rename to tests/xtro-sharpie/api-annotations-dotnet/common-Messages.ignore diff --git a/tools/common/Frameworks.cs b/tools/common/Frameworks.cs index 71beef9b44..31211fb7ea 100644 --- a/tools/common/Frameworks.cs +++ b/tools/common/Frameworks.cs @@ -622,6 +622,7 @@ public class Frameworks : Dictionary // These frameworks were added to Catalyst after they were added to iOS, so we have to adjust the Versions fields case "CoreTelephony": case "HomeKit": + case "Messages": f.Version = v14_0; f.VersionAvailableInSimulator = v14_0; break; @@ -655,8 +656,6 @@ public class Frameworks : Dictionary case "iAd": #endif case "IdentityLookupUI": - case "Messages": - case "MessageUI": case "VisionKit": case "WatchConnectivity": f.Unavailable = true;