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

[UserNotifications] Updates for Xcode13 beta 3 #12130

Merged
merged 13 commits into from
Jul 23, 2021
91 changes: 89 additions & 2 deletions src/usernotifications.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ public enum UNErrorCode : long {
AttachmentMoveIntoDataStoreFailed,
AttachmentCorrupt,
NotificationInvalidNoDate = 1400,
NotificationInvalidNoContent
NotificationInvalidNoContent,
ContentProvidingObjectNotAllowed = 1500,
ContentProvidingInvalid = 1501,
}

[iOS (10, 0)]
Expand Down Expand Up @@ -130,6 +132,8 @@ public enum UNAuthorizationOptions : ulong {
Provisional = (1 << 6),
[iOS (13,0)][TV (13,0)][Watch (6,0)]
Announcement = (1 << 7),
[iOS (15,0), Mac (12,0), MacCatalyst (15,0), TV (15,0), Watch (8,0)]
TimeSensitive = (1 << 8),
}

[iOS (10, 0)]
Expand Down Expand Up @@ -163,6 +167,16 @@ public enum UNShowPreviewsSetting : long
Never
}

[iOS (15,0), Mac (12,0), MacCatalyst (15,0), TV (15,0), Watch (8,0)]
[Native]
public enum UNNotificationInterruptionLevel : long
{
Active,
Critical,
Passive,
TimeSensitive,
}

