using System.Runtime.InteropServices;
namespace Unity.Notifications.iOS
{
///
/// Enum indicating whether the app is allowed to schedule notifications.
///
public enum AuthorizationStatus
{
///
/// The user has not yet made a choice regarding whether the application may post notifications.
///
NotDetermined = 0,
///
/// The application is not authorized to post notifications.
///
Denied = 1,
///
/// The application is authorized to post notifications.
///
Authorized = 2,
///
/// The application is authorized to post non-interruptive user notifications.
///
Provisional = 3,
///
/// The application is temporarily authorized to post notifications. Only available to app clips.
///
Ephemeral = 4,
}
///
/// Presentation styles for alerts.
///
public enum AlertStyle
{
///
/// No alert.
///
None = 0,
///
/// Banner alerts.
///
Banner = 1,
///
/// Modal alerts.
///
Alert = 2,
}
///
/// The style for previewing a notification's content.
///
public enum ShowPreviewsSetting
{
///
/// The notification's content is always shown, even when the device is locked.
///
Always = 0,
///
/// The notification's content is shown only when the device is unlocked.
///
WhenAuthenticated = 1,
///
/// The notification's content is never shown, even when the device is unlocked
///
Never = 2,
}
///
/// Enum indicating the current status of a notification setting.
///
public enum NotificationSetting
{
///
/// The app does not support this notification setting.
///
NotSupported = 0,
///
/// The notification setting is turned off.
///
Disabled,
///
/// The notification setting is turned on.
///
Enabled,
}
///
/// iOSNotificationSettings contains the current authorization status and notification-related settings for your app. Your app must receive authorization to schedule notifications.
///
///
/// Use this struct to determine what notification-related actions your app is allowed to perform by the user. This information should be used to enable, disable, or adjust your app's notification-related behaviors.
/// The system enforces your app's settings by preventing denied interactions from occurring.
///
[StructLayout(LayoutKind.Sequential)]
public struct iOSNotificationSettings
{
internal int authorizationStatus;
internal int notificationCenterSetting;
internal int lockScreenSetting;
internal int carPlaySetting;
internal int alertSetting;
internal int badgeSetting;
internal int soundSetting;
internal int alertStyle;
internal int showPreviewsSetting;
///
/// When the value is set to Authorized your app is allowed to schedule and receive local and remote notifications.
///
///
/// When authorized, use the alertSetting, badgeSetting, and soundSetting properties to specify which types of interactions are allowed.
/// When the `AuthorizationStatus` value is `Denied`, the system doesn't deliver notifications to your app, and the system ignores any attempts to schedule local notifications.
///
public AuthorizationStatus AuthorizationStatus
{
get { return (AuthorizationStatus)authorizationStatus; }
}
///
/// The setting that indicates whether your app’s notifications are displayed in Notification Center.
///
public NotificationSetting NotificationCenterSetting
{
get { return (NotificationSetting)notificationCenterSetting; }
}
///
/// The setting that indicates whether your app’s notifications appear onscreen when the device is locked.
///
public NotificationSetting LockScreenSetting
{
get { return (NotificationSetting)lockScreenSetting; }
}
///
/// The setting that indicates whether your app’s notifications may be displayed in a CarPlay environment.
///
public NotificationSetting CarPlaySetting
{
get { return (NotificationSetting)carPlaySetting; }
}
///
/// The authorization status for displaying alerts.
///
public NotificationSetting AlertSetting
{
get { return (NotificationSetting)alertSetting; }
}
///
/// The authorization status for badging your app’s icon.
///
public NotificationSetting BadgeSetting
{
get { return (NotificationSetting)badgeSetting; }
}
///
/// The authorization status for playing sounds for incoming notifications.
///
public NotificationSetting SoundSetting
{
get { return (NotificationSetting)soundSetting; }
}
///
/// The type of alert that the app may display when the device is unlocked.
///
///
/// This property specifies the presentation style for alerts when the device is unlocked.
/// The user may choose to display alerts as automatically disappearing banners or as modal windows that require explicit dismissal (the user may also choose not to display alerts at all.
///
public AlertStyle AlertStyle
{
get { return (AlertStyle)alertStyle; }
}
///
/// The setting that indicates whether the app shows a preview of the notification's content.
///
public ShowPreviewsSetting ShowPreviewsSetting
{
get { return (ShowPreviewsSetting)showPreviewsSetting; }
}
}
}