(fix) improved alarms syncing with EAS devices (fixes #4351)
parent
f799716b25
commit
c495e14cd7
|
@ -45,27 +45,23 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
- (NSString *) activeSyncRepresentationInContext: (WOContext *) context
|
- (NSString *) activeSyncRepresentationInContext: (WOContext *) context
|
||||||
{
|
{
|
||||||
NSMutableString *s;
|
NSMutableString *s;
|
||||||
|
NSCalendarDate *nextAlarmDate;
|
||||||
|
NSInteger delta;
|
||||||
|
|
||||||
s = [NSMutableString string];
|
s = [NSMutableString string];
|
||||||
|
|
||||||
if ([[self action] caseInsensitiveCompare: @"DISPLAY"] == NSOrderedSame)
|
nextAlarmDate = [self nextAlarmDate];
|
||||||
|
delta = (int)(([[(iCalEvent *)parent startDate] timeIntervalSince1970] - [nextAlarmDate timeIntervalSince1970])/60);
|
||||||
|
|
||||||
|
if ([parent isKindOfClass: [iCalEvent class]])
|
||||||
{
|
{
|
||||||
NSCalendarDate *nextAlarmDate;
|
// don't send negative reminder - not supported
|
||||||
NSInteger delta;
|
if (delta > 0)
|
||||||
|
[s appendFormat: @"<Reminder xmlns=\"Calendar:\">%d</Reminder>", (int)delta];
|
||||||
nextAlarmDate = [self nextAlarmDate];
|
}
|
||||||
delta = (int)(([[(iCalEvent *)parent startDate] timeIntervalSince1970] - [nextAlarmDate timeIntervalSince1970])/60);
|
else
|
||||||
|
{
|
||||||
if ([parent isKindOfClass: [iCalEvent class]])
|
[s appendFormat: @"<ReminderTime xmlns=\"Task:\">%@</ReminderTime>", [nextAlarmDate activeSyncRepresentationInContext: context]];
|
||||||
{
|
|
||||||
// don't send negative reminder - not supported
|
|
||||||
if (delta > 0)
|
|
||||||
[s appendFormat: @"<Reminder xmlns=\"Calendar:\">%d</Reminder>", (int)delta];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
[s appendFormat: @"<ReminderTime xmlns=\"Task:\">%@</ReminderTime>", [nextAlarmDate activeSyncRepresentationInContext: context]];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
@ -86,7 +82,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
trigger = [iCalTrigger elementWithTag: @"TRIGGER"];
|
trigger = [iCalTrigger elementWithTag: @"TRIGGER"];
|
||||||
[trigger setValueType: @"DURATION"];
|
[trigger setValueType: @"DURATION"];
|
||||||
[self setTrigger: trigger];
|
[self setTrigger: trigger];
|
||||||
[self setAction: @"DISPLAY"];
|
if (![self action])
|
||||||
|
[self setAction: @"DISPLAY"];
|
||||||
|
|
||||||
// SOGo web ui only supports 1w but not 2w (custom reminder only supports min/hours/days)
|
// SOGo web ui only supports 1w but not 2w (custom reminder only supports min/hours/days)
|
||||||
// 1week = -P1W
|
// 1week = -P1W
|
||||||
|
@ -115,8 +112,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
trigger = [iCalTrigger elementWithTag: @"TRIGGER"];
|
trigger = [iCalTrigger elementWithTag: @"TRIGGER"];
|
||||||
[trigger setValueType: @"DATE-TIME"];
|
[trigger setValueType: @"DATE-TIME"];
|
||||||
[trigger setSingleValue: [NSString stringWithFormat: @"%@Z", [o iCalFormattedDateTimeString]] forKey: @""];
|
[trigger setSingleValue: [NSString stringWithFormat: @"%@Z", [o iCalFormattedDateTimeString]] forKey: @""];
|
||||||
|
|
||||||
|
if ((o = [theValues objectForKey: @"ReminderSet"]))
|
||||||
|
{
|
||||||
|
if ([o intValue] == 0)
|
||||||
|
[trigger setValue: 0 ofAttribute: @"x-webstatus" to: @"triggered"];
|
||||||
|
}
|
||||||
|
|
||||||
[self setTrigger: trigger];
|
[self setTrigger: trigger];
|
||||||
[self setAction: @"DISPLAY"];
|
if (![self action])
|
||||||
|
[self setAction: @"DISPLAY"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -321,7 +321,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
{
|
{
|
||||||
iCalAlarm *alarm;
|
iCalAlarm *alarm;
|
||||||
|
|
||||||
alarm = [self firstDisplayOrAudioAlarm];
|
alarm = [self firstSupportedAlarm];
|
||||||
[s appendString: [alarm activeSyncRepresentationInContext: context]];
|
[s appendString: [alarm activeSyncRepresentationInContext: context]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,6 +447,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
NSCalendarDate *oldstart;
|
NSCalendarDate *oldstart;
|
||||||
NSTimeZone *userTimeZone;
|
NSTimeZone *userTimeZone;
|
||||||
iCalTimeZone *tz;
|
iCalTimeZone *tz;
|
||||||
|
iCalAlarm *alarm;
|
||||||
id o;
|
id o;
|
||||||
int deltasecs;
|
int deltasecs;
|
||||||
|
|
||||||
|
@ -582,23 +583,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
if ((o = [theValues objectForKey: @"Reminder"]) && [o length])
|
||||||
// If an alarm is deinfed with an action != DISPLAY, we ignore the alarm - don't want to overwrite.
|
|
||||||
//
|
|
||||||
if ([self hasAlarms] && [[[[self alarms] objectAtIndex: 0] action] caseInsensitiveCompare: @"DISPLAY"] != NSOrderedSame)
|
|
||||||
{
|
|
||||||
// Ignore the alarm for now
|
|
||||||
}
|
|
||||||
else if ((o = [theValues objectForKey: @"Reminder"]) && [o length])
|
|
||||||
{
|
{
|
||||||
|
if ([self hasAlarms])
|
||||||
|
alarm = [[self firstSupportedAlarm] mutableCopy];
|
||||||
|
else
|
||||||
|
alarm = [[iCalAlarm alloc] init];
|
||||||
|
|
||||||
// NOTE: Outlook sends a 15 min reminder (18 hour for allday) if no reminder is specified
|
// NOTE: Outlook sends a 15 min reminder (18 hour for allday) if no reminder is specified
|
||||||
// although no default reminder is defined (File -> Options -> Clendar -> Calendar Options - > Default Reminders)
|
// although no default reminder is defined (File -> Options -> Clendar -> Calendar Options - > Default Reminders)
|
||||||
//
|
//
|
||||||
// http://answers.microsoft.com/en-us/office/forum/office_2013_release-outlook/desktop-outlook-calendar-creates-entries-with/9aef72d8-81bb-4a32-a6ab-bf7d216fb811?page=5&tm=1395690285088
|
// http://answers.microsoft.com/en-us/office/forum/office_2013_release-outlook/desktop-outlook-calendar-creates-entries-with/9aef72d8-81bb-4a32-a6ab-bf7d216fb811?page=5&tm=1395690285088
|
||||||
//
|
//
|
||||||
iCalAlarm *alarm;
|
|
||||||
|
|
||||||
alarm = [[iCalAlarm alloc] init];
|
|
||||||
[alarm takeActiveSyncValues: theValues inContext: context];
|
[alarm takeActiveSyncValues: theValues inContext: context];
|
||||||
|
|
||||||
[self removeAllAlarms];
|
[self removeAllAlarms];
|
||||||
|
|
1
NEWS
1
NEWS
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
Bug fixes
|
Bug fixes
|
||||||
- [web] prevent deletion of special folders using del key
|
- [web] prevent deletion of special folders using del key
|
||||||
|
- [eas] improved alarms syncing with EAS devices (#4351)
|
||||||
|
|
||||||
4.0.0 (2018-03-07)
|
4.0.0 (2018-03-07)
|
||||||
------------------
|
------------------
|
||||||
|
|
Loading…
Reference in New Issue