mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 05:25:50 +03:00
Extract file provider connection configuration into separate util function
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
5ed456f30c
commit
595c23cf76
3 changed files with 16 additions and 9 deletions
|
@ -50,15 +50,9 @@ void FileProviderXPC::processConnections(NSArray *const connections)
|
|||
NSMutableDictionary<NSString *, NSObject<ClientCommunicationProtocol>*> *const clientCommServices = NSMutableDictionary.dictionary;
|
||||
|
||||
for (NSXPCConnection * const connection in connections) {
|
||||
Q_ASSERT(connection != nil);
|
||||
connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(ClientCommunicationProtocol)];
|
||||
connection.interruptionHandler = ^{
|
||||
qCInfo(lcFileProviderXPC) << "File provider connection interrupted";
|
||||
};
|
||||
connection.invalidationHandler = ^{
|
||||
qCInfo(lcFileProviderXPC) << "File provider connection invalidated";
|
||||
};
|
||||
[connection resume];
|
||||
const auto remoteObjectInterfaceProtocol = @protocol(ClientCommunicationProtocol);
|
||||
connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:remoteObjectInterfaceProtocol];
|
||||
FileProviderXPCUtils::configureFileProviderConnection(connection);
|
||||
|
||||
const id remoteServiceObject = [connection remoteObjectProxyWithErrorHandler:^(NSError *const error){
|
||||
qCWarning(lcFileProviderXPC) << "Error getting remote object proxy" << error;
|
||||
|
|
|
@ -25,6 +25,7 @@ NSArray<NSFileProviderManager *> *getDomainManagers();
|
|||
NSArray<NSURL *> *getDomainUrlsForManagers(NSArray<NSFileProviderManager *> *managers);
|
||||
NSArray<NSDictionary<NSFileProviderServiceName, NSFileProviderService *> *> *getFileProviderServicesAtUrls(NSArray<NSURL *> *urls);
|
||||
NSArray<NSXPCConnection *> *connectToFileProviderServices(NSArray<NSDictionary<NSFileProviderServiceName, NSFileProviderService *> *> *fpServices);
|
||||
void configureFileProviderConnection(NSXPCConnection *connection);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,6 +178,18 @@ NSArray<NSXPCConnection *> *connectToFileProviderServices(NSArray<NSDictionary<N
|
|||
return connections.copy;
|
||||
}
|
||||
|
||||
void configureFileProviderConnection(NSXPCConnection *const connection)
|
||||
{
|
||||
Q_ASSERT(connection != nil);
|
||||
connection.interruptionHandler = ^{
|
||||
qCInfo(lcFileProviderXPCUtils) << "File provider connection interrupted";
|
||||
};
|
||||
connection.invalidationHandler = ^{
|
||||
qCInfo(lcFileProviderXPCUtils) << "File provider connection invalidated";
|
||||
};
|
||||
[connection resume];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue