From b6144aa29e780648e94e35d342e3d69bd68bdf1e Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Thu, 26 Feb 2015 17:51:02 -0500 Subject: [PATCH] fixed tasks disappearing issue with RoadSync - patch from tfu --- ActiveSync/iCalToDo+ActiveSync.m | 57 ++++++++++++++++++++++++++------ NEWS | 1 + 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/ActiveSync/iCalToDo+ActiveSync.m b/ActiveSync/iCalToDo+ActiveSync.m index 5f237a31b..e9417752c 100644 --- a/ActiveSync/iCalToDo+ActiveSync.m +++ b/ActiveSync/iCalToDo+ActiveSync.m @@ -38,6 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #import #import #import +#import #import #import @@ -49,6 +50,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "NSDate+ActiveSync.h" #include "NSString+ActiveSync.h" + @implementation iCalToDo (ActiveSync) - (NSString *) activeSyncRepresentationInContext: (WOContext *) context @@ -62,11 +64,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. s = [NSMutableString string]; // Complete - o = [self completed]; - [s appendFormat: @"%d", (o ? 1 : 0)]; + [s appendFormat: @"%d", [[self status] isEqualToString: @"COMPLETED"] ? 1 : 0]; // DateCompleted - if (o) + if ((o = [self completed])) [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]]; // Start date @@ -97,6 +98,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Reminder - FIXME [s appendFormat: @"%d", 0]; + // Sensitivity if ([[self accessClass] isEqualToString: @"PRIVATE"]) v = 2; else if ([[self accessClass] isEqualToString: @"CONFIDENTIAL"]) @@ -104,6 +106,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. else v = 0; + [s appendFormat: @"%d", v]; + categories = [self categories]; if ([categories count]) @@ -126,11 +130,20 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // It is very important here to NOT set 0 in the response, // otherwise it'll prevent WP8 phones from sync'ing. See #3028 for details. o = [o activeSyncRepresentationInContext: context]; - [s appendString: @""]; - [s appendFormat: @"%d", 1]; - [s appendFormat: @"%d", [o length]]; - [s appendFormat: @"%@", o]; - [s appendString: @""]; + + if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"]) + { + [s appendFormat: @"%@", o]; + [s appendString: @"0"]; + } + else + { + [s appendString: @""]; + [s appendFormat: @"%d", 1]; + [s appendFormat: @"%d", [o length]]; + [s appendFormat: @"%@", o]; + [s appendString: @""]; + } } return s; @@ -152,9 +165,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [self setSummary: o]; // FIXME: merge with iCalEvent - if ((o = [[theValues objectForKey: @"Body"] objectForKey: @"Data"])) - [self setComment: o]; - + if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"]) + { + if ((o = [theValues objectForKey: @"Body"])) + [self setComment: o]; + } + else + { + if ((o = [[theValues objectForKey: @"Body"] objectForKey: @"Data"])) + [self setComment: o]; + } if ([[theValues objectForKey: @"Complete"] intValue] && ((o = [theValues objectForKey: @"DateCompleted"])) ) @@ -166,6 +186,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [completed setDate: o]; [self setStatus: @"COMPLETED"]; } + else + { + [self setStatus: @"IN-PROCESS"]; + [self setCompleted: nil]; + } if ((o = [theValues objectForKey: @"DueDate"])) { @@ -177,6 +202,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [due setDateTime: o]; } + if ((o = [theValues objectForKey: @"StartDate"])) + { + iCalDateTime *due; + + o = [o calendarDate]; + due = (iCalDateTime *) [self uniqueChildWithTag: @"dtstart"]; + [due setTimeZone: tz]; + [due setDateTime: o]; + } + // 2 == high, 1 == normal, 0 == low if ((o = [theValues objectForKey: @"Importance"])) { diff --git a/NEWS b/NEWS index ae2da50c5..71955f765 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ Bug fixes - multiple collections support for GetItemEstimate using EAS - fixed empty sync responses for EAS 2.5 and 12.0 clients - use the correct mail body element for EAS 2.5 clients + - fixed tasks disappearing issue with RoadSync 2.2.16 (2015-02-12) -------------------