using System;
namespace Unity.Notifications.Android
{
///
/// The level of interruption of this notification channel.
/// The importance of a notification is used to determine how much the notification should interrupt the user (visually and audibly).
/// The higher the importance of a notification, the more interruptive the notification will be.
///
///
/// The exact behaviour of each importance level might vary depending on the device and OS version on devices running Android 7.1 or older.
///
public enum Importance
{
///
/// A notification with no importance: does not show in the shade.
///
None = 0,
///
/// Low importance, notification is shown everywhere, but is not intrusive.
///
Low = 2,
///
/// Default importance, notification is shown everywhere, makes noise, but does not intrude visually.
///
Default = 3,
///
/// High importance, notification is shown everywhere, makes noise and is shown on the screen.
///
High = 4,
}
///
/// Determines whether notifications appear on the lock screen.
///
public enum LockScreenVisibility
{
///
/// Do not reveal any part of this notification on a secure lock screen.
///
Secret = -1,
///
/// Show this notification on all lock screens, but conceal sensitive or private information on secure lock screens.
///
Private = 0,
///
/// Show this notification in its entirety on the lock screen.
///
Public = 1,
}
///
/// The wrapper of the Android notification channel. Use this to group notifications by groups.
///
public struct AndroidNotificationChannel
{
///
/// Notification channel identifier.
/// Must be specified when scheduling notifications.
///
public string Id { get; set; }
///
/// Notification channel name which is visible to users.
///
public string Name { get; set; }
///
/// User visible description of the notification channel.
///
public string Description { get; set; }
///
/// Importance level which is applied to all notifications sent to the channel.
/// This can be changed by users in the settings app. Android uses importance to determine how much the notification should interrupt the user (visually and audibly).
/// The higher the importance of a notification, the more interruptive the notification will be.
/// The possible importance levels are the following:
/// High: Makes a sound and appears as a heads-up notification.
/// Default: Makes a sound.
/// Low: No sound.
/// None: No sound and does not appear in the status bar.
///
public Importance Importance { get; set; }
///
/// Whether or not notifications posted to this channel can bypass the Do Not Disturb.
/// This can be changed by users in the settings app.
///
public bool CanBypassDnd { get; set; }
///
/// Whether notifications posted to this channel can appear as badges in a Launcher application.
///
public bool CanShowBadge { get; set; }
///
/// Sets whether notifications posted to this channel should display notification lights, on devices that support that feature.
/// This can be changed by users in the settings app.
/// /
public bool EnableLights { get; set; }
///
/// Sets whether notification posted to this channel should vibrate.
/// This can be changed by users in the settings app.
///
public bool EnableVibration { get; set; }
///
/// Sets the vibration pattern for notifications posted to this channel.
///
public long[] VibrationPattern { get; set; }
///
/// Sets whether or not notifications posted to this channel are shown on the lockscreen in full or redacted form.
/// This can be changed by users in the settings app.
///
public LockScreenVisibility LockScreenVisibility { get; set; }
///
/// Returns false if the user has blocked this notification in the settings app. Channels can be manually blocked by settings it's Importance to None.
///
public bool Enabled
{
get { return Importance != Importance.None; }
}
///
/// Create a notification channel struct with all optional fields set to default values.
///
/// ID for the channel
/// Channel name
/// Channel description
/// Importance of the channel
public AndroidNotificationChannel(string id, string name, string description, Importance importance)
{
Id = id;
Name = name;
Description = description;
this.Importance = importance;
CanBypassDnd = false;
CanShowBadge = true;
EnableLights = false;
EnableVibration = true;
VibrationPattern = null;
this.LockScreenVisibility = LockScreenVisibility.Public;
}
}
}