From 88392b8994cb21f9256b69152c6f7844896ddde6 Mon Sep 17 00:00:00 2001 From: Rachel Kang Date: Thu, 5 Aug 2021 11:43:45 -0400 Subject: [PATCH 1/3] [QuickLookUI] Update bindings for Xcode 13.0 beta 1 --- src/quicklookUI.cs | 64 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/src/quicklookUI.cs b/src/quicklookUI.cs index fa2a7274c353..95638c765277 100644 --- a/src/quicklookUI.cs +++ b/src/quicklookUI.cs @@ -172,5 +172,69 @@ interface QLPreviewingController { [Mac (10,15)] [Export ("preparePreviewOfFileAtURL:completionHandler:")] void PreparePreviewOfFile (NSUrl url, Action completionHandler); + + [iOS (15,0), Mac (12,0), MacCatalyst (15,0)] + [Export ("providePreviewForFileRequest:completionHandler:")] + void ProvidePreview (QLFilePreviewRequest request, Action handler); + } + + [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, 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); + } + + 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 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); } } From 80de25c252d9731470e61360e6c136e9706f9ec3 Mon Sep 17 00:00:00 2001 From: Rachel Kang Date: Mon, 9 Aug 2021 12:44:54 -0400 Subject: [PATCH 2/3] Add missing using and remove todo --- src/quicklookUI.cs | 1 + tests/xtro-sharpie/macOS-QuickLookUI.todo | 19 ------------------- 2 files changed, 1 insertion(+), 19 deletions(-) delete mode 100644 tests/xtro-sharpie/macOS-QuickLookUI.todo diff --git a/src/quicklookUI.cs b/src/quicklookUI.cs index 95638c765277..545107f1eca8 100644 --- a/src/quicklookUI.cs +++ b/src/quicklookUI.cs @@ -5,6 +5,7 @@ using System; using System.ComponentModel; +using UniformTypeIdentifiers; namespace QuickLookUI { diff --git a/tests/xtro-sharpie/macOS-QuickLookUI.todo b/tests/xtro-sharpie/macOS-QuickLookUI.todo deleted file mode 100644 index e113fe7feab6..000000000000 --- a/tests/xtro-sharpie/macOS-QuickLookUI.todo +++ /dev/null @@ -1,19 +0,0 @@ -!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 From d27fdac488344cb5f54f7f4958ffda5e78054e73 Mon Sep 17 00:00:00 2001 From: Rachel Kang Date: Tue, 10 Aug 2021 11:40:31 -0400 Subject: [PATCH 3/3] update based on feedback --- src/quicklookUI.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/quicklookUI.cs b/src/quicklookUI.cs index 545107f1eca8..595fd4aa1af6 100644 --- a/src/quicklookUI.cs +++ b/src/quicklookUI.cs @@ -181,6 +181,7 @@ interface QLPreviewingController { [NoWatch, NoTV, Mac (12,0), iOS (15,0), MacCatalyst (15,0)] [BaseType (typeof(NSObject))] + [DisableDefaultCtor] interface QLFilePreviewRequest { [Export ("fileURL")] @@ -196,6 +197,7 @@ interface QLPreviewProvider : NSExtensionRequestHandling [NoWatch, NoTV, Mac (12,0), iOS (15,0), MacCatalyst (15,0)] [BaseType (typeof(NSObject))] + [DisableDefaultCtor] interface QLPreviewReplyAttachment { [Export ("data")] @@ -217,7 +219,7 @@ interface QLPreviewReplyAttachment interface QLPreviewReply { [Export ("stringEncoding")] - nuint StringEncoding { get; set; } + NSStringEncoding StringEncoding { get; set; } [Export ("attachments", ArgumentSemantic.Copy)] NSDictionary Attachments { get; set; }