Skip to content

[PdfKit] Implement Xcode 16.2 beta 1-3 changes. #21739

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

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
21 changes: 16 additions & 5 deletions src/PdfKit/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@

#nullable enable

#if MONOMAC || IOS
#if MONOMAC || IOS || TVOS

namespace PdfKit {

[Native]
[TV (18, 2)]
public enum PdfActionNamedName : long {
None = 0,
NextPage = 1,
Expand All @@ -53,6 +54,7 @@ public enum PdfActionNamedName : long {
}

[Native]
[TV (18, 2)]
public enum PdfWidgetControlType : long {
Unknown = -1,
PushButton = 0,
Expand All @@ -61,6 +63,7 @@ public enum PdfWidgetControlType : long {
}

[Native]
[TV (18, 2)]
public enum PdfLineStyle : long {
None = 0,
Square = 1,
Expand All @@ -71,6 +74,7 @@ public enum PdfLineStyle : long {
}

[Native]
[TV (18, 2)]
public enum PdfMarkupType : long {
Highlight = 0,
StrikeOut = 1,
Expand All @@ -79,6 +83,7 @@ public enum PdfMarkupType : long {
}

[Native]
[TV (18, 2)]
public enum PdfTextAnnotationIconType : long {
Comment = 0,
Key = 1,
Expand All @@ -90,6 +95,7 @@ public enum PdfTextAnnotationIconType : long {
}

[Native]
[TV (18, 2)]
public enum PdfBorderStyle : long {
Solid = 0,
Dashed = 1,
Expand All @@ -98,12 +104,9 @@ public enum PdfBorderStyle : long {
Underline = 4
}

#if NET
/// <summary>Enumerates print scaling behaviors.</summary>
[NoiOS]
#elif IOS
[Obsolete (Constants.UnavailableOniOS)]
#endif
[NoTV]
[Unavailable (PlatformName.MacCatalyst)]
[Native]
public enum PdfPrintScalingMode : long {
Expand All @@ -113,13 +116,15 @@ public enum PdfPrintScalingMode : long {
}

[Native]
[TV (18, 2)]
public enum PdfDocumentPermissions : long {
None = 0,
User = 1,
Owner = 2
}

[Native]
[TV (18, 2)]
public enum PdfDisplayBox : long {
Media = 0,
Crop = 1,
Expand All @@ -129,6 +134,7 @@ public enum PdfDisplayBox : long {
}

[Native]
[TV (18, 2)]
public enum PdfDisplayMode : long {
SinglePage = 0,
SinglePageContinuous = 1,
Expand All @@ -138,6 +144,7 @@ public enum PdfDisplayMode : long {

[Flags]
[Native]
[TV (18, 2)]
public enum PdfAreaOfInterest : long {
NoArea = 0,
PageArea = 1 << 0,
Expand All @@ -154,12 +161,14 @@ public enum PdfAreaOfInterest : long {
}

[Native]
[TV (18, 2)]
public enum PdfDisplayDirection : long {
Vertical = 0,
Horizontal = 1,
}

[Native]
[TV (18, 2)]
public enum PdfInterpolationQuality : long {
None = 0,
Low = 1,
Expand All @@ -168,12 +177,14 @@ public enum PdfInterpolationQuality : long {

[NoMac]
[Native]
[TV (18, 2)]
public enum PdfThumbnailLayoutMode : long {
Vertical = 0,
Horizontal = 1,
}

[Native]
[TV (18, 2)]
public enum PdfWidgetCellState : long {
Mixed = -1,
Off = 0,
Expand Down
21 changes: 4 additions & 17 deletions src/PdfKit/PdfAnnotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@
namespace PdfKit {
public partial class PdfAnnotation {

#if NET
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[UnsupportedOSPlatform ("tvos")]
#endif
[SupportedOSPlatform ("tvos18.2")]
public bool SetValue<T> (T value, PdfAnnotationKey key) where T : class, INativeObject
{
if (value is null)
Expand All @@ -33,12 +31,10 @@ public bool SetValue<T> (T value, PdfAnnotationKey key) where T : class, INative
return _SetValue (value.Handle, key.GetConstant ()!);
}

#if NET
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[UnsupportedOSPlatform ("tvos")]
#endif
[SupportedOSPlatform ("tvos18.2")]
public bool SetValue (string str, PdfAnnotationKey key)
{
var nstr = CFString.CreateNative (str);
Expand All @@ -49,33 +45,24 @@ public bool SetValue (string str, PdfAnnotationKey key)
}
}

#if NET
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[UnsupportedOSPlatform ("tvos")]
#endif
[SupportedOSPlatform ("tvos18.2")]
public T GetValue<T> (PdfAnnotationKey key) where T : class, INativeObject
{
return Runtime.GetINativeObject<T> (_GetValue (key.GetConstant ()!), true)!;
}

public PdfAnnotationKey AnnotationType {
#if NET
get { return PdfAnnotationKeyExtensions.GetValue (Type!); }
set { Type = value.GetConstant ()!; }
#else
get { return PdfAnnotationKeyExtensions.GetValue ((NSString) Type); }
set { Type = value.GetConstant (); }
#endif
}

#if NET
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[UnsupportedOSPlatform ("tvos")]
#endif
[SupportedOSPlatform ("tvos18.2")]
public CGPoint [] QuadrilateralPoints {
get {
return NSArray.ArrayFromHandleFunc<CGPoint> (_QuadrilateralPoints, (v) => {
Expand Down
4 changes: 2 additions & 2 deletions src/PdfKit/PdfKit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public nfloat []? DashPattern {
}
}

#if !IOS
#if !IOS && !__TVOS__
partial class PdfAnnotationMarkup {
public CGPoint []? QuadrilateralPoints {
get {
Expand All @@ -55,5 +55,5 @@ public CGPoint []? QuadrilateralPoints {
}
}
}
#endif // !IOS
#endif // !IOS && !__TVOS__
}
1 change: 1 addition & 0 deletions src/bgen/Extensions/PlatformNameExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public static bool TryGetPDFKitMap (this PlatformName currentPlatform, [NotNullW
switch (currentPlatform) {
case PlatformName.iOS:
case PlatformName.MacCatalyst:
case PlatformName.TvOS:
pdfKitMap = "PDFKit";
return true;
case PlatformName.MacOSX:
Expand Down
1 change: 1 addition & 0 deletions src/build/dotnet/generator-frameworks.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ partial class Frameworks {
"NetworkExtension",
"OpenGLES",
"OSLog",
"PdfKit",
"Phase",
"Photos",
"PhotosUI",
Expand Down
1 change: 1 addition & 0 deletions src/frameworks.sources
Original file line number Diff line number Diff line change
Expand Up @@ -2422,6 +2422,7 @@ TVOS_FRAMEWORKS = \
MultipeerConnectivity \
NetworkExtension \
OpenGLES \
PdfKit \
Phase \
Photos \
PhotosUI \
Expand Down
Loading
Loading