using System; using System.Runtime.Versioning; using System.Text.Json.Serialization; namespace ElectronNET.API.Entities { /// /// /// /// Up-to-date with Electron API 39.2 public class NotificationOptions { /// /// Gets or sets the title for the notification, which will be shown at the top of the notification window when it is shown. /// public string Title { get; set; } /// /// Gets or sets the subtitle for the notification, which will be displayed below the title. /// [SupportedOSPlatform("macos")] [JsonPropertyName("subtitle")] public string Subtitle { get; set; } /// /// Gets or sets the body text of the notification, which will be displayed below the title or subtitle. /// public string Body { get; set; } /// /// Gets or sets a value indicating whether to suppress the OS notification noise when showing the notification. /// public bool Silent { get; set; } /// /// Gets or sets an icon to use in the notification. Can be a string path or a NativeImage. If a string is passed, it must be a valid path to a local icon file. /// public string Icon { get; set; } /// /// Gets or sets a value indicating whether to add an inline reply option to the notification. /// [SupportedOSPlatform("macos")] public bool HasReply { get; set; } /// /// Gets or sets the timeout duration of the notification. Can be 'default' or 'never'. /// [SupportedOSPlatform("linux")] [SupportedOSPlatform("windows")] public string TimeoutType { get; set; } /// /// Gets or sets the placeholder to write in the inline reply input field. /// [SupportedOSPlatform("macos")] public string ReplyPlaceholder { get; set; } /// /// Gets or sets the name of the sound file to play when the notification is shown. /// [SupportedOSPlatform("macos")] public string Sound { get; set; } /// /// Gets or sets the urgency level of the notification. Can be 'normal', 'critical', or 'low'. /// [SupportedOSPlatform("linux")] public string Urgency { get; set; } /// /// Gets or sets the actions to add to the notification. Please read the available actions and limitations in the NotificationAction documentation. /// [SupportedOSPlatform("macos")] public NotificationAction[] Actions { get; set; } /// /// Gets or sets a custom title for the close button of an alert. An empty string will cause the default localized text to be used. /// [SupportedOSPlatform("macos")] public string CloseButtonText { get; set; } /// /// Gets or sets a custom description of the Notification on Windows superseding all properties above. Provides full customization of design and behavior of the notification. /// [SupportedOSPlatform("windows")] public string ToastXml { get; set; } /// /// Emitted when the notification is shown to the user, note this could be fired /// multiple times as a notification can be shown multiple times through the Show() /// method. /// [JsonIgnore] public Action OnShow { get; set; } /// /// Gets or sets the show identifier. /// /// /// The show identifier. /// [JsonInclude] internal string ShowID { get; set; } /// /// Emitted when the notification is clicked by the user. /// [JsonIgnore] public Action OnClick { get; set; } /// /// Gets or sets the click identifier. /// /// /// The click identifier. /// [JsonInclude] internal string ClickID { get; set; } /// /// Emitted when the notification is closed by manual intervention from the user. /// /// This event is not guarunteed to be emitted in all cases where the notification is closed. /// [JsonIgnore] public Action OnClose { get; set; } /// /// Gets or sets the close identifier. /// /// /// The close identifier. /// [JsonInclude] internal string CloseID { get; set; } /// /// macOS only: Emitted when the user clicks the “Reply” button on a notification with hasReply: true. /// /// The string the user entered into the inline reply field /// [JsonIgnore] [SupportedOSPlatform("macos")] public Action OnReply { get; set; } /// /// Gets or sets the reply identifier. /// /// /// The reply identifier. /// [JsonInclude] internal string ReplyID { get; set; } /// /// macOS only - The index of the action that was activated. /// [JsonIgnore] [SupportedOSPlatform("macos")] public Action OnAction { get; set; } /// /// Gets or sets the action identifier. /// /// /// The action identifier. /// [JsonInclude] internal string ActionID { get; set; } /// /// Windows only: Emitted when an error is encountered while creating and showing the native notification. /// Corresponds to the 'failed' event on Notification. /// [JsonIgnore] [SupportedOSPlatform("windows")] public Action OnFailed { get; set; } /// /// Initializes a new instance of the class. /// /// The title. /// The body. public NotificationOptions(string title, string body) { Title = title; Body = body; } } }