fix(calendar): deleted occurence of repeated event could cause some troubles with other imrbicated occurences

The fix is within SOPE/NGCards/iCalRecurrenceCalculator.m:244, the others files are juste modified to make the code more readable
This commit is contained in:
Hivert Quentin
2023-08-07 17:16:50 +02:00
parent f5f74f751a
commit f3981c4276
6 changed files with 127 additions and 135 deletions
@@ -408,24 +408,23 @@
doesOccur = [self isRecurrent];
if (doesOccur)
{
// Retrieve the range of the first event
firstRange = [self firstOccurenceRange]; // returns GMT dates
{
// Retrieve the range of the first event
firstRange = [self firstOccurenceRange]; // returns GMT dates
// Set the range to check with respect to the event timezone (extracted from the start date)
firstStartDate = (iCalDateTime *)[self uniqueChildWithTag: @"dtstart"];
timeZone = [(iCalDateTime *)firstStartDate timeZone];
if (timeZone)
startDate = [(iCalTimeZone *)timeZone computedDateForDate: theOccurenceDate];
else
startDate = theOccurenceDate;
endDate = [startDate addTimeInterval: [self occurenceInterval]];
checkRange = [NGCalendarDateRange calendarDateRangeWithStartDate: startDate
// Set the range to check with respect to the event timezone (extracted from the start date)
firstStartDate = (iCalDateTime *)[self uniqueChildWithTag: @"dtstart"];
timeZone = [(iCalDateTime *)firstStartDate timeZone];
if (timeZone)
startDate = [(iCalTimeZone *)timeZone computedDateForDate: theOccurenceDate];
else
startDate = theOccurenceDate;
endDate = [startDate addTimeInterval: [self occurenceInterval]];
checkRange = [NGCalendarDateRange calendarDateRangeWithStartDate: startDate
endDate: endDate];
// Calculate the occurrences for the given date
ranges =
[NSMutableArray arrayWithArray:
// Calculate the occurrences for the given date
ranges = [NSMutableArray arrayWithArray:
[iCalRecurrenceCalculator recurrenceRangesWithinCalendarDateRange: checkRange
firstInstanceCalendarDateRange: firstRange
recurrenceRules: [self recurrenceRulesWithTimeZone: timeZone]
@@ -433,19 +432,18 @@
recurrenceDates: [self recurrenceDatesWithTimeZone: timeZone]
exceptionDates: [self exceptionDatesWithTimeZone: timeZone]]];
// Add the master occurrence when dealing with RDATES.
// However, the master event must not be flagged with X-MOZ-FAKED-MASTER.
if ([self hasRecurrenceDates] &&
![[[self uniqueChildWithTag: @"x-moz-faked-master"]
flattenedValuesForKey: @""] isEqualToString: @"1"] &&
[checkRange doesIntersectWithDateRange: firstRange])
{
[ranges insertObject: firstRange atIndex: 0];
}
doesOccur = [ranges dateRangeArrayContainsDate: startDate];
// Add the master occurrence when dealing with RDATES.
// However, the master event must not be flagged with X-MOZ-FAKED-MASTER.
if ([self hasRecurrenceDates] &&
![[[self uniqueChildWithTag: @"x-moz-faked-master"] flattenedValuesForKey: @""] isEqualToString: @"1"] &&
[checkRange doesIntersectWithDateRange: firstRange])
{
[ranges insertObject: firstRange atIndex: 0];
}
doesOccur = [ranges dateRangeArrayContainsDate: startDate];
}
return doesOccur;
}