Skip to content

Commit

Permalink
Merge pull request #12337 from rachelkang/xcode13.0-quicklook-b1-b2-b…
Browse files Browse the repository at this point in the history
…3-b4

[QuickLook] Update bindings for Xcode 13.0 beta 1,2,3,4
  • Loading branch information
rachelkang authored Aug 6, 2021
2 parents 22ccf2e + 75ac7eb commit e45969f
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 46 deletions.
6 changes: 5 additions & 1 deletion src/generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1727,7 +1727,11 @@ public TrampolineInfo MakeTrampoline (Type t)
convert.Append ($"var {refname} = Runtime.GetINativeObject<{RenderType (nt)}> ({safe_name}, false);");
pars.Append ($"ref IntPtr {safe_name}");
postConvert.Append ($"{safe_name} = {refname} is null ? IntPtr.Zero : {refname}.Handle;");
invoke.Append ($"ref {refname}");
if (pi.IsOut)
invoke.Append ("out ");
else
invoke.Append ("ref ");
invoke.Append (refname);
continue;
}
} else if (IsNativeEnum (pi.ParameterType)) {
Expand Down
88 changes: 88 additions & 0 deletions src/quicklook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#endif
using System;
using System.ComponentModel;
using UniformTypeIdentifiers;

namespace QuickLook {
#if !MONOMAC
Expand Down Expand Up @@ -170,6 +171,89 @@ interface QLPreviewItem {
#endif
}

delegate bool QLPreviewReplyDrawingHandler (CGContext context, QLPreviewReply reply, out NSError error);
delegate NSData QLPreviewReplyDataCreationHandler (QLPreviewReply reply, out NSError error);
delegate CGPDFDocument QLPreviewReplyUIDocumentCreationHandler (QLPreviewReply reply, out NSError error);

[NoWatch, NoTV, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[BaseType (typeof(NSObject))]
interface QLPreviewReply
{
[Export ("stringEncoding")]
nuint StringEncoding { get; set; }

[Export ("attachments", ArgumentSemantic.Copy)]
NSDictionary<NSString, QLPreviewReplyAttachment> Attachments { get; set; }

[Export ("title")]
string Title { get; set; }

[Export ("initWithContextSize:isBitmap:drawingBlock:")]
IntPtr Constructor (CGSize contextSize, bool isBitmap, QLPreviewReplyDrawingHandler drawingHandler);

[Export ("initWithFileURL:")]
IntPtr Constructor (NSUrl fileUrl);

[Export ("initWithDataOfContentType:contentSize:dataCreationBlock:")]
IntPtr Constructor (UTType contentType, CGSize contentSize, QLPreviewReplyDataCreationHandler dataCreationHandler);

// QLPreviewReply_UI
[Export ("initForPDFWithPageSize:documentCreationBlock:")]
IntPtr Constructor (CGSize defaultPageSize, QLPreviewReplyUIDocumentCreationHandler documentCreationHandler);
}

[NoWatch, NoTV, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[BaseType (typeof(NSObject))]
interface QLPreviewReplyAttachment
{
[Export ("data")]
NSData Data { get; }

[Export ("contentType")]
UTType ContentType { get; }

[Export ("initWithData:contentType:")]
IntPtr Constructor (NSData data, UTType contentType);
}

[NoWatch, NoTV, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[BaseType (typeof(NSObject))]
interface QLFilePreviewRequest
{
[Export ("fileURL")]
NSUrl FileUrl { get; }
}

[NoWatch, NoTV, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[DisableDefaultCtor]
[BaseType (typeof(NSObject))]
interface QLPreviewProvider : NSExtensionRequestHandling
{
}

[NoWatch][NoTV][NoMac] // availability not mentioned in the header files
[iOS (15,0), MacCatalyst (15,0)]
[BaseType (typeof(NSObject))]
interface QLPreviewSceneOptions
{
[Export ("initialPreviewIndex")]
nint InitialPreviewIndex { get; set; }
}

// TODO: BaseType UIWindowSceneActivationConfiguration must first be implemented in UIKit
// [iOS (15,0), MacCatalyst (15,0)]
// [BaseType (typeof(UIWindowSceneActivationConfiguration))]
// interface QLPreviewSceneActivationConfiguration
// {
// [Export ("initWithItemsAtURLs:options:")]
// [DesignatedInitializer]
// IntPtr Constructor (NSUrl[] urls, [NullAllowed] QLPreviewSceneOptions options);

// [Export ("initWithUserActivity:")]
// [DesignatedInitializer]
// IntPtr Constructor (NSUserActivity userActivity);
// }

[iOS (11,0)]
[Protocol]
interface QLPreviewingController {
Expand All @@ -178,6 +262,10 @@ interface QLPreviewingController {

[Export ("preparePreviewOfFileAtURL:completionHandler:")]
void PreparePreviewOfFile (NSUrl url, Action<NSError> handler);

[iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[Export ("providePreviewForFileRequest:completionHandler:")]
void ProvidePreview (QLFilePreviewRequest request, Action<QLPreviewReply, NSError> handler);
}
#else
[Static]
Expand Down
4 changes: 4 additions & 0 deletions tests/introspection/iOS/iOSApiProtocolTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,8 @@ protected override bool Skip (Type type, string protocolName)
case "NSMergePolicy":
case "SFSafariViewControllerPrewarmingToken": // conformance not in headers
case "SRTextInputSession": // conformance not in headers
case "QLPreviewReply": // conformance not in headers
case "QLPreviewReplyAttachment": // conformance not in headers
return true;
}
break;
Expand Down Expand Up @@ -685,6 +687,8 @@ protected override bool Skip (Type type, string protocolName)
case "NSMergePolicy":
case "SFSafariViewControllerPrewarmingToken": // conformance not in headers
case "SRTextInputSession": // conformance not in headers
case "QLPreviewReply": // conformance not in headers
case "QLPreviewReplyAttachment": // conformance not in headers
return true;
}
break;
Expand Down
23 changes: 0 additions & 23 deletions tests/xtro-sharpie/MacCatalyst-QuickLook.todo
Original file line number Diff line number Diff line change
@@ -1,27 +1,4 @@
!extra-null-allowed! 'CoreGraphics.CGRect QuickLook.QLPreviewControllerDelegate::FrameForPreviewItem(QuickLook.QLPreviewController,QuickLook.IQLPreviewItem,UIKit.UIView&)' has a extraneous [NullAllowed] on parameter #2
!incorrect-protocol-member! QLPreviewItem::previewItemTitle is OPTIONAL and should NOT be abstract
## appended from unclassified file
!missing-protocol-member! QLPreviewingController::providePreviewForFileRequest:completionHandler: not found
!missing-selector! QLFilePreviewRequest::fileURL not bound
!missing-selector! QLPreviewReply::attachments not bound
!missing-selector! QLPreviewReply::initForPDFWithPageSize:documentCreationBlock: not bound
!missing-selector! QLPreviewReply::initWithContextSize:isBitmap:drawingBlock: not bound
!missing-selector! QLPreviewReply::initWithDataOfContentType:contentSize:dataCreationBlock: not bound
!missing-selector! QLPreviewReply::initWithFileURL: not bound
!missing-selector! QLPreviewReply::setAttachments: not bound
!missing-selector! QLPreviewReply::setStringEncoding: not bound
!missing-selector! QLPreviewReply::setTitle: not bound
!missing-selector! QLPreviewReply::stringEncoding not bound
!missing-selector! QLPreviewReply::title not bound
!missing-selector! QLPreviewReplyAttachment::contentType not bound
!missing-selector! QLPreviewReplyAttachment::data not bound
!missing-selector! QLPreviewReplyAttachment::initWithData:contentType: not bound
!missing-type! QLFilePreviewRequest not bound
!missing-type! QLPreviewProvider not bound
!missing-type! QLPreviewReply not bound
!missing-type! QLPreviewReplyAttachment not bound
!missing-selector! QLPreviewSceneActivationConfiguration::initWithItemsAtURLs:options: not bound
!missing-selector! QLPreviewSceneOptions::initialPreviewIndex not bound
!missing-selector! QLPreviewSceneOptions::setInitialPreviewIndex: not bound
!missing-type! QLPreviewSceneActivationConfiguration not bound
!missing-type! QLPreviewSceneOptions not bound
22 changes: 0 additions & 22 deletions tests/xtro-sharpie/iOS-QuickLook.todo
Original file line number Diff line number Diff line change
@@ -1,24 +1,2 @@
!missing-protocol-member! QLPreviewingController::providePreviewForFileRequest:completionHandler: not found
!missing-selector! QLFilePreviewRequest::fileURL not bound
!missing-selector! QLPreviewReply::attachments not bound
!missing-selector! QLPreviewReply::initForPDFWithPageSize:documentCreationBlock: not bound
!missing-selector! QLPreviewReply::initWithContextSize:isBitmap:drawingBlock: not bound
!missing-selector! QLPreviewReply::initWithDataOfContentType:contentSize:dataCreationBlock: not bound
!missing-selector! QLPreviewReply::initWithFileURL: not bound
!missing-selector! QLPreviewReply::setAttachments: not bound
!missing-selector! QLPreviewReply::setStringEncoding: not bound
!missing-selector! QLPreviewReply::setTitle: not bound
!missing-selector! QLPreviewReply::stringEncoding not bound
!missing-selector! QLPreviewReply::title not bound
!missing-selector! QLPreviewReplyAttachment::contentType not bound
!missing-selector! QLPreviewReplyAttachment::data not bound
!missing-selector! QLPreviewReplyAttachment::initWithData:contentType: not bound
!missing-type! QLFilePreviewRequest not bound
!missing-type! QLPreviewProvider not bound
!missing-type! QLPreviewReply not bound
!missing-type! QLPreviewReplyAttachment not bound
!missing-selector! QLPreviewSceneActivationConfiguration::initWithItemsAtURLs:options: not bound
!missing-selector! QLPreviewSceneOptions::initialPreviewIndex not bound
!missing-selector! QLPreviewSceneOptions::setInitialPreviewIndex: not bound
!missing-type! QLPreviewSceneActivationConfiguration not bound
!missing-type! QLPreviewSceneOptions not bound

5 comments on commit e45969f

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

❌ [CI Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

API & Generator diff

ℹ️ API Diff (from PR only) (please review changes)
ℹ️ Generator Diff (please review changes)

Packages generated

View packages

Test results

3 tests failed, 226 tests passed.

Failed tests

  • monotouch-test/Mac Catalyst/Debug [dotnet]: Failed (Tests run: 2638 Passed: 2490 Inconclusive: 35 Failed: 1 Ignored: 147)
  • Documentation/All: Failed
  • DotNet tests: Failed (Execution failed with exit code 1)

Pipeline on Agent XAMBOT-1036.BigSur'
Merge pull request #12337 from rachelkang/xcode13.0-quicklook-b1-b2-b3-b4

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

⚠️ Tests were not ran (VSTS: device tests iOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
Merge pull request #12337 from rachelkang/xcode13.0-quicklook-b1-b2-b3-b4

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

⚠️ Tests were not ran (VSTS: device tests tvOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
Merge pull request #12337 from rachelkang/xcode13.0-quicklook-b1-b2-b3-b4

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

❌ Tests failed on macOS M1 - Mac Big Sur (11.5) ❌

Tests failed on M1 - Mac Big Sur (11.5).

Failed tests are:

  • xammac_tests

Pipeline on Agent
Merge pull request #12337 from rachelkang/xcode13.0-quicklook-b1-b2-b3-b4

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

✅ Tests passed on macOS Mac Mojave (10.14) ✅

Tests passed

All tests on macOS X Mac Mojave (10.14) passed.

Pipeline on Agent
Merge pull request #12337 from rachelkang/xcode13.0-quicklook-b1-b2-b3-b4

Please sign in to comment.