Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[messages] Update for Xcode 9 beta 1 & 3 #2332

Merged
merged 2 commits into from
Jul 18, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 53 additions & 2 deletions src/messages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ namespace XamCore.Messages {
public enum MSMessagesAppPresentationStyle : nuint
{
Compact,
Expanded
Expanded,
Transcript,
}

[iOS (10,0)]
Expand All @@ -38,6 +39,7 @@ public enum MSStickerSize : nint
[ErrorDomain ("MSMessagesErrorDomain")]
public enum MSMessageErrorCode : nint
{
Unknown = -1,
FileNotFound = 1,
FileUnreadable,
ImproperFileType,
Expand All @@ -46,11 +48,23 @@ public enum MSMessageErrorCode : nint
StickerFileImproperFileSize,
StickerFileImproperFileFormat,
UrlExceedsMaxSize,
SendWithoutRecentInteraction,
SendWhileNotVisible,
}

[iOS (11,0)]
[Protocol]
interface MSMessagesAppTranscriptPresentation
{
[iOS (11,0)]
[Abstract]
[Export ("contentSizeThatFits:")]
CGSize ContentSizeThatFits (CGSize size);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need a verb to begin the method name so maybe GetContentSizeThatFits

}

[iOS (10,0)]
[BaseType (typeof(UIViewController))]
interface MSMessagesAppViewController
interface MSMessagesAppViewController : MSMessagesAppTranscriptPresentation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deriving from the protocol will inline all the protocol members, which IMO is not what you want to do here.

Derive from IMSMessagesAppTranscriptPresentation instead (you'll have to add an empty interface IMSMessagesAppTranscriptPresentation {} declaration first). That will tell the generator that the class implements the protocol (and generate in managed code implement the corresponding protocol interface), without inlining the protocol members.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore this comment, I got confused with something else.

This is 👍

{
// inlined ctor
[Export ("initWithNibName:bundle:")]
Expand Down Expand Up @@ -130,6 +144,26 @@ interface MSConversation
[Export ("insertAttachment:withAlternateFilename:completionHandler:")]
[Async]
void InsertAttachment (NSUrl url, [NullAllowed] string filename, [NullAllowed] Action<NSError> completionHandler);

[iOS (11,0)]
[Export ("sendMessage:completionHandler:")]
[Async]
void SendMessage (MSMessage message, [NullAllowed] Action<NSError> completionHandler);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just name it Send

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This match the existing Insert* API so we better use the longer names.

That's also a case that could bite back, e.g. sendFoo: and sendBar: both accepting an NSString with a different meaning (but the C# signature would be identical). It's easier to add overloads when the first parameters are identical.


[iOS (11,0)]
[Export ("sendSticker:completionHandler:")]
[Async]
void SendSticker (MSSticker sticker, [NullAllowed] Action<NSError> completionHandler);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just name it Send

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fine


[iOS (11,0)]
[Export ("sendText:completionHandler:")]
[Async]
void SendText (string text, [NullAllowed] Action<NSError> completionHandler);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just name it Send

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fine


[iOS (11,0)]
[Export ("sendAttachment:withAlternateFilename:completionHandler:")]
[Async]
void SendAttachment (NSUrl url, [NullAllowed] string filename, [NullAllowed] Action<NSError> completionHandler);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just name it Send

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fine

}

[iOS (10,0)]
Expand All @@ -144,6 +178,10 @@ interface MSMessage : NSCopying, NSSecureCoding
[NullAllowed, Export ("session")]
MSSession Session { get; }

[iOS (11,0)]
[Export ("pending")]
bool Pending { [Bind ("isPending")] get; }

[Export ("senderParticipantIdentifier")]
NSUuid SenderParticipantIdentifier { get; }

Expand Down Expand Up @@ -309,5 +347,18 @@ interface MSStickerBrowserViewController : MSStickerBrowserViewDataSource
[Export ("stickerSize")]
MSStickerSize StickerSize { get; }
}

[iOS (11,0)]
[BaseType (typeof(MSMessageLayout))]
[DisableDefaultCtor]
interface MSMessageLiveLayout
{
[Export ("initWithAlternateLayout:")]
[DesignatedInitializer]
IntPtr Constructor (MSMessageTemplateLayout alternateLayout);

[Export ("alternateLayout")]
MSMessageTemplateLayout AlternateLayout { get; }
}
}
#endif // !MONOMAC
2 changes: 2 additions & 0 deletions tests/introspection/iOS/iOSApiProtocolTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ protected override bool Skip (Type type, string protocolName)
case "HMMutableLocationEvent":
case "HMTimeEvent":
case "ILMessageFilterExtensionContext": // Conformance not in headers
case "MSMessageLiveLayout":
return true;
#if __WATCHOS__
case "CLKComplicationTemplate":
Expand Down Expand Up @@ -336,6 +337,7 @@ protected override bool Skip (Type type, string protocolName)
case "NSManagedObjectModel":
case "NSPropertyDescription":
case "NSRelationshipDescription":
case "MSMessageLiveLayout":
return true;
#if __WATCHOS__
case "CLKComplicationTemplate":
Expand Down