fix(calendar): Fix MacOS X Ventura calendar support. Fixes #5639

This commit is contained in:
smizrahi
2023-08-22 18:11:53 +02:00
parent 1c93796ae1
commit 4f7c73143f
8 changed files with 14 additions and 55 deletions

View File

@@ -2551,7 +2551,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
resourcetype. Anything else will prevent the iPhone from querying the
collection. */
request = [context request];
if (!([request isIPhone] || [request isICal4]))
if (!([request isIPhone] || [request isICal4] || [request isMacOSXCalendar]))
{
gdRT = (NSArray *) [self groupDavResourceType];
gdVEventCol = [NSArray arrayWithObjects: [gdRT objectAtIndex: 0],
@@ -2609,13 +2609,6 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
- (NSException *) setDavDescription: (NSString *) description
{
if (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] isMacOSXFromVenturaCalendarApp]) {
description = [description stringByReplacingOccurrencesOfString:@"/PERSONAL" withString:@"/personal"];
}
[self setFolderPropertyValue: description
inCategory: @"DavDescription"];
}

View File

@@ -190,7 +190,7 @@
- (NSArray *) davCalendarScheduleOutboxURL
{
return [[context request] isMacOSXFromVenturaCalendarApp] ? [self _davSpecialCalendarURLWithName: @"PERSONAL"] : [self _davSpecialCalendarURLWithName: @"personal"];
return [self _davSpecialCalendarURLWithName: @"personal"];
}
- (NSArray *) _calendarProxiedUsersWithWriteAccess: (BOOL) write

View File

@@ -136,12 +136,6 @@ static NSString *inboxFolderName = @"INBOX";
namespaceDict = [client namespace];
namespace = [namespaceDict objectForKey: @"personal"];
// 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] isMacOSXFromVenturaCalendarApp]) {
namespace = [namespaceDict objectForKey: @"PERSONAL"];
}
if (namespace)
[self _appendNamespace: namespace toFolders: folders];

View File

@@ -150,7 +150,7 @@ static NSArray *childRecordFields = nil;
if ([pathElements count] > 1)
ocsName = [pathElements objectAtIndex: 1];
else
ocsName = [[context request] isMacOSXFromVenturaCalendarApp] ? @"Personal" : @"personal";
ocsName = @"personal";
path = [NSString stringWithFormat: @"/Users/%@/%@/%@",
login, [pathElements objectAtIndex: 0], ocsName];
@@ -400,14 +400,7 @@ static NSArray *childRecordFields = nil;
}
- (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] isMacOSXFromVenturaCalendarApp]) {
_path = [_path stringByReplacingOccurrencesOfString:@"/PERSONAL" withString:@"/personal"];
}
{
if (![ocsPath isEqualToString:_path])
{
if (ocsPath)
@@ -438,12 +431,6 @@ static NSArray *childRecordFields = nil;
cache = [SOGoCache sharedCache];
record = [[cache valueForKey: _path] objectFromJSONString];
// 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] isMacOSXFromVenturaCalendarApp]) {
_path = [_path stringByReplacingOccurrencesOfString:@"PERSONAL" withString:@"personal"];
}
// We check if we got a cache miss or a potentially bogus
// entry from the cache
@@ -471,13 +458,6 @@ static NSArray *childRecordFields = nil;
realNameInContainer = [self realNameInContainer];
// 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] isMacOSXFromVenturaCalendarApp]) {
realNameInContainer = [realNameInContainer stringByReplacingOccurrencesOfString:@"PERSONAL" withString:@"personal"];
}
return [NSString stringWithFormat: @"%@:%@/%@",
owner,
[container nameInContainer],

View File

@@ -144,7 +144,7 @@ static SoSecurityManager *sm = nil;
- (NSString *) defaultFolderName
{
return [[context request] isMacOSXFromVenturaCalendarApp] ? @"PERSONAL" : @"Personal";
return @"Personal";
}
- (NSString *) collectedFolderName
@@ -173,7 +173,7 @@ static SoSecurityManager *sm = nil;
{
if (folderType == SOGoPersonalFolder)
{
folderName = [[context request] isMacOSXFromVenturaCalendarApp] ? @"PERSONAL" : @"personal";
folderName = @"personal";
folder = [subFolderClass objectWithName: folderName inContainer: self];
[folder setDisplayName: [self defaultFolderName]];
[folder setOCSPath: [NSString stringWithFormat: @"%@/%@", OCSPath, folderName]];
@@ -221,15 +221,7 @@ static SoSecurityManager *sm = nil;
while ((row = [fc fetchAttributes: attrs withZone: NULL]))
{
key = [row objectForKey: @"c_path4"];
// 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] isMacOSXFromVenturaCalendarApp]) {
if ([key isEqualToString:@"personal"]) {
key = @"PERSONAL";
}
}
if ([key isKindOfClass: [NSString class]])
{
folder = [subFolderClass objectWithName: key inContainer: self];
@@ -241,7 +233,7 @@ static SoSecurityManager *sm = nil;
}
if (folderType == SOGoPersonalFolder)
{
if (![subFolders objectForKey: @"personal"] || ![subFolders objectForKey: @"Personal"] || ![subFolders objectForKey: @"PERSONAL"])
if (![subFolders objectForKey: @"personal"])
[self createSpecialFolder: SOGoPersonalFolder];
}
else if (folderType == SOGoCollectedFolder)

View File

@@ -1060,7 +1060,7 @@
- (SOGoAppointmentFolder *) personalCalendarFolderInContext: (WOContext *) context
{
return [[self calendarsFolderInContext: context] lookupPersonalFolder: [[context request] isMacOSXFromVenturaCalendarApp] ? @"PERSONAL" : @"personal"
return [[self calendarsFolderInContext: context] lookupPersonalFolder: @"personal"
ignoringRights: YES];
}

View File

@@ -33,10 +33,10 @@
- (BOOL) isICal;
- (BOOL) isICal4;
- (BOOL) isMacOSXAddressBookApp;
- (BOOL)isMacOSXCalendarApp;
- (BOOL)isIPhoneAddressBookApp;
- (BOOL) isMacOSXCalendarApp;
- (BOOL) isIPhoneAddressBookApp;
- (BOOL) isAndroid;
- (BOOL)isMacOSXFromVenturaCalendarApp;
- (BOOL) isMacOSXCalendar;
@end

View File

@@ -242,7 +242,7 @@
return ([[cc userAgent] rangeOfString: @"Android"].location != NSNotFound);
}
- (BOOL) isMacOSXFromVenturaCalendarApp
- (BOOL) isMacOSXCalendar
{
WEClientCapabilities *cc;
BOOL b;
@@ -252,7 +252,7 @@
b = (
(
nil != [cc userAgent]
&& ([[cc userAgent] rangeOfString: @"macOS/13"].location != NSNotFound || [[cc userAgent] rangeOfString: @"macOS/14"].location != NSNotFound)
&& [[cc userAgent] rangeOfString: @"macOS"].location != NSNotFound
&& [[cc userAgent] rangeOfString: @"dataaccessd"].location != NSNotFound
)
);