Skip to content
Closed
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
2 changes: 2 additions & 0 deletions FirebaseAdmin/FirebaseAdmin.Tests/Messaging/MessageTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ public void AndroidConfig()
BodyLocKey = "body-loc-key",
BodyLocArgs = new List<string>() { "arg3", "arg4" },
ChannelId = "channel-id",
EventTime = new DateTime(1998, 9, 4, 0, 0, 0, DateTimeKind.Utc),
},
FcmOptions = new AndroidFcmOptions()
{
Expand Down Expand Up @@ -308,6 +309,7 @@ public void AndroidConfig()
{ "body_loc_key", "body-loc-key" },
{ "body_loc_args", new JArray() { "arg3", "arg4" } },
{ "channel_id", "channel-id" },
{ "event_time", new DateTime(1998, 9, 4, 0, 0, 0, DateTimeKind.Utc) },
}
},
{
Expand Down
9 changes: 9 additions & 0 deletions FirebaseAdmin/FirebaseAdmin/Messaging/AndroidNotification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ public sealed class AndroidNotification
[JsonProperty("channel_id")]
public string ChannelId { get; set; }

/// <summary>
/// Gets or sets the time that the event in the notification occurred for notifications that
/// inform users about events with an absolute time reference. Notifications in the panel are
/// sorted by this time.
/// </summary>
[JsonProperty("event_time")]
public DateTime? EventTime { get; set; }

/// <summary>
/// Copies this notification, and validates the content of it to ensure that it can be
/// serialized into the JSON format expected by the FCM service.
Expand All @@ -139,6 +147,7 @@ internal AndroidNotification CopyAndValidate()
BodyLocKey = this.BodyLocKey,
BodyLocArgs = this.BodyLocArgs?.ToList(),
ChannelId = this.ChannelId,
EventTime = this.EventTime,
};
if (copy.Color != null && !Regex.Match(copy.Color, "^#[0-9a-fA-F]{6}$").Success)
{
Expand Down