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

[CloudKit] Implement Xcode 16.0 beta 1-6 changes. #20861

Merged
merged 13 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
9 changes: 0 additions & 9 deletions src/CloudKit/CKCompat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,6 @@ public virtual string? LastName {
#endif

#if WATCH

public partial class CKModifyBadgeOperation {

// `init` does not work on watchOS but we can keep compatibility with a different init
public CKModifyBadgeOperation () : this (0)
{
}
}

public partial class CKModifyRecordZonesOperation {

// `init` does not work on watchOS but we can keep compatibility with a different init
Expand Down
95 changes: 95 additions & 0 deletions src/CloudKit/CKFetchNotificationChangesOperation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#if !XAMCORE_5_0

using System;
using System.ComponentModel;
using System.Runtime.Versioning;
using System.Diagnostics.CodeAnalysis;

using Foundation;
using ObjCRuntime;

#nullable enable

#if !NET
using NativeHandle = System.IntPtr;
#endif

namespace CloudKit {
[Register ("CKFetchNotificationChangesOperation", SkipRegistration = true)]
#if NET
[UnsupportedOSPlatform ("ios", "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")]
[UnsupportedOSPlatform ("macos", "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")]
[UnsupportedOSPlatform ("tvos", "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")]
[UnsupportedOSPlatform ("maccatalyst", "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")]
#endif
[EditorBrowsable (EditorBrowsableState.Never)]
public unsafe partial class CKFetchNotificationChangesOperation : CKOperation {
public override NativeHandle ClassHandle { get => throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); }

protected CKFetchNotificationChangesOperation (NSObjectFlag t) : base (t)
{
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}

protected internal CKFetchNotificationChangesOperation (NativeHandle handle) : base (handle)
{
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}

public CKFetchNotificationChangesOperation ()
: base (NSObjectFlag.Empty)
{
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}

public CKFetchNotificationChangesOperation (CKServerChangeToken? previousServerChangeToken)
: base (NSObjectFlag.Empty)
{
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}

public unsafe virtual global::System.Action<CKServerChangeToken, NSError>? Completed {
get {
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}
set {
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}
}

public virtual bool MoreComing {
get {
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}
}

public unsafe virtual global::System.Action<CKNotification>? NotificationChanged {
get {
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}
set {
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}
}

public virtual CKServerChangeToken? PreviousServerChangeToken {
get {
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}
set {
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}
}

public virtual nuint ResultsLimit {
get {
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}
set {
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}
}
} /* class CKFetchNotificationChangesOperation */
}

#endif // !XAMCORE_5_0
67 changes: 67 additions & 0 deletions src/CloudKit/CKMarkNotificationsReadOperation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#if !XAMCORE_5_0

using System;
using System.ComponentModel;
using System.Runtime.Versioning;
using System.Diagnostics.CodeAnalysis;

using Foundation;
using ObjCRuntime;

#nullable enable

#if !NET
using NativeHandle = System.IntPtr;
#endif

namespace CloudKit {
[Register ("CKMarkNotificationsReadOperation", SkipRegistration = true)]
#if NET
[UnsupportedOSPlatform ("ios", "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")]
[UnsupportedOSPlatform ("macos", "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")]
[UnsupportedOSPlatform ("tvos", "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")]
[UnsupportedOSPlatform ("maccatalyst", "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")]
#endif
[EditorBrowsable (EditorBrowsableState.Never)]
public unsafe partial class CKMarkNotificationsReadOperation : CKOperation {
public override NativeHandle ClassHandle { get => throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); }

protected CKMarkNotificationsReadOperation (NSObjectFlag t) : base (t)
{
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}

protected internal CKMarkNotificationsReadOperation (NativeHandle handle) : base (handle)
{
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}

public CKMarkNotificationsReadOperation (CKNotificationID [] notificationIds)
: base (NSObjectFlag.Empty)
{
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}

public unsafe virtual CKMarkNotificationsReadHandler? Completed {
get {
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}
set {
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}
}

public virtual CKNotificationID []? NotificationIds {
get {
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}
set {
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}
}
} /* class CKMarkNotificationsReadOperation */

[EditorBrowsable (EditorBrowsableState.Never)]
public delegate void CKMarkNotificationsReadHandler (CKNotificationID [] notificationIDsMarkedRead, NSError operationError);
}
#endif // !XAMCORE_5_0
69 changes: 69 additions & 0 deletions src/CloudKit/CKModifyBadgeOperation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#if !XAMCORE_5_0

