Skip to content

Commit

Permalink
Wrap use of NSFileProviderManager globalProgress in availability check
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
claucambra committed Oct 18, 2024
1 parent 18fb6dc commit d1e26b2
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/gui/macOS/fileproviderdomainsyncstatus_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d1e26b2

Please sign in to comment.