From 87bbba0c8d7893a776ff9ccafbe8227e98aa14ed Mon Sep 17 00:00:00 2001 From: smizrahi Date: Mon, 31 Jul 2023 09:15:07 +0200 Subject: [PATCH] feat(calendar): Add CALDAV Mac OS X Sonoma (14) support --- SoObjects/Appointments/SOGoAppointmentFolder.m | 2 +- SoObjects/Appointments/SOGoUserFolder+Appointments.m | 2 +- SoObjects/Mailer/SOGoMailAccount.m | 2 +- SoObjects/SOGo/SOGoGCSFolder.m | 8 ++++---- SoObjects/SOGo/SOGoParentFolder.m | 6 +++--- SoObjects/SOGo/SOGoUser.m | 2 +- SoObjects/SOGo/WORequest+SOGo.h | 1 + SoObjects/SOGo/WORequest+SOGo.m | 5 +++-- 8 files changed, 15 insertions(+), 13 deletions(-) diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index 0370d2c972..7cd7eb8cef 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -2612,7 +2612,7 @@ - (NSException *) setDavDescription: (NSString *) description // FIXME: Improve MacOSX Ventura support // Check if the problem will be fixed by Apple or if this fix should be kept in the future // Ticket #5639 - if ([[context request] isMacOSXVenturaCalendarApp]) { + if ([[context request] isMacOSXFromVenturaCalendarApp]) { description = [description stringByReplacingOccurrencesOfString:@"/PERSONAL" withString:@"/personal"]; } diff --git a/SoObjects/Appointments/SOGoUserFolder+Appointments.m b/SoObjects/Appointments/SOGoUserFolder+Appointments.m index ccedf2c6c8..7a745bdbe6 100644 --- a/SoObjects/Appointments/SOGoUserFolder+Appointments.m +++ b/SoObjects/Appointments/SOGoUserFolder+Appointments.m @@ -190,7 +190,7 @@ - (NSArray *) davCalendarScheduleInboxURL - (NSArray *) davCalendarScheduleOutboxURL { - return [[context request] isMacOSXVenturaCalendarApp] ? [self _davSpecialCalendarURLWithName: @"PERSONAL"] : [self _davSpecialCalendarURLWithName: @"personal"]; + return [[context request] isMacOSXFromVenturaCalendarApp] ? [self _davSpecialCalendarURLWithName: @"PERSONAL"] : [self _davSpecialCalendarURLWithName: @"personal"]; } - (NSArray *) _calendarProxiedUsersWithWriteAccess: (BOOL) write diff --git a/SoObjects/Mailer/SOGoMailAccount.m b/SoObjects/Mailer/SOGoMailAccount.m index 20f7a411c4..eaa02025da 100644 --- a/SoObjects/Mailer/SOGoMailAccount.m +++ b/SoObjects/Mailer/SOGoMailAccount.m @@ -139,7 +139,7 @@ - (void) _appendNamespaces: (NSMutableArray *) folders // FIXME: Improve MacOSX Ventura support // Check if the problem will be fixed by Apple or if this fix should be kept in the future // Ticket #5639 - if ([[context request] isMacOSXVenturaCalendarApp]) { + if ([[context request] isMacOSXFromVenturaCalendarApp]) { namespace = [namespaceDict objectForKey: @"PERSONAL"]; } if (namespace) diff --git a/SoObjects/SOGo/SOGoGCSFolder.m b/SoObjects/SOGo/SOGoGCSFolder.m index 5cce9a53c2..bd9ff85b30 100644 --- a/SoObjects/SOGo/SOGoGCSFolder.m +++ b/SoObjects/SOGo/SOGoGCSFolder.m @@ -150,7 +150,7 @@ + (id) folderWithSubscriptionReference: (NSString *) reference if ([pathElements count] > 1) ocsName = [pathElements objectAtIndex: 1]; else - ocsName = [[context request] isMacOSXVenturaCalendarApp] ? @"Personal" : @"personal"; + ocsName = [[context request] isMacOSXFromVenturaCalendarApp] ? @"Personal" : @"personal"; path = [NSString stringWithFormat: @"/Users/%@/%@/%@", login, [pathElements objectAtIndex: 0], ocsName]; @@ -404,7 +404,7 @@ - (void) setOCSPath: (NSString *) _path // FIXME: Improve MacOSX Ventura support // Check if the problem will be fixed by Apple or if this fix should be kept in the future // Ticket #5639 - if ([[context request] isMacOSXVenturaCalendarApp]) { + if ([[context request] isMacOSXFromVenturaCalendarApp]) { _path = [_path stringByReplacingOccurrencesOfString:@"/PERSONAL" withString:@"/personal"]; } @@ -441,7 +441,7 @@ - (GCSFolder *) ocsFolderForPath: (NSString *) _path // FIXME: Improve MacOSX Ventura support // Check if the problem will be fixed by Apple or if this fix should be kept in the future // Ticket #5639 - if ([[context request] isMacOSXVenturaCalendarApp]) { + if ([[context request] isMacOSXFromVenturaCalendarApp]) { _path = [_path stringByReplacingOccurrencesOfString:@"PERSONAL" withString:@"personal"]; } @@ -474,7 +474,7 @@ - (NSString *) folderReference // FIXME: Improve MacOSX Ventura support // Check if the problem will be fixed by Apple or if this fix should be kept in the future // Ticket #5639 - if ([[context request] isMacOSXVenturaCalendarApp]) { + if ([[context request] isMacOSXFromVenturaCalendarApp]) { realNameInContainer = [realNameInContainer stringByReplacingOccurrencesOfString:@"PERSONAL" withString:@"personal"]; } diff --git a/SoObjects/SOGo/SOGoParentFolder.m b/SoObjects/SOGo/SOGoParentFolder.m index bb3775f17d..c267dff424 100644 --- a/SoObjects/SOGo/SOGoParentFolder.m +++ b/SoObjects/SOGo/SOGoParentFolder.m @@ -144,7 +144,7 @@ - (void) setBaseOCSPath: (NSString *) newOCSPath - (NSString *) defaultFolderName { - return [[context request] isMacOSXVenturaCalendarApp] ? @"PERSONAL" : @"Personal"; + return [[context request] isMacOSXFromVenturaCalendarApp] ? @"PERSONAL" : @"Personal"; } - (NSString *) collectedFolderName @@ -173,7 +173,7 @@ - (void) createSpecialFolder: (SOGoFolderType) folderType { if (folderType == SOGoPersonalFolder) { - folderName = [[context request] isMacOSXVenturaCalendarApp] ? @"PERSONAL" : @"personal"; + folderName = [[context request] isMacOSXFromVenturaCalendarApp] ? @"PERSONAL" : @"personal"; folder = [subFolderClass objectWithName: folderName inContainer: self]; [folder setDisplayName: [self defaultFolderName]]; [folder setOCSPath: [NSString stringWithFormat: @"%@/%@", OCSPath, folderName]]; @@ -224,7 +224,7 @@ - (NSException *) fetchSpecialFolders: (NSString *) sql // FIXME: Improve MacOSX Ventura support // Check if the problem will be fixed by Apple or if this fix should be kept in the future // Ticket #5639 - if ([[context request] isMacOSXVenturaCalendarApp]) { + if ([[context request] isMacOSXFromVenturaCalendarApp]) { if ([key isEqualToString:@"personal"]) { key = @"PERSONAL"; } diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index ae04332d51..9143327e46 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -1060,7 +1060,7 @@ - (SOGoAppointmentFolders *) calendarsFolderInContext: (WOContext *) context - (SOGoAppointmentFolder *) personalCalendarFolderInContext: (WOContext *) context { - return [[self calendarsFolderInContext: context] lookupPersonalFolder: [[context request] isMacOSXVenturaCalendarApp] ? @"PERSONAL" : @"personal" + return [[self calendarsFolderInContext: context] lookupPersonalFolder: [[context request] isMacOSXFromVenturaCalendarApp] ? @"PERSONAL" : @"personal" ignoringRights: YES]; } diff --git a/SoObjects/SOGo/WORequest+SOGo.h b/SoObjects/SOGo/WORequest+SOGo.h index 6f9fb80f14..7aa299c9d9 100644 --- a/SoObjects/SOGo/WORequest+SOGo.h +++ b/SoObjects/SOGo/WORequest+SOGo.h @@ -36,6 +36,7 @@ - (BOOL)isMacOSXCalendarApp; - (BOOL)isIPhoneAddressBookApp; - (BOOL) isAndroid; +- (BOOL)isMacOSXFromVenturaCalendarApp, @end diff --git a/SoObjects/SOGo/WORequest+SOGo.m b/SoObjects/SOGo/WORequest+SOGo.m index b807fa0abf..5a74497814 100644 --- a/SoObjects/SOGo/WORequest+SOGo.m +++ b/SoObjects/SOGo/WORequest+SOGo.m @@ -242,7 +242,7 @@ - (BOOL) isAndroid return ([[cc userAgent] rangeOfString: @"Android"].location != NSNotFound); } -- (BOOL) isMacOSXVenturaCalendarApp +- (BOOL) isMacOSXFromVenturaCalendarApp { WEClientCapabilities *cc; BOOL b; @@ -251,7 +251,8 @@ - (BOOL) isMacOSXVenturaCalendarApp b = ( ( - nil != [cc userAgent] && [[cc userAgent] rangeOfString: @"macOS/13"].location != NSNotFound + nil != [cc userAgent] + && ([[cc userAgent] rangeOfString: @"macOS/13"].location != NSNotFound || [[cc userAgent] rangeOfString: @"macOS/14"].location != NSNotFound) && [[cc userAgent] rangeOfString: @"dataaccessd"].location != NSNotFound ) );