-
-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathHtmlNotificationData.cs
More file actions
98 lines (82 loc) · 3.44 KB
/
HtmlNotificationData.cs
File metadata and controls
98 lines (82 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using System;
using System.Text.Json.Serialization;
namespace Majorsoft.Blazor.Components.Notifications
{
/// <summary>
/// Base properties for all types of HTML notifications.
/// </summary>
public abstract class HtmlNotificationData
{
/// <summary>
/// The title of the notification as specified in the first parameter of the constructor.
/// </summary>
public string Title { get; set; }
/// <summary>
/// The URL of the image used to represent the notification when there is not enough space to display the notification itself.
/// </summary>
public string Badge { get; set; } = "";
/// <summary>
/// The body string of the notification as specified in the constructor's options parameter.
/// </summary>
public string Body { get; set; } = "";
/// <summary>
/// The data read-only property of the Notification interface returns a structured clone of the notification's data, as specified in the data option of the Notification() constructor.
/// The notification's data can be any arbitrary data that you want associated with the notification.
/// </summary>
public object Data { get; set; } = new object();
/// <summary>
/// The text direction of the notification as specified in the constructor's options parameter.
/// </summary>
public string Dir { get; set; } = "auto";
/// <summary>
/// The language code of the notification as specified in the constructor's options parameter.
/// </summary>
public string Lang { get; set; } = "en";
/// <summary>
/// The ID of the notification (if any) as specified in the constructor's options parameter.
/// </summary>
public string Tag { get; set; } = "";
/// <summary>
/// The URL of the image used as an icon of the notification as specified in the constructor's options parameter.
/// </summary>
public string Icon { get; set; } = "";
/// <summary>
/// The URL of an image to be displayed as part of the notification, as specified in the constructor's options parameter.
/// </summary>
public string Image { get; set; } = "";
/// <summary>
/// Specifies whether the user should be notified after a new notification replaces an old one.
/// </summary>
public bool Renotify { get; set; }
/// <summary>
/// A Boolean indicating that a notification should remain active until the user clicks or dismisses it, rather than closing automatically.
/// </summary>
public bool RequireInteraction { get; set; }
/// <summary>
/// Specifies whether the notification should be silent — i.e., no sounds or vibrations should be issued, regardless of the device settings.
/// </summary>
public bool Silent { get; set; }
/// <summary>
/// Specifies the time at which a notification is created or applicable (past, present, or future).
/// </summary>
[JsonConverter(typeof(EpochTimestampDateTimeConverter))]
public DateTime Timestamp { get; set; } = DateTime.UtcNow;
/// <summary>
/// Specifies a vibration pattern for devices with vibration hardware to emit.
/// An array of values describes alternating periods in which the device is vibrating and not vibrating.
/// </summary>
public int[] Vibrate { get; set; } = new int[0];
/// <summary>
/// Default constructor.
/// </summary>
/// <param name="title">Notification title</param>
public HtmlNotificationData(string title)
{
if (string.IsNullOrWhiteSpace(title))
{
throw new ArgumentException($"Argument: {nameof(title)} is required.");
}
Title = title;
}
}
}