Skip to content

Commit

Permalink
add - Added duration/results for legacy alarms
Browse files Browse the repository at this point in the history
---

For legacy alarms, we've added two properties:

  - SnoozeDuration: a TimeSpan instance containing snooze duration
  - SnoozeIn:       a DateTimeOffset instance containing a date/time to snooze

---

Type: add
Breaking: False
Doc Required: False
Backport Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Sep 30, 2024
1 parent 5e447f2 commit 739f3e3
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
12 changes: 12 additions & 0 deletions VisualCard.Calendar/Parts/Implementations/Legacy/AudioAlarmInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ public class AudioAlarmInfo : BaseCalendarPartInfo, IEquatable<AudioAlarmInfo>
/// </summary>
public string? AudioResource { get; }

/// <summary>
/// Snooze duration. Throws exception if there is no snooze time, so check accordingly.
/// </summary>
public TimeSpan SnoozeDuration =>
VcardCommonTools.GetDurationSpan(SnoozeTime ?? "").span;

/// <summary>
/// Snooze date/time. Throws exception if there is no snooze time, so check accordingly.
/// </summary>
public DateTimeOffset SnoozeIn =>
VcardCommonTools.GetDurationSpan(SnoozeTime ?? "").result;

internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, string[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion) =>
new AudioAlarmInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, calendarVersion);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ public class DisplayAlarmInfo : BaseCalendarPartInfo, IEquatable<DisplayAlarmInf
/// </summary>
public string? Display { get; }

/// <summary>
/// Snooze duration. Throws exception if there is no snooze time, so check accordingly.
/// </summary>
public TimeSpan SnoozeDuration =>
VcardCommonTools.GetDurationSpan(SnoozeTime ?? "").span;

/// <summary>
/// Snooze date/time. Throws exception if there is no snooze time, so check accordingly.
/// </summary>
public DateTimeOffset SnoozeIn =>
VcardCommonTools.GetDurationSpan(SnoozeTime ?? "").result;

internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, string[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion) =>
new DisplayAlarmInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, calendarVersion);

Expand Down
12 changes: 12 additions & 0 deletions VisualCard.Calendar/Parts/Implementations/Legacy/MailAlarmInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ public class MailAlarmInfo : BaseCalendarPartInfo, IEquatable<MailAlarmInfo>
/// </summary>
public string? Note { get; }

/// <summary>
/// Snooze duration. Throws exception if there is no snooze time, so check accordingly.
/// </summary>
public TimeSpan SnoozeDuration =>
VcardCommonTools.GetDurationSpan(SnoozeTime ?? "").span;

/// <summary>
/// Snooze date/time. Throws exception if there is no snooze time, so check accordingly.
/// </summary>
public DateTimeOffset SnoozeIn =>
VcardCommonTools.GetDurationSpan(SnoozeTime ?? "").result;

internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, string[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion) =>
new MailAlarmInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, calendarVersion);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ public class ProcedureAlarmInfo : BaseCalendarPartInfo, IEquatable<ProcedureAlar
/// </summary>
public string? Procedure { get; }

/// <summary>
/// Snooze duration. Throws exception if there is no snooze time, so check accordingly.
/// </summary>
public TimeSpan SnoozeDuration =>
VcardCommonTools.GetDurationSpan(SnoozeTime ?? "").span;

/// <summary>
/// Snooze date/time. Throws exception if there is no snooze time, so check accordingly.
/// </summary>
public DateTimeOffset SnoozeIn =>
VcardCommonTools.GetDurationSpan(SnoozeTime ?? "").result;

internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, string[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion) =>
new ProcedureAlarmInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, calendarVersion);

Expand Down

0 comments on commit 739f3e3

Please sign in to comment.