Skip to content

Commit

Permalink
imp - PRIORITY now supports vCalendar 1.0
Browse files Browse the repository at this point in the history
---

The PRIORITY key was mistakenly thought to be only supported in vCalendar 2.0, until the fixed vcalendar-1.0.txt said that this key is also supported in vCalendar 1.0

---

Type: imp
Breaking: False
Doc Required: False
Backport Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Sep 29, 2024
1 parent d883583 commit 0ae9b85
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion VisualCard.Calendar/Parsers/VCalendarConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ internal static class VCalendarConstants
internal const string _dueDateSpecifier = "DUE";
internal const string _relationshipSpecifier = "RELATED-TO";
internal const string _lastModSpecifier = "LAST-MODIFIED";
internal const string _prioritySpecifier = "PRIORITY";
internal const string _xSpecifier = "X-";
internal const string _typeArgumentSpecifier = "TYPE=";
internal const string _valueArgumentSpecifier = "VALUE=";
Expand All @@ -99,7 +100,6 @@ internal static class VCalendarConstants
internal const string _methodSpecifier = "METHOD";
internal const string _locationSpecifier = "LOCATION";
internal const string _commentSpecifier = "COMMENT";
internal const string _prioritySpecifier = "PRIORITY";
internal const string _tzNameSpecifier = "TZNAME";
internal const string _percentCompletionSpecifier = "PERCENT-COMPLETION";
}
Expand Down
2 changes: 1 addition & 1 deletion VisualCard.Calendar/Parsers/VCalendarParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public Parts.Calendar Parse()
case PartType.Integers:
{
CalendarIntegersEnum integerType = (CalendarIntegersEnum)enumeration;
bool supported = VCalendarParserTools.IntegerSupported(integerType, CalendarVersion, calendarType);
bool supported = VCalendarParserTools.IntegerSupported(integerType, calendarType);
if (!supported)
continue;

Expand Down
4 changes: 2 additions & 2 deletions VisualCard.Calendar/Parsers/VCalendarParserTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ internal static bool StringSupported(CalendarStringsEnum stringsEnum, Version ca
throw new InvalidOperationException("Invalid string enumeration type to get supported value"),
};

internal static bool IntegerSupported(CalendarIntegersEnum integersEnum, Version calendarVersion, Type componentType) =>
internal static bool IntegerSupported(CalendarIntegersEnum integersEnum, Type componentType) =>
integersEnum switch
{
CalendarIntegersEnum.Priority => calendarVersion.Major == 2 && TypeMatch(componentType, typeof(CalendarEvent), typeof(CalendarTodo)),
CalendarIntegersEnum.Priority => TypeMatch(componentType, typeof(CalendarEvent), typeof(CalendarTodo)),
CalendarIntegersEnum.Sequence => TypeMatch(componentType, typeof(CalendarEvent), typeof(CalendarTodo), typeof(CalendarJournal)),
CalendarIntegersEnum.PercentComplete => TypeMatch(componentType, typeof(CalendarTodo)),
_ =>
Expand Down
8 changes: 4 additions & 4 deletions VisualCard.Calendar/Parts/Calendar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,12 @@ internal string GetString(CalendarStringsEnum key, Version version, Dictionary<C
/// <param name="key">A key to use</param>
/// <returns>A value or -1 if any other type either doesn't exist or the type is not supported by the card version</returns>
public int GetInteger(CalendarIntegersEnum key) =>
GetInteger(key, version, integers);
GetInteger(key, integers);

internal int GetInteger(CalendarIntegersEnum key, Version version, Dictionary<CalendarIntegersEnum, int> integers)
internal int GetInteger(CalendarIntegersEnum key, Dictionary<CalendarIntegersEnum, int> integers)
{
// Check for version support
if (!VCalendarParserTools.IntegerSupported(key, version, GetType()))
if (!VCalendarParserTools.IntegerSupported(key, GetType()))
return -1;

// Get the fallback value
Expand Down Expand Up @@ -285,7 +285,7 @@ internal string SaveToString(Version version, Dictionary<CalendarPartsArrayEnum,
foreach (CalendarIntegersEnum integerEnum in integerEnums)
{
// Get the integer value
int integerValue = GetInteger(integerEnum, version, integers);
int integerValue = GetInteger(integerEnum, integers);
if (integerValue == -1)
continue;

Expand Down

0 comments on commit 0ae9b85

Please sign in to comment.