using System;
using System.ComponentModel;
using System.Runtime.Versioning;
using System.Diagnostics.CodeAnalysis;

using Foundation;
using ObjCRuntime;

#nullable enable

#if !NET
using NativeHandle = System.IntPtr;
#endif

namespace CloudKit {
[Register ("CKModifyBadgeOperation", SkipRegistration = true)]
#if NET
[UnsupportedOSPlatform ("ios", "Modifying badge counts is no longer supported.")]
[UnsupportedOSPlatform ("macos", "Modifying badge counts is no longer supported.")]
[UnsupportedOSPlatform ("tvos", "Modifying badge counts is no longer supported.")]
[UnsupportedOSPlatform ("maccatalyst", "Modifying badge counts is no longer supported.")]
#endif
[EditorBrowsable (EditorBrowsableState.Never)]
public class CKModifyBadgeOperation : CKOperation {
public override NativeHandle ClassHandle { get => throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); }

public CKModifyBadgeOperation () : base (NSObjectFlag.Empty)
{
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}

protected CKModifyBadgeOperation (NSObjectFlag t) : base (t)
{
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}

protected internal CKModifyBadgeOperation (NativeHandle handle) : base (handle)
{
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}

public CKModifyBadgeOperation (nuint badgeValue)
: base (NSObjectFlag.Empty)
{
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}

public virtual nuint BadgeValue {
get {
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}
set {
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}
}

public unsafe virtual global::System.Action<NSError>? Completed {
get {
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}
set {
throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms);
}
}
} /* class CKModifyBadgeOperation */
}
#endif // !XAMCORE_5_0
108 changes: 9 additions & 99 deletions src/cloudkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ interface CKUserIdentity : NSSecureCoding, NSCopying {

[NoTV]
[MacCatalyst (13, 1)]
[Deprecated (PlatformName.WatchOS, 11, 0, message: "Please read Apple's document about 'Sharing CloudKit Data with Other iCloud Users'.")]
[Deprecated (PlatformName.TvOS, 18, 0, message: "Please read Apple's document about 'Sharing CloudKit Data with Other iCloud Users'.")]
[Deprecated (PlatformName.iOS, 18, 0, message: "Please read Apple's document about 'Sharing CloudKit Data with Other iCloud Users'.")]
[Deprecated (PlatformName.MacCatalyst, 18, 0, message: "Please read Apple's document about 'Sharing CloudKit Data with Other iCloud Users'.")]
[Deprecated (PlatformName.MacOSX, 15, 0, message: "Please read Apple's document about 'Sharing CloudKit Data with Other iCloud Users'.")]
[Export ("contactIdentifiers", ArgumentSemantic.Copy)]
string [] ContactIdentifiers { get; }
}
Expand Down Expand Up @@ -217,6 +222,10 @@ interface CKShareParticipant : NSSecureCoding, NSCopying {

[Export ("permission", ArgumentSemantic.Assign)]
CKShareParticipantPermission Permission { get; set; }

// This showed up in Xcode 16's b1 headers, but according to the availability attributes it's always been available.
[Export ("participantID", ArgumentSemantic.Copy)]
string ParticipantId { get; }
}

[MacCatalyst (13, 1)]
Expand Down Expand Up @@ -525,48 +534,6 @@ interface CKErrorFields {
NSString UserDidResetEncryptedDataKey { get; }
}

