[UserNotifications] Fix xtro test results and bug in UNNotificationResponse (#455)

* ActionIdentifier from UNNotificationResponse class can be
  a NSString defined in UNNotificationActionIdentifier but can
  also be a custom defined identifier so we can't really strong type it
* Renamed enums to use the same name as defined in the header because
  we don't really know how this framework will evolve over time
  and there is a chance that the current naming can create confusion
  in the long run so we play safe here
This commit is contained in:
Alex Soto 2016-07-22 07:11:28 -05:00 коммит произвёл Sebastien Pouliot
Родитель c27c86e03d
Коммит 958861869c
5 изменённых файлов: 26 добавлений и 42 удалений

Просмотреть файл

@ -1,18 +0,0 @@
//
// UNNotificationResponse extensions & syntax sugar
//
// Authors:
// Alex Soto <alex.soto@xamarin.com>
//
// Copyright 2016 Xamarin Inc. All rights reserved.
//
#if !TVOS
using System;
namespace XamCore.UserNotifications {
public partial class UNNotificationResponse {
public UNActionIdentifier ActionIdentifier => _ActionIdentifier == UNNotificationResponse.DefaultActionIdentifier ? UNActionIdentifier.Default : UNActionIdentifier.Dismiss;
}
}
#endif // !TVOS

Просмотреть файл

@ -1309,7 +1309,6 @@ UIKIT_SOURCES = \
USERNOTIFICATIONS_SOURCES = \
UserNotifications/UNNotificationAttachment.cs \
UserNotifications/UNNotificationResponse.cs \
# VideoSubscriberAccount

Просмотреть файл

@ -61,15 +61,6 @@ namespace XamCore.UserNotifications {
AllowInCarPlay = (2 << 0)
}
[Introduced (PlatformName.iOS, 10, 0)]
[Introduced (PlatformName.WatchOS, 3, 0)]
[Unavailable (PlatformName.TvOS)]
[Native]
public enum UNActionIdentifier : nint {
Default,
Dismiss
}
[Introduced (PlatformName.iOS, 10, 0)]
[Introduced (PlatformName.TvOS, 10, 0)]
[Introduced (PlatformName.WatchOS, 3, 0)]
@ -400,6 +391,19 @@ namespace XamCore.UserNotifications {
UNNotificationRequest FromIdentifier (string identifier, UNNotificationContent content, [NullAllowed] UNNotificationTrigger trigger);
}
[Introduced (PlatformName.iOS, 10, 0)]
[Introduced (PlatformName.WatchOS, 3, 0)]
[Unavailable (PlatformName.TvOS)]
[Static]
interface UNNotificationActionIdentifier {
[Field ("UNNotificationDefaultActionIdentifier")]
NSString Default { get; }
[Field ("UNNotificationDismissActionIdentifier")]
NSString Dismiss { get; }
}
[Introduced (PlatformName.iOS, 10, 0)]
[Introduced (PlatformName.WatchOS, 3, 0)]
[Unavailable (PlatformName.TvOS)]
@ -407,20 +411,12 @@ namespace XamCore.UserNotifications {
[DisableDefaultCtor]
interface UNNotificationResponse : NSCopying, NSSecureCoding {
[Internal]
[Field ("UNNotificationDefaultActionIdentifier")]
NSString DefaultActionIdentifier { get; }
[Internal]
[Field ("UNNotificationDismissActionIdentifier")]
NSString DismissActionIdentifier { get; }
[Export ("notification", ArgumentSemantic.Copy)]
UNNotification Notification { get; }
[Internal] // Replaced with typed ActionIdentifier
[Advice ("Check against UNNotificationActionIdentifier or your custom registered identifier")]
[Export ("actionIdentifier")]
NSString _ActionIdentifier { get; }
NSString ActionIdentifier { get; }
}
[Introduced (PlatformName.iOS, 10, 0)]

Просмотреть файл

@ -21,7 +21,7 @@ namespace XamCore.UserNotificationsUI {
[Unavailable (PlatformName.WatchOS)]
[Unavailable (PlatformName.TvOS)]
[Native]
public enum UNMediaPlayPauseButtonType : nuint {
public enum UNNotificationContentExtensionMediaPlayPauseButtonType : nuint {
None,
Default,
Overlay
@ -32,7 +32,7 @@ namespace XamCore.UserNotificationsUI {
[Unavailable (PlatformName.WatchOS)]
[Unavailable (PlatformName.TvOS)]
[Native]
public enum UNResponseOption : nuint {
public enum UNNotificationContentExtensionResponseOption : nuint {
DoNotDismiss,
Dismiss,
DismissAndForwardAction
@ -52,10 +52,10 @@ namespace XamCore.UserNotificationsUI {
void DidReceiveNotification (UNNotification notification);
[Export ("didReceiveNotificationResponse:completionHandler:")]
void DidReceiveNotificationResponse (UNNotificationResponse response, Action<UNResponseOption> completion);
void DidReceiveNotificationResponse (UNNotificationResponse response, Action<UNNotificationContentExtensionResponseOption> completion);
[Export ("mediaPlayPauseButtonType", ArgumentSemantic.Assign)]
UNMediaPlayPauseButtonType MediaPlayPauseButtonType { get; }
UNNotificationContentExtensionMediaPlayPauseButtonType MediaPlayPauseButtonType { get; }
[Export ("mediaPlayPauseButtonFrame", ArgumentSemantic.Assign)]
CGRect MediaPlayPauseButtonFrame { get; }

Просмотреть файл

@ -44,6 +44,13 @@
!unknown-type! GKQuadTree bound
!unknown-type! GKQuadTreeNode bound
# UserNotifications
## While these keys are present in the SDK, the class that uses them UNNotificationAttachment is __TVOS_PROHIBITED
!missing-field! UNNotificationAttachmentOptionsThumbnailClippingRectKey not bound
!missing-field! UNNotificationAttachmentOptionsThumbnailHiddenKey not bound
!missing-field! UNNotificationAttachmentOptionsThumbnailTimeKey not bound
!missing-field! UNNotificationAttachmentOptionsTypeHintKey not bound
# Security