From 87d90aba2718f99e6421ca709ac07e55dd35bcd8 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 29 Oct 2024 17:31:17 +0800 Subject: [PATCH 1/2] Rewrite setResult:forPath: method signature for SyncClient and FinderSync Signed-off-by: Claudio Cambra --- .../MacOSX/NextcloudIntegration/FinderSyncExt/FinderSync.m | 2 +- .../FinderSyncExt/FinderSyncSocketLineProcessor.m | 2 +- .../MacOSX/NextcloudIntegration/FinderSyncExt/SyncClient.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/shell_integration/MacOSX/NextcloudIntegration/FinderSyncExt/FinderSync.m b/shell_integration/MacOSX/NextcloudIntegration/FinderSyncExt/FinderSync.m index 9d2c3a015c880..822a2b6393846 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FinderSyncExt/FinderSync.m +++ b/shell_integration/MacOSX/NextcloudIntegration/FinderSyncExt/FinderSync.m @@ -194,7 +194,7 @@ - (void)subMenuActionClicked:(id)sender { #pragma mark - SyncClientProxyDelegate implementation -- (void)setResultForPath:(NSString*)path result:(NSString*)result +- (void)setResult:(NSString *)result forPath:(NSString*)path { NSString *normalizedPath = [path decomposedStringWithCanonicalMapping]; [[FIFinderSyncController defaultController] setBadgeIdentifier:result forURL:[NSURL fileURLWithPath:normalizedPath]]; diff --git a/shell_integration/MacOSX/NextcloudIntegration/FinderSyncExt/FinderSyncSocketLineProcessor.m b/shell_integration/MacOSX/NextcloudIntegration/FinderSyncExt/FinderSyncSocketLineProcessor.m index e906154bb2d6e..79c5aa6e97aea 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FinderSyncExt/FinderSyncSocketLineProcessor.m +++ b/shell_integration/MacOSX/NextcloudIntegration/FinderSyncExt/FinderSyncSocketLineProcessor.m @@ -42,7 +42,7 @@ -(void)process:(NSString*)line dispatch_async(dispatch_get_main_queue(), ^{ NSLog(@"Setting result %@ for path %@", result, path); - [self.delegate setResultForPath:path result:result]; + [self.delegate setResult:result forPath:path]; }); } else if([command isEqualToString:@"UPDATE_VIEW"]) { NSString *path = [split objectAtIndex:1]; diff --git a/shell_integration/MacOSX/NextcloudIntegration/FinderSyncExt/SyncClient.h b/shell_integration/MacOSX/NextcloudIntegration/FinderSyncExt/SyncClient.h index f8c495a6c2738..05bbe091cf6ca 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FinderSyncExt/SyncClient.h +++ b/shell_integration/MacOSX/NextcloudIntegration/FinderSyncExt/SyncClient.h @@ -15,7 +15,7 @@ #import @protocol SyncClientDelegate -- (void)setResultForPath:(NSString *)path result:(NSString *)result; +- (void)setResult:(NSString *)result forPath:(NSString *)path; - (void)reFetchFileNameCacheForPath:(NSString *)path; - (void)registerPath:(NSString *)path; - (void)unregisterPath:(NSString *)path; From ffa0e55025a46655b6c7fde0325237a959ba93fe Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 29 Oct 2024 17:31:59 +0800 Subject: [PATCH 2/2] Do not set badge identifier for a given path URL if the URL is nil Signed-off-by: Claudio Cambra --- .../NextcloudIntegration/FinderSyncExt/FinderSync.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/shell_integration/MacOSX/NextcloudIntegration/FinderSyncExt/FinderSync.m b/shell_integration/MacOSX/NextcloudIntegration/FinderSyncExt/FinderSync.m index 822a2b6393846..c21c3a9ac3f5b 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FinderSyncExt/FinderSync.m +++ b/shell_integration/MacOSX/NextcloudIntegration/FinderSyncExt/FinderSync.m @@ -196,8 +196,12 @@ - (void)subMenuActionClicked:(id)sender { - (void)setResult:(NSString *)result forPath:(NSString*)path { - NSString *normalizedPath = [path decomposedStringWithCanonicalMapping]; - [[FIFinderSyncController defaultController] setBadgeIdentifier:result forURL:[NSURL fileURLWithPath:normalizedPath]]; + NSString *const normalizedPath = path.decomposedStringWithCanonicalMapping; + NSURL *const urlForPath = [NSURL fileURLWithPath:normalizedPath]; + if (urlForPath == nil) { + return; + } + [FIFinderSyncController.defaultController setBadgeIdentifier:result forURL:urlForPath]; } - (void)reFetchFileNameCacheForPath:(NSString*)path