[BaseType (typeof (CKOperation))]
[Deprecated (PlatformName.iOS, 11, 0, message: "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 13, message: "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")]
[Deprecated (PlatformName.WatchOS, 4, 0, message: "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")]
[Deprecated (PlatformName.TvOS, 11, 0, message: "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")]
[MacCatalyst (13, 1)]
[Deprecated (PlatformName.MacCatalyst, 13, 1, message: "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")]
[DisableDefaultCtor] // designated
interface CKFetchNotificationChangesOperation {

[DesignatedInitializer]
[Export ("init")]
NativeHandle Constructor ();

[Export ("initWithPreviousServerChangeToken:")]
NativeHandle Constructor ([NullAllowed] CKServerChangeToken previousServerChangeToken);

[NullAllowed] // by default this property is null
[Export ("previousServerChangeToken", ArgumentSemantic.Copy)]
CKServerChangeToken PreviousServerChangeToken { get; set; }

[Export ("resultsLimit")]
nuint ResultsLimit { get; set; }

[Export ("moreComing")]
bool MoreComing { get; }

[NullAllowed] // by default this property is null
[Export ("notificationChangedBlock", ArgumentSemantic.Copy)]
Action<CKNotification> NotificationChanged {
get;
set;
}

[NullAllowed] // by default this property is null
[Export ("fetchNotificationChangesCompletionBlock", ArgumentSemantic.Copy)]
Action<CKServerChangeToken, NSError> Completed {
get;
set;
}
}

[MacCatalyst (13, 1)]
[DisableDefaultCtor] // Objective-C exception thrown. Name: CKException Reason: You can't call init on CKServerChangeToken
[BaseType (typeof (NSObject))]
Expand Down Expand Up @@ -890,63 +857,6 @@ interface CKLocationSortDescriptor : NSSecureCoding {
CLLocation RelativeLocation { get; }
}

[MacCatalyst (13, 1)]
delegate void CKMarkNotificationsReadHandler (CKNotificationID [] notificationIDsMarkedRead, NSError operationError);

[BaseType (typeof (CKOperation))]
[DisableDefaultCtor] // NSInvalidArgumentException Reason: You must call -[CKMarkNotificationsReadOperation initWithNotificationIDsToMarkRead:]
[Deprecated (PlatformName.iOS, 11, 0, message: "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 13, message: "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")]
[Deprecated (PlatformName.WatchOS, 4, 0, message: "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")]
[Deprecated (PlatformName.TvOS, 11, 0, message: "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")]
[MacCatalyst (13, 1)]
[Deprecated (PlatformName.MacCatalyst, 13, 1, message: "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")]
interface CKMarkNotificationsReadOperation {

[DesignatedInitializer]
[Export ("initWithNotificationIDsToMarkRead:")]
NativeHandle Constructor (CKNotificationID [] notificationIds);

[NullAllowed]
[Export ("notificationIDs", ArgumentSemantic.Copy)]
CKNotificationID [] NotificationIds { get; set; }

[NullAllowed]
[Export ("markNotificationsReadCompletionBlock", ArgumentSemantic.Copy)]
CKMarkNotificationsReadHandler Completed {
get;
set;
}
}

#if WATCH
[DisableDefaultCtor] // does not work on watchOS, working stub provided to ease source compatibility
#else
[DesignatedDefaultCtor]
#endif
[BaseType (typeof (CKOperation))]
[Deprecated (PlatformName.iOS, 11, 0)]
[Deprecated (PlatformName.MacOSX, 10, 13)]
[Deprecated (PlatformName.WatchOS, 4, 0)]
[Deprecated (PlatformName.TvOS, 11, 0)]
[MacCatalyst (13, 1)]
[Deprecated (PlatformName.MacCatalyst, 13, 1)]
interface CKModifyBadgeOperation {

[Export ("initWithBadgeValue:")]
NativeHandle Constructor (nuint badgeValue);

[Export ("badgeValue", ArgumentSemantic.UnsafeUnretained)]
nuint BadgeValue { get; set; }

[NullAllowed] // by default this property is null
[Export ("modifyBadgeCompletionBlock", ArgumentSemantic.Copy)]
Action<NSError> Completed {
get;
set;
}
}

[MacCatalyst (13, 1)]
delegate void CKModifyRecordsOperationHandler (CKRecord [] savedRecords, CKRecordID [] deletedRecordIds, NSError operationError);

Expand Down
3 changes: 3 additions & 0 deletions src/frameworks.sources
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,9 @@ CLOUDKIT_API_SOURCES = \

CLOUDKIT_SOURCES = \
CloudKit/CKCompat.cs \
CloudKit/CKFetchNotificationChangesOperation.cs \
CloudKit/CKMarkNotificationsReadOperation.cs \
CloudKit/CKModifyBadgeOperation.cs \
CloudKit/CKRecord.cs \
CloudKit/CKRecordID.cs \
CloudKit/CKRecordZoneID.cs \
Expand Down
Loading
Loading