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 | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/gui/macOS/fileproviderdomainsyncstatus_mac.mm b/src/gui/macOS/fileproviderdomainsyncstatus_mac.mm index 6cc7efd42ae4c..03de3e97636fc 100644 --- a/src/gui/macOS/fileproviderdomainsyncstatus_mac.mm +++ b/src/gui/macOS/fileproviderdomainsyncstatus_mac.mm @@ -42,17 +42,19 @@ explicit MacImplementation(const QString &domainIdentifier, FileProviderDomainSy return; } - 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); - }; + 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); + }; + } } ~MacImplementation() = default;