Skip to content
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
19 changes: 19 additions & 0 deletions src/usernotifications.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,29 @@ public enum UNShowPreviewsSetting : long
[Native]
public enum UNNotificationInterruptionLevel : long
{
#if XAMCORE_5_0
Passive,
Active,
TimeSensitive,
Critical,
#else
[Obsolete ("Use 'Active2'.")]
Active,
[Obsolete ("Use 'Critical2'.")]
Critical,
[Obsolete ("Use 'Passive2'.")]
Passive,
[Obsolete ("Use 'TimeSensitive2'.")]
TimeSensitive,
#endif // XAMCORE_5_0

// Additional enum values to fix reordering - to be at the end of the enum
#if !XAMCORE_5_0
Active2 = Critical,
Critical2 = TimeSensitive,
Passive2 = Active,
TimeSensitive2 = Passive,
#endif // !XAMCORE_5_0
}

[iOS (10, 0)]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using NUnit.Framework;

using Foundation;
using UserNotifications;

namespace MonoTouchFixtures.UserNotifications {

[TestFixture]
[Preserve (AllMembers = true)]
public class UNNotificationInterruptionLevelTest {

[Test]
public void EnumTest ()
{
#if !XAMCORE_5_0
/* Apple Docs order these enum values as:
typedef NS_ENUM (NSUInteger, UNNotificationInterruptionLevel)
{
UNNotificationInterruptionLevelPassive,
UNNotificationInterruptionLevelActive,
UNNotificationInterruptionLevelTimeSensitive,
UNNotificationInterruptionLevelCritical,
} */
Assert.AreEqual ( (int)UNNotificationInterruptionLevel.Passive2, 0);
Assert.AreEqual ( (int)UNNotificationInterruptionLevel.Active2, 1);
Assert.AreEqual ( (int)UNNotificationInterruptionLevel.TimeSensitive2, 2);
Assert.AreEqual ( (int)UNNotificationInterruptionLevel.Critical2, 3);
#endif
}
}
}