mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-29 04:08:54 +03:00
Simplify xpc service acquisition completion handler
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
b22f463ad5
commit
9611e47a3b
1 changed files with 4 additions and 8 deletions
|
@ -45,6 +45,7 @@ NSArray<NSFileProviderManager *> *getDomainManagers()
|
||||||
for (NSFileProviderDomain *const domain in domains) {
|
for (NSFileProviderDomain *const domain in domains) {
|
||||||
qCInfo(lcFileProviderXPCUtils) << "Got domain" << domain.identifier;
|
qCInfo(lcFileProviderXPCUtils) << "Got domain" << domain.identifier;
|
||||||
NSFileProviderManager *const manager = [NSFileProviderManager managerForDomain:domain];
|
NSFileProviderManager *const manager = [NSFileProviderManager managerForDomain:domain];
|
||||||
|
[manager retain];
|
||||||
[managers addObject:manager];
|
[managers addObject:manager];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,23 +69,18 @@ NSArray<NSDictionary<NSFileProviderServiceName, NSFileProviderService *> *> *get
|
||||||
dispatch_group_t group = dispatch_group_create();
|
dispatch_group_t group = dispatch_group_create();
|
||||||
|
|
||||||
for (NSFileProviderManager *const manager in managers) {
|
for (NSFileProviderManager *const manager in managers) {
|
||||||
__block NSFileProviderService *acquiredService;
|
|
||||||
dispatch_group_enter(group);
|
dispatch_group_enter(group);
|
||||||
[manager getServiceWithName:nsClientCommunicationServiceName
|
[manager getServiceWithName:nsClientCommunicationServiceName
|
||||||
itemIdentifier:NSFileProviderRootContainerItemIdentifier
|
itemIdentifier:NSFileProviderRootContainerItemIdentifier
|
||||||
completionHandler:^(NSFileProviderService *const service, NSError *const error) {
|
completionHandler:^(NSFileProviderService *const service, NSError *const error) {
|
||||||
if (error != nil) {
|
if (error != nil) {
|
||||||
qCWarning(lcFileProviderXPCUtils) << "Error getting file provider service" << error;
|
qCWarning(lcFileProviderXPCUtils) << "Error getting file provider service" << error;
|
||||||
dispatch_group_leave(group);
|
|
||||||
return;
|
|
||||||
} else if (service == nil) {
|
} else if (service == nil) {
|
||||||
qCWarning(lcFileProviderXPCUtils) << "Service is nil";
|
qCWarning(lcFileProviderXPCUtils) << "Service is nil";
|
||||||
dispatch_group_leave(group);
|
} else {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
[service retain];
|
[service retain];
|
||||||
[fpServices addObject:@{acquiredService.name: acquiredService}];
|
[fpServices addObject:@{service.name: service}];
|
||||||
|
}
|
||||||
dispatch_group_leave(group);
|
dispatch_group_leave(group);
|
||||||
}];
|
}];
|
||||||
dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
|
dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
|
||||||
|
|
Loading…
Reference in a new issue