From d1e26b27f9e306d128271872fb2986fcad374378 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Wed, 16 Oct 2024 14:13:00 +0800 Subject: [PATCH] Wrap use of NSFileProviderManager globalProgress in availability check This selector was only made available on macOS 11.3 Just to be safe we should check for the availability Signed-off-by: Claudio Cambra --- .../macOS/fileproviderdomainsyncstatus_mac.mm | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/gui/macOS/fileproviderdomainsyncstatus_mac.mm b/src/gui/macOS/fileproviderdomainsyncstatus_mac.mm index 6cc7efd42..03de3e976 100644 --- a/src/gui/macOS/fileproviderdomainsyncstatus_mac.mm +++ b/src/gui/macOS/fileproviderdomainsyncstatus_mac.mm @@ -42,17 +42,19 @@ public: return; } - NSProgress *const downloadProgress = [_manager globalProgressForKind:NSProgressFileOperationKindDownloading]; - NSProgress *const uploadProgress = [_manager globalProgressForKind:NSProgressFileOperationKindUploading]; - _downloadProgressObserver = [[ProgressObserver alloc] initWithProgress:downloadProgress]; - _uploadProgressObserver = [[ProgressObserver alloc] initWithProgress:uploadProgress]; + if (@available(macOS 11.3, *)) { + NSProgress *const downloadProgress = [_manager globalProgressForKind:NSProgressFileOperationKindDownloading]; + NSProgress *const uploadProgress = [_manager globalProgressForKind:NSProgressFileOperationKindUploading]; + _downloadProgressObserver = [[ProgressObserver alloc] initWithProgress:downloadProgress]; + _uploadProgressObserver = [[ProgressObserver alloc] initWithProgress:uploadProgress]; - _downloadProgressObserver.progressKVOChangeHandler = ^(NSProgress *const progress){ - updateDownload(progress); - }; - _uploadProgressObserver.progressKVOChangeHandler = ^(NSProgress *const progress){ - updateUpload(progress); - }; + _downloadProgressObserver.progressKVOChangeHandler = ^(NSProgress *const progress){ + updateDownload(progress); + }; + _uploadProgressObserver.progressKVOChangeHandler = ^(NSProgress *const progress){ + updateUpload(progress); + }; + } } ~MacImplementation() = default;