mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 15:06:08 +03:00
Retrieve extension account ids over XPC, store client comm service per account
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
6cb71694fd
commit
7716860bc9
1 changed files with 25 additions and 0 deletions
|
@ -164,6 +164,8 @@ void FileProviderXPC::start()
|
|||
|
||||
dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
|
||||
|
||||
NSMutableDictionary<NSString *, NSObject<ClientCommunicationProtocol>*> *const clientCommServices = NSMutableDictionary.dictionary;
|
||||
|
||||
for (NSXPCConnection * const connection in connections) {
|
||||
Q_ASSERT(connection != nil);
|
||||
connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(ClientCommunicationProtocol)];
|
||||
|
@ -191,6 +193,29 @@ void FileProviderXPC::start()
|
|||
}
|
||||
|
||||
[clientCommService retain];
|
||||
__block NSString *extensionNcAccount = @"";
|
||||
dispatch_group_enter(group);
|
||||
[clientCommService getExtensionAccountIdWithCompletionHandler:^(NSString *const extensionAccountId, NSError *const error){
|
||||
if (error != nil) {
|
||||
qCWarning(lcFileProviderXPC) << "Error getting extension account id" << error;
|
||||
dispatch_group_leave(group);
|
||||
return;
|
||||
}
|
||||
|
||||
extensionNcAccount = [NSString stringWithString:extensionAccountId];
|
||||
[extensionNcAccount retain];
|
||||
dispatch_group_leave(group);
|
||||
}];
|
||||
|
||||
dispatch_group_wait(group, DISPATCH_TIME_FOREVER); // Do not edit the NSDictionary concurrently
|
||||
|
||||
if (extensionNcAccount == nil) {
|
||||
qCWarning(lcFileProviderXPC) << "Extension account id is nil";
|
||||
continue;
|
||||
}
|
||||
qCInfo(lcFileProviderXPC) << "Got extension account id" << extensionNcAccount.UTF8String;
|
||||
[clientCommServices setObject:clientCommService forKey:extensionNcAccount];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue