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 <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-10-16 14:13:00 +08:00
parent 18fb6dc456
commit d1e26b27f9

View file

@ -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;