[iOS (10, 0)]
[TV (10, 0)]
[Watch (3, 0)]
Expand Down Expand Up @@ -198,6 +212,15 @@ interface UNNotificationAction : NSCopying, NSSecureCoding {
[Static]
[Export ("actionWithIdentifier:title:options:")]
UNNotificationAction FromIdentifier (string identifier, string title, UNNotificationActionOptions options);

[Watch (8,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Static]
[Export ("actionWithIdentifier:title:options:icon:")]
UNNotificationAction FromIdentifier (string identifier, string title, UNNotificationActionOptions options, [NullAllowed] UNNotificationActionIcon icon);

[Watch (8,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[NullAllowed, Export ("icon", ArgumentSemantic.Copy)]
UNNotificationActionIcon Icon { get; }
}

[iOS (10, 0)]
Expand All @@ -212,6 +235,11 @@ interface UNTextInputNotificationAction {
[Export ("actionWithIdentifier:title:options:textInputButtonTitle:textInputPlaceholder:")]
UNTextInputNotificationAction FromIdentifier (string identifier, string title, UNNotificationActionOptions options, string textInputButtonTitle, string textInputPlaceholder);

[iOS (15,0), Mac (12,0), MacCatalyst (15,0), Watch (8,0)]
[Static]
[Export ("actionWithIdentifier:title:options:icon:textInputButtonTitle:textInputPlaceholder:")]
UNTextInputNotificationAction FromIdentifier (string identifier, string title, UNNotificationActionOptions options, [NullAllowed] UNNotificationActionIcon icon, string textInputButtonTitle, string textInputPlaceholder);

[Export ("textInputButtonTitle")]
string TextInputButtonTitle { get; }

Expand Down Expand Up @@ -382,10 +410,12 @@ interface UNNotificationContent : NSCopying, NSMutableCopying, NSSecureCoding {
NSDictionary UserInfo { get; }

[NoWatch, NoTV, iOS (12, 0)]
[Deprecated (PlatformName.iOS, 15, 0, message: "This property is ignored.")]
[Export ("summaryArgument")]
string SummaryArgument { get; }

[NoWatch, NoTV, iOS (12, 0)]
[Deprecated (PlatformName.iOS, 15, 0, message: "This property is ignored.")]
[Export ("summaryArgumentCount")]
nuint SummaryArgumentCount { get; }

Expand All @@ -394,6 +424,19 @@ interface UNNotificationContent : NSCopying, NSMutableCopying, NSSecureCoding {
[Mac (10,15)]
[NullAllowed, Export ("targetContentIdentifier")]
string TargetContentIdentifier { get; [NotImplemented] set; }

[Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("contentByUpdatingWithProvider:error:")]
[return: NullAllowed]
UNNotificationContent Update (IUNNotificationContentProviding fromProvider, [NullAllowed] out NSError outError);

[Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("interruptionLevel", ArgumentSemantic.Assign)]
UNNotificationInterruptionLevel InterruptionLevel { get; }

[Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("relevanceScore")]
double RelevanceScore { get; }
}

[iOS (10, 0)]
Expand Down Expand Up @@ -442,10 +485,12 @@ interface UNMutableNotificationContent {
NSDictionary UserInfo { get; set; }

[NoWatch, NoTV, iOS (12, 0)]
[Deprecated (PlatformName.iOS, 15, 0, message: "This property is ignored.")]
[Export ("summaryArgument")]
string SummaryArgument { get; set; }

[NoWatch, NoTV, iOS (12, 0)]
[Deprecated (PlatformName.iOS, 15, 0, message: "This property is ignored.")]
[Export ("summaryArgumentCount")]
nuint SummaryArgumentCount { get; set; }

Expand All @@ -454,6 +499,14 @@ interface UNMutableNotificationContent {
[Mac (10,15)]
[NullAllowed, Export ("targetContentIdentifier")]
string TargetContentIdentifier { get; set; }

[iOS (15,0), Mac (12,0), MacCatalyst (15,0), TV (15,0), Watch (8,0)]
[Export ("interruptionLevel", ArgumentSemantic.Assign)]
UNNotificationInterruptionLevel InterruptionLevel { get; set; }

[iOS (15,0), Mac (12,0), MacCatalyst (15,0), TV (15,0), Watch (8,0)]
[Export ("relevanceScore")]
double RelevanceScore { get; set; }
}

[iOS (10, 0)]
Expand Down Expand Up @@ -605,6 +658,18 @@ interface UNNotificationSettings : NSCopying, NSSecureCoding {
[Watch (6,0), NoTV, NoMac, iOS (13,0)]
[Export ("announcementSetting")]
UNNotificationSetting AnnouncementSetting { get; }

[iOS (15,0), Mac (12,0), MacCatalyst (15,0), Watch (8,0), TV (15,0)]
[Export ("timeSensitiveSetting")]
UNNotificationSetting TimeSensitiveSetting { get; }

[iOS (15,0), Mac (12,0), MacCatalyst (15,0), Watch (8,0), TV (15,0)]
[Export ("scheduledDeliverySetting")]
UNNotificationSetting ScheduledDeliverySetting { get; }

[iOS (15,0), Mac (12,0), MacCatalyst (15,0), Watch (8,0), TV (15,0)]
[Export ("directMessagesSetting")]
UNNotificationSetting DirectMessagesSetting { get; }
}

[iOS (10, 0)]
Expand Down Expand Up @@ -717,7 +782,7 @@ interface UNLocationNotificationTrigger {
[Export ("region", ArgumentSemantic.Copy)]
CLRegion Region { get; }

[Unavailable (PlatformName.WatchOS)]
[Watch (8,0)]
[Static]
[Export ("triggerWithRegion:repeats:")]
UNLocationNotificationTrigger CreateTrigger (CLRegion region, bool repeats);
Expand Down Expand Up @@ -807,5 +872,27 @@ interface UNUserNotificationCenter {
[Export ("removeAllDeliveredNotifications")]
void RemoveAllDeliveredNotifications ();
}

[iOS (15,0), Mac (12,0), MacCatalyst (15,0), TV (15,0), Watch (8,0)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface UNNotificationActionIcon : NSCopying, NSSecureCoding
{
[Static]
[Export ("iconWithTemplateImageName:")]
UNNotificationActionIcon CreateFromTemplate (string imageName);

[Static]
[Export ("iconWithSystemImageName:")]
UNNotificationActionIcon CreateFromSystem (string imageName);
}

interface IUNNotificationContentProviding {}

[iOS (15,0), Mac (12,0), MacCatalyst (15,0), TV (15,0), Watch (8,0)]
[Protocol]
interface UNNotificationContentProviding
{
}
}

21 changes: 0 additions & 21 deletions tests/xtro-sharpie/MacCatalyst-UserNotifications.todo

This file was deleted.

27 changes: 0 additions & 27 deletions tests/xtro-sharpie/iOS-UserNotifications.todo

This file was deleted.

21 changes: 0 additions & 21 deletions tests/xtro-sharpie/macOS-UserNotifications.todo

This file was deleted.

7 changes: 7 additions & 0 deletions tests/xtro-sharpie/tvOS-UserNotifications.ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# both added and deprecated in Xcode 13 beta 2
!missing-selector! UNMutableNotificationContent::setSummaryArgument: not bound
!missing-selector! UNMutableNotificationContent::setSummaryArgumentCount: not bound
!missing-selector! UNMutableNotificationContent::summaryArgument not bound
!missing-selector! UNMutableNotificationContent::summaryArgumentCount not bound
!missing-selector! UNNotificationContent::summaryArgument not bound
!missing-selector! UNNotificationContent::summaryArgumentCount not bound
spouliot marked this conversation as resolved.
Show resolved Hide resolved
21 changes: 0 additions & 21 deletions tests/xtro-sharpie/tvOS-UserNotifications.todo

This file was deleted.

7 changes: 7 additions & 0 deletions tests/xtro-sharpie/watchOS-UserNotifications.ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# both added and deprecated in Xcode 13 beta 2
Copy link
Member

Choose a reason for hiding this comment

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

@tj-devel709 do we get these errors when using beta 3? Have you tried removing it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I remove this, I get errors still!

!missing-selector! UNMutableNotificationContent::setSummaryArgument: not bound
!missing-selector! UNMutableNotificationContent::setSummaryArgumentCount: not bound
!missing-selector! UNMutableNotificationContent::summaryArgument not bound
!missing-selector! UNMutableNotificationContent::summaryArgumentCount not bound
!missing-selector! UNNotificationContent::summaryArgument not bound
!missing-selector! UNNotificationContent::summaryArgumentCount not bound
spouliot marked this conversation as resolved.
Show resolved Hide resolved
28 changes: 0 additions & 28 deletions tests/xtro-sharpie/watchOS-UserNotifications.todo

This file was deleted.